more warnings removed
[squirrelmail.git] / src / load_prefs.php
index 391ff21394bbb0314b8704ab59feb7701189314c..0380b4dec7b9b7c9379b7945e4fad8ce846da588 100644 (file)
@@ -8,6 +8,7 @@
     **  Loads preferences from the $username.pref file used by almost
     **  every other script in the source directory and alswhere.
     **
+    **  $Id$
     **/
 
    if (!isset($config_php))
    checkForPrefs($data_dir, $username);
 
    $chosen_theme = getPref($data_dir, $username, "chosen_theme");
-   if ((substr($chosen_theme, 0, 10) == "../config/")) {
-      $chosen_theme = substr($chosen_theme, 10);
-      $chosen_theme = "../themes/$chosen_theme";
+   $in_ary = false;
+   for ($i=0; $i < count($theme); $i++){
+         if ($theme[$i]["PATH"] == $chosen_theme) {
+                $in_ary = true;
+                break;
+         }
+   }
+   if (!$in_ary) {
+               $chosen_theme = "";
    }
 
    if ((isset($chosen_theme)) && (file_exists($chosen_theme))) {
@@ -53,7 +60,7 @@
       }
    }
 
-       session_register("theme_css");
+    if (!isset($download_php)) session_register("theme_css");
 
    $use_javascript_addr_book = getPref($data_dir, $username, "use_javascript_addr_book");
    if ($use_javascript_addr_book == "")
    $left_refresh = getPref($data_dir, $username, "left_refresh");
    if ($left_refresh == "")
       $left_refresh = false;
+
+   $sort = getPref($data_dir, $username, "sort");
+   if ($sort == "")
+      $sort = 6;
    
    /** Load up the Signature file **/
    if ($use_signature == true) {
       $message_highlight_list[$i]["value"] = $ary[2];
       $message_highlight_list[$i]["match_type"] = $ary[3];
    }
+
+   #index order lets you change the order of the message index
+   $order = getPref($data_dir, $username, "order1");
+   for ($i=1; $order; $i++) {
+      $index_order[$i] = $order;
+      $order = getPref($data_dir, $username, "order".($i+1));
+   }
+   if (!isset($index_order)) {
+      $index_order[1] = 1;
+      $index_order[2] = 2;
+      $index_order[3] = 3;
+      $index_order[4] = 5;
+      $index_order[5] = 4;
+   }
    
    $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
    if ($location_of_bar == '')
        $location_of_bar = 'left';
+       
+   $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons');
+   if ($location_of_buttons == '')
+       $location_of_buttons = 'between';
 
    do_hook("loading_prefs");