X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-config_points.php;h=44cafc4f7694a20cc8cf640b0c2817da6b52359a;hb=53b5edd1ee2b126087000ff842ac7bd0feea8814;hp=f3ae527583d29818a6a15834425892e53e6af6e1;hpb=6032b7018b83778f1592383238f4e0d28f718622;p=mailer.git diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index f3ae527583..44cafc4f76 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -32,44 +32,37 @@ ************************************************************************/ // Some security stuff... -if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) { +if ((!defined('__SECURITY')) || (!IS_ADMIN())) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; require($INC); } // Add description as navigation point -ADD_DESCR("admin", basename(__FILE__)); +ADD_DESCR("admin", __FILE__); -if (!empty($_GET['sub'])) -{ +if (!empty($_GET['sub'])) { switch ($_GET['sub']) { case "points": - if ((empty($_POST['points_register'])) || (empty($_POST['points_ref']))) - { + if ((empty($_POST['points_register'])) || (empty($_POST['points_ref']))) { unset($_POST['ok']); } break; case "ref": - if (isset($_GET['do'])) - { - if (((empty($_POST['lvl'])) || (empty($_POST['perc']))) && ($_GET['do'] == "add")) - { + if (isset($_GET['do'])) { + if (((empty($_POST['lvl'])) || (empty($_POST['perc']))) && ($_GET['do'] == "add")) { unset($_POST['ok']); } } break; } -} - else -{ +} else { // Display overview $_GET['sub'] = "overview"; } -if (isset($_POST['ok'])) -{ +if (isset($_POST['ok'])) { $SQL = array(); switch ($_GET['sub']) { @@ -81,15 +74,17 @@ if (isset($_POST['ok'])) switch ($_GET['do']) { case "add": - $SQL[] = "INSERT INTO "._MYSQL_PREFIX."_refdepths (level, percents) VALUES ('".$_POST['lvl']."', '".$_POST['perc']."')"; + $SQL[] = "INSERT INTO "._MYSQL_PREFIX."_refdepths (level, percents) VALUES ('".$_POST['lvl']."','".$_POST['perc']."')"; break; case "edit": // Change entries - foreach ($_POST['lvl'] as $id=>$value) - { + foreach ($_POST['lvl'] as $id => $value) { // 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__); @@ -98,8 +93,7 @@ if (isset($_POST['ok'])) break; case "del": - foreach ($_POST['id'] as $id=>$value) - { + foreach ($_POST['id'] as $id => $value) { $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_refdepths WHERE id=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); } @@ -108,9 +102,8 @@ 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 (GET_EXT_VERSION("cache") >= "0.1.2") { + if ($cacheInstance->cache_file("refdepths")) $cacheInstance->cache_destroy(); } break; @@ -159,11 +152,7 @@ WHERE mails_confirmed < %s", $REF, $REF); $content = "".SETTINGS_SAVED.""; // Destroy config cache file here... - if (GET_EXT_VERSION("cache") >= "0.1.2") - { - if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy(); - unset($cacheArray); - } + REBUILD_CACHE("config", "config"); } else { @@ -180,28 +169,28 @@ 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 + // Including new add-mode for one-time referal bonus switch ($_CONFIG['allow_direct_pay']) { case 'Y': - define('__DIRECT_Y', ' checked'); + define('__DIRECT_Y', " checked=\"checked\""); define('__DIRECT_N', ""); break; case 'N': define('__DIRECT_Y', ""); - define('__DIRECT_N', ' checked'); + define('__DIRECT_N', " checked=\"checked\""); break; } - // One-time referral bonus add-mode + // One-time referal bonus add-mode switch ($_CONFIG['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 + // Referal payout value define('__REF_PAYOUT', round($_CONFIG['ref_payout'])); // Load template @@ -213,7 +202,7 @@ WHERE mails_confirmed < %s", $REF, $REF); { // Delete entries $SW = 2; $OUT = ""; - foreach ($_POST['sel'] as $id=>$value) + foreach ($_POST['sel'] as $id => $value) { $result = SQL_QUERY_ESC("SELECT level, percents FROM "._MYSQL_PREFIX."_refdepths WHERE id=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); @@ -225,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 @@ -241,7 +230,7 @@ WHERE mails_confirmed < %s", $REF, $REF); { // Edit entries $SW = 2; $OUT = ""; - foreach ($_POST['sel'] as $id=>$value) + foreach ($_POST['sel'] as $id => $value) { $result = SQL_QUERY_ESC("SELECT level, percents FROM "._MYSQL_PREFIX."_refdepths WHERE id=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); @@ -253,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 @@ -267,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 @@ -282,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 @@ -298,13 +287,13 @@ 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... + // First points for registration and other fixed points including new add-mode for one-time referal bonus... define('P_REG_VALUE', $_CONFIG['points_register']); define('P_REF_VALUE', $_CONFIG['points_ref']);