[ Index ] |
PHP Cross Reference of MyBB |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.6 4 * Copyright 2010 MyBB Group, All Rights Reserved 5 * 6 * Website: http://mybb.com 7 * License: http://mybb.com/about/license 8 * 9 * $Id: usercleanup.php 5297 2010-12-28 22:01:14Z Tomm $ 10 */ 11 12 function task_usercleanup($task) 13 { 14 global $db, $lang, $cache; 15 16 // Expire any old warnings 17 expire_warnings(); 18 19 // Expire any post moderation or suspension limits 20 $query = $db->simple_select("users", "uid, moderationtime, suspensiontime", "(moderationtime!=0 AND moderationtime<".TIME_NOW.") OR (suspensiontime!=0 AND suspensiontime<".TIME_NOW.")"); 21 while($user = $db->fetch_array($query)) 22 { 23 $updated_user = array(); 24 if($user['moderationtime'] != 0 && $user['moderationtime'] < TIME_NOW) 25 { 26 $updated_user['moderateposts'] = 0; 27 $updated_user['moderationtime'] = 0; 28 } 29 if($user['suspensiontime'] != 0 && $user['suspensiontime'] < TIME_NOW) 30 { 31 $updated_user['suspendposting'] = 0; 32 $updated_user['suspensiontime'] = 0; 33 } 34 $db->update_query("users", $updated_user, "uid='{$user['uid']}'"); 35 } 36 37 // Expire any suspended signatures 38 $query = $db->simple_select("users", "uid, suspendsigtime", "suspendsignature != 0 AND suspendsigtime < '".TIME_NOW."'"); 39 while($user = $db->fetch_array($query)) 40 { 41 if($user['suspendsigtime'] != 0 && $user['suspendsigtime'] < TIME_NOW) 42 { 43 $updated_user = array( 44 "suspendsignature" => 0, 45 "suspendsigtime" => 0, 46 ); 47 $db->update_query("users", $updated_user, "uid='".$user['uid']."'"); 48 } 49 } 50 51 // Expire bans 52 $query = $db->simple_select("banned", "*", "lifted!=0 AND lifted<".TIME_NOW); 53 while($ban = $db->fetch_array($query)) 54 { 55 $updated_user = array( 56 "usergroup" => $ban['oldgroup'], 57 "additionalgroups" => $ban['oldadditionalgroups'], 58 "displaygroup" => $ban['olddisplaygroup'] 59 ); 60 $db->update_query("users", $updated_user, "uid='{$ban['uid']}'"); 61 $db->delete_query("banned", "uid='{$ban['uid']}'"); 62 } 63 64 $cache->update_moderators(); 65 66 add_task_log($task, $lang->task_usercleanup_ran); 67 } 68 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Oct 8 19:19:50 2013 | Cross-referenced by PHPXref 0.7.1 |