X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmonthly%2Fmonthly_bonus.php;h=089ebf9b50b4e84340c801136ddf771e8bf05eef;hp=1d4f8ad0d0d7fbee70cf08d6a5e9c1b885c29dec;hb=d7d40e177e09a7161b79bfc95a1d2e91fdff4691;hpb=20741b93fd58620af677a7f1039ffd16ea6ec689 diff --git a/inc/monthly/monthly_bonus.php b/inc/monthly/monthly_bonus.php index 1d4f8ad0d0..089ebf9b50 100644 --- a/inc/monthly/monthly_bonus.php +++ b/inc/monthly/monthly_bonus.php @@ -16,7 +16,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * + * Copyright (c) 2009 - 2013 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -38,11 +38,11 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((isCssOutputMode()) || (!isResetModeEnabled())) { - // Do not execute when script is in CSS mode or no hourly reset +} elseif ((!isHtmlOutputMode()) || (!isMonthlyResetEnabled())) { + // Do not execute when script is in non-HTML mode or no hourly reset return; } elseif (!isExtensionActive('bonus')) { - logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.'); + if (isDebugModeEnabled()) logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension ext-bonus disabled.'); return; } @@ -50,13 +50,20 @@ if (!defined('__SECURITY')) { //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Monthly reset started.'); if ((getBonusRanks() > 0) && (!isCssOutputMode())) { - // Extension 'autopurge' is inactive or purging of inactive accounts is deactivated - $whereStatement = "WHERE `status`='CONFIRMED'"; + // Extension 'autopurge' is inactive or purging of inactive accounts is deactivated\ + $whereStatement = runFilterChain('user_exclusion_sql', "WHERE `status`='CONFIRMED'"); // Shall I keep inactive members away from here? (mostly wanted in an "active-rallye" ...) + // @TODO Rewrite these if() blocks to a filter if ((isExtensionActive('autopurge')) && ((getApInactiveSince() > 0))) { // Okay, include last online timestamp - $whereStatement .= ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}'; + $whereStatement .= ' AND (UNIX_TIMESTAMP() - `d`.`last_online`) < {?ap_inactive_since?}'; + } // END - if + + // Is ext-holiday installed? + if (isExtensionActive('holiday')) { + // Exclude those as well + $whereStatement .= " AND `d`.`holiday_active`='N'"; } // END - if // Add more bonus points here by running a filter @@ -69,13 +76,14 @@ if ((getBonusRanks() > 0) && (!isCssOutputMode())) { // Run SQL string to check for accounts $result_main = SQL_QUERY('SELECT - `userid`,`email`,`gender`,`surname`,`family`, (0' . $add . ') AS `points` + `d`.`userid`, + (0' . $add . ') AS `points` FROM - `{?_MYSQL_PREFIX?}_user_data` + `{?_MYSQL_PREFIX?}_user_data` AS `d` ' . $whereStatement . ' ORDER BY `points` DESC, - `userid` ASC + `d`.`userid` ASC LIMIT {?bonus_ranks?}', __FILE__, __LINE__); // Some entries were found? @@ -85,8 +93,8 @@ LIMIT {?bonus_ranks?}', __FILE__, __LINE__); // Make sure zero points are not mailed if ($content['points'] > 0) { // Add points to user's account directly - initReferalSystem(); - addPointsThroughReferalSystem('monthly_bonus', $content['userid'], $content['points']); + initReferralSystem(); + addPointsThroughReferralSystem('monthly_bonus', $content['userid'], $content['points']); // Load email template and email it away $message = loadEmailTemplate('member_bonus', $content, bigintval($content['userid']));