Пример #1
0
    if (is_team_admin($user, $team)) {
        error_page(tra("%1 is already an admin of %2", $email_addr, $team->name));
    }
    $now = time();
    $ret = BoincTeamAdmin::insert("(teamid, userid, create_time) values ({$team->id}, {$user->id}, {$now})");
    if (!$ret) {
        error_page(tra("Couldn't add admin"));
    }
}
$user = get_logged_in_user();
$teamid = get_int('teamid');
$team = BoincTeam::lookup_id($teamid);
if (!$team) {
    error_page(tra("No such team"));
}
require_founder_login($user, $team);
$action = get_str('action', true);
switch ($action) {
    case 'remove':
        check_tokens($user->authenticator);
        remove_admin($team);
        Header("Location: team_admins.php?teamid={$teamid}");
        exit;
    case 'add':
        check_tokens($user->authenticator);
        add_admin($team);
        Header("Location: team_admins.php?teamid={$teamid}");
        exit;
}
show_admins($user, $teamid);
Пример #2
0
    if ($row['user_id'] == 1) {
        // Can't delete main admin
        $text = $row['user_name'] . " " . ADMSLAN_6 . "\n\t\t<br /><br />\n\t\t<a href='" . e_ADMIN_ABS . "administrator.php'>" . ADMSLAN_4 . "</a>";
        $emessage->add($text, E_MESSAGE_ERROR);
        $ns->tablerender(LAN_ERROR, $emessage->render());
        require_once "footer.php";
        exit;
    }
    admin_update($sql->db_Update("user", "user_admin=0, user_perms='' WHERE user_id= " . $aID), 'update', ADMSLAN_61, LAN_DELETED_FAILED, false);
    $logMsg = str_replace(array('--ID--', '--NAME--'), array($aID, $row['user_name']), ADMSLAN_73);
    $admin_log->log_event('ADMIN_02', $logMsg, E_LOG_INFORMATIVE, '');
}
if (isset($_POST['edit_admin']) || $action == "edit") {
    $prm->edit_administrator($row);
} else {
    show_admins();
}
function show_admins()
{
    $sql = e107::getDb();
    $frm = e107::getForm();
    $ns = e107::getRender();
    $mes = e107::getMessage();
    $tp = e107::getParser();
    $prm = e107::getUserPerms();
    $sql->db_Select("user", "*", "user_admin='1'");
    $text = "\n\t<form action='" . e_SELF . "' method='post' id='del_administrator'>\n\t\t<fieldset id='core-administrator-list'>\n\t\t\t<legend class='e-hideme'>" . ADMSLAN_13 . "</legend>\n\t\t\t<table class='table adminlist'>\n\t\t\t\t<colgroup>\n\t\t\t\t\t<col style='width:  5%' />\n\t\t\t\t\t<col style='width: 20%' />\n\t\t\t\t\t<col style='width: 65%' />\n\t\t\t\t\t<col style='width: 10%' />\n\t\t\t\t</colgroup>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>ID</th>\n\t\t\t\t\t\t<th>" . ADMSLAN_56 . "</th>\n\t\t\t\t\t\t<th>" . ADMSLAN_18 . "</th>\n\t\t\t\t\t\t<th class='center last'>" . LAN_OPTIONS . "</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\n\t";
    while ($row = $sql->db_Fetch()) {
        //$permtxt = "";
        $text .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $row['user_id'] . "</td>\n\t\t\t\t\t\t<td><a href='" . e107::getUrl()->create('user/profile/view', array('id' => $row['user_id'], 'name' => $row['user_name'])) . "'>" . $row['user_name'] . "</a></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t" . $prm->renderperms($row['user_perms'], $row['user_id'], "words") . "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class='center'>\n\t\t";
        if ($row['user_id'] != "1") {