From b3f82be7e5ecc294acfe9c00ef75e3dc0c8b43d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 6 Oct 2008 17:46:56 +0000 Subject: [PATCH 1/1] More use of REVERT_COMMA() fixes problems --- doubler.php | 2 +- inc/databases.php | 2 +- inc/libs/payout_functions.php | 2 +- inc/modules/admin/admin-inc.php | 2 +- inc/modules/admin/what-config_beg.php | 6 +++--- inc/modules/admin/what-config_bonus.php | 12 ++++++------ inc/modules/admin/what-config_doubler.php | 10 +++++----- inc/modules/admin/what-config_newsletter.php | 2 +- inc/modules/admin/what-config_payouts.php | 6 +++--- inc/modules/admin/what-config_surfbar.php | 6 +++--- inc/modules/admin/what-edit_sponsor.php | 4 ++-- inc/modules/admin/what-list_sponsor_pay.php | 2 +- inc/modules/member/what-payout.php | 4 ++-- inc/modules/member/what-points.php | 2 +- 14 files changed, 31 insertions(+), 31 deletions(-) diff --git a/doubler.php b/doubler.php index ed96136bbc..8c56144ccf 100644 --- a/doubler.php +++ b/doubler.php @@ -106,7 +106,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { SQL_FREERESULT($result); // Remove any dots and unwanted chars from the points - $_POST['points'] = bigintval(round(str_replace(",", ".", $_POST['points']))); + $_POST['points'] = bigintval(round(REVERT_COMMA($_POST['points']))); // Probe for enough points $probe_points = (($_POST['points'] >= $_CONFIG['doubler_min']) && ($_POST['points'] <= $_CONFIG['doubler_max'])); diff --git a/inc/databases.php b/inc/databases.php index 17b8ea8808..081fad2707 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -113,7 +113,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "463"); +define('CURR_SVN_REVISION', "464"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/libs/payout_functions.php b/inc/libs/payout_functions.php index 95d03c0f6e..eab3ad8fc0 100644 --- a/inc/libs/payout_functions.php +++ b/inc/libs/payout_functions.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { function PAYOUT_OUTPUT_PAYOUT_LIST($points) { // Replace german decimal comma with CPU's decimal dot - $points = strval(str_replace(",", ".", $points)); + $points = strval(REVERT_COMMA($points)); if ($points > 0) { // Pay this out! diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 8e583b6436..0c7f5bfeee 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -645,7 +645,7 @@ function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="con // Translate the value? (comma to dot!) if ((is_array($translateComma)) && (in_array($id, $translateComma))) { // Then do it here... :) - $val = str_replace(",", ".", $val); + $val = REVERT_COMMA($val); } // END - if // Shall we add numbers or strings? diff --git a/inc/modules/admin/what-config_beg.php b/inc/modules/admin/what-config_beg.php index 40d412e6b2..5342beb5ad 100644 --- a/inc/modules/admin/what-config_beg.php +++ b/inc/modules/admin/what-config_beg.php @@ -43,9 +43,9 @@ ADD_DESCR("admin", basename(__FILE__)); if (isset($_POST['ok'])) { // Translate german decimal commas to computer decimal dots - $_POST['beg_points'] = str_replace(",", ".", $_POST['beg_points'] ); - $_POST['beg_points_max'] = str_replace(",", ".", $_POST['beg_points_max'] ); - $_POST['beg_notify_bonus'] = str_replace(",", ".", $_POST['beg_notify_bonus']); + $_POST['beg_points'] = REVERT_COMMA($_POST['beg_points'] ); + $_POST['beg_points_max'] = REVERT_COMMA($_POST['beg_points_max'] ); + $_POST['beg_notify_bonus'] = REVERT_COMMA($_POST['beg_notify_bonus']); // Save settings ADMIN_SAVE_SETTINGS($_POST); diff --git a/inc/modules/admin/what-config_bonus.php b/inc/modules/admin/what-config_bonus.php index 9e4641d08b..961168604c 100644 --- a/inc/modules/admin/what-config_bonus.php +++ b/inc/modules/admin/what-config_bonus.php @@ -43,17 +43,17 @@ ADD_DESCR("admin", basename(__FILE__)); if (isset($_POST['ok'])) { // Replace german decimal commas to computer decimal dots - $_POST['login_bonus'] = str_replace(",", ".", $_POST['login_bonus'] ); - $_POST['turbo_bonus'] = str_replace(",", ".", $_POST['turbo_bonus'] ); - $_POST['bonus_ref'] = str_replace(",", ".", $_POST['bonus_ref'] ); - $_POST['bonus_order'] = str_replace(",", ".", $_POST['bonus_order'] ); - $_POST['bonus_notify_points'] = str_replace(",", ".", $_POST['bonus_notify_points']); + $_POST['login_bonus'] = REVERT_COMMA($_POST['login_bonus'] ); + $_POST['turbo_bonus'] = REVERT_COMMA($_POST['turbo_bonus'] ); + $_POST['bonus_ref'] = REVERT_COMMA($_POST['bonus_ref'] ); + $_POST['bonus_order'] = REVERT_COMMA($_POST['bonus_order'] ); + $_POST['bonus_notify_points'] = REVERT_COMMA($_POST['bonus_notify_points']); // Generate string for saving ranks $_POST['turbo_rates'] = ""; $RATES = array(); foreach ($_POST['rate'] as $rate) { - $rate = trim(str_replace(",", ".", $rate)); + $rate = trim(REVERT_COMMA($rate)); if (isset($rate)) $RATES[] = $rate; } $_POST['turbo_rates'] = trim(implode(";", $RATES)); diff --git a/inc/modules/admin/what-config_doubler.php b/inc/modules/admin/what-config_doubler.php index 42bbc12e74..48ab8b8cac 100644 --- a/inc/modules/admin/what-config_doubler.php +++ b/inc/modules/admin/what-config_doubler.php @@ -42,11 +42,11 @@ ADD_DESCR("admin", basename(__FILE__)); if (isset($_POST['ok'])) { // Replace commata with decimal dot - $_POST['doubler_charge'] = str_replace(",", ".", ($_POST['doubler_charge'] / 100)); - $_POST['doubler_ref'] = str_replace(",", ".", ($_POST['doubler_ref'] / 100)); - $_POST['doubler_min'] = str_replace(",", ".", $_POST['doubler_min']); - $_POST['doubler_max'] = str_replace(",", ".", $_POST['doubler_max']); - $_POST['doubler_left'] = str_replace(",", ".", $_POST['doubler_left']); + $_POST['doubler_charge'] = REVERT_COMMA(($_POST['doubler_charge'] / 100)); + $_POST['doubler_ref'] = REVERT_COMMA(($_POST['doubler_ref'] / 100)); + $_POST['doubler_min'] = REVERT_COMMA($_POST['doubler_min']); + $_POST['doubler_max'] = REVERT_COMMA($_POST['doubler_max']); + $_POST['doubler_left'] = REVERT_COMMA($_POST['doubler_left']); // Save settings ADMIN_SAVE_SETTINGS($_POST); diff --git a/inc/modules/admin/what-config_newsletter.php b/inc/modules/admin/what-config_newsletter.php index c7dc393d5b..f3d42154b1 100644 --- a/inc/modules/admin/what-config_newsletter.php +++ b/inc/modules/admin/what-config_newsletter.php @@ -43,7 +43,7 @@ ADD_DESCR("admin", basename(__FILE__)); if (isset($_POST['ok'])) { // Save data - $_POST['nl_charge'] = str_replace(",", ".", $_POST['nl_charge']); + $_POST['nl_charge'] = REVERT_COMMA($_POST['nl_charge']); ADMIN_SAVE_SETTINGS($_POST); } diff --git a/inc/modules/admin/what-config_payouts.php b/inc/modules/admin/what-config_payouts.php index 58e04477de..9859235a08 100644 --- a/inc/modules/admin/what-config_payouts.php +++ b/inc/modules/admin/what-config_payouts.php @@ -40,7 +40,7 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { // Add description as navigation point ADD_DESCR("admin", basename(__FILE__)); -if (!empty($_POST['rate'])) $_POST['rate'] = str_replace(",", ".", $_POST['rate']); +if (!empty($_POST['rate'])) $_POST['rate'] = REVERT_COMMA($_POST['rate']); if ((isset($_POST['add'])) && (!empty($_POST['title'])) && ($_POST['rate'] > 0)) { @@ -104,8 +104,8 @@ allow_url='%s' WHERE id='".$id."' LIMIT 1", array( $_POST['title'][$id], - bigintval(str_replace(",", ".", $_POST['rate'][$id])), - bigintval(str_replace(",", ".", $_POST['mpoi'][$id])), + bigintval(REVERT_COMMA($_POST['rate'][$id])), + bigintval(REVERT_COMMA($_POST['mpoi'][$id])), $_POST['allow'][$id], ),__FILE__, __LINE__); } diff --git a/inc/modules/admin/what-config_surfbar.php b/inc/modules/admin/what-config_surfbar.php index f486767182..b615405e99 100644 --- a/inc/modules/admin/what-config_surfbar.php +++ b/inc/modules/admin/what-config_surfbar.php @@ -43,9 +43,9 @@ ADD_DESCR("admin", basename(__FILE__)); // Was the form submitted? if (isset($_POST['ok'])) { // Replace german decimal comma with computer decimal dot - if (isset($_POST['surfbar_static_reward'])) $_POST['surfbar_static_reward'] = str_replace(",", ".", $_POST['surfbar_static_reward']); - if (isset($_POST['surfbar_static_costs'])) $_POST['surfbar_static_costs'] = str_replace(",", ".", $_POST['surfbar_static_costs']); - if (isset($_POST['surfbar_dynamic_percent'])) $_POST['surfbar_dynamic_percent'] = str_replace(",", ".", $_POST['surfbar_dynamic_percent']); + if (isset($_POST['surfbar_static_reward'])) $_POST['surfbar_static_reward'] = REVERT_COMMA($_POST['surfbar_static_reward']); + if (isset($_POST['surfbar_static_costs'])) $_POST['surfbar_static_costs'] = REVERT_COMMA($_POST['surfbar_static_costs']); + if (isset($_POST['surfbar_dynamic_percent'])) $_POST['surfbar_dynamic_percent'] = REVERT_COMMA($_POST['surfbar_dynamic_percent']); // Save settings ADMIN_SAVE_SETTINGS($_POST); diff --git a/inc/modules/admin/what-edit_sponsor.php b/inc/modules/admin/what-edit_sponsor.php index 9b4a761f0f..8840a1a875 100644 --- a/inc/modules/admin/what-edit_sponsor.php +++ b/inc/modules/admin/what-edit_sponsor.php @@ -105,7 +105,7 @@ if ((!empty($_GET['id'])) && (!empty($_GET['mode']))) { case "add_points": // Add points if (strval($_POST['points']) > 0) { // Replace german decimal comma with computer's decimal dot - $POINTS = strval(str_replace(",", ".", $_POST['points'])); + $POINTS = strval(REVERT_COMMA($_POST['points'])); // Add points to account $result_add = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_sponsor_data SET points_amount=points_amount+%s WHERE id='%s' LIMIT 1", @@ -128,7 +128,7 @@ if ((!empty($_GET['id'])) && (!empty($_GET['mode']))) { case "sub_points": // Subtract points if (strval($_POST['points']) > 0) { // Replace german decimal comma with computer's decimal dot - $POINTS = strval(str_replace(",", ".", $_POST['points'])); + $POINTS = strval(REVERT_COMMA($_POST['points'])); // Add points to account $result_add = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_sponsor_data SET points_used=points_used+%s WHERE id='%s' LIMIT 1", diff --git a/inc/modules/admin/what-list_sponsor_pay.php b/inc/modules/admin/what-list_sponsor_pay.php index 9f49ed635a..3e77ed7c0d 100644 --- a/inc/modules/admin/what-list_sponsor_pay.php +++ b/inc/modules/admin/what-list_sponsor_pay.php @@ -97,7 +97,7 @@ if (isset($_POST['add'])) { // No entry found so add this line $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_sponsor_paytypes (pay_name, pay_rate, pay_min_count, pay_currency) VALUES ('%s','%s','%s','%s')", - array(htmlspecialchars($_POST['pay_name']), str_replace(",", ".", $_POST['pay_rate']), bigintval($_POST['pay_min_count']), htmlspecialchars($_POST['pay_currency'])), + array(htmlspecialchars($_POST['pay_name']), REVERT_COMMA($_POST['pay_rate']), bigintval($_POST['pay_min_count']), htmlspecialchars($_POST['pay_currency'])), __FILE__, __LINE__); // Payment type added! diff --git a/inc/modules/member/what-payout.php b/inc/modules/member/what-payout.php index b49491e1eb..25aa636c78 100644 --- a/inc/modules/member/what-payout.php +++ b/inc/modules/member/what-payout.php @@ -81,7 +81,7 @@ if (empty($_GET['payout'])) $result = SQL_QUERY_ESC("SELECT id, type, rate, min_points, allow_url FROM "._MYSQL_PREFIX."_payout_types WHERE %s >= min_points -ORDER BY type", array(str_replace(",", ".", $TPTS)), __FILE__, __LINE__); +ORDER BY type", array(REVERT_COMMA($TPTS)), __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { // Free memory @@ -184,7 +184,7 @@ ORDER BY p.payout_timestamp DESC", define('PAYOUT_MAX_VALUE' , $max); define('PAYOUT_TYPE_VALUE', COMPILE_CODE($type)); - if (str_replace(",", ".", $TPTS) >= $min) + if (REVERT_COMMA($TPTS) >= $min) { // Ok, he can get be paid if ((isset($_POST['ok'])) && ($PAYOUT <= $PAY_MAX) && ($PAYOUT >= $min)) diff --git a/inc/modules/member/what-points.php b/inc/modules/member/what-points.php index ec7275b3c5..e4935abd61 100644 --- a/inc/modules/member/what-points.php +++ b/inc/modules/member/what-points.php @@ -199,7 +199,7 @@ if (EXT_IS_ACTIVE("user")) { if (EXT_IS_ACTIVE("payout")) { // Payput extension is installed and active so we can check if the user has enougth points - PAYOUT_OUTPUT_PAYOUT_LIST(str_replace(",", ".", ($TPTS - $USED))); + PAYOUT_OUTPUT_PAYOUT_LIST(REVERT_COMMA(($TPTS - $USED))); } // -- 2.30.2