5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
8 ** Loads preferences from the $username.pref file used by almost
9 ** every other script in the source directory and alswhere.
14 if (!isset($config_php))
15 include("../config/config.php");
16 if (!isset($prefs_php))
17 include("../functions/prefs.php");
18 if (!isset($plugin_php))
19 include("../functions/plugin.php");
21 $load_prefs_php = true;
22 if (!isset($username))
24 checkForPrefs($data_dir, $username);
26 $chosen_theme = getPref($data_dir, $username, "chosen_theme");
28 for ($i=0; $i < count($theme); $i++
){
29 if ($theme[$i]["PATH"] == $chosen_theme) {
38 if ((isset($chosen_theme)) && (file_exists($chosen_theme))) {
39 require("$chosen_theme");
41 if (file_exists($theme[0]["PATH"])) {
42 require($theme[0]["PATH"]);
45 # I hard coded the theme as a last resort if no themes were
46 # found. It makes no sense to cause the whole thing to exit
47 # just because themes were not found. This is the absolute
50 $color[0] = "#DCDCDC"; // (light gray) TitleBar
51 $color[1] = "#800000"; // (red)
52 $color[2] = "#CC0000"; // (light red) Warning/Error Messages
53 $color[3] = "#A0B8C8"; // (green-blue) Left Bar Background
54 $color[4] = "#FFFFFF"; // (white) Normal Background
55 $color[5] = "#FFFFCC"; // (light yellow) Table Headers
56 $color[6] = "#000000"; // (black) Text on left bar
57 $color[7] = "#0000CC"; // (blue) Links
58 $color[8] = "#000000"; // (black) Normal text
59 $color[9] = "#ABABAB"; // (mid-gray) Darker version of #0
60 $color[10] = "#666666"; // (dark gray) Darker version of #9
61 $color[11] = "#770000"; // (dark red) Special Folders color
65 if (!isset($download_php)) session_register("theme_css");
67 $use_javascript_addr_book = getPref($data_dir, $username, "use_javascript_addr_book");
68 if ($use_javascript_addr_book == "")
69 $use_javascript_addr_book = $default_use_javascript_addr_book;
72 /** Load the user's sent folder preferences **/
73 $move_to_sent = getPref($data_dir, $username, "move_to_sent");
74 if ($move_to_sent == "")
75 $move_to_sent = $default_move_to_sent;
77 /** Load the user's trash folder preferences **/
78 $move_to_trash = getPref($data_dir, $username, "move_to_trash");
79 if ($move_to_trash == "")
80 $move_to_trash = $default_move_to_trash;
83 $unseen_type = getPref($data_dir, $username, "unseen_type");
84 if ($default_unseen_type == "")
85 $default_unseen_type = 1;
86 if ($unseen_type == "")
87 $unseen_type = $default_unseen_type;
89 $unseen_notify = getPref($data_dir, $username, "unseen_notify");
90 if ($default_unseen_notify == "")
91 $default_unseen_notify = 2;
92 if ($unseen_notify == "")
93 $unseen_notify = $default_unseen_notify;
96 $folder_prefix = getPref($data_dir, $username, "folder_prefix");
97 if ($folder_prefix == "")
98 $folder_prefix = $default_folder_prefix;
100 /** Load special folders **/
101 $new_trash_folder = getPref($data_dir, $username, "trash_folder");
102 if (($new_trash_folder == "") && ($move_to_trash == true))
103 $trash_folder = $folder_prefix . $trash_folder;
105 $trash_folder = $new_trash_folder;
107 /** Load special folders **/
108 $new_sent_folder = getPref($data_dir, $username, "sent_folder");
109 if (($new_sent_folder == "") && ($move_to_sent == true))
110 $sent_folder = $folder_prefix . $sent_folder;
112 $sent_folder = $new_sent_folder;
114 $show_num = getPref($data_dir, $username, "show_num");
118 $wrap_at = getPref($data_dir, $username, "wrap_at");
124 $left_size = getPref($data_dir, $username, "left_size");
125 if ($left_size == "") {
126 if (isset($default_left_size))
127 $left_size = $default_left_size;
132 $editor_size = getPref($data_dir, $username, "editor_size");
133 if ($editor_size == "")
136 $use_signature = getPref($data_dir, $username, "use_signature");
137 if ($use_signature == "")
138 $use_signature = false;
140 $left_refresh = getPref($data_dir, $username, "left_refresh");
141 if ($left_refresh == "")
142 $left_refresh = false;
144 $sort = getPref($data_dir, $username, "sort");
148 /** Load up the Signature file **/
149 if ($use_signature == true) {
150 $signature_abs = $signature = getSig($data_dir, $username);
152 $signature_abs = getSig($data_dir, $username);
155 // highlightX comes in with the form: name,color,header,value
156 for ($i=0; $hlt = getPref($data_dir, $username, "highlight$i"); $i++
) {
157 $ary = explode(",", $hlt);
158 $message_highlight_list[$i]["name"] = $ary[0];
159 $message_highlight_list[$i]["color"] = $ary[1];
160 $message_highlight_list[$i]["value"] = $ary[2];
161 $message_highlight_list[$i]["match_type"] = $ary[3];
164 #index order lets you change the order of the message index
165 $order = getPref($data_dir, $username, "order1");
166 for ($i=1; $order; $i++
) {
167 $index_order[$i] = $order;
168 $order = getPref($data_dir, $username, "order".($i+
1));
170 if (!isset($index_order)) {
178 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
179 if ($location_of_bar == '')
180 $location_of_bar = 'left';
182 $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons');
183 if ($location_of_buttons == '')
184 $location_of_buttons = 'between';
186 $collapse_folders = getPref($data_dir, $username, 'collapse_folders');
188 do_hook("loading_prefs");