]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-points.php
More rewrites to make lesser use of getMessage()
[mailer.git] / inc / modules / member / what-points.php
index 38065edd7bf3815c9847cfdaca24c3b4a8e0c9ef..2017dfd9022049c299bb2057b9670c79b506d39f 100644 (file)
@@ -61,9 +61,9 @@ if (isExtensionInstalledAndNewer('bonus', '0.4.4')) $depths += 4;
 $content['rowspan'] = ($depths*2+15);
 
 // Init some vars...
-$totalPoints = '0';
-$totalReferals = '0';
-$totalLocked = '0';
+$content['total_points'] = '0';
+$content['total_referals'] = '0';
+$content['total_locked'] = '0';
 $OUT = '';
 
 // Load ref levels
@@ -89,8 +89,8 @@ while ($data = SQL_FETCHARRAY($result_depths)) {
                $content = merge_array($content, SQL_FETCHARRAY($result_points));
 
                // Add both points
-               $totalPoints += $content['points'];
-               $totalLocked += $content['locked_points'];
+               $content['total_points'] += $content['points'];
+               $content['total_locked'] += $content['locked_points'];
        } // END - if
 
        // Free result
@@ -109,7 +109,7 @@ while ($data = SQL_FETCHARRAY($result_depths)) {
                $content = merge_array($content, SQL_FETCHARRAY($result_refs));
 
                // Add them to total refs
-               $totalReferals += $content['counter'];
+               $content['total_referals'] += $content['counter'];
        } // END - if
 
        // Free result
@@ -126,35 +126,26 @@ SQL_FREERESULT($result_depths);
 $content['rows'] = $OUT;
 
 // Initialize variables
-$CONFIRMED = '---';
-$SENT      = '---';
-$RECEIVED  = '---';
+$content['confirmed'] = '---';
+$content['sent']      = '---';
+$content['receive']   = '---';
 
 // Only user >= v0.1.2: Fetch confirmed mails counter
 if (isExtensionInstalledAndNewer('user', '0.1.2')) {
        $add = '';
-       $CONFIRMED = getUserData('mails_confirmed');
+       $content['confirmed'] = getUserData('mails_confirmed');
 
        if (isExtensionInstalledAndNewer('user', '0.1.4')) {
-               $SENT     = getUserData('emails_sent');
-               $RECEIVED = getUserData('emails_received');
+               $content['sent']    = getUserData('emails_sent');
+               $content['receive'] = getUserData('emails_received');
        } // END - if
-
-       // Please update the user extension if you see 3 dashes
-       if (empty($SENT))     $SENT     = '---';
-       if (empty($RECEIVED)) $RECEIVED = '---';
-} else {
-       // Please update!
-       $CONFIRMED = '---';
-}
+} // END - if
 
 // If TLOCK is 0 add 3 zeros for floating
-if ($totalLocked == '0') $totalLocked = '0.00000';
+if ($content['total_locked'] == '0') $content['total_locked'] = '0.00000';
 
 // Remember several values in constants
-$content['sum']   = ($totalPoints - getUserData('used_points'));
-$content['tref']  = $totalReferals;
-$content['tlock'] = $totalLocked;
+$content['total_points']  = ($content['total_points'] - getUserData('used_points'));
 
 // Fixes a bug when there is no bonus extension installed
 if (isExtensionInstalledAndOlder('bonus', '0.4.4')) setConfigEntry('bonus_active', 'X');
@@ -164,19 +155,8 @@ $content['special_rows'] = '';
 
 // Display login bonus and turbo-click bonus
 if ((isExtensionInstalledAndNewer('bonus', '0.2.2')) && (isExtensionActive('bonus')) && (getConfig('bonus_active') == 'Y')) {
-       // Fetch some data and init others (to avoid a notice here)
-       $content['login'] = getUserData('login_bonus');
-       $content['turbo'] = getUserData('turbo_bonus');
-
-       // Get more data if ext-bonus is newer
-       if (isExtensionInstalledAndNewer('bonus', '0.4.4')) {
-               $content['ref']   = getUserData('bonus_ref');
-               $content['order'] = getUserData('bonus_order');
-               $content['stats'] = getUserData('bonus_stats');
-       } // END - if
-
        // Total bonus points
-       $content['ttotal'] = $content['turbo'] + $content['login'] + $content['ref'] + $content['order'] + $content['stats'];
+       $content['total'] = getUserData('turbo_bonus') + getUserData('login_bonus') + getUserData('bonus_ref') + getUserData('bonus_order') + getUserData('bonus_stats');
 
        // Output rows
        $content['special_rows'] = loadTemplate('member_points_bonus_rows', true, $content);
@@ -188,11 +168,6 @@ if ((isExtensionInstalledAndNewer('bonus', '0.2.2')) && (isExtensionActive('bonu
        $content['special_rows'] = loadTemplate('member_points_upgrade');
 }
 
-// Remeber values for the final template
-$content['receive']   = $RECEIVED;
-$content['confirmed'] = $CONFIRMED;
-$content['sent']      = $SENT;
-
 // Load final template
 if (isExtensionActive('user')) {
        // Load template when required extension is there
@@ -202,12 +177,12 @@ if (isExtensionActive('user')) {
        loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('user'));
 } else {
        // Message for user
-       loadTemplate('admin_settings_saved', false, getMessage('PROBLEM_POINTS_OVERVIEW_UNAVAILABLE'));
+       loadTemplate('admin_settings_saved', false, '{--PROBLEM_POINTS_OVERVIEW_UNAVAILABLE--}');
 }
 
 if (isExtensionActive('payout')) {
        // Payput extension is installed and active so we can check if the user has enougth points
-       outputPayoutList(convertCommaToDot(($totalPoints - getUserData('used_points'))));
+       outputPayoutList($content['total_points'] - getUserData('used_points'));
 } // END - if
 
 // [EOF]