示例#1
0
/**
* Moderate user submissions
*
* Users from the user submission queue are either appoved (an email containing
* the password is sent out) or deleted.
*
* @param    int     $uid        Array of items
* @param    array   $action     Action to perform ('delete', 'approve')
* @param    int     $count      Number of items
* @return   string              HTML for "command and control" page
*
*/
function moderateusers($uid, $action, $count)
{
    global $_CONF, $_TABLES, $LANG04;
    $retval = '';
    // Set true if an valid action other then delete_all is selected
    $formaction = false;
    for ($i = 0; $i < $count; $i++) {
        if (isset($action[$i]) and $action[$i] != '') {
            $formaction = true;
        } else {
            continue;
        }
        switch ($action[$i]) {
            case 'delete':
                // Ok, delete everything related to this user
                if ($uid[$i] > 1) {
                    USER_deleteAccount($uid[$i]);
                }
                break;
            case 'approve':
                $uid[$i] = COM_applyFilter($uid[$i], true);
                $result = DB_query("SELECT email,username, uid FROM {$_TABLES['users']} WHERE uid = {$uid[$i]}");
                $nrows = DB_numRows($result);
                if ($nrows == 1) {
                    $A = DB_fetchArray($result);
                    $sql = "UPDATE {$_TABLES['users']} SET status=3 WHERE uid={$A['uid']}";
                    DB_query($sql);
                    USER_createAndSendPassword($A['username'], $A['email'], $A['uid']);
                }
                break;
        }
    }
    // Check if there was no direct action used on the form
    // and if the delete_all submit action was used
    if (!$formaction and isset($_POST['delitem'])) {
        foreach ($_POST['delitem'] as $del_uid) {
            $del_uid = COM_applyFilter($del_uid, true);
            if ($del_uid > 1) {
                USER_deleteAccount($del_uid);
            }
        }
    }
    $retval .= commandcontrol(SEC_createToken());
    return $retval;
}
示例#2
0
* Display a reminder to execute the security check script
*
*/
function security_check_reminder()
{
    global $_CONF, $_TABLES, $_IMAGE_TYPE, $MESSAGE;
    $retval = '';
    if (!SEC_inGroup('Root')) {
        return $retval;
    }
    $done = DB_getItem($_TABLES['vars'], 'value', "name = 'security_check'");
    if ($done != 1) {
        $retval .= COM_showMessage(92);
    }
    return $retval;
}
// MAIN
$display = COM_siteHeader('menu', $LANG29[34]);
$msg = COM_getMessage();
if ($msg > 0) {
    $plugin = '';
    if (isset($_GET['plugin'])) {
        $plugin = COM_applyFilter($_GET['plugin']);
    }
    $display .= COM_showMessage($msg, $plugin);
}
$display .= _checkUpgrades();
$display .= security_check_reminder();
$display .= commandcontrol();
$display .= COM_siteFooter();
echo $display;