Fixes for minor bugs pointed out by Tyler Akins.
[squirrelmail.git] / include / load_prefs.php
index e96d042b8dad99cd624fcbb302cdecb2d044b1dc..f300101c86bceea5e2cdad5a459b3650514f4632 100644 (file)
@@ -27,6 +27,10 @@ $color = ( !isset($color) ? array() : $color );
 
 $chosen_theme = getPref($data_dir, $username, 'chosen_theme');
 $found_theme = false;
+
+/* need to adjust $chosen_theme path with SM_PATH */
+$chosen_theme = preg_replace("/(\.\.\/){1,}/", SM_PATH, $chosen_theme);
+
 for ($i = 0; $i < count($theme); ++$i){
     if ($theme[$i]['PATH'] == $chosen_theme) {
         $found_theme = true;
@@ -63,8 +67,9 @@ if (isset($chosen_theme) && $found_theme && (file_exists($chosen_theme))) {
     }
 }
 
+
 if (!defined('download_php')) { 
-    session_register('theme_css'); 
+    sqsession_register($theme_css, 'theme_css'); 
 }
 
 $use_javascript_addr_book = getPref($data_dir, $username, 'use_javascript_addr_book', $default_use_javascript_addr_book);
@@ -88,6 +93,9 @@ $unseen_type =
 $unseen_notify =
     getPref($data_dir, $username, 'unseen_notify', $default_unseen_notify);
 
+$unseen_cum =
+    getPref($data_dir, $username, 'unseen_cum', false);
+
 $folder_prefix =
     getPref($data_dir, $username, 'folder_prefix', $default_folder_prefix);
 
@@ -150,15 +158,26 @@ $left_refresh = strtolower($left_refresh);
 $sort = getPref($data_dir, $username, 'sort', 6 );
 
 /** Load up the Signature file **/
-$signature_abs = $signature = getSig($data_dir, $username, "g");
-
-/* Highlight comes in with the form: name, color, header, value. */
-for ($i = 0; $hlt = getPref($data_dir, $username, "highlight$i"); ++$i) {
-    $highlight_array = explode(',', $hlt);
-    $message_highlight_list[$i]['name'] = $highlight_array[0];
-    $message_highlight_list[$i]['color'] = $highlight_array[1];
-    $message_highlight_list[$i]['value'] = $highlight_array[2];
-    $message_highlight_list[$i]['match_type'] = $highlight_array[3];
+$signature_abs = $signature = getSig($data_dir, $username, 'g');
+
+/* Message Highlighting Rules */
+$message_highlight_list = array();
+
+/* use new way of storing highlighting rules */
+if( $ser = getPref($data_dir, $username, 'hililist') ) {
+    $message_highlight_list = unserialize($ser);
+} else {
+    /* use old way */
+    for ($i = 0; $hlt = getPref($data_dir, $username, "highlight$i"); ++$i) {
+        $highlight_array = explode(',', $hlt);
+        $message_highlight_list[$i]['name'] = $highlight_array[0];
+        $message_highlight_list[$i]['color'] = $highlight_array[1];
+        $message_highlight_list[$i]['value'] = $highlight_array[2];
+        $message_highlight_list[$i]['match_type'] = $highlight_array[3];
+        removePref($data_dir, $username, "highlight$i");
+    }
+    /* store in new format for the next time */
+    setPref($data_dir, $username, 'hililist', serialize($message_highlight_list));
 }
 
 /* Index order lets you change the order of the message index */
@@ -236,6 +255,8 @@ $search_memory = getPref($data_dir, $username, 'search_memory', 0);
 
 $forward_cc = getPref($data_dir, $username, 'forward_cc', 0);
 
+$mailbox_select_style = getPref($data_dir, $username, 'mailbox_select_style', 0);
+
 do_hook('loading_prefs');
 
 ?>