]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/bonus_functions.php
A lot has been rewritten, ext-teams added, ext-forced continued:
[mailer.git] / inc / libs / bonus_functions.php
index 6418d1e5431e9c5cc50a9cba5f361abd1ba72f17..ef8b7144c7676ce5ce7cc860a16337a678d4bd65 100644 (file)
@@ -100,7 +100,7 @@ function addTurboBonus ($mid, $userid, $type) {
                ), __FUNCTION__, __LINE__);
 
        // Rember this whole data for displaying ranking list
-       SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_bonus_turbo` (`userid`, `mail_id`, `bonus_id`, `level`, `points`, `timemark`) VALUES (%s, %s, %s, %s, %s, UNIX_TIMESTAMP())",
+       SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_bonus_turbo` (`userid`,`mail_id`,`bonus_id`,`level`,`points`,`timemark`) VALUES (%s, %s, %s, %s, %s, UNIX_TIMESTAMP())",
                array(
                        bigintval($userid),
                        bigintval($mail),
@@ -126,7 +126,7 @@ function addBonusRanks ($data, $type, $userid) {
        $ranks = count(explode(';', getConfig('turbo_rates'))) + 1;
 
        // Load current user's data
-       $result = SQL_QUERY_ESC("SELECT `level`, `points`, `timemark` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `%s`=%s AND `userid`=%s LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT `level`,`points`,`timemark` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `%s`=%s AND `userid`=%s LIMIT 1",
                array(
                        $type,
                        $data,
@@ -156,7 +156,7 @@ function addBonusRanks ($data, $type, $userid) {
                for ($rank = 1; $rank <= SQL_NUMROWS($result); $rank++) {
                        // Load data
                        $result_users = SQL_QUERY_ESC("SELECT
-       `userid`, `points`
+       `userid`,`points`
 FROM
        `{?_MYSQL_PREFIX?}_bonus_turbo`
 WHERE
@@ -206,7 +206,12 @@ LIMIT 1",
 //
 function handleBonusPoints ($mode) {
        // Shall we add bonus points?
-       if (!isBonusRallyeActive()) return;
+       if (!isBonusRallyeActive()) {
+               return;
+       } // END - if
+
+       // Default is not working
+       $return = false;
 
        // Switch to jackpot-mode when no UID is supplied but userid-mode is selected
        if ((getBonusMode() == 'UID') && (getBonusUserid() == '0') && (isExtensionActive('jackpot'))) {
@@ -232,10 +237,10 @@ function handleBonusPoints ($mode) {
                        break;
 
                case 'JACKPOT': // ... jackpot
-                       if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) == -1) && (isValidUserId(getBonusUserid()))) {
+                       if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) === false) && (isValidUserId(getBonusUserid()))) {
                                if ($total >= $points) {
                                        // Subtract points from userid's account
-                                       subtractPointsFromJackpot('bonus_payout_jackpot', getBonusUserid(), $points);
+                                       $return = subtractPointsFromJackpot('bonus_payout_jackpot', getBonusUserid(), $points);
                                } // END - if
                        } // END - if
                        break;
@@ -243,10 +248,10 @@ function handleBonusPoints ($mode) {
                case 'UID': // ... userid's account
                        if ($total >= $points) {
                                // Subtract points from userid's account
-                               subtractPoints('bonus_payout_userid', getBonusUserid(), $points);
+                               $return = subtractPoints('bonus_payout_userid', getBonusUserid(), $points);
                        } elseif (isExtensionActive('jackpot')) {
                                // Try to subtract from jackpot
-                               $dummy = subtractPointsFromJackpot($points);
+                               $return = subtractPointsFromJackpot($points);
                        }
                        break;
 
@@ -254,6 +259,9 @@ function handleBonusPoints ($mode) {
                        debug_report_bug(__FUNCTION__, __LINE__, 'Invalid bonus-mode ' . getBonusMode() . ' detected.');
                        break;
        } // END - switch
+
+       // Return status
+       return $return;
 }
 
 // Purges expired fast-click bonus entries