setConfig() will now delete config values if the second parameter is explicitly set to false
authorDan
Thu, 26 Feb 2009 01:06:58 -0500
changeset 842 f13bb4f21890
parent 841 83bb60402f51
child 843 4415e50e4e84
setConfig() will now delete config values if the second parameter is explicitly set to false
includes/functions.php
--- a/includes/functions.php	Thu Feb 26 01:04:27 2009 -0500
+++ b/includes/functions.php	Thu Feb 26 01:06:58 2009 -0500
@@ -53,6 +53,9 @@
   }
   
   $enano_config[$n] = $v;
+  if ( $v === false )
+    unset($enano_config[$n]);
+  
   $v = $db->escape($v);
 
   $e = $db->sql_query('DELETE FROM '.table_prefix.'config WHERE config_name=\''.$n.'\';');
@@ -61,10 +64,13 @@
     $db->_die('Error during generic setConfig() call row deletion.');
   }
 
-  $e = $db->sql_query('INSERT INTO '.table_prefix.'config(config_name, config_value) VALUES(\''.$n.'\', \''.$v.'\')');
-  if ( !$e )
-  {
-    $db->_die('Error during generic setConfig() call row insertion.');
+  if ( $v !== false )
+  {
+    $e = $db->sql_query('INSERT INTO '.table_prefix.'config(config_name, config_value) VALUES(\''.$n.'\', \''.$v.'\')');
+    if ( !$e )
+    {
+      $db->_die('Error during generic setConfig() call row insertion.');
+    }
   }
 }
 
@@ -497,6 +503,8 @@
     }
   }
   
+  ob_end_clean();
+  
   $output->set_title($lang->get('user_csrf_confirm_title'));
   $output->header();