Vergleich inc/tasks/promotions.php - 1.6.3 - 1.6.12

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: promotions.php 5380 2011-02-21 12:04:43Z Tomm $

 * $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 25Zeile 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) && !empty($promotion['reputationtype']))
{
$sql_where .= "{$and}reputation {$promotion['reputationtype']} '{$promotion['reputations']}'";

		}

if(in_array('reputation', $requirements) && !empty($promotion['reputationtype']))
{
$sql_where .= "{$and}reputation {$promotion['reputationtype']} '{$promotion['reputations']}'";

			
$and = " AND ";
}


			
$and = " AND ";
}


		if(in_array('referrals', $requirements) && intval($promotion['referrals']) >= 0 && !empty($promotion['referralstype']))
{
$sql_where .= "{$and}referrals {$promotion['referralstype']} '{$promotion['referrals']}'";

		if(in_array('referrals', $requirements) && intval($promotion['referrals']) >= 0 && !empty($promotion['referralstype']))
{
$sql_where .= "{$and}referrals {$promotion['referralstype']} '{$promotion['referrals']}'";

Zeile 55Zeile 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;