From cd951a117b88c07a2dcbf3e97587b4c370973b85 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 29 Jun 2011 01:37:24 +0000 Subject: [PATCH] 'order_points' and locked are now displayed, some array elements/language ids renamed --- DOCS/TODOs.txt | 4 +- inc/db/lib-mysql3.php | 2 +- inc/extensions/ext-beg.php | 2 +- inc/language-functions.php | 4 +- inc/language/de.php | 4 +- inc/libs/payout_functions.php | 13 ++++++ inc/modules/admin/what-del_transfer.php | 2 +- inc/modules/admin/what-list_beg.php | 2 +- inc/modules/admin/what-list_bonus.php | 2 +- inc/modules/admin/what-list_transfer.php | 2 +- inc/modules/admin/what-list_user.php | 2 +- inc/modules/member/what-order.php | 2 +- inc/modules/member/what-payout.php | 10 ++--- inc/modules/member/what-points.php | 42 +++++++++++-------- inc/modules/member/what-transfer.php | 4 +- inc/wrapper-functions.php | 2 +- mailid_top.php | 2 +- templates/de/html/admin/admin_list_beg.tpl | 2 +- templates/de/html/admin/admin_list_bonus.tpl | 2 +- .../de/html/admin/admin_list_transfer.tpl | 2 +- .../de/html/admin/admin_user_details.tpl | 2 +- .../de/html/mailid/mailid_points_done.tpl | 2 +- .../de/html/mailid/mailid_points_done2.tpl | 2 +- .../de/html/member/member_order_points.tpl | 2 +- templates/de/html/member/member_points.tpl | 34 +++++++++++---- .../member/member_points_bonus_disabled.tpl | 2 +- .../html/member/member_points_bonus_rows.tpl | 12 ++++-- .../de/html/member/member_points_row.tpl | 1 + .../de/html/member/member_points_upgrade.tpl | 2 +- .../de/html/member/member_transfer_list.tpl | 2 +- 30 files changed, 110 insertions(+), 58 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 82f9135702..fb162595b7 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -56,8 +56,8 @@ ./inc/functions.php:92: // @TODO Extension 'msg' does not exist ./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter ./inc/install-functions.php:57: // @TODO DEACTIVATED: changeDataInLocalConfigurationFile('OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0); -./inc/language/de.php:1083: // @TODO Rewrite these two constants -./inc/language/de.php:1104: // @TODO Rewrite these three constants +./inc/language/de.php:1085: // @TODO Rewrite these two constants +./inc/language/de.php:1106: // @TODO Rewrite these three constants ./inc/language/de.php:778:// @TODO Are these constants longer used? ./inc/language-functions.php:255: // @TODO These are all valid languages, again hard-coded ./inc/language-functions.php:44:// @TODO Rewrite all language constants to this function. diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 13e69f99b9..6a11f697f1 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -119,7 +119,7 @@ function SQL_QUERY ($sqlString, $F, $L, $enableCodes = true) { } // END - if // Append debug line - appendLineToFile(getCachePath() . 'mysql.log', $F . '(LINE=' . $L . '|NUM=' . SQL_NUMROWS($result) . '|AFFECTED=' . SQL_AFFECTEDROWS() . '|QUERYTIME:' . $queryTime . '): ' . str_replace("\r", '', str_replace("\n", ' ', $GLOBALS['last_sql']))); + appendLineToFile(getCachePath() . 'mysql.log', basename($F) . '|LINE=' . $L . '|NUM=' . (is_resource($result) ? SQL_NUMROWS($result) : 'false') . '|AFFECTED=' . SQL_AFFECTEDROWS() . '|QUERYTIME:' . $queryTime . '): ' . str_replace("\r", '', str_replace("\n", ' ', $GLOBALS['last_sql']))); } // END - if // Count DB hits diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index c2e71c2fe6..3e7185c8cd 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -312,7 +312,7 @@ INDEX (`userid`) // Remove old entries $OLD = getBegTimeout(); if (getBegUseridTimeout() > $OLD) $OLD = getBegUseridTimeout(); - SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE `timeout` < (UNIX_TIMESTAMP() - ' . ($OLD + 60*60) . ')', __FILE__, __LINE__); + SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE (UNIX_TIMESTAMP() - `timeout`) >= ' . ($OLD + 60*60) . '', __FILE__, __LINE__); // Check for beg rallye is active and send mails out if ((isBegRallyeEnabled()) && (isBegNewMemberNotifyEnabled())) { diff --git a/inc/language-functions.php b/inc/language-functions.php index 29e07cf33a..77f6f2e9e5 100644 --- a/inc/language-functions.php +++ b/inc/language-functions.php @@ -270,7 +270,9 @@ function ifLanguageFilesCompares ($source, $target, $targetLanguage) { // Init differences $GLOBALS['lang_diff'][$target] = array(); $GLOBALS['lang_diff_count'][$target] = 0; - if (!isset($GLOBALS['lang_diff_count']['total'])) $GLOBALS['lang_diff_count']['total'] = 0; + if (!isset($GLOBALS['lang_diff_count']['total'])) { + $GLOBALS['lang_diff_count']['total'] = 0; + } // END - if // *Does* match by default $matches = true; diff --git a/inc/language/de.php b/inc/language/de.php index 022f64f30c..520d11e5be 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -570,7 +570,7 @@ addMessages(array( 'ADMIN_CHANGE_PAYMENT' => "Mailvergütungen ändern", 'ADMIN_REMOVE_PAYMENT' => "Mailvergütungen löschen", 'REFERALS' => "Referals", - 'MEMBER_TOTAL_POINTS' => "Gesamtsumme", + 'MEMBER_PART_POINTS' => "Teilsummen", 'KBYTES' => "KBytes", 'DEFAULT_SUBJECT_LINE' => "Klick-Mail von {?MAIN_TITLE?}", 'MEBER_UPDATE_PWD_WRONG' => "Sie haben das falsche Passwort eingegeben! Bitte nochmal versuchen.", @@ -1074,6 +1074,8 @@ addMessages(array( 'DEBUG_REPORT_BUG_SUBJECT' => "[BUG!] Es wurde ein Bug im Script erkannt:", 'ADMIN_EXTENSION_ALWAYS_ACTIVE' => "Die Erweiterung %s kann nicht deaktiviert werden, da sie immer aktiv bleiben muss.", 'MEMBER_REFERAL_LINKS_FOOTER' => "Ihr Referal-Link eingebaut in Ihrer Homepage bringt Ihnen passiv mehr Referals. (Aber Ihren Referal-Link bewerben schadet auch nicht... ;-) )", + 'POINTS_ORDER' => "Werbeguthaben", + 'MEMBER_TOTAL_POINTS' => "Gesamtguthaben", 'MEMBER_MAIL_BONUS_CONFIRMED_ON' => "Sie haben diese Bonusmail %s bestätigt.", 'MEMBER_MAIL_BONUS_CONFIRMED_UNKNOWN' => "Es konnte nicht festgestellt werden, wann Sie die Bonus-Mail %s bestätigt hatten.", diff --git a/inc/libs/payout_functions.php b/inc/libs/payout_functions.php index bf2c8a6988..21d8914430 100644 --- a/inc/libs/payout_functions.php +++ b/inc/libs/payout_functions.php @@ -88,6 +88,19 @@ function translatePayoutStatus ($status) { $message = '{--PAYOUT_STATUS_' . strtoupper($status) . '--}'; // Return it + return $message; +} + +// "Getter" for payoutable user points +function getPayoutPoints ($userid) { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__][$userid])) { + // Determine it + $GLOBALS[__FUNCTION__][$userid] = countSumTotalData($userid, 'user_points', 'points') - countSumTotalData($userid, 'user_data', 'used_points'); + } // END - if + + // Return it + return $GLOBALS[__FUNCTION__][$userid]; } // [EOF] diff --git a/inc/modules/admin/what-del_transfer.php b/inc/modules/admin/what-del_transfer.php index 756aa130f2..567b318c21 100644 --- a/inc/modules/admin/what-del_transfer.php +++ b/inc/modules/admin/what-del_transfer.php @@ -100,7 +100,7 @@ if (!SQL_HASZERONUMS($result)) { $content['rows'] = $OUT; // Remeber total amount -$content['total'] = $total; +$content['total_points'] = $total; // Set title $content['title'] = '{--TRANSFER_LIST_ALL--}'; diff --git a/inc/modules/admin/what-list_beg.php b/inc/modules/admin/what-list_beg.php index 654f7eccca..cad194c34a 100644 --- a/inc/modules/admin/what-list_beg.php +++ b/inc/modules/admin/what-list_beg.php @@ -107,7 +107,7 @@ ORDER BY } // END - while $content['rows'] = $OUT; - $content['total'] = $total; + $content['total_points'] = $total; // Check if we need to display form or not with manuel withdraw if (getLastMonth() == getMonth()) { diff --git a/inc/modules/admin/what-list_bonus.php b/inc/modules/admin/what-list_bonus.php index 0c8129d11d..da8b9ba4f8 100644 --- a/inc/modules/admin/what-list_bonus.php +++ b/inc/modules/admin/what-list_bonus.php @@ -118,7 +118,7 @@ ORDER BY } // END - while $content['rows'] = $OUT; - $content['total'] = $total; + $content['total_points'] = $total; // Check if we need to display form or not with manuel withdraw if (getLastMonth() == getMonth()) { diff --git a/inc/modules/admin/what-list_transfer.php b/inc/modules/admin/what-list_transfer.php index a3773aa3eb..8da60d30ce 100644 --- a/inc/modules/admin/what-list_transfer.php +++ b/inc/modules/admin/what-list_transfer.php @@ -80,7 +80,7 @@ if (!SQL_HASZERONUMS($result)) { $content['rows'] = $OUT; // Remeber total amount -$content['total'] = $total; +$content['total_points'] = $total; // Set title $content['title'] = '{--TRANSFER_LIST_ALL--}'; diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php index 40f53bb898..4d0fda767b 100644 --- a/inc/modules/admin/what-list_user.php +++ b/inc/modules/admin/what-list_user.php @@ -139,7 +139,7 @@ LIMIT 1", $content['joined'] = generateDateTime($content['joined'], 0); $content['last_update'] = generateDateTime($content['last_update'], 0); $content['last_profile_sent'] = generateDateTime($content['last_profile_sent'], 0); - $content['total'] = countSumTotalData($userid, 'user_points', 'points'); + $content['total_points'] = countSumTotalData($userid, 'user_points', 'points'); $content['locked'] = countSumTotalData($userid, 'user_points', 'locked_points'); $content['lock_timestamp'] = generateDateTime($content['lock_timestamp'], 2); $content['nickname'] = '{--EXT_NICKNAME_404--}'; diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index f1d4a2444c..bd934037f5 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -527,7 +527,7 @@ LIMIT 1", SQL_FREERESULT($result); // Output user's points - $content['total'] = $total; + $content['total_points'] = $total; // Check how many mail orders he has placed today and how many he's allowed to send switch (getConfig('order_max_full')) { diff --git a/inc/modules/member/what-payout.php b/inc/modules/member/what-payout.php index aa9e6e516c..280912e15a 100644 --- a/inc/modules/member/what-payout.php +++ b/inc/modules/member/what-payout.php @@ -53,7 +53,7 @@ if ((!isExtensionActive('payout')) && (!isAdmin())) { } // END - if // Translate point into comma -$totalPoints = getTotalPoints(getMemberId()); +$payoutPoints = getPayoutPoints(getMemberId()); if (!isGetRequestParameterSet('payout')) { // Load payout types @@ -65,7 +65,7 @@ WHERE %s >= `min_points` ORDER BY `type` ASC", - array($totalPoints), __FILE__, __LINE__); + array($payoutPoints), __FILE__, __LINE__); if (!SQL_HASZERONUMS($result)) { // Free memory SQL_FREERESULT($result); @@ -116,7 +116,7 @@ ORDER BY SQL_FREERESULT($result_payouts); // Output payout list - outputPayoutList($totalPoints); + outputPayoutList($payoutPoints); } else { // No payout types setup displayMessage('{--MEMBER_PAYOUT_SETUP_INCOMPLETE--}'); @@ -131,7 +131,7 @@ ORDER BY $content = SQL_FETCHARRAY($result); // Calculate maximum value - $max = round($totalPoints * $content['rate'] - 0.5); + $max = round($payoutPoints * $content['rate'] - 0.5); $PAY_MAX = '0'; // Calulcate points from submitted amount @@ -142,7 +142,7 @@ ORDER BY } // Has enougth points to payout? - if ($totalPoints >= $content['min_points']) { + if ($payoutPoints >= $content['min_points']) { // Ok, he can get be paid if ((isFormSent()) && ($points <= $PAY_MAX) && ($points >= $content['min_points'])) { // Remember points in array diff --git a/inc/modules/member/what-points.php b/inc/modules/member/what-points.php index 15bc77867a..fb050d6552 100644 --- a/inc/modules/member/what-points.php +++ b/inc/modules/member/what-points.php @@ -60,10 +60,19 @@ if (isExtensionInstalledAndNewer('bonus', '0.4.4')) $numDepths += 4; // Remember row count in constant $content['rowspan'] = ($numDepths * 2 + 15); -// Init some vars... -$content['total_points'] = '0'; -$content['total_referals'] = '0'; -$content['total_locked'] = '0'; +// Initialize array elements +$content['part_points'] = '0.00000'; +$content['part_referals'] = '0'; +$content['part_locked'] = '0.00000'; +$content['part_order'] = '0.00000'; +$content['part_locked_order'] = '0.00000'; +$content['counter'] = '0'; +$content['points'] = '0.00000'; +$content['order_points'] = '0.00000'; +$content['locked_points'] = '0.00000'; +$content['locked_order_points'] = '0.00000'; + +// And output variable $OUT = ''; // Load ref levels @@ -71,26 +80,23 @@ while ($data = SQL_FETCHARRAY($result_depths)) { // Merge it together $content = merge_array($content, $data); - // Initialize array elements - $content['counter'] = '0'; - $content['points'] = '0.00000'; - $content['locked_points'] = '0.00000'; - // Load referal points $result_points = SQL_QUERY_ESC("SELECT p.`points`, + p.`order_points`, p.`locked_points`, + p.`locked_order_points`, r.`counter` FROM `{?_MYSQL_PREFIX?}_user_points` AS p -INNER JOIN +LEFT JOIN `{?_MYSQL_PREFIX?}_refsystem` AS r ON p.`userid`=r.`userid` AND p.`ref_depth`=r.`level` WHERE p.`userid`=%s AND - p.`ref_depth`='%s' + p.`ref_depth`=%s LIMIT 1", array( getMemberId(), @@ -103,9 +109,11 @@ LIMIT 1", $content = merge_array($content, SQL_FETCHARRAY($result_points)); // Add all entries - $content['total_points'] += $content['points']; - $content['total_locked'] += $content['locked_points']; - $content['total_referals'] += $content['counter']; + $content['part_points'] += $content['points']; + $content['part_order'] += $content['order_points']; + $content['part_locked'] += $content['locked_points']; + $content['part_locked_order'] += $content['locked_order_points']; + $content['part_referals'] += $content['counter']; } // END - if // Free result @@ -122,7 +130,7 @@ SQL_FREERESULT($result_depths); $content['rows'] = $OUT; // Remember several values in constants -$content['total_points'] = ($content['total_points'] - getUserData('used_points')); +$content['total_points'] = $content['part_points'] - getUserData('used_points') + $content['part_order']; // Fixes a bug when there is no bonus extension installed if (isExtensionInstalledAndOlder('bonus', '0.4.4')) { @@ -135,7 +143,7 @@ $content['special_rows'] = ''; // Display login bonus and turbo-click bonus if ((isExtensionInstalledAndNewer('bonus', '0.2.2')) && (isExtensionActive('bonus')) && (isBonusRallyeActive())) { // Total bonus points - $content['total'] = getUserData('turbo_bonus') + getUserData('login_bonus') + getUserData('bonus_ref') + getUserData('bonus_order') + getUserData('bonus_stats'); + $content['bonus_total_points'] = 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); @@ -161,7 +169,7 @@ if (isExtensionActive('user')) { if (isExtensionActive('payout')) { // Payput extension is installed and active so we can check if the user has enougth points - outputPayoutList($content['total_points'] - getUserData('used_points')); + outputPayoutList($content['part_points'] - getUserData('used_points')); } // END - if // [EOF] diff --git a/inc/modules/member/what-transfer.php b/inc/modules/member/what-transfer.php index 4255b1f6d8..b535b08da2 100644 --- a/inc/modules/member/what-transfer.php +++ b/inc/modules/member/what-transfer.php @@ -340,7 +340,7 @@ switch ($mode) { $content['rows'] = $OUT; // Remeber total amount - $content['total'] = $totalPoints; + $content['total_points'] = $totalPoints; // Load final template loadTemplate('member_transfer_list', false, $content); @@ -427,7 +427,7 @@ KEY (`party_userid`) $content['rows'] = $OUT; // Remeber total amount - $content['total'] = $total; + $content['total_points'] = $total; // Set title $content['title'] = '{--TRANSFER_LIST_ALL--}'; diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 1520f11915..f311eb72dc 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -2336,7 +2336,7 @@ function getTotalPoints ($userid) { // Do we have cache? if (!isset($GLOBALS[__FUNCTION__][$userid])) { // Determine it - $GLOBALS[__FUNCTION__][$userid] = countSumTotalData($userid, 'user_points', 'points') - countSumTotalData($userid, 'user_data', 'used_points'); + $GLOBALS[__FUNCTION__][$userid] = countSumTotalData($userid, 'user_points', 'points') - countSumTotalData($userid, 'order_points', 'points') - countSumTotalData($userid, 'user_data', 'used_points'); } // END - if // Return cache diff --git a/mailid_top.php b/mailid_top.php index e033a56f04..2f04e4caeb 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -288,7 +288,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr } // END - if // Load total points - $content['total'] = getTotalPoints($userId); + $content['total_points'] = getTotalPoints($userId); // Add payment points $content['points'] = $payment; diff --git a/templates/de/html/admin/admin_list_beg.tpl b/templates/de/html/admin/admin_list_beg.tpl index 75a98eb811..3c1bdb25d7 100644 --- a/templates/de/html/admin/admin_list_beg.tpl +++ b/templates/de/html/admin/admin_list_beg.tpl @@ -28,7 +28,7 @@ $content[rows] {--MEMBER_BEG_TOTAL--}: - {%pipe,translateComma=$content[total]%} {?POINTS?} + {%pipe,translateComma=$content[total_points]%} {?POINTS?}   diff --git a/templates/de/html/admin/admin_list_bonus.tpl b/templates/de/html/admin/admin_list_bonus.tpl index 781575b221..e10febf2e3 100644 --- a/templates/de/html/admin/admin_list_bonus.tpl +++ b/templates/de/html/admin/admin_list_bonus.tpl @@ -28,7 +28,7 @@ $content[rows] {--ADMIN_TOTAL_MEMBER_BONUS--}:  - {%pipe,translateComma=$content[total]%} {?POINTS?} + {%pipe,translateComma=$content[total_points]%} {?POINTS?}   diff --git a/templates/de/html/admin/admin_list_transfer.tpl b/templates/de/html/admin/admin_list_transfer.tpl index 66fe8136ca..372aee856d 100644 --- a/templates/de/html/admin/admin_list_transfer.tpl +++ b/templates/de/html/admin/admin_list_transfer.tpl @@ -32,7 +32,7 @@ {--ADMIN_TRANSFER_POINTS_TOTAL--} - {%pipe,translateComma=$content[total]%} + {%pipe,translateComma=$content[total_points]%} diff --git a/templates/de/html/admin/admin_user_details.tpl b/templates/de/html/admin/admin_user_details.tpl index dc85ff32d0..d2a5d01f83 100644 --- a/templates/de/html/admin/admin_user_details.tpl +++ b/templates/de/html/admin/admin_user_details.tpl @@ -102,7 +102,7 @@ {--TOTAL_POINTS--}:
- {%pipe,translateComma=$content[total]%} + {%pipe,translateComma=$content[total_points]%} {--TOTAL_REFERALS--}:
diff --git a/templates/de/html/mailid/mailid_points_done.tpl b/templates/de/html/mailid/mailid_points_done.tpl index e3529c352b..54ac17efbb 100644 --- a/templates/de/html/mailid/mailid_points_done.tpl +++ b/templates/de/html/mailid/mailid_points_done.tpl @@ -3,7 +3,7 @@ {%message,MEMBER_THANX_POINTS_ADDED=$content[points]%}
- {%message,MEMBER_MAILID_TOTAL_POINTS=$content[total]%} + {%message,MEMBER_MAILID_TOTAL_POINTS=$content[total_points]%}