]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-config_points.php
Mahor rewrite:
[mailer.git] / inc / modules / admin / what-config_points.php
index 8307ed99a081e2d0f9d72bcc1bc36d7f740787ff..1e93a7ff5195ce1481ba60a29d56fcea203e4a2c 100644 (file)
@@ -38,7 +38,7 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 }
 
 // Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
+ADD_DESCR("admin", __FILE__);
 
 if (!empty($_GET['sub'])) {
        switch ($_GET['sub'])
@@ -67,7 +67,7 @@ if (isset($_POST['ok'])) {
        switch ($_GET['sub'])
        {
        case "points":
-               $SQL[] = "UPDATE "._MYSQL_PREFIX."_config SET points_register='".$_POST['points_register']."', points_ref='".$_POST['points_ref']."' WHERE config=0 LIMIT 1";
+               $SQL[] = "UPDATE `"._MYSQL_PREFIX."_config` SET points_register='".$_POST['points_register']."', points_ref='".$_POST['points_ref']."' WHERE config=0 LIMIT 1";
                break;
 
        case "ref":
@@ -82,6 +82,9 @@ if (isset($_POST['ok'])) {
                                // Secure ID
                                $id = bigintval($id);
 
+                               // Revert german commata
+                               $_POST['perc'][$id] = REVERT_COMMA($_POST['perc'][$id]);
+
                                // Update entry
                                $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_refdepths SET level='%s', percents='%s' WHERE id=%s LIMIT 1",
                                 array(bigintval($value), $_POST['perc'][$id], $id), __FILE__, __LINE__);
@@ -100,13 +103,13 @@ if (isset($_POST['ok'])) {
 
                // Update cache file
                if (GET_EXT_VERSION("cache") >= "0.1.2") {
-                       if ($cacheInstance->cache_file("refdepths", true)) $cacheInstance->cache_destroy();
+                       if ($cacheInstance->loadCacheFile("refdepths")) $cacheInstance->destroyCacheFile();
                }
                break;
 
        case "settings":
                $REF = bigintval($_POST['ref_payout']);
-               $SQL[] = sprintf("UPDATE "._MYSQL_PREFIX."_config SET
+               $SQL[] = sprintf("UPDATE `"._MYSQL_PREFIX."_config` SET
 allow_direct_pay='%s',
 reg_points_mode='%s',
 ref_payout='%s'
@@ -115,16 +118,16 @@ WHERE config=0 LIMIT 1",
  $_POST['reg_points_mode'],
  $REF
                );
-               if (($_CONFIG['ref_payout'] == 0) && ($_POST['ref_payout'] > 0))
+               if ((getConfig('ref_payout') == 0) && ($_POST['ref_payout'] > 0))
                {
                        // Update account's ref_payout for "must-confirm"
-                       $SQL[] = sprintf("UPDATE "._MYSQL_PREFIX."_user_data SET ref_payout=(%s - mails_confirmed)
+                       $SQL[] = sprintf("UPDATE `"._MYSQL_PREFIX."_user_data` SET ref_payout=(%s - mails_confirmed)
 WHERE mails_confirmed < %s", $REF, $REF);
                }
-                elseif (($_CONFIG['ref_payout'] > 0) && ($_POST['ref_payout'] == 0))
+                elseif ((getConfig('ref_payout') > 0) && ($_POST['ref_payout'] == 0))
                {
                        // Update account's ref_payout for "not-must-confirm"
-                       $SQL[] = "UPDATE "._MYSQL_PREFIX."_user_data SET ref_payout=0 WHERE ref_payout > 0";
+                       $SQL[] = "UPDATE `"._MYSQL_PREFIX."_user_data` SET ref_payout=0 WHERE ref_payout > 0";
                        $SQL[] = "UPDATE "._MYSQL_PREFIX."_user_points SET points=points+locked_points WHERE locked_points>0";
                        $SQL[] = "UPDATE "._MYSQL_PREFIX."_user_points SET locked_points=0 WHERE locked_points>0";
                }
@@ -166,29 +169,29 @@ WHERE mails_confirmed < %s", $REF, $REF);
  elseif ($_GET['sub'] == "settings")
 {
        // Setup some settings like direct pay and so on
-       // Including new add-mode for one-time referral bonus
-       switch ($_CONFIG['allow_direct_pay'])
+       // Including new add-mode for one-time referal bonus
+       switch (getConfig('allow_direct_pay'))
        {
-       case 'Y':
-               define('__DIRECT_Y', " checked");
+       case "Y":
+               define('__DIRECT_Y', " checked=\"checked\"");
                define('__DIRECT_N', "");
                break;
 
-       case 'N':
+       case "N":
                define('__DIRECT_Y', "");
-               define('__DIRECT_N', " checked");
+               define('__DIRECT_N', " checked=\"checked\"");
                break;
        }
 
-       // One-time referral bonus add-mode
-       switch ($_CONFIG['reg_points_mode'])
+       // One-time referal bonus add-mode
+       switch (getConfig('reg_points_mode'))
        {
-               case "ref"   : define('__MODE_REF', " checked"); define('__MODE_DIRECT', "");         break;
-               case "direct": define('__MODE_REF', "");         define('__MODE_DIRECT', " checked"); break;
+               case "ref"   : define('__MODE_REF', " checked=\"checked\""); define('__MODE_DIRECT', "");         break;
+               case "direct": define('__MODE_REF', "");         define('__MODE_DIRECT', " checked=\"checked\""); break;
        }
 
-       // Referral payout value
-       define('__REF_PAYOUT', round($_CONFIG['ref_payout']));
+       // Referal payout value
+       define('__REF_PAYOUT', round(getConfig('ref_payout')));
 
        // Load template
        LOAD_TEMPLATE("admin_config_point_settings");
@@ -211,7 +214,7 @@ WHERE mails_confirmed < %s", $REF, $REF);
                                'sw'  => $SW,
                                'id'  => $id,
                                'lvl' => $lvl,
-                               'per' => $perc,
+                               'per' => TRANSLATE_COMMA($perc),
                        );
 
                        // Load row template and switch color
@@ -239,7 +242,7 @@ WHERE mails_confirmed < %s", $REF, $REF);
                                'sw'  => $SW,
                                'id'  => $id,
                                'lvl' => $lvl,
-                               'per' => $perc,
+                               'per' => TRANSLATE_COMMA($perc),
                        );
 
                        // Load row template and switch color
@@ -253,11 +256,11 @@ WHERE mails_confirmed < %s", $REF, $REF);
        }
         else
        {
-               // Referral levels
+               // Referal levels
                $result = SQL_QUERY("SELECT id, level, percents FROM "._MYSQL_PREFIX."_refdepths ORDER BY level", __FILE__, __LINE__);
                if (SQL_NUMROWS($result) > 0)
                {
-                       // Make referral levels editable and deletable
+                       // Make referal levels editable and deletable
                        $SW = 2; $OUT = "";
 
                        // List already existing categories for editing
@@ -268,7 +271,7 @@ WHERE mails_confirmed < %s", $REF, $REF);
                                        'sw'  => $SW,
                                        'id'  => $id,
                                        'lvl' => $lvl,
-                                       'per' => $perc,
+                                       'per' => TRANSLATE_COMMA($perc),
                                );
 
                                // Load row template and switch color
@@ -284,15 +287,15 @@ WHERE mails_confirmed < %s", $REF, $REF);
                        LOAD_TEMPLATE("admin_points");
                }
 
-               // Form for adding new referral levels
+               // Form for adding new referal levels
                LOAD_TEMPLATE("admin_add_reflvl");
        }
 }
  elseif ($_GET['sub'] == "points")
 {
-       // First points for registration and other fixed points including new add-mode for one-time referral bonus...
-       define('P_REG_VALUE', $_CONFIG['points_register']);
-       define('P_REF_VALUE', $_CONFIG['points_ref']);
+       // First points for registration and other fixed points including new add-mode for one-time referal bonus...
+       define('P_REG_VALUE', getConfig('points_register'));
+       define('P_REF_VALUE', getConfig('points_ref'));
 
        // Load templates
        LOAD_TEMPLATE("admin_config_sub_points");