/**
 * MyBB 1.4
 * Copyright © 2008 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybboard.net
 * License: http://www.mybboard.net/about/license
 *
 * $Id: usercleanup.php 4304 2009-01-02 01:11:56Z chris $
 */
function task_usercleanup($task)
{
    global $db, $lang, $cache;
    // Expire any old warnings
    expire_warnings();
    // Expire any post moderation or suspension limits
    $query = $db->simple_select("users", "uid, moderationtime, suspensiontime", "(moderationtime!=0 AND moderationtime<" . TIME_NOW . ") OR (suspensiontime!=0 AND suspensiontime<" . TIME_NOW . ")");
    while ($user = $db->fetch_array($query)) {
        $updated_user = array();
        if ($user['moderationtime'] != 0 && $user['moderationtime'] < TIME_NOW) {
            $updated_user['moderateposts'] = 0;
            $updated_user['moderationtime'] = 0;
        }
        if ($user['suspensiontime'] != 0 && $user['suspensiontime'] < TIME_NOW) {
            $updated_user['suspendposting'] = 0;
            $updated_user['suspensiontime'] = 0;
        }
        $db->update_query("users", $updated_user, "uid='{$user['uid']}'");
    }
    // Expire bans
    $query = $db->simple_select("banned", "*", "lifted!=0 AND lifted<" . TIME_NOW);
    while ($ban = $db->fetch_array($query)) {
        $updated_user = array("usergroup" => $ban['oldgroup'], "additionalgroups" => $ban['oldadditionalgroups'], "displaygroup" => $ban['olddisplaygroup']);
        $db->update_query("users", $updated_user, "uid='{$ban['uid']}'");
        $db->delete_query("banned", "uid='{$ban['uid']}'");
    }
    $cache->update_moderators();
    add_task_log($task, $lang->task_usercleanup_ran);
}
Beispiel #2
0
         break;
     default:
         // "dateline"
         $sortby = "w.dateline";
         $sortbysel['dateline'] = ' selected="selected"';
 }
 $order = $mybb->input['filter']['order'];
 $ordersel = array();
 if ($order != "asc") {
     $order = "desc";
     $ordersel['desc'] = ' selected="selected"';
 } else {
     $ordersel['asc'] = ' selected="selected"';
 }
 // Expire any warnings past their expiration date
 expire_warnings();
 // Pagination stuff
 $sql = "\n\t\tSELECT COUNT(wid) as count\n\t\tFROM\n\t\t\t" . TABLE_PREFIX . "warnings w\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "warningtypes t ON (w.tid=t.tid)\n\t\tWHERE 1=1\n\t\t\t{$where_sql}\n\t";
 $query = $db->query($sql);
 $total_warnings = $db->fetch_field($query, 'count');
 $view_page = 1;
 if (isset($mybb->input['page']) && intval($mybb->input['page']) > 0) {
     $view_page = intval($mybb->input['page']);
 }
 $per_page = 20;
 if (isset($mybb->input['filter']['per_page']) && intval($mybb->input['filter']['per_page']) > 0) {
     $per_page = intval($mybb->input['filter']['per_page']);
 }
 $start = ($view_page - 1) * $per_page;
 // Build the base URL for pagination links
 $url = 'index.php?module=tools-warninglog';