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 | ** |
11 | **/ |
12 | |
37df47f5 |
13 | if (!isset($config_php)) |
14 | include("../config/config.php"); |
d30d79f2 |
15 | if (!isset($prefs_php)) |
16 | include("../functions/prefs.php"); |
6b638171 |
17 | if (!isset($plugin_php)) |
18 | include("../functions/plugin.php"); |
37df47f5 |
19 | |
20 | $load_prefs_php = true; |
b4da6659 |
21 | checkForPrefs($data_dir, $username); |
22 | |
d0747e26 |
23 | $chosen_theme = getPref($data_dir, $username, "chosen_theme"); |
47f9c368 |
24 | $in_ary = false; |
25 | for ($i=0; $i < count($theme); $i++){ |
26 | if ($theme[$i]["PATH"] == $chosen_theme) { |
27 | $in_ary = true; |
28 | break; |
29 | } |
30 | } |
31 | if (!$in_ary) { |
32 | $chosen_theme = ""; |
390372b4 |
33 | } |
d3cdb279 |
34 | |
f3d17401 |
35 | if ((isset($chosen_theme)) && (file_exists($chosen_theme))) { |
d3cdb279 |
36 | require("$chosen_theme"); |
37 | } else { |
f3d17401 |
38 | if (file_exists($theme[0]["PATH"])) { |
39 | require($theme[0]["PATH"]); |
40 | } else { |
98fe1e9f |
41 | # |
42 | # I hard coded the theme as a last resort if no themes were |
43 | # found. It makes no sense to cause the whole thing to exit |
74a7d5b0 |
44 | # just because themes were not found. This is the absolute |
98fe1e9f |
45 | # last resort. |
46 | # |
47 | $color[0] = "#DCDCDC"; // (light gray) TitleBar |
48 | $color[1] = "#800000"; // (red) |
49 | $color[2] = "#CC0000"; // (light red) Warning/Error Messages |
50 | $color[3] = "#A0B8C8"; // (green-blue) Left Bar Background |
51 | $color[4] = "#FFFFFF"; // (white) Normal Background |
52 | $color[5] = "#FFFFCC"; // (light yellow) Table Headers |
53 | $color[6] = "#000000"; // (black) Text on left bar |
54 | $color[7] = "#0000CC"; // (blue) Links |
55 | $color[8] = "#000000"; // (black) Normal text |
56 | $color[9] = "#ABABAB"; // (mid-gray) Darker version of #0 |
57 | $color[10] = "#666666"; // (dark gray) Darker version of #9 |
58 | $color[11] = "#770000"; // (dark red) Special Folders color |
f3d17401 |
59 | } |
d3cdb279 |
60 | } |
11307a4c |
61 | |
2de8df87 |
62 | session_register("theme_css"); |
63 | |
3806fa52 |
64 | $use_javascript_addr_book = getPref($data_dir, $username, "use_javascript_addr_book"); |
65 | if ($use_javascript_addr_book == "") |
66 | $use_javascript_addr_book = $default_use_javascript_addr_book; |
67 | |
68 | |
1573e796 |
69 | /** Load the user's sent folder preferences **/ |
70 | $move_to_sent = getPref($data_dir, $username, "move_to_sent"); |
71 | if ($move_to_sent == "") |
72 | $move_to_sent = $default_move_to_sent; |
73 | |
74 | /** Load the user's trash folder preferences **/ |
75 | $move_to_trash = getPref($data_dir, $username, "move_to_trash"); |
76 | if ($move_to_trash == "") |
77 | $move_to_trash = $default_move_to_trash; |
78 | |
79 | |
24fc5dd2 |
80 | $unseen_type = getPref($data_dir, $username, "unseen_type"); |
81 | if ($default_unseen_type == "") |
82 | $default_unseen_type = 1; |
83 | if ($unseen_type == "") |
84 | $unseen_type = $default_unseen_type; |
85 | |
86 | $unseen_notify = getPref($data_dir, $username, "unseen_notify"); |
87 | if ($default_unseen_notify == "") |
88 | $default_unseen_notify = 2; |
89 | if ($unseen_notify == "") |
90 | $unseen_notify = $default_unseen_notify; |
91 | |
92 | |
1e0628fb |
93 | $folder_prefix = getPref($data_dir, $username, "folder_prefix"); |
94 | if ($folder_prefix == "") |
95 | $folder_prefix = $default_folder_prefix; |
96 | |
97 | /** Load special folders **/ |
98 | $new_trash_folder = getPref($data_dir, $username, "trash_folder"); |
99 | if (($new_trash_folder == "") && ($move_to_trash == true)) |
100 | $trash_folder = $folder_prefix . $trash_folder; |
101 | else |
102 | $trash_folder = $new_trash_folder; |
103 | |
104 | /** Load special folders **/ |
105 | $new_sent_folder = getPref($data_dir, $username, "sent_folder"); |
106 | if (($new_sent_folder == "") && ($move_to_sent == true)) |
107 | $sent_folder = $folder_prefix . $sent_folder; |
108 | else |
109 | $sent_folder = $new_sent_folder; |
11307a4c |
110 | |
9c83f905 |
111 | $show_num = getPref($data_dir, $username, "show_num"); |
112 | if ($show_num == "") |
113 | $show_num = 25; |
114 | |
11307a4c |
115 | $wrap_at = getPref($data_dir, $username, "wrap_at"); |
116 | if ($wrap_at == "") |
117 | $wrap_at = 86; |
7aaa81fc |
118 | if ($wrap_at < 15) |
119 | $wrap_at = 15; |
11307a4c |
120 | |
2848c630 |
121 | $left_size = getPref($data_dir, $username, "left_size"); |
122 | if ($left_size == "") { |
123 | if (isset($default_left_size)) |
124 | $left_size = $default_left_size; |
125 | else |
126 | $left_size = 200; |
127 | } |
128 | |
11307a4c |
129 | $editor_size = getPref($data_dir, $username, "editor_size"); |
130 | if ($editor_size == "") |
131 | $editor_size = 76; |
f804972b |
132 | |
133 | $use_signature = getPref($data_dir, $username, "use_signature"); |
134 | if ($use_signature == "") |
135 | $use_signature = false; |
136 | |
469eb37b |
137 | $left_refresh = getPref($data_dir, $username, "left_refresh"); |
138 | if ($left_refresh == "") |
139 | $left_refresh = false; |
5c54e435 |
140 | |
141 | $sort = getPref($data_dir, $username, "sort"); |
142 | if ($sort == "") |
143 | $sort = 6; |
469eb37b |
144 | |
f804972b |
145 | /** Load up the Signature file **/ |
146 | if ($use_signature == true) { |
c36ed9cf |
147 | $signature_abs = $signature = getSig($data_dir, $username); |
f804972b |
148 | } else { |
c36ed9cf |
149 | $signature_abs = getSig($data_dir, $username); |
f804972b |
150 | } |
636e611c |
151 | |
9d157cec |
152 | // highlightX comes in with the form: name,color,header,value |
153 | for ($i=0; $hlt = getPref($data_dir, $username, "highlight$i"); $i++) { |
154 | $ary = explode(",", $hlt); |
155 | $message_highlight_list[$i]["name"] = $ary[0]; |
156 | $message_highlight_list[$i]["color"] = $ary[1]; |
157 | $message_highlight_list[$i]["value"] = $ary[2]; |
3e69e88b |
158 | $message_highlight_list[$i]["match_type"] = $ary[3]; |
9d157cec |
159 | } |
8e265988 |
160 | |
161 | #index order lets you change the order of the message index |
162 | $order = getPref($data_dir, $username, "order1"); |
163 | for ($i=1; $order; $i++) { |
164 | $index_order[$i] = $order; |
165 | $order = getPref($data_dir, $username, "order".($i+1)); |
166 | } |
167 | if (!$index_order) { |
168 | $index_order[1] = 1; |
169 | $index_order[2] = 2; |
170 | $index_order[3] = 3; |
171 | $index_order[4] = 5; |
172 | $index_order[5] = 4; |
173 | } |
9a732bb6 |
174 | |
175 | $location_of_bar = getPref($data_dir, $username, 'location_of_bar'); |
176 | if ($location_of_bar == '') |
177 | $location_of_bar = 'left'; |
441f2d33 |
178 | |
179 | $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons'); |
180 | if ($location_of_buttons == '') |
181 | $location_of_buttons = 'between'; |
c36ed9cf |
182 | |
6b638171 |
183 | do_hook("loading_prefs"); |
b731cd83 |
184 | |
11307a4c |
185 | ?> |