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 require_once('../src/validate.php');
16 // ----------------------------------------------------------
17 // Following code should be removed in the next foo_once step
18 if (defined('load_prefs_php'))
20 define('load_prefs_php', true);
21 // ----------------------------------------------------------
23 global $theme, $chosen_theme, $color;
28 require_once('../functions/prefs.php');
29 require_once('../functions/plugin.php');
31 if (!isset($username))
33 checkForPrefs($data_dir, $username);
35 $chosen_theme = getPref($data_dir, $username, "chosen_theme");
37 for ($i=0; $i < count($theme); $i++
){
38 if ($theme[$i]["PATH"] == $chosen_theme) {
47 if (isset($chosen_theme) && $in_ary && (file_exists($chosen_theme))) {
48 @include_once
($chosen_theme);
50 if (isset($theme) && isset($theme[0]) && file_exists($theme[0]["PATH"])) {
51 @include_once
($theme[0]["PATH"]);
54 # I hard coded the theme as a failsafe if no themes were
55 # found. It makes no sense to cause the whole thing to exit
56 # just because themes were not found. This is the absolute
59 $color[0] = "#DCDCDC"; // (light gray) TitleBar
60 $color[1] = "#800000"; // (red)
61 $color[2] = "#CC0000"; // (light red) Warning/Error Messages
62 $color[3] = "#A0B8C8"; // (green-blue) Left Bar Background
63 $color[4] = "#FFFFFF"; // (white) Normal Background
64 $color[5] = "#FFFFCC"; // (light yellow) Table Headers
65 $color[6] = "#000000"; // (black) Text on left bar
66 $color[7] = "#0000CC"; // (blue) Links
67 $color[8] = "#000000"; // (black) Normal text
68 $color[9] = "#ABABAB"; // (mid-gray) Darker version of #0
69 $color[10] = "#666666"; // (dark gray) Darker version of #9
70 $color[11] = "#770000"; // (dark red) Special Folders color
74 if (!defined('download_php'))
75 session_register("theme_css");
77 global $use_javascript_addr_book;
78 $use_javascript_addr_book = getPref($data_dir, $username, "use_javascript_addr_book");
79 if ($use_javascript_addr_book == "")
80 $use_javascript_addr_book = $default_use_javascript_addr_book;
83 /** Load the user's sent folder preferences **/
84 global $move_to_sent, $move_to_trash;
85 $move_to_sent = getPref($data_dir, $username, "move_to_sent");
86 if ($move_to_sent == "")
87 $move_to_sent = $default_move_to_sent;
89 /** Load the user's trash folder preferences **/
90 $move_to_trash = getPref($data_dir, $username, "move_to_trash");
91 if ($move_to_trash == "")
92 $move_to_trash = $default_move_to_trash;
95 global $unseen_type, $unseen_notify;
96 $unseen_type = getPref($data_dir, $username, "unseen_type");
97 if ($default_unseen_type == "")
98 $default_unseen_type = 1;
99 if ($unseen_type == "")
100 $unseen_type = $default_unseen_type;
102 $unseen_notify = getPref($data_dir, $username, "unseen_notify");
103 if ($default_unseen_notify == "")
104 $default_unseen_notify = 2;
105 if ($unseen_notify == "")
106 $unseen_notify = $default_unseen_notify;
109 global $folder_prefix;
110 $folder_prefix = getPref($data_dir, $username, "folder_prefix");
111 if ($folder_prefix == "") {
112 $folder_prefix = $default_folder_prefix;
115 /** Load special folders **/
116 global $trash_folder, $sent_folder;
117 $new_trash_folder = getPref($data_dir, $username, "trash_folder");
118 if (($new_trash_folder == "") && ($move_to_trash == true)) {
119 $trash_folder = $folder_prefix . $trash_folder;
121 $trash_folder = $new_trash_folder;
124 /** Load special folders **/
125 $new_sent_folder = getPref($data_dir, $username, "sent_folder");
126 if (($new_sent_folder == "") && ($move_to_sent == true)) {
127 $sent_folder = $folder_prefix . $sent_folder;
129 $sent_folder = $new_sent_folder;
132 global $show_num, $wrap_at, $left_size;
133 $show_num = getPref($data_dir, $username, "show_num");
134 if ($show_num == "") {
138 $wrap_at = getPref($data_dir, $username, "wrap_at");
139 if ($wrap_at == "") {
141 } else if ($wrap_at < 15) {
145 $left_size = getPref($data_dir, $username, "left_size");
146 if ($left_size == "") {
147 if (isset($default_left_size)) {
148 $left_size = $default_left_size;
154 global $editor_size, $use_signature, $prefix_sig;
155 $editor_size = getPref($data_dir, $username, "editor_size");
156 if ($editor_size == "") {
161 $use_signature = getPref($data_dir, $username, "use_signature");
162 if ($use_signature == "") {
163 $use_signature = false;
166 $prefix_sig = getPref($data_dir, $username, "prefix_sig");
168 /* Load preferences for reply citation style. */
169 global $reply_citation_style, $reply_citation_start, $reply_citation_end;
171 $reply_citation_style = getPref($data_dir, $username, 'reply_citation_style');
172 if ($reply_citation_style == '') {
173 $reply_citation_style = 'none';
175 $reply_citation_start = getPref($data_dir, $username, 'reply_citation_start');
176 $reply_citation_end = getPref($data_dir, $username, 'reply_citation_end');
179 global $left_refresh, $sort;
180 $left_refresh = getPref($data_dir, $username, "left_refresh");
181 if ($left_refresh == "") {
182 $left_refresh = false;
185 $sort = getPref($data_dir, $username, "sort");
190 /** Load up the Signature file **/
191 global $signature_abs;
192 if ($use_signature == true) {
193 $signature_abs = $signature = getSig($data_dir, $username);
195 $signature_abs = getSig($data_dir, $username);
199 // highlightX comes in with the form: name,color,header,value
200 global $message_highlight_list;
201 for ($i=0; $hlt = getPref($data_dir, $username, "highlight$i"); $i++
) {
202 $ary = explode(",", $hlt);
203 $message_highlight_list[$i]["name"] = $ary[0];
204 $message_highlight_list[$i]["color"] = $ary[1];
205 $message_highlight_list[$i]["value"] = $ary[2];
206 $message_highlight_list[$i]["match_type"] = $ary[3];
210 #index order lets you change the order of the message index
212 $order = getPref($data_dir, $username, "order1");
213 for ($i=1; $order; $i++
) {
214 $index_order[$i] = $order;
215 $order = getPref($data_dir, $username, "order".($i+
1));
217 if (!isset($index_order)) {
225 global $alt_index_colors;
226 $alt_index_colors = getPref($data_dir, $username, 'alt_index_colors');
227 if ($alt_index_colors == 0) {
228 $alt_index_colors = false;
230 $alt_index_colors = true;
233 global $location_of_bar, $location_of_buttons;
234 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
235 if ($location_of_bar == '')
236 $location_of_bar = 'left';
238 $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons');
239 if ($location_of_buttons == '') {
240 $location_of_buttons = 'between';
243 global $collapse_folders, $show_html_default;
244 $collapse_folders = getPref($data_dir, $username, 'collapse_folders');
246 // show_html_default is a int value
247 $show_html_default = intval(getPref($data_dir, $username, 'show_html_default'));
249 do_hook("loading_prefs");