Menu moved to extension, index_delay should not have UNSIGNED
[mailer.git] / inc / modules / admin / admin-inc.php
index a1df0f22779c2760f020bae54e9a341dba6586b4..66a7223bd4abd1192e01dc9b0a51f277f56943e7 100644 (file)
@@ -544,7 +544,7 @@ function adminMenuSelectionBox_DEPRECATED ($mode, $default = '', $defid = '') {
 }
 
 // Wrapper for $_POST and adminSaveSettings
-function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement = 'config=0', $translateComma = array(), $alwaysAdd = false) {
+function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false) {
        // Get the array
        $postData = postRequestArray();
 
@@ -553,7 +553,7 @@ function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement
 }
 
 // Save settings to the database
-function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement = 'config=0', $translateComma = array(), $alwaysAdd = false) {
+function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false) {
        // Prepare all arrays, variables
        $DATA = array();
        $skip = false;
@@ -566,7 +566,7 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
                        convertSelectionsToTimestamp($postData, $DATA, $id, $skip);
 
                        // Shall we process this ID? It muss not be empty, of course
-                       if (($skip === false) && (!empty($id))) {
+                       if (($skip === false) && (!empty($id)) && (!isset($GLOBALS['skip_config'][$id]))) {
                                // Save this entry
                                $val = compileCode($val);
 
@@ -578,7 +578,7 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
 
                                // Shall we add numbers or strings?
                                $test = (float)$val;
-                               if ("".$val."" == ''.$test."") {
+                               if ('' . $val . '' == '' . $test . '') {
                                        // Add numbers
                                        $DATA[] = sprintf("`%s`=%s", $id, $test);
                                } else {
@@ -586,6 +586,9 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
                                        $DATA[] = sprintf("`%s`='%s'", $id, trim($val));
                                }
 
+                               // Do not add a config entry twice
+                               $GLOBALS['skip_config'][$id] = true;
+
                                // Update current configuration
                                setConfigEntry($id, $val);
                        } // END - if
@@ -608,9 +611,9 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
 
                // Generate SQL string
                $sql = sprintf("UPDATE `{?_MYSQL_PREFIX?}%s` SET %s WHERE %s LIMIT 1",
-               $tableName,
-               $DATA_UPDATE,
-               $whereStatement
+                       $tableName,
+                       $DATA_UPDATE,
+                       $whereStatement
                );
        } else {
                // Add Line (does only work with auto_increment!
@@ -622,14 +625,14 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
                } // END - foreach
 
                // Add both in one line
-               $KEYs = implode('', $KEYs);
+               $KEYs = implode('`, `', $KEYs);
                $values = implode(', ', $values);
 
                // Generate SQL string
-               $sql = sprintf("INSERT INTO {?_MYSQL_PREFIX?}%s (%s) VALUES (%s)",
-               $tableName,
-               $KEYs,
-               $values
+               $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}%s` (%s) VALUES (%s)",
+                       $tableName,
+                       $KEYs,
+                       $values
                );
        }