X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-config_points.php;h=f81988eb1104c973a4c7664b4e0c6d2e52257819;hp=f874710e81e8ac7a640a4d53d57c6abec2c86223;hb=2e68ea39a430a7217e58747b877acaa3e92ea997;hpb=81048fd007675d6201fbae06577d3a13f83d943e diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index f874710e81..f81988eb11 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -40,7 +40,12 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { // Add description as navigation point ADD_DESCR("admin", __FILE__); +// Init variables +$message = ""; + +// Is the 'sub' parameter set? if (!empty($_GET['sub'])) { + // Yes, then do some sanity-checks 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__); } - $TEXT = REF_DEPTHS_SAVED; + $message = REF_DEPTHS_SAVED; 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__); } - $TEXT = REF_DEPTHS_DELETED; + $message = REF_DEPTHS_DELETED; break; } @@ -114,18 +119,15 @@ allow_direct_pay='%s', 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); - } - 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"; @@ -135,27 +137,34 @@ WHERE mails_confirmed < %s", $REF, $REF); } 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); - } + } // END - if + if (count($SQLs) > 0) { // Run all SQL commands RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs)); - $content = "".SETTINGS_SAVED.""; + // Entry saved... + $message = SETTINGS_SAVED; // Destroy config cache file here... REBUILD_CACHE("config", "config"); } else { - $content = "".SETTINGS_NOT_SAVED.""; + // Prepare failed-message + $message = "".SETTINGS_NOT_SAVED.""; } + + // Remove SQL queries 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