]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-config_points.php
Several more constants rewritten to getConfig()
[mailer.git] / inc / modules / admin / what-config_points.php
index 4c10dafb62d17d45359fc47989e9735ec8d4a921..6be930611ab19b57a16f55b809e5087dfa641672 100644 (file)
@@ -75,7 +75,7 @@ if (isFormSent()) {
        INIT_SQLS();
        switch (REQUEST_GET('sub')) {
                case 'points':
-                       ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_config` SET points_register='".REQUEST_POST('points_register')."', points_ref='".REQUEST_POST('points_ref')."' WHERE config=0 LIMIT 1");
+                       updateConfiguration(array('points_register', 'points_ref'), array(REQUEST_POST('points_register'), REQUEST_POST('points_ref')));
                        break;
 
                case 'ref':
@@ -117,24 +117,19 @@ if (isFormSent()) {
 
                                case "settings":
                                        $REF = bigintval(REQUEST_POST('ref_payout'));
-                                       ADD_SQL(sprintf("UPDATE `{!_MYSQL_PREFIX!}_config` SET
-allow_direct_pay='%s',
-reg_points_mode='%s',
-ref_payout='%s'
-WHERE config=0 LIMIT 1",
-                                       REQUEST_POST('allow_direct_pay'),
-                                       REQUEST_POST('reg_points_mode'),
-                                       $REF
-                                       ));
+                                       updateConfiguration(
+                                               array('allow_direct_pay', 'reg_points_mode', 'ref_payout'),
+                                               array(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"
-                                               ADD_SQL(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"
-                                               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");
+                                               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;
        }
@@ -256,7 +251,7 @@ WHERE mails_confirmed < %s", $REF, $REF));
                LOAD_TEMPLATE("admin_points_edit");
        } else {
                // Referal levels
-               $result = SQL_QUERY("SELECT id, level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` ORDER BY level", __FILE__, __LINE__);
+               $result = SQL_QUERY("SELECT `id`, `level`, `percents` FROM `{!_MYSQL_PREFIX!}_refdepths` ORDER BY `level` ASC", __FILE__, __LINE__);
                if (SQL_NUMROWS($result) > 0) {
                        // Make referal levels editable and deletable
                        $OUT = ''; $SW = 2;
@@ -273,7 +268,7 @@ WHERE mails_confirmed < %s", $REF, $REF));
                                );
 
                                // Load row template and switch color
-                               $OUT .= LOAD_TEMPLATE("admin_points_row", true, $content);
+                               $OUT .= LOAD_TEMPLATE('admin_points_row', true, $content);
                                $SW = 3 - $SW;
                        }
 
@@ -282,22 +277,22 @@ WHERE mails_confirmed < %s", $REF, $REF));
                        define('__LEVEL_ROWS', $OUT);
 
                        // Load main template
-                       LOAD_TEMPLATE("admin_points");
+                       LOAD_TEMPLATE('admin_points');
                }
 
                // Form for adding new referal levels
-               LOAD_TEMPLATE("admin_add_reflvl");
+               LOAD_TEMPLATE('admin_add_reflvl');
        }
-} elseif (REQUEST_GET('sub') == "points") {
+} elseif (REQUEST_GET('sub') == 'points') {
        // 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");
+       LOAD_TEMPLATE('admin_config_sub_points');
 } else {
        // Display selection box
-       LOAD_TEMPLATE("admin_config_points");
+       LOAD_TEMPLATE('admin_config_points');
 }
 
 //