From: Roland Häder Date: Sat, 10 Jul 2010 08:51:00 +0000 (+0000) Subject: New wrapper function introduced, more EL rewrites: X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=1fd39b2564946ce7f19776abab8d65a31928fba1 New wrapper function introduced, more EL rewrites: - New wrapper function getTotalPoints() introduced - Even more rewrites to make usage of EL - TODOs.txt updated --- diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 095875b9fb..346184b921 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -161,7 +161,7 @@ ./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'] = '' . $content['login'] . ''; ./inc/modules/member/what-refback.php:126: // @TODO UNUSED: $refRow['status'] = translateUserStatus($refRow['status']); @@ -178,8 +178,8 @@ ./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 @@ -200,8 +200,8 @@ ./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 diff --git a/doubler.php b/doubler.php index 8685143cf2..aaf4c8053b 100644 --- a/doubler.php +++ b/doubler.php @@ -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) { diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index 4b466f3564..1de221578f 100644 --- a/inc/extensions/ext-wernis.php +++ b/inc/extensions/ext-wernis.php @@ -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] ?> diff --git a/inc/functions.php b/inc/functions.php index 427c31205c..c171e6217f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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? diff --git a/inc/language/beg_de.php b/inc/language/beg_de.php index 6cf9a06e83..8f7b2cf854 100644 --- a/inc/language/beg_de.php +++ b/inc/language/beg_de.php @@ -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ür den erneuten Klick.", - 'BEG_MEMBER_YOUR_LINK' => "Hier ist Ihr persö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ür jeden Klick auf Ihren Bettellink.", - 'BEG_MEMBER_TIMEOUT' => "Die Zeitsperre ist derzeit eingestellt auf {%config,createFancyTime=beg_timeout%}. Innerhalb dieser Zeit erhalten Sie keine erneute Vergü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ü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önnen derzeit alle %s {?POINTS?} betteln.", - 'BEG_GUEST_HAVE_FUN' => "Heute noch anmelden und Spass haben.", + 'MEMBER_BEG_YOUR_LINK' => "Hier ist Ihr persö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ür jeden Klick auf Ihren Bettellink.", + 'MEMBER_BEG_TIMEOUT' => "Die Zeitsperre ist derzeit eingestellt auf {%config,createFancyTime=beg_timeout%}. Innerhalb dieser Zeit erhalten Sie keine erneute Vergü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ü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önnen derzeit alle {%config,createFancyTime=beg_timeout%} {?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ü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ätestens am %s noch aktiv waren. Alle anderen Mitglieder erhalten die Vergütung nicht.", 'ADMIN_EDIT_BEG_RALLYE_SETTINGS' => "Einstellungen an der Bettel-Rallye", 'ADMIN_BEG_RALLYE_ACTIVE' => "Ist die Bettel-Rallye aktiv? (Mails kö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?} ({?MAIN_TITLE?}) und freigegeben ist.", 'BEG_RALLYE_CONDITION_3' => "Zur Erstellung des Rallye-Ergebnisses werden alle erbettelten {?POINTS?} berücksichtig.", 'BEG_RALLYE_CONDITION_4' => "Der Rechtsweg ist ausgeschlossen.", - 'BEG_MEMBER_HERE_IS_THE_LIST' => "Hier finden Sie die aktuelle Liste mit den möglichen Gewinnern.", + 'MEMBER_BEG_HERE_IS_THE_LIST' => "Hier finden Sie die aktuelle Liste mit den mö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", diff --git a/inc/language/doubler_de.php b/inc/language/doubler_de.php index fdfed8e503..5028dbe970 100644 --- a/inc/language/doubler_de.php +++ b/inc/language/doubler_de.php @@ -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 %s {?POINTS?} ausgezahlt.", - 'MEMBER_DOUBLER_ALREADY_PAYED' => "Es wurden bereits {%config,translateComma=doubler_points%} {?POINTS?} ausgezahlt.", + 'DOUBLER_ALREADY_PAYED' => "Es wurden bereits {%config,translateComma=doubler_points%} {?POINTS?} ausgezahlt.", 'DOUBLER_MINIMUM_IS' => "Mindestens", 'DOUBLER_MAXIMUM_IS' => "verdoppeln, maximal", 'DOUBLER_HAVE_FUN' => "Viel Spaß.", diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index c6768029f0..25a7974dde 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -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')) { diff --git a/inc/libs/doubler_functions.php b/inc/libs/doubler_functions.php index b9a603e4e2..cc143c2e6c 100644 --- a/inc/libs/doubler_functions.php +++ b/inc/libs/doubler_functions.php @@ -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 diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index e588ce6508..490d6725ca 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -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 diff --git a/inc/libs/wernis_functions.php b/inc/libs/wernis_functions.php index 21c3f2f147..ffc792f40f 100644 --- a/inc/libs/wernis_functions.php +++ b/inc/libs/wernis_functions.php @@ -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] ?> diff --git a/inc/modules/admin/what-edit_sponsor.php b/inc/modules/admin/what-edit_sponsor.php index 88bf548263..c6a793cd2e 100644 --- a/inc/modules/admin/what-edit_sponsor.php +++ b/inc/modules/admin/what-edit_sponsor.php @@ -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 diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php index 6e78f65d9e..d9fe102e9d 100644 --- a/inc/modules/admin/what-list_user.php +++ b/inc/modules/admin/what-list_user.php @@ -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'; diff --git a/inc/modules/guest/what-active.php b/inc/modules/guest/what-active.php index 7e017196db..9b14876013 100644 --- a/inc/modules/guest/what-active.php +++ b/inc/modules/guest/what-active.php @@ -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), ); diff --git a/inc/modules/guest/what-beg.php b/inc/modules/guest/what-beg.php index 0ea722691d..07a7d8b6cf 100644 --- a/inc/modules/guest/what-beg.php +++ b/inc/modules/guest/what-beg.php @@ -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] ?> diff --git a/inc/modules/guest/what-doubler.php b/inc/modules/guest/what-doubler.php index a4809fb0af..1d8a4ac661 100644 --- a/inc/modules/guest/what-doubler.php +++ b/inc/modules/guest/what-doubler.php @@ -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'); diff --git a/inc/modules/guest/what-top10.php b/inc/modules/guest/what-top10.php index 82d1adab6e..20865bdfed 100644 --- a/inc/modules/guest/what-top10.php +++ b/inc/modules/guest/what-top10.php @@ -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) ); diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index 281248a795..3104a78364 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -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! diff --git a/inc/modules/member/what-payout.php b/inc/modules/member/what-payout.php index edb05b8042..4c317522e7 100644 --- a/inc/modules/member/what-payout.php +++ b/inc/modules/member/what-payout.php @@ -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 diff --git a/inc/modules/member/what-primera.php b/inc/modules/member/what-primera.php index f38dfd5b9b..243a2bb337 100644 --- a/inc/modules/member/what-primera.php +++ b/inc/modules/member/what-primera.php @@ -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; diff --git a/inc/modules/member/what-transfer.php b/inc/modules/member/what-transfer.php index aad5bf37e2..ae163b7510 100644 --- a/inc/modules/member/what-transfer.php +++ b/inc/modules/member/what-transfer.php @@ -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); diff --git a/inc/modules/member/what-wernis.php b/inc/modules/member/what-wernis.php index 3e3189811f..8cf42616a4 100644 --- a/inc/modules/member/what-wernis.php +++ b/inc/modules/member/what-wernis.php @@ -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 diff --git a/inc/modules/sponsor/welcome.php b/inc/modules/sponsor/welcome.php index 4a0dcccbf3..3748ee35cf 100644 --- a/inc/modules/sponsor/welcome.php +++ b/inc/modules/sponsor/welcome.php @@ -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); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 910f6a5513..cc8988e1f9 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -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); diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index bc89dfc63f..56620b9019 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -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] ?> diff --git a/mailid_top.php b/mailid_top.php index 6d88d094bc..36a5c00785 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -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); diff --git a/surfbar.php b/surfbar.php index 63facf329f..4bfb8caaaf 100644 --- a/surfbar.php +++ b/surfbar.php @@ -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) ); diff --git a/templates/de/emails/back-admin.tpl b/templates/de/emails/back-admin.tpl index 365bf1e292..e8d185dda7 100644 --- a/templates/de/emails/back-admin.tpl +++ b/templates/de/emails/back-admin.tpl @@ -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üßen, Ihr {?MAIN_TITLE?} Script diff --git a/templates/de/emails/sponsor/sponsor_add_points.tpl b/templates/de/emails/sponsor/sponsor_add_points.tpl index 9821c77581..945f2d245f 100644 --- a/templates/de/emails/sponsor/sponsor_add_points.tpl +++ b/templates/de/emails/sponsor/sponsor_add_points.tpl @@ -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: ------------------------------ diff --git a/templates/de/emails/sponsor/sponsor_sub_points.tpl b/templates/de/emails/sponsor/sponsor_sub_points.tpl index 9f526fd7f6..28f1e6e5f5 100644 --- a/templates/de/emails/sponsor/sponsor_sub_points.tpl +++ b/templates/de/emails/sponsor/sponsor_sub_points.tpl @@ -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: ------------------------------ diff --git a/templates/de/emails/sub-points.tpl b/templates/de/emails/sub-points.tpl index 8db1d81f29..91ac7f449a 100644 --- a/templates/de/emails/sub-points.tpl +++ b/templates/de/emails/sub-points.tpl @@ -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: ---------------- diff --git a/templates/de/html/admin/admin_list_beg.tpl b/templates/de/html/admin/admin_list_beg.tpl index 5f58825e39..d49b69d4eb 100644 --- a/templates/de/html/admin/admin_list_beg.tpl +++ b/templates/de/html/admin/admin_list_beg.tpl @@ -21,7 +21,7 @@ $content[rows] - {--BEG_MEMBER_TOTAL--}: + {--MEMBER_BEG_TOTAL--}: $content[total] {?POINTS?} diff --git a/templates/de/html/guest/guest_beg.tpl b/templates/de/html/guest/guest_beg.tpl index 3e1d5697dd..937bbc89b9 100644 --- a/templates/de/html/guest/guest_beg.tpl +++ b/templates/de/html/guest/guest_beg.tpl @@ -1,19 +1,19 @@
-
{--BEG_GUEST_TRAILER--}
+
{--GUEST_BEG_TRAILER--}
{?MAIN_TITLE?}
- {--BEG_GUEST_EARN_1--} {%config,translateComma=beg_points%} {?POINTS?} - {--BEG_GUEST_EARN_2--} {%config,translateComma=beg_points_max%} {?POINTS?} - {--BEG_GUEST_EARN_3--} + {--GUEST_BEG_EARN_1--} {%config,translateComma=beg_points%} {?POINTS?} + {--GUEST_BEG_EARN_2--} {%config,translateComma=beg_points_max%} {?POINTS?} + {--GUEST_BEG_EARN_3--}
- {%message,BEG_GUEST_TIMEOUT={%config,createFancyTime=beg_timeout%}%} + {--GUEST_BEG_TIMEOUT--}
- {--BEG_GUEST_HAVE_FUN--} + {--GUEST_BEG_HAVE_FUN--}
diff --git a/templates/de/html/guest/guest_doubler.tpl b/templates/de/html/guest/guest_doubler.tpl index 4c4e70f77b..e0dfdfcc22 100644 --- a/templates/de/html/guest/guest_doubler.tpl +++ b/templates/de/html/guest/guest_doubler.tpl @@ -9,7 +9,7 @@
  • {--DOUBLER_MINIMUM_IS--} {%config,translateComma=doubler_min%} {?POINTS?} {--DOUBLER_MAXIMUM_IS--} {%config,translateComma=doubler_max%} {?POINTS?}
  • -
  • {%message,DOUBLER_ALREADY_PAYED={%config,translateComma=doubler_points%}%}
  • +
  • {--DOUBLER_ALREADY_PAYED--}
  • {--DOUBLER_POINTS_LEFT_1--} {%pipe,getDoublerTotalPointsLeft,translateComma%} {?POINTS?} {--DOUBLER_POINTS_LEFT_2--}
  • {--DOUBLER_USAGE_COUNTER_1--} {%config,translateComma=doubler_counter%} {--DOUBLER_USAGE_COUNTER_2--}
  • $content[payout_time]
  • diff --git a/templates/de/html/mailid/mailid_points_done.tpl b/templates/de/html/mailid/mailid_points_done.tpl index 24d69b2006..98bb7c3bfe 100644 --- a/templates/de/html/mailid/mailid_points_done.tpl +++ b/templates/de/html/mailid/mailid_points_done.tpl @@ -1,15 +1,19 @@ +
    - {%message,THANX_POINTS_ADDED=$content[points]%}
    - {%message,MAILID_TOTAL_POINTS=$content[total]%} + {%message,THANX_POINTS_ADDED={%pipe,translateComma=$content[points]%}%}
    + {%message,MAILID_TOTAL_POINTS={%pipe,translateComma=$content[total]%}%}
    - +
    $content[banner] + $content[banner] +
    +
    diff --git a/templates/de/html/mailid/mailid_points_done2.tpl b/templates/de/html/mailid/mailid_points_done2.tpl index 3842ea434d..05ce6f42a2 100644 --- a/templates/de/html/mailid/mailid_points_done2.tpl +++ b/templates/de/html/mailid/mailid_points_done2.tpl @@ -1,9 +1,10 @@ +
    - {%message,THANX_POINTS_ADDED=$content[points]%}
    - {%message,MAILID_TOTAL_POINTS=$content[total]%}
    + {%message,THANX_POINTS_ADDED={%pipe,translateComma=$content[points]%}%}
    + {%message,MAILID_TOTAL_POINTS={%pipe,translateComma=$content[total]%}%}

    {--BONUS_SHOW_TURBO_BONUS--}
    @@ -11,9 +12,12 @@
    - +
    $content[banner] + $content[banner] +
    +
    diff --git a/templates/de/html/mailid/mailid_points_failed.tpl b/templates/de/html/mailid/mailid_points_failed.tpl index b63a910d1a..73d9461abc 100644 --- a/templates/de/html/mailid/mailid_points_failed.tpl +++ b/templates/de/html/mailid/mailid_points_failed.tpl @@ -1,7 +1,8 @@ +
    - {%message,POINTS_NOT_ADDED=$content[points]%} + {%message,POINTS_NOT_ADDED={%pipe,translateComma=$content[points]%}%}
    @@ -10,3 +11,4 @@
    +
    diff --git a/templates/de/html/mailid/mailid_points_locked.tpl b/templates/de/html/mailid/mailid_points_locked.tpl index b36719abb0..856f69dc40 100644 --- a/templates/de/html/mailid/mailid_points_locked.tpl +++ b/templates/de/html/mailid/mailid_points_locked.tpl @@ -1,7 +1,8 @@ +
    - {%message,THANX_POINTS_LOCKED=$content[points]%} + {%message,THANX_POINTS_LOCKED={%pipe,translateComma=$content[points]%}%}
    @@ -10,3 +11,4 @@
    +
    diff --git a/templates/de/html/mailid/mailid_points_locked2.tpl b/templates/de/html/mailid/mailid_points_locked2.tpl index 684705d7e2..ecddad00b5 100644 --- a/templates/de/html/mailid/mailid_points_locked2.tpl +++ b/templates/de/html/mailid/mailid_points_locked2.tpl @@ -1,8 +1,9 @@ +
    - {%message,THANX_POINTS_LOCKED=$content[points]%}
    + {%message,THANX_POINTS_LOCKED={%pipe,translateComma=$content[points]%}%}

    {--BONUS_SHOW_TURBO_BONUS--}
    @@ -14,3 +15,4 @@
    +
    diff --git a/templates/de/html/member/member_beg.tpl b/templates/de/html/member/member_beg.tpl index 3132773ee6..46baf279c6 100644 --- a/templates/de/html/member/member_beg.tpl +++ b/templates/de/html/member/member_beg.tpl @@ -1,27 +1,27 @@
    - {--BEG_MEMBER_YOUR_LINK--}: + {--MEMBER_BEG_YOUR_LINK--}:
    - {--BEG_MEMBER_CLICKS_TOTAL--}: + {--MEMBER_BEG_CLICKS_TOTAL--}: {%user,beg_clicks,translateComma%}
    - {--BEG_MEMBER_EARN_1--} {%config,translateComma=beg_points%} {?POINTS?} - {--BEG_MEMBER_EARN_2--} {%config,translateComma=beg_points_max%} {?POINTS?} - {--BEG_MEMBER_EARN_3--} + {--MEMBER_BEG_EARN_1--} {%config,translateComma=beg_points%} {?POINTS?} + {--MEMBER_BEG_EARN_2--} {%config,translateComma=beg_points_max%} {?POINTS?} + {--MEMBER_BEG_EARN_3--}
    - {%message,BEG_MEMBER_TIMEOUT%} + {%message,MEMBER_BEG_TIMEOUT%}
    - {--BEG_MEMBER_HAVE_FUN--} + {--MEMBER_BEG_HAVE_FUN--}
    diff --git a/templates/de/html/member/member_doubler.tpl b/templates/de/html/member/member_doubler.tpl index b026836b56..2dd2d3fca5 100644 --- a/templates/de/html/member/member_doubler.tpl +++ b/templates/de/html/member/member_doubler.tpl @@ -28,7 +28,7 @@
    • {--DOUBLER_MINIMUM_IS--} {%config,translateComma=doubler_min%} {?POINTS?} {--DOUBLER_MAXIMUM_IS--} {%config,translateComma=doubler_max%} {?POINTS?}
    • -
    • {%message,MEMBER_DOUBLER_ALREADY_PAYED%}
    • +
    • Es wurden bereits {%config,translateComma=doubler_points%} {?POINTS?} ausgezahlt.
    • {--DOUBLER_POINTS_LEFT_1--} {%pipe,getDoublerTotalPointsLeft,translateComma%} {?POINTS?} {--DOUBLER_POINTS_LEFT_2--}
    • {--DOUBLER_USAGE_COUNTER_1--} {%config,translateComma=doubler_counter%} {--DOUBLER_USAGE_COUNTER_2--}
    • $content[payout_time]
    • diff --git a/templates/de/html/member/member_list_beg.tpl b/templates/de/html/member/member_list_beg.tpl index 4040388c6c..f9797bd2e8 100644 --- a/templates/de/html/member/member_list_beg.tpl +++ b/templates/de/html/member/member_list_beg.tpl @@ -1,4 +1,4 @@ -
      {--BEG_MEMBER_HERE_IS_THE_LIST--}
      +
      {--MEMBER_BEG_HERE_IS_THE_LIST--}

      diff --git a/templates/de/html/member/member_wernis_mode_payout.tpl b/templates/de/html/member/member_wernis_mode_payout.tpl index a38334c14c..32904d6ed3 100644 --- a/templates/de/html/member/member_wernis_mode_payout.tpl +++ b/templates/de/html/member/member_wernis_mode_payout.tpl @@ -8,7 +8,7 @@ - + diff --git a/templates/de/html/member/member_wernis_mode_withdraw.tpl b/templates/de/html/member/member_wernis_mode_withdraw.tpl index f0a9a79f37..009a66fa31 100644 --- a/templates/de/html/member/member_wernis_mode_withdraw.tpl +++ b/templates/de/html/member/member_wernis_mode_withdraw.tpl @@ -8,7 +8,7 @@ - + diff --git a/templates/de/html/sponsor/sponsor_welcome.tpl b/templates/de/html/sponsor/sponsor_welcome.tpl index b988bb9aaa..90cdd38a8e 100644 --- a/templates/de/html/sponsor/sponsor_welcome.tpl +++ b/templates/de/html/sponsor/sponsor_welcome.tpl @@ -7,5 +7,5 @@ Schön, dass wir Sie wieder in unserem Sponsorenbereich begrüssen d&uum
      -Sie haben noch $content[points] {?POINTS?} für weitere Sponsorenaktionen übrig. +Sie haben noch {%pipe,translateComma=$content[points]%} {?POINTS?} für weitere Sponsorenaktionen übrig.
      {--MEMBER_WERNIS_PAYOUT_POINTS--}$content[points] Wernis{%pipe,translateComma=$content[points]%} Wernis
      {--MEMBER_WERNIS_PAYOUT_MIN_POINTS--}
      {--MEMBER_WERNIS_WITHDRAW_POINTS_ACCOUNT--}$content[points] Wernis{%pipe,translateComma=$content[points]%} Wernis
      {--MEMBER_WERNIS_WITHDRAW_MIN_POINTS--}