Serialize option types whose values are not scalar. At first, I strongly considered...
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 6 Jan 2008 05:58:24 +0000 (05:58 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 6 Jan 2008 05:58:24 +0000 (05:58 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12876 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/options.php

index f593e1a..6647bd6 100644 (file)
@@ -526,16 +526,29 @@ class SquirrelOption {
 } /* End of SquirrelOption class*/
 
 /**
- * Saves option
+ * Saves the option value (this is the default save function
+ * unless overridden by the user)
+ *
  * @param object $option object that holds option name and new_value
  */
 function save_option($option) {
+
+    // Can't save the pref if we don't have the username
+    //
     if ( !sqgetGlobalVar('username', $username, SQ_SESSION ) ) {
-        /* Can't save the pref if we don't have the username */
         return;
     }
+
     global $data_dir;
-    setPref($data_dir, $username, $option->name, $option->new_value);
+
+    // Certain option types need to be serialized because
+    // they are not scalar
+    //
+    if ($option->type == SMOPT_TYPE_FLDRLIST_MULTI)
+        setPref($data_dir, $username, $option->name, serialize($option->new_value));
+    else
+        setPref($data_dir, $username, $option->name, $option->new_value);
+
 }
 
 /**