Fix issue not allowing save of boolean prefs that default to SMPREF_ON
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 14 Mar 2008 09:27:32 +0000 (09:27 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 14 Mar 2008 09:27:32 +0000 (09:27 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13036 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/options.php

index 0bca18e..fb0d8aa 100644 (file)
@@ -784,6 +784,14 @@ function save_option($option) {
     } else if ($option->is_multiple_valued())
         setPref($data_dir, $username, $option->name, serialize($option->new_value));
 
+    // Checkboxes, when unchecked, don't submit anything in
+    // the POST, so set to SMPREF_OFF if not found
+    //
+    else if (($option->type == SMOPT_TYPE_BOOLEAN
+           || $option->type == SMOPT_TYPE_BOOLEAN_CHECKBOX)
+          && empty($option->new_value)) 
+        setPref($data_dir, $username, $option->name, SMPREF_OFF);
+
     else
         setPref($data_dir, $username, $option->name, $option->new_value);