9716a90b4bef4da68a391f0e0740f3dc14647ebd
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('../src/validate.php');
24 include("../config/config.php");
25 include("../functions/prefs.php");
26 include("../functions/plugin.php");
28 if (!isset($username))
30 checkForPrefs($data_dir, $username);
32 $chosen_theme = getPref($data_dir, $username, "chosen_theme");
34 for ($i=0; $i < count($theme); $i++
){
35 if ($theme[$i]["PATH"] == $chosen_theme) {
44 if (isset($chosen_theme) && $in_ary && (file_exists($chosen_theme))) {
45 @include
($chosen_theme);
47 if (file_exists(isset($theme) && isset($theme[0]) && $theme[0]["PATH"])) {
48 @include
($theme[0]["PATH"]);
51 # I hard coded the theme as a failsafe if no themes were
52 # found. It makes no sense to cause the whole thing to exit
53 # just because themes were not found. This is the absolute
56 $color[0] = "#DCDCDC"; // (light gray) TitleBar
57 $color[1] = "#800000"; // (red)
58 $color[2] = "#CC0000"; // (light red) Warning/Error Messages
59 $color[3] = "#A0B8C8"; // (green-blue) Left Bar Background
60 $color[4] = "#FFFFFF"; // (white) Normal Background
61 $color[5] = "#FFFFCC"; // (light yellow) Table Headers
62 $color[6] = "#000000"; // (black) Text on left bar
63 $color[7] = "#0000CC"; // (blue) Links
64 $color[8] = "#000000"; // (black) Normal text
65 $color[9] = "#ABABAB"; // (mid-gray) Darker version of #0
66 $color[10] = "#666666"; // (dark gray) Darker version of #9
67 $color[11] = "#770000"; // (dark red) Special Folders color
71 if (!defined('download_php'))
72 session_register("theme_css");
74 global $use_javascript_addr_book;
75 $use_javascript_addr_book = getPref($data_dir, $username, "use_javascript_addr_book");
76 if ($use_javascript_addr_book == "")
77 $use_javascript_addr_book = $default_use_javascript_addr_book;
80 /** Load the user's sent folder preferences **/
81 global $move_to_sent, $move_to_trash;
82 $move_to_sent = getPref($data_dir, $username, "move_to_sent");
83 if ($move_to_sent == "")
84 $move_to_sent = $default_move_to_sent;
86 /** Load the user's trash folder preferences **/
87 $move_to_trash = getPref($data_dir, $username, "move_to_trash");
88 if ($move_to_trash == "")
89 $move_to_trash = $default_move_to_trash;
92 global $unseen_type, $unseen_notify;
93 $unseen_type = getPref($data_dir, $username, "unseen_type");
94 if ($default_unseen_type == "")
95 $default_unseen_type = 1;
96 if ($unseen_type == "")
97 $unseen_type = $default_unseen_type;
99 $unseen_notify = getPref($data_dir, $username, "unseen_notify");
100 if ($default_unseen_notify == "")
101 $default_unseen_notify = 2;
102 if ($unseen_notify == "")
103 $unseen_notify = $default_unseen_notify;
106 global $folder_prefix;
107 $folder_prefix = getPref($data_dir, $username, "folder_prefix");
108 if ($folder_prefix == "")
109 $folder_prefix = $default_folder_prefix;
112 /** Load special folders **/
113 global $trash_folder, $sent_folder;
114 $new_trash_folder = getPref($data_dir, $username, "trash_folder");
115 if (($new_trash_folder == "") && ($move_to_trash == true))
116 $trash_folder = $folder_prefix . $trash_folder;
118 $trash_folder = $new_trash_folder;
120 /** Load special folders **/
121 $new_sent_folder = getPref($data_dir, $username, "sent_folder");
122 if (($new_sent_folder == "") && ($move_to_sent == true))
123 $sent_folder = $folder_prefix . $sent_folder;
125 $sent_folder = $new_sent_folder;
128 global $show_num, $wrap_at, $left_size;
129 $show_num = getPref($data_dir, $username, "show_num");
133 $wrap_at = getPref($data_dir, $username, "wrap_at");
139 $left_size = getPref($data_dir, $username, "left_size");
140 if ($left_size == "") {
141 if (isset($default_left_size))
142 $left_size = $default_left_size;
148 global $editor_size, $use_signature, $prefix_sig;
149 $editor_size = getPref($data_dir, $username, "editor_size");
150 if ($editor_size == "")
153 $use_signature = getPref($data_dir, $username, "use_signature");
154 if ($use_signature == "")
155 $use_signature = false;
157 $prefix_sig = getPref($data_dir, $username, "prefix_sig");
158 if ($prefix_sig == "")
162 global $left_refresh, $sort;
163 $left_refresh = getPref($data_dir, $username, "left_refresh");
164 if ($left_refresh == "")
165 $left_refresh = false;
167 $sort = getPref($data_dir, $username, "sort");
172 /** Load up the Signature file **/
173 global $signature_abs;
174 if ($use_signature == true) {
175 $signature_abs = $signature = getSig($data_dir, $username);
177 $signature_abs = getSig($data_dir, $username);
181 // highlightX comes in with the form: name,color,header,value
182 global $message_highlight_list;
183 for ($i=0; $hlt = getPref($data_dir, $username, "highlight$i"); $i++
) {
184 $ary = explode(",", $hlt);
185 $message_highlight_list[$i]["name"] = $ary[0];
186 $message_highlight_list[$i]["color"] = $ary[1];
187 $message_highlight_list[$i]["value"] = $ary[2];
188 $message_highlight_list[$i]["match_type"] = $ary[3];
192 #index order lets you change the order of the message index
194 $order = getPref($data_dir, $username, "order1");
195 for ($i=1; $order; $i++
) {
196 $index_order[$i] = $order;
197 $order = getPref($data_dir, $username, "order".($i+
1));
199 if (!isset($index_order)) {
207 global $alt_index_colors;
208 $alt_index_colors = getPref($data_dir, $username, 'alt_index_colors');
209 if ($alt_index_colors === 0) {
210 $alt_index_colors = false;
212 $alt_index_colors = true;
216 global $location_of_bar, $location_of_buttons;
217 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
218 if ($location_of_bar == '')
219 $location_of_bar = 'left';
221 $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons');
222 if ($location_of_buttons == '')
223 $location_of_buttons = 'between';
226 global $collapse_folders, $show_html_default;
227 $collapse_folders = getPref($data_dir, $username, 'collapse_folders');
229 $show_html_default = getPref($data_dir, $username, 'show_html_default');
231 do_hook("loading_prefs");