From: Roland Häder Date: Fri, 29 Jul 2011 00:13:07 +0000 (+0000) Subject: Handling of bonus points fixed X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=00e734ff1236dc875952f5b34dada9892568e7cd;p=mailer.git Handling of bonus points fixed --- diff --git a/inc/daily/daily_100_bonus.php b/inc/daily/daily_100_bonus.php index 2b8e783868..18a74623d0 100644 --- a/inc/daily/daily_100_bonus.php +++ b/inc/daily/daily_100_bonus.php @@ -81,7 +81,7 @@ if (!SQL_HASZERONUMS($result_bonus)) { } // END - while // Handle bonus points - handleBonusPoints(getConfig('bonus_stats')); + handleBonusPoints(getConfig('bonus_stats'), $content['userid']); } // END - if // Free memory diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index ef8b7144c7..7236987cad 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -110,7 +110,7 @@ function addTurboBonus ($mid, $userid, $type) { ), __FUNCTION__, __LINE__); if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD') && ($points > 0)) { - handleBonusPoints($points); + handleBonusPoints($points, $userid); } // END - if } @@ -203,8 +203,8 @@ LIMIT 1", return $OUT; } -// -function handleBonusPoints ($mode) { +// Hanle any bonus points the given user shall become +function handleBonusPoints ($mode, $userid) { // Shall we add bonus points? if (!isBonusRallyeActive()) { return; @@ -214,7 +214,7 @@ function handleBonusPoints ($mode) { $return = false; // Switch to jackpot-mode when no UID is supplied but userid-mode is selected - if ((getBonusMode() == 'UID') && (getBonusUserid() == '0') && (isExtensionActive('jackpot'))) { + if ((getBonusMode() == 'UID') && ($userid == '0') && (isExtensionActive('jackpot'))) { // Update database & config updateConfiguration('bonus_mode', 'JACKPOT'); } // END - if @@ -228,7 +228,7 @@ function handleBonusPoints ($mode) { } // Check his amount first - $total = getTotalPoints(getBonusUserid()); + $total = getTotalPoints($userid); // Subtract points from... switch (getBonusMode()) { @@ -237,10 +237,10 @@ function handleBonusPoints ($mode) { break; case 'JACKPOT': // ... jackpot - if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) === false) && (isValidUserId(getBonusUserid()))) { + if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) === false) && (isValidUserId($userid))) { if ($total >= $points) { // Subtract points from userid's account - $return = subtractPointsFromJackpot('bonus_payout_jackpot', getBonusUserid(), $points); + $return = subtractPointsFromJackpot('bonus_payout_jackpot', $userid, $points); } // END - if } // END - if break; @@ -248,7 +248,7 @@ function handleBonusPoints ($mode) { case 'UID': // ... userid's account if ($total >= $points) { // Subtract points from userid's account - $return = subtractPoints('bonus_payout_userid', getBonusUserid(), $points); + $return = subtractPoints('bonus_payout_userid', $userid, $points); } elseif (isExtensionActive('jackpot')) { // Try to subtract from jackpot $return = subtractPointsFromJackpot($points); diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index d28a0ab1ba..0199f568c5 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -978,16 +978,16 @@ LIMIT 1", // Check wether the user is allowed to book more URLs function SURFBAR_IF_USER_BOOK_MORE_URLS ($userid = NULL) { // Is this admin and userid is zero or does the user has some URLs left to book? - return ((($userid == '0') && (isAdmin())) || (SURFBAR_GET_TOTAL_USER_URLS($userid, '', array('REJECTED')) < getSurfbarMaxOrder())); + return (((is_null($userid)) && (isAdmin())) || (SURFBAR_GET_TOTAL_USER_URLS($userid, '', array('REJECTED')) < getSurfbarMaxOrder())); } // Get total amount of URLs of given status for current user function SURFBAR_GET_TOTAL_USER_URLS ($userid = NULL, $status = '', $exclude = '') { // Is the user 0 and user is logged in? - if (($userid == '0') && (isMember())) { + if ((is_null($userid)) && (isMember())) { // Then use this userid $userid = getMemberId(); - } elseif ($userid == '0') { + } elseif (is_null($userid)) { // Error! return (getSurfbarMaxOrder() + 1); } diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 488e8f6f4f..33fa5067ce 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -333,7 +333,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p // Subtract login bonus from userid's account or jackpot if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD')) { - handleBonusPoints('login_bonus'); + handleBonusPoints('login_bonus', $userid); } // END - if } // END - if } // END - if @@ -477,7 +477,7 @@ function getEpocheTimeFromUserStats ($statsType, $statsData, $userid = NULL) { $data['inserted'] = '0'; // User id set? - if ((isMemberIdSet()) && ($userid == '0')) { + if ((isMemberIdSet()) && (is_null($userid))) { $userid = getMemberId(); } // END - if @@ -609,7 +609,7 @@ LIMIT 1", array(bigintval($refid)), __FILE__, __LINE__); // Subtract points from system - handleBonusPoints(getConfig('bonus_ref')); + handleBonusPoints(getConfig('bonus_ref'), $refid); } // END - if // Add one-time referal bonus over referal system or directly diff --git a/inc/modules/admin/what-list_payouts.php b/inc/modules/admin/what-list_payouts.php index 00d5a450aa..dcb186be05 100644 --- a/inc/modules/admin/what-list_payouts.php +++ b/inc/modules/admin/what-list_payouts.php @@ -45,7 +45,7 @@ addYouAreHereLink('admin', __FILE__); if (isGetRequestParameterSet('pid')) { // First let's get the member's id - $result = SQL_QUERY_ESC("SELECT userid, target_account, payout_total, payout_timestamp, password FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `id`=%s LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `userid`, `target_account`, `payout_total`, `payout_timestamp`, `password` FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `id`=%s LIMIT 1", array(getRequestParameter('pid')), __FILE__, __LINE__); list($userid, $tuserid, $points, $tstamp, $tpass) = SQL_FETCHROW($result); SQL_FREERESULT($result); diff --git a/inc/modules/admin/what-unlock_emails.php b/inc/modules/admin/what-unlock_emails.php index 1d95092fa8..555502ec79 100644 --- a/inc/modules/admin/what-unlock_emails.php +++ b/inc/modules/admin/what-unlock_emails.php @@ -94,7 +94,7 @@ LIMIT 1", array(bigintval($content['sender'])), __FILE__, __LINE__); // Subtract bonus points from system - handleBonusPoints(getConfig('bonus_order')); + handleBonusPoints(getConfig('bonus_order'), $content['sender']); } // END - if // Load email template diff --git a/mailid_top.php b/mailid_top.php index 40ef802d41..0ad68b00d5 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -125,10 +125,14 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr list($pool, $sender, $notify) = SQL_FETCHROW($result_mailid); // Correct notification switch in non-bonus mails - if (($notify != 'Y') && ($notify != 'N')) $notify = 'N'; + if (($notify != 'Y') && ($notify != 'N')) { + $notify = 'N'; + } // END - if // Set sender to 0 when we have a bonus mail - if ($ltype == 'BONUS') $sender = '0'; + if ($ltype == 'BONUS') { + $sender = '0'; + } // END - if // Is the user id valid? if (fetchUserData($userId) === true) {