Sig Prefix fix (forgot getPref)
[squirrelmail.git] / src / load_prefs.php
CommitLineData
59177427 1<?php
ef870322 2 /**
3 ** load_prefs.php
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** Loads preferences from the $username.pref file used by almost
9 ** every other script in the source directory and alswhere.
10 **
245a6892 11 ** $Id$
ef870322 12 **/
13
37df47f5 14 if (!isset($config_php))
15 include("../config/config.php");
d30d79f2 16 if (!isset($prefs_php))
17 include("../functions/prefs.php");
6b638171 18 if (!isset($plugin_php))
19 include("../functions/plugin.php");
37df47f5 20
21 $load_prefs_php = true;
ceac7a2f 22 if (!isset($username))
23 $username = '';
b4da6659 24 checkForPrefs($data_dir, $username);
25
d0747e26 26 $chosen_theme = getPref($data_dir, $username, "chosen_theme");
47f9c368 27 $in_ary = false;
28 for ($i=0; $i < count($theme); $i++){
29 if ($theme[$i]["PATH"] == $chosen_theme) {
30 $in_ary = true;
31 break;
32 }
33 }
34 if (!$in_ary) {
35 $chosen_theme = "";
390372b4 36 }
d3cdb279 37
f3d17401 38 if ((isset($chosen_theme)) && (file_exists($chosen_theme))) {
d3cdb279 39 require("$chosen_theme");
40 } else {
f3d17401 41 if (file_exists($theme[0]["PATH"])) {
42 require($theme[0]["PATH"]);
43 } else {
98fe1e9f 44 #
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
74a7d5b0 47 # just because themes were not found. This is the absolute
98fe1e9f 48 # last resort.
49 #
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
f3d17401 62 }
d3cdb279 63 }
11307a4c 64
245a6892 65 if (!isset($download_php)) session_register("theme_css");
2de8df87 66
3806fa52 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;
70
71
1573e796 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;
76
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;
81
82
24fc5dd2 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;
88
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;
94
95
1e0628fb 96 $folder_prefix = getPref($data_dir, $username, "folder_prefix");
97 if ($folder_prefix == "")
98 $folder_prefix = $default_folder_prefix;
99
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;
104 else
105 $trash_folder = $new_trash_folder;
106
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;
111 else
112 $sent_folder = $new_sent_folder;
11307a4c 113
9c83f905 114 $show_num = getPref($data_dir, $username, "show_num");
115 if ($show_num == "")
116 $show_num = 25;
117
11307a4c 118 $wrap_at = getPref($data_dir, $username, "wrap_at");
119 if ($wrap_at == "")
120 $wrap_at = 86;
7aaa81fc 121 if ($wrap_at < 15)
122 $wrap_at = 15;
11307a4c 123
2848c630 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;
128 else
129 $left_size = 200;
130 }
131
11307a4c 132 $editor_size = getPref($data_dir, $username, "editor_size");
133 if ($editor_size == "")
134 $editor_size = 76;
f804972b 135
136 $use_signature = getPref($data_dir, $username, "use_signature");
137 if ($use_signature == "")
138 $use_signature = false;
139
025deae0 140 $prefix_sig = getPref($data_dir, $username, "prefix_sig");
141 if ($prefix_sig == "")
142 $prefix_sig = false;
143
469eb37b 144 $left_refresh = getPref($data_dir, $username, "left_refresh");
145 if ($left_refresh == "")
146 $left_refresh = false;
5c54e435 147
148 $sort = getPref($data_dir, $username, "sort");
149 if ($sort == "")
150 $sort = 6;
469eb37b 151
f804972b 152 /** Load up the Signature file **/
153 if ($use_signature == true) {
c36ed9cf 154 $signature_abs = $signature = getSig($data_dir, $username);
f804972b 155 } else {
c36ed9cf 156 $signature_abs = getSig($data_dir, $username);
f804972b 157 }
636e611c 158
9d157cec 159 // highlightX comes in with the form: name,color,header,value
160 for ($i=0; $hlt = getPref($data_dir, $username, "highlight$i"); $i++) {
161 $ary = explode(",", $hlt);
162 $message_highlight_list[$i]["name"] = $ary[0];
163 $message_highlight_list[$i]["color"] = $ary[1];
164 $message_highlight_list[$i]["value"] = $ary[2];
3e69e88b 165 $message_highlight_list[$i]["match_type"] = $ary[3];
9d157cec 166 }
8e265988 167
168 #index order lets you change the order of the message index
169 $order = getPref($data_dir, $username, "order1");
170 for ($i=1; $order; $i++) {
171 $index_order[$i] = $order;
172 $order = getPref($data_dir, $username, "order".($i+1));
173 }
a7ea7540 174 if (!isset($index_order)) {
8e265988 175 $index_order[1] = 1;
176 $index_order[2] = 2;
177 $index_order[3] = 3;
178 $index_order[4] = 5;
179 $index_order[5] = 4;
180 }
9a732bb6 181
182 $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
183 if ($location_of_bar == '')
184 $location_of_bar = 'left';
441f2d33 185
186 $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons');
187 if ($location_of_buttons == '')
188 $location_of_buttons = 'between';
c36ed9cf 189
6b638171 190 do_hook("loading_prefs");
b731cd83 191
11307a4c 192?>