Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: promotions.php 3883 2008-06-05 00:38:28Z Tikitiki $
| * $Id: promotions.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
function task_promotions($task)
| */
function task_promotions($task)
|
Zeile 22 | Zeile 22 |
---|
// Based on the promotion generate criteria for user selection $requirements = explode(',', $promotion['requirements']);
|
// Based on the promotion generate criteria for user selection $requirements = explode(',', $promotion['requirements']);
|
if(in_array('postcount', $requirements) && intval($promotion['posts']) > 0 && !empty($promotion['posttype']))
| if(in_array('postcount', $requirements) && intval($promotion['posts']) >= 0 && !empty($promotion['posttype']))
|
{ $sql_where .= "{$and}postnum {$promotion['posttype']} '{$promotion['posts']}'"; $and = " AND "; }
|
{ $sql_where .= "{$and}postnum {$promotion['posttype']} '{$promotion['posts']}'"; $and = " AND "; }
|
if(in_array('reputation', $requirements) && intval($promotion['reputations']) > 0 && !empty($promotion['reputationtype']))
| if(in_array('reputation', $requirements) && intval($promotion['reputations']) >= 0 && !empty($promotion['reputationtype']))
|
{ $sql_where .= "{$and}reputation {$promotion['reputationtype']} '{$promotion['reputations']}'";
| { $sql_where .= "{$and}reputation {$promotion['reputationtype']} '{$promotion['reputations']}'";
|
Zeile 49 | Zeile 49 |
---|
case "weeks": $regdate = $promotion['registered']*60*60*24*7; case "months":
|
case "weeks": $regdate = $promotion['registered']*60*60*24*7; case "months":
|
$regdate = $promotion['registered']*60*60*24*7*30;
| $regdate = $promotion['registered']*60*60*24*30;
|
break; case "years":
|
break; case "years":
|
$regdate = $promotion['registered']*60*60*24*7*365;
| $regdate = $promotion['registered']*60*60*24*365;
|
break; default: $regdate = $promotion['registered']*60*60*24;
| break; default: $regdate = $promotion['registered']*60*60*24;
|
Zeile 89 | Zeile 89 |
---|
$usergroup_select = "usergroup"; }
|
$usergroup_select = "usergroup"; }
|
$query = $db->simple_select("users", "uid,{$usergroup_select}", $sql_where); while($user = $db->fetch_array($query))
| $query2 = $db->simple_select("users", "uid,{$usergroup_select}", $sql_where); while($user = $db->fetch_array($query2))
|
{
|
{
|
| // super admin check?
|
if($usergroup_select == "additionalgroups") { $log_inserts[] = array(
| if($usergroup_select == "additionalgroups") { $log_inserts[] = array(
|
Zeile 120 | Zeile 121 |
---|
if($usergroup_select == "additionalgroups") {
|
if($usergroup_select == "additionalgroups") {
|
join_usergroup($user['uid'], $promotion['newusergroup']);
| if(join_usergroup($user['uid'], $promotion['newusergroup']) === false) { // Did the user already have the additional usergroup? array_pop($log_inserts); array_pop($uids); }
|
} if((count($uids) % 20) == 0) { if($usergroup_select == "usergroup")
|
} if((count($uids) % 20) == 0) { if($usergroup_select == "usergroup")
|
{
| {
|
$db->update_query("users", array('usergroup' => $promotion['newusergroup']), "uid IN(".implode(",", $uids).")"); }
|
$db->update_query("users", array('usergroup' => $promotion['newusergroup']), "uid IN(".implode(",", $uids).")"); }
|
$db->insert_query_multiple("promotionlogs", $log_inserts);
| if(!empty($log_inserts)) { $db->insert_query_multiple("promotionlogs", $log_inserts); }
|
$uids = array(); $log_inserts = array();
| $uids = array(); $log_inserts = array();
|
Zeile 144 | Zeile 153 |
---|
$db->update_query("users", array('usergroup' => $promotion['newusergroup']), "uid IN(".implode(",", $uids).")"); }
|
$db->update_query("users", array('usergroup' => $promotion['newusergroup']), "uid IN(".implode(",", $uids).")"); }
|
$db->insert_query_multiple("promotionlogs", $log_inserts);
| if(!empty($log_inserts)) { $db->insert_query_multiple("promotionlogs", $log_inserts); }
|
$uids = array(); $log_inserts = array();
| $uids = array(); $log_inserts = array();
|