]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-config_points.php
More fixes from bugtracker issues, thanks to profi-concept
[mailer.git] / inc / modules / admin / what-config_points.php
index f874710e81e8ac7a640a4d53d57c6abec2c86223..f81988eb1104c973a4c7664b4e0c6d2e52257819 100644 (file)
@@ -40,7 +40,12 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 // Add description as navigation point
 ADD_DESCR("admin", __FILE__);
 
 // Add description as navigation point
 ADD_DESCR("admin", __FILE__);
 
+// Init variables
+$message = "";
+
+// Is the 'sub' parameter set?
 if (!empty($_GET['sub'])) {
 if (!empty($_GET['sub'])) {
+       // Yes, then do some sanity-checks
        switch ($_GET['sub'])
        {
        case "points":
        switch ($_GET['sub'])
        {
        case "points":
@@ -89,7 +94,7 @@ if (isset($_POST['ok'])) {
                                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__);
                        }
                                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__);
                        }
-                       $TEXT = REF_DEPTHS_SAVED;
+                       $message = REF_DEPTHS_SAVED;
                        break;
 
                case "del":
                        break;
 
                case "del":
@@ -97,7 +102,7 @@ if (isset($_POST['ok'])) {
                                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_refdepths WHERE id=%s LIMIT 1",
                                        array(bigintval($id)), __FILE__, __LINE__);
                        }
                                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_refdepths WHERE id=%s LIMIT 1",
                                        array(bigintval($id)), __FILE__, __LINE__);
                        }
-                       $TEXT = REF_DEPTHS_DELETED;
+                       $message = REF_DEPTHS_DELETED;
                        break;
                }
 
                        break;
                }
 
@@ -114,18 +119,15 @@ allow_direct_pay='%s',
 reg_points_mode='%s',
 ref_payout='%s'
 WHERE config=0 LIMIT 1",
 reg_points_mode='%s',
 ref_payout='%s'
 WHERE config=0 LIMIT 1",
- $_POST['allow_direct_pay'],
- $_POST['reg_points_mode'],
- $REF
                      $_POST['allow_direct_pay'],
                      $_POST['reg_points_mode'],
                      $REF
                );
                );
-               if ((getConfig('ref_payout') == 0) && ($_POST['ref_payout'] > 0))
-               {
+               if ((getConfig('ref_payout') == 0) && ($_POST['ref_payout'] > 0)) {
                        // Update account's ref_payout for "must-confirm"
                        $SQLs[] = sprintf("UPDATE `"._MYSQL_PREFIX."_user_data` SET ref_payout=(%s - mails_confirmed)
 WHERE mails_confirmed < %s", $REF, $REF);
                        // Update account's ref_payout for "must-confirm"
                        $SQLs[] = sprintf("UPDATE `"._MYSQL_PREFIX."_user_data` SET ref_payout=(%s - mails_confirmed)
 WHERE mails_confirmed < %s", $REF, $REF);
-               }
-                elseif ((getConfig('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"
                        $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_user_data` SET ref_payout=0 WHERE ref_payout > 0";
                        $SQLs[] = "UPDATE "._MYSQL_PREFIX."_user_points SET points=points+locked_points WHERE locked_points>0";
                        // Update account's ref_payout for "not-must-confirm"
                        $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_user_data` SET ref_payout=0 WHERE ref_payout > 0";
                        $SQLs[] = "UPDATE "._MYSQL_PREFIX."_user_points SET points=points+locked_points WHERE locked_points>0";
@@ -135,27 +137,34 @@ WHERE mails_confirmed < %s", $REF, $REF);
        }
 
        if ((isset($SQLs)) && (is_array($SQLs)) && (!empty($SQLs[0]))) {
        }
 
        if ((isset($SQLs)) && (is_array($SQLs)) && (!empty($SQLs[0]))) {
-               if (strpos($SQLs[0], "INSERT") > -1)
-               {
+               if (strpos($SQLs[0], "INSERT") > -1) {
                        $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_refdepths WHERE level='%s' LIMIT 1",
                                array(bigintval($_POST['lvl'])), __FILE__, __LINE__);
                        SQL_FREERESULT($result);
                        $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_refdepths WHERE level='%s' LIMIT 1",
                                array(bigintval($_POST['lvl'])), __FILE__, __LINE__);
                        SQL_FREERESULT($result);
-               }
+               } // END - if
+
                if (count($SQLs) > 0) {
                        // Run all SQL commands
                        RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs));
 
                if (count($SQLs) > 0) {
                        // Run all SQL commands
                        RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs));
 
-                       $content = "<SPAN class=\"admin_done\">".SETTINGS_SAVED."</SPAN>";
+                       // Entry saved...
+                       $message = SETTINGS_SAVED;
 
                        // Destroy config cache file here...
                        REBUILD_CACHE("config", "config");
                } else {
 
                        // Destroy config cache file here...
                        REBUILD_CACHE("config", "config");
                } else {
-                       $content = "<SPAN class=\"admin_failed\">".SETTINGS_NOT_SAVED."</SPAN>";
+                       // Prepare failed-message
+                       $message = "<SPAN class=\"admin_failed\">".SETTINGS_NOT_SAVED."</SPAN>";
                }
                }
+
+               // Remove SQL queries
                unset($SQLs);
                unset($SQLs);
-               LOAD_TEMPLATE("admin_settings_saved", false, $content);
-       } elseif (isset($TEXT)) {
-               LOAD_TEMPLATE("admin_settings_saved", false, $TEXT);
+       }
+
+       // Shall we display a message?
+       if (!empty($message)) {
+               // When do so...
+               LOAD_TEMPLATE("admin_settings_saved", false, $message);
        }
 } elseif ($_GET['sub'] == "settings") {
        // Setup some settings like direct pay and so on
        }
 } elseif ($_GET['sub'] == "settings") {
        // Setup some settings like direct pay and so on