]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/bonus_functions.php
Extension ext-forced enhanced, some code cleanup:
[mailer.git] / inc / libs / bonus_functions.php
index 2b75d7b96af98ebc4b87f4cb787eff85f68db5c9..e9e982ff6eea67a825f157639b84ae9ad92c95e0 100644 (file)
@@ -107,7 +107,9 @@ function addTurboBonus ($mid, $userid, $type) {
                        $points
                ), __FUNCTION__, __LINE__);
 
-       if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD') && ($points > 0)) handleBonusPoints($points);
+       if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD') && ($points > 0)) {
+               handleBonusPoints($points);
+       } // END - if
 }
 
 //
@@ -232,6 +234,10 @@ function handleBonusPoints ($mode) {
 
        // Subtract points from...
        switch (getBonusMode()) {
+               case 'ADD': // Only add them (no subtraction)
+                       // Ignored
+                       break;
+
                case 'JACKPOT': // ... jackpot
                        if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) == -1) && (isValidUserId(getBonusUserId()))) {
                                if ($total >= $points) {
@@ -252,7 +258,7 @@ function handleBonusPoints ($mode) {
                        break;
 
                default: // This should not happen
-                       debug_report_bug(__FUNCTION__, __LINE__, 'Invalid config entry ' . getBonusMode() . ' detected.');
+                       debug_report_bug(__FUNCTION__, __LINE__, 'Invalid bonus-mode ' . getBonusMode() . ' detected.');
                        break;
        } // END - switch
 }
@@ -363,5 +369,17 @@ function getBonusMode () {
        return $GLOBALS[__FUNCTION__];
 }
 
+// Getter for bonus_ranks
+function getBonusRanks () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('bonus_ranks');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // [EOF]
 ?>