X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-config_points.php;h=ae54e81cda0a5bca0a884b12122c5d36c42856f4;hb=5deec33be1baf2135eefc2bbb0d1b63c6cbd2f9a;hp=085393a3d5150737e4e3b28916cbf5d97eccfe0b;hpb=d8148e3f1f3a6762b2e786dbe99ada269dcf2ea0;p=mailer.git diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index 085393a3d5..ae54e81cda 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -68,18 +68,18 @@ if (REQUEST_ISSET_GET(('sub'))) { } if (IS_FORM_SENT()) { - $SQLs = array(); + INIT_SQLS(); switch (REQUEST_GET('sub')) { case "points": - $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_config` SET points_register='".REQUEST_POST('points_register')."', points_ref='".REQUEST_POST('points_ref')."' WHERE config=0 LIMIT 1"; + ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_config` SET points_register='".REQUEST_POST('points_register')."', points_ref='".REQUEST_POST('points_ref')."' WHERE config=0 LIMIT 1"); break; case "ref": switch (REQUEST_GET('do')) { case "add": - $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_refdepths` (level, percents) VALUES ('".REQUEST_POST('lvl')."','".REQUEST_POST('perc')."')"; + ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_refdepths` (level, percents) VALUES ('".REQUEST_POST('lvl')."','".REQUEST_POST('perc')."')"); break; case "edit": // Change entries @@ -114,7 +114,7 @@ if (IS_FORM_SENT()) { case "settings": $REF = bigintval(REQUEST_POST('ref_payout')); - $SQLs[] = sprintf("UPDATE `{!_MYSQL_PREFIX!}_config` SET + ADD_SQL(sprintf("UPDATE `{!_MYSQL_PREFIX!}_config` SET allow_direct_pay='%s', reg_points_mode='%s', ref_payout='%s' @@ -122,43 +122,43 @@ WHERE config=0 LIMIT 1", REQUEST_POST('allow_direct_pay'), REQUEST_POST('reg_points_mode'), $REF - ); + )); if ((getConfig('ref_payout') == 0) && (REQUEST_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); + ADD_SQL(sprintf("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_payout=(%s - mails_confirmed) +WHERE mails_confirmed < %s", $REF, $REF)); } elseif ((getConfig('ref_payout') > 0) && (REQUEST_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"; - $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_user_points` SET locked_points=0 WHERE locked_points>0"; + ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_payout=0 WHERE ref_payout > 0"); + ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET points=points+locked_points WHERE locked_points>0"); + ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET locked_points=0 WHERE locked_points>0"); } break; } - if ((isset($SQLs)) && (is_array($SQLs)) && (!empty($SQLs[0]))) { - if (strpos($SQLs[0], "INSERT") > -1) { + if ((IS_SQLS_VALID()) && (IS_SQLS_VALID())) { + if (strpos($GLOBALS['sqls'][0], "INSERT") > -1) { $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE level='%s' LIMIT 1", array(bigintval(REQUEST_POST('lvl'))), __FILE__, __LINE__); SQL_FREERESULT($result); } // END - if - if (count($SQLs) > 0) { + if (COUNT_SQLS() > 0) { // Run all SQL commands - RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs)); + runFilterChain('run_sqls'); // Entry saved... $message = SETTINGS_SAVED; // Destroy config cache file here... - REBUILD_CACHE("config", "config"); + rebuildCacheFiles("config", "config"); } else { // Prepare failed-message $message = "{--SETTINGS_NOT_SAVED--}"; } // Remove SQL queries - unset($SQLs); + UNSET_SQLS(); } // Shall we display a message?