]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/bonus_functions.php
Syntax errors fixed, naming convention applied, wrappers used:
[mailer.git] / inc / libs / bonus_functions.php
index c6768029f0219a4162909c4c336b4cbefb002ffc..17736e92928eaf3137403c87d37d14d1cb70a440 100644 (file)
@@ -65,7 +65,7 @@ function addTurboBonus ($mid, $userid, $type) {
                default:
                        logDebugMessage(__FUNCTION__, __LINE__, sprintf("Invalid type %s detected.", $type));
                        break;
-       }
+       } // END - switch
 
        // Is a column name set?
        if (empty($column)) {
@@ -128,7 +128,7 @@ function addBonusRanks ($data, $type, $userid) {
                array(
                        $type,
                        $data,
-                       $userid
+                       bigintval($userid)
                ), __FUNCTION__, __LINE__);
 
        // Entry found?
@@ -140,9 +140,7 @@ function addBonusRanks ($data, $type, $userid) {
                $self  = true;
 
                // Transfer data to template
-               $GLOBALS['ranking_content']['yr_level']  = $GLOBALS['ranking_content']['level'];
-               $GLOBALS['ranking_content']['yr_points'] = translateComma($GLOBALS['ranking_content']['points']);
-               $GLOBALS['ranking_content']['yr_tmark']  = generateDateTime($GLOBALS['ranking_content']['timemark'], 1);
+               $GLOBALS['ranking_content']['timemark'] = generateDateTime($GLOBALS['ranking_content']['timemark'], 1);
 
                // Load template
                $GLOBALS['ranking_content']['own'] = loadTemplate('show_bonus_yr', true, $GLOBALS['ranking_content']);
@@ -235,7 +233,7 @@ function handleBonusPoints ($mode) {
        }
 
        // Check his amount first
-       $total = countSumTotalData(getBonusUserId(), 'user_points', 'points') - countSumTotalData(getBonusUserId(), 'user_data', 'used_points');
+       $total = getTotalPoints(getBonusUserId());
 
        // Subtract points from...
        switch (getConfig('bonus_mode')) {
@@ -314,6 +312,10 @@ LIMIT 1',
        }
 }
 
+///////////////////////////////////////////////////////////////////////////////
+//                             Wrapper functions                             //
+///////////////////////////////////////////////////////////////////////////////
+
 // Determines wether the "bonus rallye" is active
 function isBonusRallyeActive () {
        // Do we have cache?
@@ -326,5 +328,17 @@ function isBonusRallyeActive () {
        return $GLOBALS['bonus_rallye_active'];
 }
 
+// Determines wether the "bonus new_member_notify" is active
+function isBonusNewMemberNotifyEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['bonus_new_member_notify_active'])) {
+               // Just determine it
+               $GLOBALS['bonus_new_member_notify_active'] = (getConfig('bonus_new_member_notify') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['bonus_new_member_notify_active'];
+}
+
 // [EOF]
 ?>