More use of REVERT_COMMA() fixes problems
authorRoland Häder <roland@mxchange.org>
Mon, 6 Oct 2008 17:46:56 +0000 (17:46 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 6 Oct 2008 17:46:56 +0000 (17:46 +0000)
14 files changed:
doubler.php
inc/databases.php
inc/libs/payout_functions.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-config_beg.php
inc/modules/admin/what-config_bonus.php
inc/modules/admin/what-config_doubler.php
inc/modules/admin/what-config_newsletter.php
inc/modules/admin/what-config_payouts.php
inc/modules/admin/what-config_surfbar.php
inc/modules/admin/what-edit_sponsor.php
inc/modules/admin/what-list_sponsor_pay.php
inc/modules/member/what-payout.php
inc/modules/member/what-points.php

index ed96136..8c56144 100644 (file)
@@ -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']));
index 17b8ea8..081fad2 100644 (file)
@@ -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);
index 95d03c0..eab3ad8 100644 (file)
@@ -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!
index 8e583b6..0c7f5bf 100644 (file)
@@ -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?
index 40d412e..5342beb 100644 (file)
@@ -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);
index 9e4641d..9611686 100644 (file)
@@ -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));
index 42bbc12..48ab8b8 100644 (file)
@@ -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);
index c7dc393..f3d4215 100644 (file)
@@ -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);
 }
index 58e0447..9859235 100644 (file)
@@ -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__);
                        }
index f486767..b615405 100644 (file)
@@ -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);
index 9b4a761..8840a1a 100644 (file)
@@ -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",
index 9f49ed6..3e77ed7 100644 (file)
@@ -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!
index b49491e..25aa636 100644 (file)
@@ -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))
index ec7275b..e4935ab 100644 (file)
@@ -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)));
 }
 
 //