]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-config_points.php
Project continued:
[mailer.git] / inc / modules / admin / what-config_points.php
index f444ac4459569a27946b6757f52a1b6dcfad68ec..b50f23eb2c40ce206061e3b55e4fbbf1b3325b57 100644 (file)
@@ -79,7 +79,7 @@ if (isFormSent()) {
                case 'ref':
                        switch (getRequestElement('do')) {
                                case 'add':
-                                       addSql("INSERT INTO `{?_MYSQL_PREFIX?}_refdepths` (`level`,`percents`) VALUES ('".bigintval(postRequestElement('level'))."','".bigintval(postRequestElement('percents'))."')");
+                                       addSql("INSERT INTO `{?_MYSQL_PREFIX?}_refdepths` (`level`, `percents`) VALUES ('".bigintval(postRequestElement('level'))."','".bigintval(postRequestElement('percents'))."')");
                                        break;
 
                                case 'edit': // Change entries
@@ -107,10 +107,7 @@ if (isFormSent()) {
                        } // END - switch
 
                        // Update cache file
-                       // @TODO Rewrite this to a filter
-                       if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
-                               if ($GLOBALS['cache_instance']->loadCacheFile('refdepths')) $GLOBALS['cache_instance']->removeCacheFile();
-                       } // END - if
+                       rebuildCache('refdepths', 'refdepths');
                        break;
 
                case 'settings':
@@ -137,13 +134,10 @@ WHERE
                        break;
        } // END - switch
 
-       if ((isSqlsValid()) && (isSqlsValid())) {
-               // Is INSERT there?
-               if (isInString('INSERT', $GLOBALS['sqls'][0])) {
-                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE `level`=%s LIMIT 1",
-                               array(bigintval(postRequestElement('level'))), __FILE__, __LINE__);
-                       SQL_FREERESULT($result);
-               } // END - if
+       // Is there an array?
+       if ((getRequestElement('sub') != 'points') && (isSqlsValid())) {
+               // Default is failed-message
+               $message = '<span class="bad">{--SETTINGS_NOT_SAVED--}</span>';
 
                if (countSqls() > 0) {
                        // Run all SQL commands
@@ -154,14 +148,11 @@ WHERE
 
                        // Destroy config cache file here...
                        rebuildCache('config', 'config');
-               } else {
-                       // Prepare failed-message
-                       $message = '<span class="bad">{--SETTINGS_NOT_SAVED--}</span>';
-               }
+               } // END - if
 
                // Remove SQL queries
                unsetSqls();
-       }
+       } // END - if
 
        // Shall we display a message?
        if (!empty($message)) {
@@ -178,42 +169,42 @@ WHERE
        } // END - foreach
 
        // Load template
-       loadTemplate('admin_config_point_settings', false, $content);
+       loadTemplate('admin_config_point_settings', FALSE, $content);
 } elseif (getRequestElement('sub') == 'ref') {
        // 12          3     32    2                        3321
        if ((isFormSent('delete')) && (ifPostContainsSelections())) {
                // Delete entries
                $OUT = '';
                foreach (postRequestElement('sel') as $id => $value) {
-                       $result = SQL_QUERY_ESC("SELECT `id`,`level`,`percents` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE `id`=%s LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT `id`, `level`, `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE `id`=%s LIMIT 1",
                                array(bigintval($id)), __FILE__, __LINE__);
                        $content = SQL_FETCHARRAY($result);
                        SQL_FREERESULT($result);
 
                        // Load row template and switch color
-                       $OUT .= loadTemplate('admin_delete_reflevel_row', true, $content);
+                       $OUT .= loadTemplate('admin_delete_reflevel_row', TRUE, $content);
                } // END - foreach
 
                // Load main template
-               loadTemplate('admin_delete_reflevel', false, $OUT);
+               loadTemplate('admin_delete_reflevel', FALSE, $OUT);
        } elseif ((isFormSent('edit')) && (ifPostContainsSelections())) {
                // Edit entries
                $OUT = '';
                foreach (postRequestElement('sel') as $id => $value) {
-                       $result = SQL_QUERY_ESC("SELECT `id`,`level`,`percents` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE `id`=%s LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT `id`, `level`, `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE `id`=%s LIMIT 1",
                                array(bigintval($id)), __FILE__, __LINE__);
                        $content = SQL_FETCHARRAY($result);
                        SQL_FREERESULT($result);
 
                        // Load row template and switch color
-                       $OUT .= loadTemplate('admin_edit_reflevel_row', true, $content);
+                       $OUT .= loadTemplate('admin_edit_reflevel_row', TRUE, $content);
                } // END - foreach
 
                // Load main template
-               loadTemplate('admin_edit_reflevel', false, $OUT);
+               loadTemplate('admin_edit_reflevel', FALSE, $OUT);
        } else {
                // Referral levels
-               $result = SQL_QUERY("SELECT `id`,`level`,`percents` FROM `{?_MYSQL_PREFIX?}_refdepths` ORDER BY `level` ASC", __FILE__, __LINE__);
+               $result = SQL_QUERY("SELECT `id`, `level`, `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` ORDER BY `level` ASC", __FILE__, __LINE__);
                if (!SQL_HASZERONUMS($result)) {
                        // Make referral levels editable and deletable
                        $OUT = '';
@@ -221,14 +212,14 @@ WHERE
                        // List already existing categories for editing
                        while ($content = SQL_FETCHARRAY($result)) {
                                // Load row template and switch color
-                               $OUT .= loadTemplate('admin_list_reflevel_row', true, $content);
+                               $OUT .= loadTemplate('admin_list_reflevel_row', TRUE, $content);
                        } // END - while
 
                        // Free memory
                        SQL_FREERESULT($result);
 
                        // Load main template
-                       loadTemplate('admin_list_reflevel', false, $OUT);
+                       loadTemplate('admin_list_reflevel', FALSE, $OUT);
                }
 
                // Form for adding new referral levels