]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/bonus_functions.php
Adding of API array indexes basicly finished
[mailer.git] / inc / libs / bonus_functions.php
index 17736e92928eaf3137403c87d37d14d1cb70a440..0cba632fea12a6f5a6fea5a721e110d65e91f18c 100644 (file)
@@ -150,11 +150,8 @@ function addBonusRanks ($data, $type, $userid) {
        $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `%s`=%s ORDER BY `level` ASC LIMIT {?bonus_lines?}",
                array($type, $data), __FUNCTION__, __LINE__);
        if (!SQL_HASZERONUMS($result)) {
-               // Start generating the ranking list
-               $max = SQL_NUMROWS($result);
-
                // Output all ranks (levels)
-               for ($rank = 1; $rank <= $max; $rank++) {
+               for ($rank = 1; $rank <= SQL_NUMROWS($result); $rank++) {
                        // Load data
                        $result_users = SQL_QUERY_ESC("SELECT
        `userid`, `points`
@@ -197,14 +194,14 @@ LIMIT 1",
 
                if ($self === false) {
                        // If current user was not found set constant
-                       $GLOBALS['ranking_content']['rankings'] = '{--BONUS_RANK_YOU_ARE_404--}';
+                       $GLOBALS['ranking_content']['rankings'] = '{--MEMBER_BONUS_RANK_YOU_ARE_404--}';
                } // END - if
        } else {
                // No entries found!
                // @TODO Move this HTML to a template
                $OUT = '<tr>
   <td colspan="3" align="center" height="30" class="bottom">
-    <div class="guest_failed">' . getMaskedMessage('BONUS_NO_RANKS', $data) . '</div>
+    <div class="guest_failed">' . getMaskedMessage('MEMBER_BONUS_NO_RANKS', $data) . '</div>
   </td>
 </tr>';
        }
@@ -261,7 +258,7 @@ function handleBonusPoints ($mode) {
 // Purges expired fast-click bonus entries
 function purgeExpiredTurboBonus() {
        // Remove entries
-       $result = SQL_QUERY("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `timemark` < (UNIX_TIMESTAMP() - {?bonus_timeout?})", __FUNCTION__, __LINE__);
+       $result = SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `timemark` < (UNIX_TIMESTAMP() - {?bonus_timeout?})', __FUNCTION__, __LINE__);
 
        if (SQL_AFFECTEDROWS() > 0) {
                // Send out email to admin
@@ -269,9 +266,9 @@ function purgeExpiredTurboBonus() {
        } // END - if
 }
 
-///////////////////////////////////////////////////////////////////////////////
-//                              Only filter functions
-///////////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------------
+//                                Filter Functions
+//-----------------------------------------------------------------------------
 
 // Filter for adding login bonus to the user's account
 function FILTER_ADD_LOGIN_BONUS () {
@@ -305,16 +302,16 @@ LIMIT 1',
 
        if (($bonus === true) && (getRequestParameter('mode') == 'bonus')) {
                // Output message with added points
-               $GLOBALS['message'] .= '<div class="tiny">{--BONUS_LOGIN_BONUS_ADDED--}</div>';
+               $GLOBALS['message'] .= '<div class="tiny">{--MEMBER_BONUS_LOGIN_BONUS_ADDED--}</div>';
        } elseif (isExtensionActive('bonus')) {
                // No login bonus added!
-               $GLOBALS['message'] .= '<div class="member_failed">{--BONUS_LOGIN_BONUS_NOT_ADDED--}</div>';
+               $GLOBALS['message'] .= '<div class="member_failed">{--MEMBER_BONUS_LOGIN_BONUS_NOT_ADDED--}</div>';
        }
 }
 
-///////////////////////////////////////////////////////////////////////////////
-//                             Wrapper functions                             //
-///////////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------------
+//                             Wrapper Functions
+//-----------------------------------------------------------------------------
 
 // Determines wether the "bonus rallye" is active
 function isBonusRallyeActive () {
@@ -340,5 +337,17 @@ function isBonusNewMemberNotifyEnabled () {
        return $GLOBALS['bonus_new_member_notify_active'];
 }
 
+// Getter for bonus_timeout
+function getBonusTimeout () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('bonus_timeout');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // [EOF]
 ?>