Zeile 1 | Zeile 1 |
---|
<?php /** * MyBB 1.6
|
<?php /** * MyBB 1.6
|
* Copyright � 2010 MyBB Group, All Rights Reserved
| * Copyright 2010 MyBB Group, All Rights Reserved
|
* * Website: http://mybb.com * License: http://mybb.com/about/license *
|
* * Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: promotions.php 4941 2010-05-15 18:17:38Z RyanGordon $
| * $Id$
|
*/
function task_promotions($task) { global $mybb, $db, $lang, $cache;
|
*/
function task_promotions($task) { global $mybb, $db, $lang, $cache;
|
| $usergroups = $cache->read("usergroups");
|
// Iterate through all our promotions $query = $db->simple_select("promotions", "*", "enabled = '1'"); while($promotion = $db->fetch_array($query)) {
|
// Iterate through all our promotions $query = $db->simple_select("promotions", "*", "enabled = '1'"); while($promotion = $db->fetch_array($query)) {
|
| // Does the destination usergroup even exist?? If it doesn't and it moves a user to it, the user will get PHP errors. if(!array_key_exists($promotion['newusergroup'], $usergroups)) { // Instead of just skipping this promotion, disable it to stop it even being selected when this task is run. $update = array( "enabled" => 0 ); $db->update_query("promotions", $update, "pid = '" . intval($promotion['pid']) . "'"); continue; }
|
$and = ""; $sql_where = "";
| $and = ""; $sql_where = "";
|
Zeile 25 | Zeile 37 |
---|
if(in_array('postcount', $requirements) && intval($promotion['posts']) >= 0 && !empty($promotion['posttype'])) { $sql_where .= "{$and}postnum {$promotion['posttype']} '{$promotion['posts']}'";
|
if(in_array('postcount', $requirements) && intval($promotion['posts']) >= 0 && !empty($promotion['posttype'])) { $sql_where .= "{$and}postnum {$promotion['posttype']} '{$promotion['posts']}'";
|
$and = " AND ";
| $and = " AND ";
|
}
|
}
|
if(in_array('reputation', $requirements) && intval($promotion['reputations']) >= 0 && !empty($promotion['reputationtype']))
| if(in_array('reputation', $requirements) && !empty($promotion['reputationtype']))
|
{ $sql_where .= "{$and}reputation {$promotion['reputationtype']} '{$promotion['reputations']}'";
| { $sql_where .= "{$and}reputation {$promotion['reputationtype']} '{$promotion['reputations']}'";
|
Zeile 55 | Zeile 67 |
---|
break; case "weeks": $regdate = $promotion['registered']*60*60*24*7;
|
break; case "weeks": $regdate = $promotion['registered']*60*60*24*7;
|
| break;
|
case "months": $regdate = $promotion['registered']*60*60*24*30; break;
| case "months": $regdate = $promotion['registered']*60*60*24*30; break;
|