7c9857f9753c1f2d42fddee3e372c4f0c2709171
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.
13 if (!isset($config_php))
14 include("../config/config.php");
15 if (!isset($prefs_php))
16 include("../functions/prefs.php");
17 if (!isset($plugin_php))
18 include("../functions/plugin.php");
20 $load_prefs_php = true;
21 checkForPrefs($data_dir, $username);
23 $chosen_theme = getPref($data_dir, $username, "chosen_theme");
24 if ((substr($chosen_theme, 0, 10) == "../config/")) {
25 $chosen_theme = substr($chosen_theme, 10);
26 $chosen_theme = "../themes/$chosen_theme";
29 if ((isset($chosen_theme)) && (file_exists($chosen_theme))) {
30 require("$chosen_theme");
32 if (file_exists($theme[0]["PATH"])) {
33 require($theme[0]["PATH"]);
36 # I hard coded the theme as a last resort if no themes were
37 # found. It makes no sense to cause the whole thing to exit
38 # just because themes were not found. This is the absolute
41 $color[0] = "#DCDCDC"; // (light gray) TitleBar
42 $color[1] = "#800000"; // (red)
43 $color[2] = "#CC0000"; // (light red) Warning/Error Messages
44 $color[3] = "#A0B8C8"; // (green-blue) Left Bar Background
45 $color[4] = "#FFFFFF"; // (white) Normal Background
46 $color[5] = "#FFFFCC"; // (light yellow) Table Headers
47 $color[6] = "#000000"; // (black) Text on left bar
48 $color[7] = "#0000CC"; // (blue) Links
49 $color[8] = "#000000"; // (black) Normal text
50 $color[9] = "#ABABAB"; // (mid-gray) Darker version of #0
51 $color[10] = "#666666"; // (dark gray) Darker version of #9
52 $color[11] = "#770000"; // (dark red) Special Folders color
56 session_register("theme_css");
58 $use_javascript_addr_book = getPref($data_dir, $username, "use_javascript_addr_book");
59 if ($use_javascript_addr_book == "")
60 $use_javascript_addr_book = $default_use_javascript_addr_book;
63 /** Load the user's sent folder preferences **/
64 $move_to_sent = getPref($data_dir, $username, "move_to_sent");
65 if ($move_to_sent == "")
66 $move_to_sent = $default_move_to_sent;
68 /** Load the user's trash folder preferences **/
69 $move_to_trash = getPref($data_dir, $username, "move_to_trash");
70 if ($move_to_trash == "")
71 $move_to_trash = $default_move_to_trash;
74 $unseen_type = getPref($data_dir, $username, "unseen_type");
75 if ($default_unseen_type == "")
76 $default_unseen_type = 1;
77 if ($unseen_type == "")
78 $unseen_type = $default_unseen_type;
80 $unseen_notify = getPref($data_dir, $username, "unseen_notify");
81 if ($default_unseen_notify == "")
82 $default_unseen_notify = 2;
83 if ($unseen_notify == "")
84 $unseen_notify = $default_unseen_notify;
87 $folder_prefix = getPref($data_dir, $username, "folder_prefix");
88 if ($folder_prefix == "")
89 $folder_prefix = $default_folder_prefix;
91 /** Load special folders **/
92 $new_trash_folder = getPref($data_dir, $username, "trash_folder");
93 if (($new_trash_folder == "") && ($move_to_trash == true))
94 $trash_folder = $folder_prefix . $trash_folder;
96 $trash_folder = $new_trash_folder;
98 /** Load special folders **/
99 $new_sent_folder = getPref($data_dir, $username, "sent_folder");
100 if (($new_sent_folder == "") && ($move_to_sent == true))
101 $sent_folder = $folder_prefix . $sent_folder;
103 $sent_folder = $new_sent_folder;
105 $show_num = getPref($data_dir, $username, "show_num");
109 $wrap_at = getPref($data_dir, $username, "wrap_at");
115 $left_size = getPref($data_dir, $username, "left_size");
116 if ($left_size == "") {
117 if (isset($default_left_size))
118 $left_size = $default_left_size;
123 $editor_size = getPref($data_dir, $username, "editor_size");
124 if ($editor_size == "")
127 $use_signature = getPref($data_dir, $username, "use_signature");
128 if ($use_signature == "")
129 $use_signature = false;
131 $left_refresh = getPref($data_dir, $username, "left_refresh");
132 if ($left_refresh == "")
133 $left_refresh = false;
135 $sort = getPref($data_dir, $username, "sort");
139 /** Load up the Signature file **/
140 if ($use_signature == true) {
141 $signature_abs = $signature = getSig($data_dir, $username);
143 $signature_abs = getSig($data_dir, $username);
146 // highlightX comes in with the form: name,color,header,value
147 for ($i=0; $hlt = getPref($data_dir, $username, "highlight$i"); $i++
) {
148 $ary = explode(",", $hlt);
149 $message_highlight_list[$i]["name"] = $ary[0];
150 $message_highlight_list[$i]["color"] = $ary[1];
151 $message_highlight_list[$i]["value"] = $ary[2];
152 $message_highlight_list[$i]["match_type"] = $ary[3];
155 #index order lets you change the order of the message index
156 $order = getPref($data_dir, $username, "order1");
157 for ($i=1; $order; $i++
) {
158 $index_order[$i] = $order;
159 $order = getPref($data_dir, $username, "order".($i+
1));
169 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
170 if ($location_of_bar == '')
171 $location_of_bar = 'left';
173 $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons');
174 if ($location_of_buttons == '')
175 $location_of_buttons = 'between';
177 do_hook("loading_prefs");