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 (defined('load_prefs_php'))
16 define('load_prefs_php', true);
18 global $theme, $chosen_theme, $color;
23 include("../functions/prefs.php");
24 include("../functions/plugin.php");
26 if (!isset($username))
28 checkForPrefs($data_dir, $username);
30 $chosen_theme = getPref($data_dir, $username, "chosen_theme");
32 for ($i=0; $i < count($theme); $i++
){
33 if ($theme[$i]["PATH"] == $chosen_theme) {
42 if (isset($chosen_theme) && $in_ary && (file_exists($chosen_theme))) {
43 @include
($chosen_theme);
45 if (file_exists(isset($theme) && isset($theme[0]) && $theme[0]["PATH"])) {
46 @include
($theme[0]["PATH"]);
49 # I hard coded the theme as a failsafe if no themes were
50 # found. It makes no sense to cause the whole thing to exit
51 # just because themes were not found. This is the absolute
54 $color[0] = "#DCDCDC"; // (light gray) TitleBar
55 $color[1] = "#800000"; // (red)
56 $color[2] = "#CC0000"; // (light red) Warning/Error Messages
57 $color[3] = "#A0B8C8"; // (green-blue) Left Bar Background
58 $color[4] = "#FFFFFF"; // (white) Normal Background
59 $color[5] = "#FFFFCC"; // (light yellow) Table Headers
60 $color[6] = "#000000"; // (black) Text on left bar
61 $color[7] = "#0000CC"; // (blue) Links
62 $color[8] = "#000000"; // (black) Normal text
63 $color[9] = "#ABABAB"; // (mid-gray) Darker version of #0
64 $color[10] = "#666666"; // (dark gray) Darker version of #9
65 $color[11] = "#770000"; // (dark red) Special Folders color
69 if (!defined('download_php'))
70 session_register("theme_css");
72 global $use_javascript_addr_book;
73 $use_javascript_addr_book = getPref($data_dir, $username, "use_javascript_addr_book");
74 if ($use_javascript_addr_book == "")
75 $use_javascript_addr_book = $default_use_javascript_addr_book;
78 /** Load the user's sent folder preferences **/
79 global $move_to_sent, $move_to_trash;
80 $move_to_sent = getPref($data_dir, $username, "move_to_sent");
81 if ($move_to_sent == "")
82 $move_to_sent = $default_move_to_sent;
84 /** Load the user's trash folder preferences **/
85 $move_to_trash = getPref($data_dir, $username, "move_to_trash");
86 if ($move_to_trash == "")
87 $move_to_trash = $default_move_to_trash;
90 global $unseen_type, $unseen_notify;
91 $unseen_type = getPref($data_dir, $username, "unseen_type");
92 if ($default_unseen_type == "")
93 $default_unseen_type = 1;
94 if ($unseen_type == "")
95 $unseen_type = $default_unseen_type;
97 $unseen_notify = getPref($data_dir, $username, "unseen_notify");
98 if ($default_unseen_notify == "")
99 $default_unseen_notify = 2;
100 if ($unseen_notify == "")
101 $unseen_notify = $default_unseen_notify;
104 global $folder_prefix;
105 $folder_prefix = getPref($data_dir, $username, "folder_prefix");
106 if ($folder_prefix == "")
107 $folder_prefix = $default_folder_prefix;
110 /** Load special folders **/
111 global $trash_folder, $sent_folder;
112 $new_trash_folder = getPref($data_dir, $username, "trash_folder");
113 if (($new_trash_folder == "") && ($move_to_trash == true))
114 $trash_folder = $folder_prefix . $trash_folder;
116 $trash_folder = $new_trash_folder;
118 /** Load special folders **/
119 $new_sent_folder = getPref($data_dir, $username, "sent_folder");
120 if (($new_sent_folder == "") && ($move_to_sent == true))
121 $sent_folder = $folder_prefix . $sent_folder;
123 $sent_folder = $new_sent_folder;
126 global $show_num, $wrap_at, $left_size;
127 $show_num = getPref($data_dir, $username, "show_num");
131 $wrap_at = getPref($data_dir, $username, "wrap_at");
137 $left_size = getPref($data_dir, $username, "left_size");
138 if ($left_size == "") {
139 if (isset($default_left_size))
140 $left_size = $default_left_size;
146 global $editor_size, $use_signature, $prefix_sig;
147 $editor_size = getPref($data_dir, $username, "editor_size");
148 if ($editor_size == "")
151 $use_signature = getPref($data_dir, $username, "use_signature");
152 if ($use_signature == "")
153 $use_signature = false;
155 $prefix_sig = getPref($data_dir, $username, "prefix_sig");
156 if ($prefix_sig == "")
160 global $left_refresh, $sort;
161 $left_refresh = getPref($data_dir, $username, "left_refresh");
162 if ($left_refresh == "")
163 $left_refresh = false;
165 $sort = getPref($data_dir, $username, "sort");
170 /** Load up the Signature file **/
171 global $signature_abs;
172 if ($use_signature == true) {
173 $signature_abs = $signature = getSig($data_dir, $username);
175 $signature_abs = getSig($data_dir, $username);
179 // highlightX comes in with the form: name,color,header,value
180 global $message_highlight_list;
181 for ($i=0; $hlt = getPref($data_dir, $username, "highlight$i"); $i++
) {
182 $ary = explode(",", $hlt);
183 $message_highlight_list[$i]["name"] = $ary[0];
184 $message_highlight_list[$i]["color"] = $ary[1];
185 $message_highlight_list[$i]["value"] = $ary[2];
186 $message_highlight_list[$i]["match_type"] = $ary[3];
190 #index order lets you change the order of the message index
192 $order = getPref($data_dir, $username, "order1");
193 for ($i=1; $order; $i++
) {
194 $index_order[$i] = $order;
195 $order = getPref($data_dir, $username, "order".($i+
1));
197 if (!isset($index_order)) {
205 global $alt_index_colors;
206 $alt_index_colors = getPref($data_dir, $username, 'alt_index_colors');
207 if ($alt_index_colors === 0) {
208 $alt_index_colors = false;
210 $alt_index_colors = true;
214 global $location_of_bar, $location_of_buttons;
215 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
216 if ($location_of_bar == '')
217 $location_of_bar = 'left';
219 $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons');
220 if ($location_of_buttons == '')
221 $location_of_buttons = 'between';
224 global $collapse_folders, $show_html_default;
225 $collapse_folders = getPref($data_dir, $username, 'collapse_folders');
227 $show_html_default = getPref($data_dir, $username, 'show_html_default');
229 do_hook("loading_prefs");