New wrapper function introduced, more EL rewrites:
authorRoland Häder <roland@mxchange.org>
Sat, 10 Jul 2010 08:51:00 +0000 (08:51 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 10 Jul 2010 08:51:00 +0000 (08:51 +0000)
- New wrapper function getTotalPoints() introduced
- Even more rewrites to make usage of EL
- TODOs.txt updated

44 files changed:
DOCS/TODOs.txt
doubler.php
inc/extensions/ext-wernis.php
inc/functions.php
inc/language/beg_de.php
inc/language/doubler_de.php
inc/libs/bonus_functions.php
inc/libs/doubler_functions.php
inc/libs/surfbar_functions.php
inc/libs/wernis_functions.php
inc/modules/admin/what-edit_sponsor.php
inc/modules/admin/what-list_user.php
inc/modules/guest/what-active.php
inc/modules/guest/what-beg.php
inc/modules/guest/what-doubler.php
inc/modules/guest/what-top10.php
inc/modules/member/what-order.php
inc/modules/member/what-payout.php
inc/modules/member/what-primera.php
inc/modules/member/what-transfer.php
inc/modules/member/what-wernis.php
inc/modules/sponsor/welcome.php
inc/mysql-manager.php
inc/wrapper-functions.php
mailid_top.php
surfbar.php
templates/de/emails/back-admin.tpl
templates/de/emails/sponsor/sponsor_add_points.tpl
templates/de/emails/sponsor/sponsor_sub_points.tpl
templates/de/emails/sub-points.tpl
templates/de/html/admin/admin_list_beg.tpl
templates/de/html/guest/guest_beg.tpl
templates/de/html/guest/guest_doubler.tpl
templates/de/html/mailid/mailid_points_done.tpl
templates/de/html/mailid/mailid_points_done2.tpl
templates/de/html/mailid/mailid_points_failed.tpl
templates/de/html/mailid/mailid_points_locked.tpl
templates/de/html/mailid/mailid_points_locked2.tpl
templates/de/html/member/member_beg.tpl
templates/de/html/member/member_doubler.tpl
templates/de/html/member/member_list_beg.tpl
templates/de/html/member/member_wernis_mode_payout.tpl
templates/de/html/member/member_wernis_mode_withdraw.tpl
templates/de/html/sponsor/sponsor_welcome.tpl

index 095875b..346184b 100644 (file)
 ./inc/modules/member/what-categories.php:129:          // @TODO Rewrite this to use $OUT .= ...
 ./inc/modules/member/what-order.php:457:                       // @TODO Rewrite this to a filter
 ./inc/modules/member/what-order.php:65:// @TODO Rewrite this to a filter
-./inc/modules/member/what-payout.php:216:                                      // @TODO Rewrite this to a filter
+./inc/modules/member/what-payout.php:207:                                      // @TODO Rewrite this to a filter
 ./inc/modules/member/what-points.php:55:// @TODO Should we rewrite this to a filter?
 ./inc/modules/member/what-rallyes.php:91:      // @TODO Reactivate this: $content['admin'] = '<a href="{%url=modules.php?module=index&amp;what=impressum&amp;admin=' . $content['admin_id'] . '%}">' . $content['login'] . '</a>';
 ./inc/modules/member/what-refback.php:126:                     // @TODO UNUSED: $refRow['status']      = translateUserStatus($refRow['status']);
 ./inc/mysql-manager.php:1164:  // @TODO Rewrite this to a filter
 ./inc/mysql-manager.php:1411:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
 ./inc/mysql-manager.php:1509:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1889:                  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1933:// @TODO Fix inconsistency between last_module and getWhat()
+./inc/mysql-manager.php:1888:                  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1932:// @TODO Fix inconsistency between last_module and getWhat()
 ./inc/mysql-manager.php:370:   // @TODO Try to rewrite this to one or more functions
 ./inc/mysql-manager.php:46:// @TODO Can we cache this?
 ./inc/reset/reset_beg.php:51:// @TODO This should be converted in a daily beg rallye
 ./mailid_top.php:132:                                  // @TODO Rewrite this to a filter
 ./mailid_top.php:179:                                                  // @TODO Rewrite this to a filter
 ./mailid_top.php:186:                                                                  // @TODO Rewrite this to a filter
-./mailid_top.php:222:                                                                  // @TODO Rewrite these blocks to filter
-./mailid_top.php:257:                                                                          // @TODO Try to rewrite the following unset()
+./mailid_top.php:221:                                                                  // @TODO Rewrite these blocks to filter
+./mailid_top.php:256:                                                                          // @TODO Try to rewrite the following unset()
 ./mailid_top.php:99:           // @TODO Rewrite this to a filter
 ./show_bonus.php:107:                  // @TODO No more needed? $content['points'] = translateComma($content['points']);
 ./view.php:70:         // @TODO No banner found, output some default banner
index 8685143..aaf4c80 100644 (file)
@@ -95,7 +95,7 @@ if (isFormSent()) {
                        $GLOBALS['doubler_userid'] = getUserData('userid');
 
                        // Calulcate points
-                       $points = countSumTotalData(getUserData('userid'), 'user_points', 'points') - countSumTotalData(getUserData('userid'), 'user_data', 'used_points');
+                       $points = getTotalPoints(getUserData('userid'));
 
                        // So let's continue with probing his points amount
                        if (($points - getConfig('doubler_left') - postRequestParameter('points') * getConfig('doubler_charge') / 100) >= 0) {
index 4b466f3..1de2215 100644 (file)
@@ -136,7 +136,7 @@ PRIMARY KEY (id)
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("WDS66-Username muss nun eintragen werden (API-Anpassung).");
                                break;
-               }
+               } // END - switch
                break;
 
        case 'modify': // When the extension got modified
@@ -153,7 +153,7 @@ PRIMARY KEY (id)
        default: // Unknown extension mode
                logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
                break;
-}
+} // END - switch
 
 // [EOF]
 ?>
index 427c312..c171e62 100644 (file)
@@ -89,7 +89,7 @@ function addFatalMessage ($F, $L, $message, $extra = '') {
 
 // Getter for total fatal message count
 function getTotalFatalErrors () {
-       // Init coun
+       // Init count
        $count = '0';
 
        // Do we have at least the first entry?
index 6cf9a06..8f7b2cf 100644 (file)
@@ -61,19 +61,19 @@ addMessages(array(
        'BEG_SORRY_ANOTHER_WAS_HERE_2' => " hat von Ihnen auch keine ",
        'BEG_SORRY_ANOTHER_WAS_HERE_3' => " {?POINTS?} erhalten.",
        'BEG_THANKS_FOR_CLICK_AGAIN' => "Danke dennoch f&uuml;r den erneuten Klick.",
-       'BEG_MEMBER_YOUR_LINK' => "Hier ist Ihr pers&ouml;nlicher Bettel-Link",
-       'BEG_MEMBER_CLICKS_TOTAL' => "Anzahl Gesamtklicks auf Ihren Bettel-Link",
-       'BEG_MEMBER_EARN_1' => "Sie erhalten von",
-       'BEG_MEMBER_EARN_2' => "bis",
-       'BEG_MEMBER_EARN_3' => "f&uuml;r jeden Klick auf Ihren Bettellink.",
-       'BEG_MEMBER_TIMEOUT' => "Die Zeitsperre ist derzeit eingestellt auf <span class=\"data\">{%config,createFancyTime=beg_timeout%}</span>. Innerhalb dieser Zeit erhalten Sie keine erneute Verg&uuml;tung.",
-       'BEG_MEMBER_HAVE_FUN' => "Viel Spass beim {?POINTS?}-Betteln.",
-       'BEG_GUEST_TRAILER' => "{?POINTS?} erbetteln bei...",
-       'BEG_GUEST_EARN_1' => "Betteln macht sich bezahlt! F&uuml;r jeden Klick erhalten Sie von",
-       'BEG_GUEST_EARN_2' => "bis",
-       'BEG_GUEST_EARN_3' => "auf Ihr Mitgliedskonto direkt gutgeschrieben. Zuddem verdienen Sie an den erbettelteten {?POINTS?} Ihrer Refferal mit.",
-       'BEG_GUEST_TIMEOUT' => "Sie k&ouml;nnen derzeit alle <span class=\"data\">%s</span> {?POINTS?} betteln.",
-       'BEG_GUEST_HAVE_FUN' => "Heute noch anmelden und Spass haben.",
+       'MEMBER_BEG_YOUR_LINK' => "Hier ist Ihr pers&ouml;nlicher Bettel-Link",
+       'MEMBER_BEG_CLICKS_TOTAL' => "Anzahl Gesamtklicks auf Ihren Bettel-Link",
+       'MEMBER_BEG_EARN_1' => "Sie erhalten von",
+       'MEMBER_BEG_EARN_2' => "bis",
+       'MEMBER_BEG_EARN_3' => "f&uuml;r jeden Klick auf Ihren Bettellink.",
+       'MEMBER_BEG_TIMEOUT' => "Die Zeitsperre ist derzeit eingestellt auf <span class=\"data\">{%config,createFancyTime=beg_timeout%}</span>. Innerhalb dieser Zeit erhalten Sie keine erneute Verg&uuml;tung.",
+       'MEMBER_BEG_HAVE_FUN' => "Viel Spass beim {?POINTS?}-Betteln.",
+       'GUEST_BEG_TRAILER' => "{?POINTS?} erbetteln bei...",
+       'GUEST_BEG_EARN_1' => "Betteln macht sich bezahlt! F&uuml;r jeden Klick erhalten Sie von",
+       'GUEST_BEG_EARN_2' => "bis",
+       'GUEST_BEG_EARN_3' => "auf Ihr Mitgliedskonto direkt gutgeschrieben. Zuddem verdienen Sie an den erbettelteten {?POINTS?} Ihrer Refferal mit.",
+       'GUEST_BEG_TIMEOUT' => "Sie k&ouml;nnen derzeit alle <span class=\"data\">{%config,createFancyTime=beg_timeout%}</span> {?POINTS?} betteln.",
+       'GUEST_BEG_HAVE_FUN' => "Heute noch anmelden und Spass haben.",
        'ADMIN_BEG_POINTS_MAX' => "Maximale erbettelbare {?POINTS?} bei Klick auf Bettellink",
        'ADMIN_BEG_USERID' => "Mitglied-Account zum Abbuchen der erbettelten {?POINTS?}",
        'ADMIN_SELECT_BEG_MODE' => "Verg&uuml;tungsmodus der erbettelten {?POINTS?}",
@@ -101,7 +101,7 @@ addMessages(array(
        'BEG_RANK' => "Bettel-Rank",
        'BEG_TOTAL' => "Gesamt erbettelt",
        'BEG_POINTS' => "Erbettelt",
-       'BEG_MEMBER_TOTAL' => "Erbettelte {?POINTS?} aller Mitglieder",
+       'MEMBER_BEG_TOTAL' => "Erbettelte {?POINTS?} aller Mitglieder",
        'ADMIN_BEG_TIMEOUT' => "Es werden nur Mitglieder ausgewertet und hier aufgelistet, die sp&auml;testens am <span class=\"data\">%s</span> noch aktiv waren. Alle anderen Mitglieder erhalten die Verg&uuml;tung nicht.",
        'ADMIN_EDIT_BEG_RALLYE_SETTINGS' => "Einstellungen an der Bettel-Rallye",
        'ADMIN_BEG_RALLYE_ACTIVE' => "Ist die Bettel-Rallye aktiv? (Mails k&ouml;nnen optional versendet werden!)",
@@ -118,7 +118,7 @@ addMessages(array(
        'BEG_RALLYE_CONDITION_2' => "Es kann jeder dran teilnehmen, der Mitglied bei diesem {?mt_word?} (<strong>{?MAIN_TITLE?}</strong>) und freigegeben ist.",
        'BEG_RALLYE_CONDITION_3' => "Zur Erstellung des Rallye-Ergebnisses werden alle erbettelten {?POINTS?} ber&uuml;cksichtig.",
        'BEG_RALLYE_CONDITION_4' => "Der Rechtsweg ist ausgeschlossen.",
-       'BEG_MEMBER_HERE_IS_THE_LIST' => "Hier finden Sie die aktuelle Liste mit den m&ouml;glichen Gewinnern.",
+       'MEMBER_BEG_HERE_IS_THE_LIST' => "Hier finden Sie die aktuelle Liste mit den m&ouml;glichen Gewinnern.",
        'BEG_LINK_HERE' => "Betteln Sie am Besten gleich los! Hier ist der Link dazu.",
        'ADMIN_BEG_RANKS' => "Anzahl Gewinner der Bettel-Rallye",
        'BEG_MONTHLY_RALLYE' => "GEWONNEN: Monatliche Bettel-Rallye",
index fdfed8e..5028dbe 100644 (file)
@@ -85,8 +85,7 @@ addMessages(array(
        'DOUBLER_NOTE_FOR_PASSWORD' => "Das Passwort wird nicht gespeichert.",
        'DOUBLER_ENTER_POINTS' => "{?POINTS?} zum Verdoppeln",
        'DOUBLER_NOW' => "Verdoppeln.",
-       'DOUBLER_ALREADY_PAYED' => "Es wurden bereits <strong>%s {?POINTS?}</strong> ausgezahlt.",
-       'MEMBER_DOUBLER_ALREADY_PAYED' => "Es wurden bereits <strong>{%config,translateComma=doubler_points%} {?POINTS?}</strong> ausgezahlt.",
+       'DOUBLER_ALREADY_PAYED' => "Es wurden bereits <strong>{%config,translateComma=doubler_points%} {?POINTS?}</strong> ausgezahlt.",
        'DOUBLER_MINIMUM_IS' => "Mindestens",
        'DOUBLER_MAXIMUM_IS' => "verdoppeln, maximal",
        'DOUBLER_HAVE_FUN' => "Viel Spa&szlig;.",
index c676802..25a7974 100644 (file)
@@ -235,7 +235,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')) {
index b9a603e..cc143c2 100644 (file)
@@ -143,7 +143,7 @@ function getDoublerTotalPointsLeft() {
 
        if (isValidUserId(getConfig('doubler_userid'))) {
                // Get user's points
-               $user = countSumTotalData(getConfig('doubler_userid'), 'user_points', 'points');
+               $user = getTotalPoints(getConfig('doubler_userid'));
                $points += $user;
        } // END - if
 
index e588ce6..490d672 100644 (file)
@@ -1147,9 +1147,9 @@ function SURFBAR_DETERMINE_DEPLETED_USERIDS ($limit=0) {
        // Do we have a current user id?
        if ((isMember()) && ($limit == '0')) {
                // Then add this as well
-               $userids['url_userid'][getMemberId()]      = getMemberId();
-               $userids['points'][getMemberId()]   = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');
-               $userids['notified'][getMemberId()] = '0';
+               $userids['url_userid'][getMemberId()] = getMemberId();
+               $userids['points'][getMemberId()]     = getTotalPoints(getMemberId());
+               $userids['notified'][getMemberId()]   = '0';
 
                // Get all userid except logged in one
                $result = SQL_QUERY_ESC("SELECT
@@ -1188,16 +1188,16 @@ ORDER BY
        // Load all userid
        while ($content = SQL_FETCHARRAY($result)) {
                // Get total points
-               $points = countSumTotalData($content['url_userid'], 'user_points', 'points') - countSumTotalData($content['url_userid'], 'user_data', 'used_points');
+               $points = getTotalPoints($content['url_userid']);
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "userid={$content['url_userid']},points={$points}", false);
 
                // Shall we add this to ignore?
                if ($points <= $limit) {
                        // Ignore this one!
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "userid={$content['url_userid']} has depleted points amount!", false);
-                       $userids['url_userid'][$content['url_userid']]      = $content['url_userid'];
-                       $userids['points'][$content['url_userid']]   = $points;
-                       $userids['notified'][$content['url_userid']] = $content['notified'];
+                       $userids['url_userid'][$content['url_userid']] = $content['url_userid'];
+                       $userids['points'][$content['url_userid']]     = $points;
+                       $userids['notified'][$content['url_userid']]   = $content['notified'];
                } // END - if
        } // END - while
 
index 21c3f2f..ffc792f 100644 (file)
@@ -40,7 +40,7 @@
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
-}
+} // END - if
 
 // Sets a status message and code
 function WERNIS_STATUS_MESSAGE ($message, $status) {
@@ -389,22 +389,5 @@ function WERNIS_ADD_WITHDRAW_FEE ($points) {
        return $points;
 }
 
-// Add all fees to the array
-function WERNIS_ADD_FEES_TO_ARRAY (&$array) {
-       // Is the array an array? ;-)
-       if (!is_array($array)) {
-               // Log error and return
-               logDebugMessage(__FUNCTION__, __LINE__, 'Type ' . gettype($array) . ' != array.');
-               return;
-       } // END - if
-
-       // Add both factors
-       $array['withdraw_factor']      = translateComma(getConfig('wernis_withdraw_factor'));
-
-       // Add all fees
-       $array['withdraw_fee_percent'] = translateComma(getConfig('wernis_withdraw_fee_percent'));
-       $array['withdraw_fee_fix']     = translateComma(getConfig('wernis_withdraw_fee_fix'));
-}
-
 // [EOF]
 ?>
index 88bf548..c6a793c 100644 (file)
@@ -96,7 +96,7 @@ LIMIT 1",
                                                        array($points, bigintval(getRequestParameter('id'))), __FILE__, __LINE__);
 
                                                // Remember points /reason for the template
-                                               $content['points'] = translateComma($points);
+                                               $content['points'] = $points;
                                                $content['reason'] = secureString(postRequestParameter('reason'));
 
                                                // Send email
@@ -119,7 +119,7 @@ LIMIT 1",
                                                        array($points, bigintval(getRequestParameter('id'))), __FILE__, __LINE__);
 
                                                // Remember points /reason for the template
-                                               $content['points'] = translateComma($points);
+                                               $content['points'] = $points;
                                                $content['reason'] = secureString(postRequestParameter('reason'));
 
                                                // Send email
index 6e78f65..d9fe102 100644 (file)
@@ -279,7 +279,7 @@ LIMIT 1",
                        if (isExtensionInstalled('nickname')) $content['nickname'] = getNickname($content['userid']);
 
                        // Calculate total points
-                       $content['points'] = countSumTotalData($content['userid'], 'user_points', 'points')  - countSumTotalData($content['userid'], 'user_data', 'used_points');
+                       $content['points'] = getTotalPoints($content['userid']);
 
                        // Clickrate
                        $content['rate'] = '0';
index 7e01719..9b14876 100644 (file)
@@ -79,7 +79,7 @@ if (!SQL_HASZERONUMS($result)) {
                $content = array(
                        'userid'      => $userid,
                        'nickname'    => $nick2,
-                       'points'      => (countSumTotalData($userid, 'user_points', 'points') - countSumTotalData($userid, 'user_data', 'used_points')),
+                       'points'      => getTotalPoints($userid),
                        'last_online' => generateDateTime($last, 2),
                );
 
index 0ea7226..07a7d8b 100644 (file)
@@ -53,7 +53,7 @@ if ((!isExtensionActive('beg')) && (!isAdmin())) {
 // @TODO No more needed? define('__BEG_UID_TIMEOUT', createFancyTime(getConfig('beg_userid_timeout')));
 
 // Load final template
-loadTemplate('guest_beg', false, $content);
+loadTemplate('guest_beg');
 
 // [EOF]
 ?>
index a4809fb..1d8a4ac 100644 (file)
@@ -51,7 +51,7 @@ if ((!isExtensionActive('doubler')) && (!isAdmin())) {
 } // END - if
 
 // Which mail-send-mode did the admin setup?
-$content['payout_time'] = '{--DOUBLER_PAYOUT_TIME_' . getConfig('doubler_send_mode') . '--}';
+$content['payout_time'] = '{--DOUBLER_PAYOUT_TIME_{?doubler_send_mode?}--}';
 
 // Generate table with already payed out doubles
 $content['payout_history'] = generateDoublerTable(0, 'Y', 'N', 'DESC');
index 82d1ada..20865bd 100644 (file)
@@ -79,7 +79,7 @@ while ($content = SQL_FETCHARRAY($result)) {
                'userid'       => $content['userid'],
                'nickname'     => $content['nickname'],
                'total_logins' => $content['total_logins'],
-               'points'       => (countSumTotalData($content['userid'], 'user_points', 'points')),
+               'points'       => getTotalPoints($content['userid']),
                'last_online'  => generateDateTime($content['last_online'], 3),
        );
 
@@ -208,7 +208,7 @@ while ($content = SQL_FETCHARRAY($result)) {
                'userid'      => $content['userid'],
                'refs'        => $content['refs'],
                'nickname'    => $content['nickname'],
-               'points'      => (countSumTotalData($content['userid'], 'user_points', 'points')),
+               'points'      => getTotalPoints($content['userid']),
                'last_online' => generateDateTime($content['last_online'], 3)
        );
 
index 281248a..3104a78 100644 (file)
@@ -95,7 +95,7 @@ $ALLOWED = $MAXI - $ORDERS;
 if (getConfig('order_max_full') == 'MAX') $ALLOWED = $MAXI;
 
 // Now check his points amount
-$total = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');;
+$total = getTotalPoints(getMemberId());
 
 if (($HOLIDAY == 'Y') && (isExtensionInstalledAndNewer('holiday', '0.1.3'))) {
        // Holiday is active!
index edb05b8..4c31752 100644 (file)
@@ -54,17 +54,8 @@ if ((!isExtensionActive('payout')) && (!isAdmin())) {
        return;
 } // END - if
 
-// Get total points
-$totalPoints = countSumTotalData(getMemberId(), 'user_points', 'points');
-
-// Get used points
-$usedPoints = countSumTotalData(getMemberId(), 'user_data', 'used_points');
-
 // Translate point into comma
-$totalPoints = ($totalPoints - $usedPoints);
-
-// Sanity check...
-if (empty($totalPoints)) $totalPoints = '0.00000';
+$totalPoints = getTotalPoints(getMemberId());
 
 if (!isGetRequestParameterSet('payout')) {
        // Load payout types
index f38dfd5..243a2bb 100644 (file)
@@ -99,7 +99,7 @@ if (!isGetRequestParameterSet('mode')) {
 
 if (getRequestParameter('mode') == 'pay') {
        // Get total points and check if the user can request a payout
-       $points = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');
+       $points = getTotalPoints(getMemberId());
 
        // No dots here...
        $points = explode('.', $points);
@@ -113,7 +113,7 @@ if (getRequestParameter('mode') == 'pay') {
                // No, then abort here
                loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_MIN_PAYOUT_PAYOUT--}');
                return;
-       }
+       } // END - if
 
        // Add points to content array
        $content['points'] = $points;
index aad5bf3..ae163b7 100644 (file)
@@ -62,7 +62,7 @@ if ((getUserData('opt_in') != 'Y') && ($mode == 'new')) $mode = '';
 switch ($mode) {
        case 'new': // Start new transfer
                // Get total points and subtract the balance amount from it = maximum transferable points
-               $total = countSumTotalData(getMemberId(), 'user_points', 'points')  - countSumTotalData(getMemberId(), 'user_data', 'used_points');
+               $total = getTotalPoints(getMemberId());
 
                // Remember maximum value for template
                $content['max_transferable'] = round($total - getConfig('transfer_balance') - 0.5);
index 3e31898..8cf4261 100644 (file)
@@ -116,11 +116,8 @@ if ((!isGetRequestParameterSet('mode')) || (getRequestParameter('mode') == 'choo
                setGetRequestParameter('mode', 'choose');
        }
 } elseif ((getRequestParameter('mode') == 'payout') && (getConfig('wernis_payout_active') == 'Y')) {
-       // Get total points and check if the user can request a payout
-       $points = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');
-
-       // Remove the registration fee
-       $points = $points - getPointsRegister();
+       // Get user's total points and remove the registration fee
+       $points = getTotalPoints(getMemberId()) - getPointsRegister();
 
        // Is there a percentage or fixed fee?
        $points = WERNIS_TAKE_FEE($points, 'payout');
@@ -141,21 +138,15 @@ if ((!isGetRequestParameterSet('mode')) || (getRequestParameter('mode') == 'choo
        $points = bigintval($points[0]);
 
        // Add points to content array
-       $content['points']     = translateComma($points);
+       $content['points']     = $points;
 
        // Get WDS66 username
        $content['wernis_userid'] = getUserData('wernis_userid');
 } elseif ((getRequestParameter('mode') == 'withdraw') && (getConfig('wernis_withdraw_active') == 'Y')) {
-       // Get total points for just displaying them
-       $points = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');
-
        // Prepare data for the template
-       $content['points']        = translateComma($points);
+       $content['points']        = getTotalPoints(getMemberId());
        $content['wernis_userid'] = '';
 
-       // Add fees to array
-       WERNIS_ADD_FEES_TO_ARRAY($content);
-
        // Fetch id
        $content['wernis_userid'] = getUserData('wernis_userid');
 } else {
@@ -167,13 +158,13 @@ if ((!isGetRequestParameterSet('mode')) || (getRequestParameter('mode') == 'choo
 // Is the formular sent?
 if ((isFormSent()) && (isGetRequestParameterSet('mode'))) {
        // Is the user id and password set?
-       if (!isPostRequestParameterSet(('wernis_userid'))) {
+       if (!isPostRequestParameterSet('wernis_userid')) {
                // Nothing entered in WDS66 user id
                loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_EMPTY_USERNAME--}');
-       } elseif (!isPostRequestParameterSet(('wds66_password'))) {
+       } elseif (!isPostRequestParameterSet('wds66_password')) {
                // Nothing entered in WDS66 password
                loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_EMPTY_PASSWORD--}');
-       } elseif (!isPostRequestParameterSet(('amount'))) {
+       } elseif (!isPostRequestParameterSet('amount')) {
                // Nothing entered in amount
                loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_EMPTY_AMOUNT--}');
        } elseif (postRequestParameter('wernis_userid') != bigintval(postRequestParameter('wernis_userid'))) {
@@ -248,7 +239,7 @@ if ((isFormSent()) && (isGetRequestParameterSet('mode'))) {
                                logDebugMessage(__FILE__, __LINE__, sprintf("Invalid mode %s detected.", getRequestParameter('mode')));
                                loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_WERNIS_MODE_INVALID', getRequestParameter('mode')));
                                return;
-               }
+               } // END - switch
        }
 } // END - if
 
index 4a0dccc..3748ee3 100644 (file)
@@ -50,19 +50,25 @@ if (!defined('__SECURITY')) {
 }
 
 // Load some data
-$result = SQL_QUERY_ESC("SELECT `gender`, `surname`, `family`, (`points_amount` - `points_used`) AS points
-FROM `{?_MYSQL_PREFIX?}_sponsor_data`
-WHERE `id`='%s' AND `password`='%s' LIMIT 1",
-       array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FILE__, __LINE__);
+$result = SQL_QUERY_ESC("SELECT
+       `gender`, `surname`, `family`, (`points_amount` - `points_used`) AS points
+FROM
+       `{?_MYSQL_PREFIX?}_sponsor_data`
+WHERE
+       `id`=%s AND
+       `password`='%s'
+LIMIT 1",
+       array(
+               bigintval(getSession('sponsorid')),
+               getSession('sponsorpass')
+       ), __FILE__, __LINE__);
+
+// Fetch data
 $content = SQL_FETCHARRAY($result);
 
 // Free memory
 SQL_FREERESULT($result);
 
-// Prepare data for the template
-$content['gender'] = translateGender($content['gender']);
-$content['points'] = translateComma($content['points']);
-
 // Load main template
 $OUT = loadTemplate('sponsor_welcome', true, $content);
 
index 910f6a5..cc8988e 100644 (file)
@@ -1514,7 +1514,6 @@ LIMIT 1",
 
        // Add reason and translate points
        $data['text']   = $reason;
-       $data['points'] = translateComma($data['points']);
 
        // Now a mail to the user and that's all...
        $message = loadEmailTemplate('del-user', $data, $userid);
@@ -1830,7 +1829,7 @@ ORDER BY
                // Fetch all entries
                while ($row = SQL_FETCHARRAY($result)) {
                        // Get total points of this user
-                       $row['points'] = countSumTotalData($row['refid'], 'user_points', 'points') - countSumTotalData($row['refid'], 'user_data', 'used_points');
+                       $row['points'] = getTotalPoints($row['refid']);
 
                        // Get unconfirmed mails
                        $row['unconfirmed']  = countSumTotalData($row['refid'], 'user_links', 'id', 'userid', true);
index bc89dfc..56620b9 100644 (file)
@@ -1826,5 +1826,17 @@ function isVerboseSqlEnabled () {
        return $GLOBALS['is_verbose_sql_enabled'];
 }
 
+// "Getter" for total user points
+function getTotalPoints ($userid) {
+       // Do we have cache?
+       if (!isset($GLOBALS['total_points'][$userid])) {
+               // Determine it
+               $GLOBALS['total_points'][$userid] = countSumTotalData($userid, 'user_points', 'points') - countSumTotalData($userid, 'user_data', 'used_points');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['total_points'][$userid];
+}
+
 // [EOF]
 ?>
index 6d88d09..36a5c00 100644 (file)
@@ -215,7 +215,6 @@ if ((isValidUserId($url_userid)) && (($url_mid > 0) || ($url_bid > 0)) && (!ifFa
                                                                        } // END - switch
 
                                                                        // Export data into constants for the template
-                                                                       $content['points'] = translateComma($payment);
                                                                        $content['banner'] = loadTemplate('mailid_banner', true);
 
                                                                        // Only when user extension = v0.1.2: Update mails-confirmed counter
@@ -278,10 +277,7 @@ if ((isValidUserId($url_userid)) && (($url_mid > 0) || ($url_bid > 0)) && (!ifFa
                                                                                } // END - if
 
                                                                                // Load total points
-                                                                               $content['total'] = translateComma(
-                                                                                       countSumTotalData($url_userid, 'user_points', 'points') -
-                                                                                       countSumTotalData($url_userid, 'user_data', 'used_points')
-                                                                               );
+                                                                               $content['total'] = getTotalPoints($url_userid);
 
                                                                                // Load template
                                                                                loadTemplate($template, false, $content);
index 63facf3..4bfb8ca 100644 (file)
@@ -122,12 +122,9 @@ if ((SURFBAR_CHECK_RELOAD_FULL()) || ((isGetRequestParameterSet('frame')) && (in
                // This makes the footer appear again
                unsetGetRequestParameter('frame');
        } elseif ((isGetRequestParameterSet('frame')) && (getRequestParameter('frame') == 'stats')) {
-               // Get total points amount
-               $points = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');
-
                // Prepare content
                $content = array(
-                       'points' => $points,
+                       'points' => getTotalPoints(getMemberId()),
                        'reload' => (getConfig('surfbar_stats_reload') * 1000)
                );
 
index 365bf1e..e8d185d 100644 (file)
@@ -1,6 +1,6 @@
 Hallo Administrator,
 
-soeben wurden in Ihrem {?mt_word?} $content[points] {?POINTS?} aus nicht versendeten Mails in den Jackpot getan!
+soeben wurden in Ihrem {?mt_word?} {%pipe,translateComma=$content[points]%} {?POINTS?} aus nicht versendeten Mails in den Jackpot getan!
 
 Mit freundlichen Gr&uuml;&szlig;en,
   Ihr {?MAIN_TITLE?} Script
index 9821c77..945f2d2 100644 (file)
@@ -1,6 +1,6 @@
 Hallo {%sponsor,gender,translateGender=$userid%} {%sponsor,surname=$userid%} {%sponsor,family=$userid%},
 
-Einer unserer Administratoren hat Ihnen soeben $content[points] {?POINTS?} Ihrem Sponsoren-Account mit der id $content[id] gutgeschrieben!
+Einer unserer Administratoren hat Ihnen soeben {%pipe,translateComma=$content[points]%} {?POINTS?} Ihrem Sponsoren-Account mit der id $content[id] gutgeschrieben!
 
 Grund dazu war folgender:
 ------------------------------
index 9f526fd..28f1e6e 100644 (file)
@@ -1,6 +1,6 @@
 Hallo {%sponsor,gender,translateGender=$userid%} {%sponsor,surname=$userid%} {%sponsor,family=$userid%},
 
-Einer unserer Administratoren hat Ihnen soeben $content[points] {?POINTS?} von Ihrem Sponsoren-Account mit der id $content[id] abgezogen!
+Einer unserer Administratoren hat Ihnen soeben {%pipe,translateComma=$content[points]%} {?POINTS?} von Ihrem Sponsoren-Account mit der id $content[id] abgezogen!
 
 Grund dazu war folgender:
 ------------------------------
index 8db1d81..91ac7f4 100644 (file)
@@ -1,6 +1,6 @@
 Hallo {%user,gender,translateGender=$userid%} {%user,surname=$userid%} {%user,family=$userid%},
 
-Einer unserer Administratoren hat Ihnen soeben $content[points] {?POINTS?} abgezogen!
+Einer unserer Administratoren hat Ihnen soeben {%pipe,translateComma=$content[points]%} {?POINTS?} abgezogen!
 
 Grund dazu war folgender:
 ----------------
index 5f58825..d49b69d 100644 (file)
@@ -21,7 +21,7 @@
        $content[rows]
        <tr>
                <td colspan="3" class="header_column bottom right" align="right">
-                       <u>{--BEG_MEMBER_TOTAL--}:</u>
+                       <u>{--MEMBER_BEG_TOTAL--}:</u>
                </td>
                <td class="header_column bottom right">
                        <u>$content[total] {?POINTS?}</u>
index 3e1d569..937bbc8 100644 (file)
@@ -1,19 +1,19 @@
 <div align="center" class="beg_table dashed">
        <div class="beg_msg">
-               <div class="big">{--BEG_GUEST_TRAILER--}</div>
+               <div class="big">{--GUEST_BEG_TRAILER--}</div>
                <div>{?MAIN_TITLE?}</div>
        </div>
        <div class="beg_msg">
                <div class="para">
-                       {--BEG_GUEST_EARN_1--} <strong>{%config,translateComma=beg_points%} {?POINTS?}</strong>
-                       {--BEG_GUEST_EARN_2--} <strong>{%config,translateComma=beg_points_max%} {?POINTS?}</strong>
-                       {--BEG_GUEST_EARN_3--}
+                       {--GUEST_BEG_EARN_1--} <strong>{%config,translateComma=beg_points%} {?POINTS?}</strong>
+                       {--GUEST_BEG_EARN_2--} <strong>{%config,translateComma=beg_points_max%} {?POINTS?}</strong>
+                       {--GUEST_BEG_EARN_3--}
                </div>
                <div class="para">
-                       {%message,BEG_GUEST_TIMEOUT={%config,createFancyTime=beg_timeout%}%}
+                       {--GUEST_BEG_TIMEOUT--}
                </div>
                <div class="para" align="right">
-                       {--BEG_GUEST_HAVE_FUN--}
+                       {--GUEST_BEG_HAVE_FUN--}
                </div>
        </div>
        <div align="center" class="beg_msg">
index 4c4e70f..e0dfdfc 100644 (file)
@@ -9,7 +9,7 @@
                <td class="doubler_main bottom" style="padding-left: 0px; padding-right: 10px; padding-top: 10px; padding-bottom: 10px">
                        <ul>
                        <li>{--DOUBLER_MINIMUM_IS--} <strong>{%config,translateComma=doubler_min%} {?POINTS?}</strong> {--DOUBLER_MAXIMUM_IS--} <strong>{%config,translateComma=doubler_max%} {?POINTS?}</strong></li>
-                       <li>{%message,DOUBLER_ALREADY_PAYED={%config,translateComma=doubler_points%}%}</li>
+                       <li>{--DOUBLER_ALREADY_PAYED--}</li>
                        <li>{--DOUBLER_POINTS_LEFT_1--} <strong>{%pipe,getDoublerTotalPointsLeft,translateComma%} {?POINTS?}</strong> {--DOUBLER_POINTS_LEFT_2--}</li>
                        <li>{--DOUBLER_USAGE_COUNTER_1--} <strong>{%config,translateComma=doubler_counter%}</strong> {--DOUBLER_USAGE_COUNTER_2--}</li>
                        <li>$content[payout_time]</li>
index 24d69b2..98bb7c3 100644 (file)
@@ -1,15 +1,19 @@
+<div align="center">
 <table border="0" cellspacing="0" cellpadding="0" class="member_mailidtop">
        <tr>
                <td width="220" align="center">
-                       {%message,THANX_POINTS_ADDED=$content[points]%}<br />
-                       {%message,MAILID_TOTAL_POINTS=$content[total]%}
+                       {%message,THANX_POINTS_ADDED={%pipe,translateComma=$content[points]%}%}<br />
+                       {%message,MAILID_TOTAL_POINTS={%pipe,translateComma=$content[total]%}%}
                </td>
                <td align="center">
                        <table border="0" cellspacing="0" cellpadding="0" class="member_banner dashed">
                        <tr>
-                               <td align="center">$content[banner]</td>
+                               <td align="center">
+                                       $content[banner]
+                               </td>
                        </tr>
                        </table>
                </td>
 </tr>
 </table>
+</div>
index 3842ea4..05ce6f4 100644 (file)
@@ -1,9 +1,10 @@
+<div align="center">
 <table border="0" cellspacing="0" cellpadding="0" class="member_mailidtop">
        <tr>
                <td width="220" align="center">
                        <div class="tiny">
-                       {%message,THANX_POINTS_ADDED=$content[points]%}<br />
-                       {%message,MAILID_TOTAL_POINTS=$content[total]%}<br />
+                       {%message,THANX_POINTS_ADDED={%pipe,translateComma=$content[points]%}%}<br />
+                       {%message,MAILID_TOTAL_POINTS={%pipe,translateComma=$content[total]%}%}<br />
                        <br />
                        <a href="{%url=show_bonus.php?userid=$content[userid]&amp;t=$content[type]&amp;d=$content[data]%}" target="_blank">{--BONUS_SHOW_TURBO_BONUS--}
                        </div>
                <td align="center">
                <table border="0" cellspacing="0" cellpadding="0" class="member_banner dashed">
                        <tr>
-                               <td align="center">$content[banner]</td>
+                               <td align="center">
+                                       $content[banner]
+                               </td>
                        </tr>
                </table>
                </td>
        </tr>
 </table>
+</div>
index b63a910..73d9461 100644 (file)
@@ -1,7 +1,8 @@
+<div align="center">
 <table border="0" cellspacing="0" cellpadding="0" class="member_mailidtop">
        <tr>
                <td width="220" align="center">
-                       {%message,POINTS_NOT_ADDED=$content[points]%}
+                       {%message,POINTS_NOT_ADDED={%pipe,translateComma=$content[points]%}%}
                </td>
                <td align="center">
                        <div class="member_banner dashed">
@@ -10,3 +11,4 @@
                </td>
        </tr>
 </table>
+</div>
index b36719a..856f69d 100644 (file)
@@ -1,7 +1,8 @@
+<div align="center">
 <table border="0" cellspacing="0" cellpadding="0" class="member_mailidtop">
        <tr>
                <td width="220" align="center">
-                       {%message,THANX_POINTS_LOCKED=$content[points]%}
+                       {%message,THANX_POINTS_LOCKED={%pipe,translateComma=$content[points]%}%}
                </td>
                <td align="center">
                        <div class="member_banner dashed">
@@ -10,3 +11,4 @@
                </td>
        </tr>
 </table>
+</div>
index 684705d..ecddad0 100644 (file)
@@ -1,8 +1,9 @@
+<div align="center">
 <table border="0" cellspacing="0" cellpadding="0" class="member_mailidtop">
        <tr>
                <td width="220" align="center">
                        <div class="tiny">
-                               {%message,THANX_POINTS_LOCKED=$content[points]%}<br />
+                               {%message,THANX_POINTS_LOCKED={%pipe,translateComma=$content[points]%}%}<br />
                                <br />
                                <a href="{%url=show_bonus.php?userid=$content[userid]&amp;t=$content[type]&amp;d=$content[data]%}" target="_blank">{--BONUS_SHOW_TURBO_BONUS--}
                        </div>
@@ -14,3 +15,4 @@
                </td>
        </tr>
 </table>
+</div>
index 3132773..46baf27 100644 (file)
@@ -1,27 +1,27 @@
 <div align="center" class="beg_table dashed">
        <div class="beg_msg">
                <div>
-                       {--BEG_MEMBER_YOUR_LINK--}:
+                       {--MEMBER_BEG_YOUR_LINK--}:
                </div>
                <div>
                        <strong><a href="{?URL?}/beg.php?userid=$content[userid]">{?URL?}/beg.php?userid=$content[userid]</a></strong>
                </div>
        </div>
        <div class="beg_msg">
-               {--BEG_MEMBER_CLICKS_TOTAL--}:
+               {--MEMBER_BEG_CLICKS_TOTAL--}:
                <strong>{%user,beg_clicks,translateComma%}</strong>
        </div>
        <div align="left" class="beg_msg">
                <div class="para">
-                       {--BEG_MEMBER_EARN_1--} <strong>{%config,translateComma=beg_points%} {?POINTS?}</strong>
-                       {--BEG_MEMBER_EARN_2--} <strong>{%config,translateComma=beg_points_max%} {?POINTS?}</strong>
-                       {--BEG_MEMBER_EARN_3--}
+                       {--MEMBER_BEG_EARN_1--} <strong>{%config,translateComma=beg_points%} {?POINTS?}</strong>
+                       {--MEMBER_BEG_EARN_2--} <strong>{%config,translateComma=beg_points_max%} {?POINTS?}</strong>
+                       {--MEMBER_BEG_EARN_3--}
                </div>
                <div class="para">
-                       {%message,BEG_MEMBER_TIMEOUT%}
+                       {%message,MEMBER_BEG_TIMEOUT%}
                </div>
                <div class="para" align="right">
-                       {--BEG_MEMBER_HAVE_FUN--}
+                       {--MEMBER_BEG_HAVE_FUN--}
                </div>
        </div>
 </div>
index b026836..2dd2d3f 100644 (file)
@@ -28,7 +28,7 @@
        <div class="doubler_main bottom" style="padding-left: 0px; padding-right: 10px; padding-top: 10px; padding-bottom: 10px">
                <ul>
                        <li>{--DOUBLER_MINIMUM_IS--} <strong>{%config,translateComma=doubler_min%} {?POINTS?}</strong> {--DOUBLER_MAXIMUM_IS--} <strong>{%config,translateComma=doubler_max%} {?POINTS?}</strong></li>
-                       <li>{%message,MEMBER_DOUBLER_ALREADY_PAYED%}</li>
+                       <li>Es wurden bereits <strong>{%config,translateComma=doubler_points%} {?POINTS?}</strong> ausgezahlt.</li>
                        <li>{--DOUBLER_POINTS_LEFT_1--} <strong>{%pipe,getDoublerTotalPointsLeft,translateComma%} {?POINTS?}</strong> {--DOUBLER_POINTS_LEFT_2--}</li>
                        <li>{--DOUBLER_USAGE_COUNTER_1--} <strong>{%config,translateComma=doubler_counter%}</strong> {--DOUBLER_USAGE_COUNTER_2--}</li>
                        <li>$content[payout_time]</li>
index 4040388..f9797bd 100644 (file)
@@ -1,4 +1,4 @@
-<div align="center"><strong>{--BEG_MEMBER_HERE_IS_THE_LIST--}</strong><br />
+<div align="center"><strong>{--MEMBER_BEG_HERE_IS_THE_LIST--}</strong><br />
 <br />
 <table border="0" cellspacing="0" cellpadding="0" class="member_table dashed">
        <tr>
index a38334c..32904d6 100644 (file)
@@ -8,7 +8,7 @@
        </tr>
        <tr>
                <td height="25" align="right">{--MEMBER_WERNIS_PAYOUT_POINTS--}</td>
-               <td><strong>$content[points]</strong> Wernis</td>
+               <td><strong>{%pipe,translateComma=$content[points]%}</strong> Wernis</td>
        </tr>
        <tr>
                <td height="25" align="right">{--MEMBER_WERNIS_PAYOUT_MIN_POINTS--}</td>
index f0a9a79..009a66f 100644 (file)
@@ -8,7 +8,7 @@
        </tr>
        <tr>
                <td class="bottom" height="25" align="right">{--MEMBER_WERNIS_WITHDRAW_POINTS_ACCOUNT--}</td>
-               <td class="bottom"><strong>$content[points]</strong> Wernis</td>
+               <td class="bottom"><strong>{%pipe,translateComma=$content[points]%}</strong> Wernis</td>
        </tr>
        <tr>
                <td class="bottom" height="25" align="right">{--MEMBER_WERNIS_WITHDRAW_MIN_POINTS--}</td>
index b988bb9..90cdd38 100644 (file)
@@ -7,5 +7,5 @@ Sch&ouml;n, dass wir Sie wieder in unserem Sponsorenbereich begr&uuml;ssen d&uum
 </div>
 
 <div class="para">
-Sie haben noch <strong>$content[points] {?POINTS?}</strong> f&uuml;r weitere Sponsorenaktionen &uuml;brig.
+Sie haben noch <strong>{%pipe,translateComma=$content[points]%} {?POINTS?}</strong> f&uuml;r weitere Sponsorenaktionen &uuml;brig.
 </div>