]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-config_points.php
New naming convention applied to many functions, see #118 for details
[mailer.git] / inc / modules / admin / what-config_points.php
index a13f1cdd2036cf63b9cfeb4922ce462657830152..874f8c79b9f610f946695a21b94e14d9fc4a6c17 100644 (file)
@@ -87,24 +87,24 @@ if (IS_FORM_SENT()) {
                        ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_refdepths` (level, percents) VALUES ('".REQUEST_POST('lvl')."','".REQUEST_POST('perc')."')");
                        break;
 
-               case "edit": // Change entries
+               case 'edit': // Change entries
                        foreach (REQUEST_POST('lvl') as $id => $value) {
                                // Secure ID
                                $id = bigintval($id);
 
                                // Revert german commata
-                               REQUEST_SET_POST(array('perc', $id), REVERT_COMMA(REQUEST_POST('perc', $id)));
+                               REQUEST_SET_POST(array('perc', $id), convertCommaToDot(REQUEST_POST('perc', $id)));
 
                                // Update entry
-                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refdepths` SET level='%s', percents='%s' WHERE id=%s LIMIT 1",
+                               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refdepths` SET level='%s', percents='%s' WHERE `id`=%s LIMIT 1",
                                        array(bigintval($value), REQUEST_POST('perc', $id), $id), __FILE__, __LINE__);
                        }
                        $message = getMessage('REF_DEPTHS_SAVED');
                        break;
 
-               case "del":
+               case 'del':
                        foreach (REQUEST_POST('id') as $id => $value) {
-                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE id=%s LIMIT 1",
+                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE `id`=%s LIMIT 1",
                                        array(bigintval($id)), __FILE__, __LINE__);
                        }
                        $message = getMessage('REF_DEPTHS_DELETED');
@@ -143,7 +143,7 @@ WHERE mails_confirmed < %s", $REF, $REF));
 
        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",
+                       $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
@@ -188,8 +188,15 @@ WHERE mails_confirmed < %s", $REF, $REF));
 
        // One-time referal bonus add-mode
        switch (getConfig('reg_points_mode')) {
-               case "ref"   : define('__MODE_REF', ' chkecked="checked"'); define('__MODE_DIRECT', '');         break;
-               case "direct": define('__MODE_REF', '');         define('__MODE_DIRECT', ' chkecked="checked"'); break;
+               case 'ref'   :
+                       define('__MODE_REF', ' chkecked="checked"');
+                       define('__MODE_DIRECT', '');
+                       break;
+
+               case 'direct':
+                       define('__MODE_REF', '');
+                       define('__MODE_DIRECT', ' chkecked="checked"');
+                       break;
        }
 
        // Referal payout value
@@ -199,11 +206,11 @@ WHERE mails_confirmed < %s", $REF, $REF));
        LOAD_TEMPLATE("admin_config_point_settings");
 } elseif (REQUEST_GET('sub') == "ref") {
        // 12                  3     32    2                  3     32    2               3            4     43    21
-       if ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST('sel')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+       if ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST('sel')) && (countPostSelection() > 0)) {
                // Delete entries
                $OUT = ''; $SW = 2;
                foreach (REQUEST_POST('sel') as $id => $value) {
-                       $result = SQL_QUERY_ESC("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE id=%s LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE `id`=%s LIMIT 1",
                                array(bigintval($id)), __FILE__, __LINE__);
                        list($lvl, $perc) = SQL_FETCHROW($result);
                        SQL_FREERESULT($result);
@@ -213,7 +220,7 @@ WHERE mails_confirmed < %s", $REF, $REF));
                                'sw'  => $SW,
                                'id'  => $id,
                                'lvl' => $lvl,
-                               'per' => TRANSLATE_COMMA($perc),
+                               'per' => translateComma($perc),
                        );
 
                        // Load row template and switch color
@@ -224,11 +231,11 @@ WHERE mails_confirmed < %s", $REF, $REF));
 
                // Load main template
                LOAD_TEMPLATE("admin_points_del");
-       } elseif ((REQUEST_ISSET_POST('edit')) && (REQUEST_ISSET_POST('sel')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+       } elseif ((REQUEST_ISSET_POST('edit')) && (REQUEST_ISSET_POST('sel')) && (countPostSelection() > 0)) {
                // Edit entries
                $OUT = ''; $SW = 2;
                foreach (REQUEST_POST('sel') as $id => $value) {
-                       $result = SQL_QUERY_ESC("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE id=%s LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE `id`=%s LIMIT 1",
                         array(bigintval($id)), __FILE__, __LINE__);
                        list($lvl, $perc) = SQL_FETCHROW($result);
                        SQL_FREERESULT($result);
@@ -238,7 +245,7 @@ WHERE mails_confirmed < %s", $REF, $REF));
                                'sw'  => $SW,
                                'id'  => $id,
                                'lvl' => $lvl,
-                               'per' => TRANSLATE_COMMA($perc),
+                               'per' => translateComma($perc),
                        );
 
                        // Load row template and switch color
@@ -264,7 +271,7 @@ WHERE mails_confirmed < %s", $REF, $REF));
                                        'sw'  => $SW,
                                        'id'  => $content['id'],
                                        'lvl' => $content['level'],
-                                       'per' => TRANSLATE_COMMA($content['percents']),
+                                       'per' => translateComma($content['percents']),
                                );
 
                                // Load row template and switch color