]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/bonus_functions.php
Wrapper getTurboRates() introduced
[mailer.git] / inc / libs / bonus_functions.php
index 7236987cad24dd561544159c2843e86fade70b03..dd62ec7e5678d9937278fe3b11a1a26ba5fbdf7e 100644 (file)
@@ -82,7 +82,7 @@ function addTurboBonus ($mid, $userid, $type) {
                $points = getConfig('turbo_bonus');
        } else {
                // Anything else so let's explode all entered rank points
-               $test = explode(';', getConfig('turbo_rates'));
+               $test = explode(';', getTurboRates());
                if (!empty($test[$rank - 2])) {
                        // Level found
                        $points = $test[$rank - 2];
@@ -123,7 +123,7 @@ function addBonusRanks ($data, $type, $userid) {
        $GLOBALS['ranking_content']['rankings'] = '';
 
        // How many ranks do we have?
-       $ranks = count(explode(';', getConfig('turbo_rates'))) + 1;
+       $ranks = count(explode(';', getTurboRates())) + 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",
@@ -339,5 +339,17 @@ function getBonusRanks () {
        return $GLOBALS[__FUNCTION__];
 }
 
+// Getter for turbo_rates
+function getTurboRates () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('turbo_rates');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // [EOF]
 ?>