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 | } |
d3cdb279 |
34 | |
31ac7db8 |
35 | if ($in_ary && (file_exists($chosen_theme))) { |
36 | $loaded=@include($chosen_theme); |
d3cdb279 |
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 | } |
088623a1 |
61 | if (!isset($loaded)) |
62 | echo _("Unable to load chosen theme file:") . ' "' . |
63 | $chosen_theme . '"'; |
245a6892 |
64 | if (!isset($download_php)) session_register("theme_css"); |
2de8df87 |
65 | |
3806fa52 |
66 | $use_javascript_addr_book = getPref($data_dir, $username, "use_javascript_addr_book"); |
67 | if ($use_javascript_addr_book == "") |
68 | $use_javascript_addr_book = $default_use_javascript_addr_book; |
69 | |
70 | |
1573e796 |
71 | /** Load the user's sent folder preferences **/ |
72 | $move_to_sent = getPref($data_dir, $username, "move_to_sent"); |
73 | if ($move_to_sent == "") |
74 | $move_to_sent = $default_move_to_sent; |
75 | |
76 | /** Load the user's trash folder preferences **/ |
77 | $move_to_trash = getPref($data_dir, $username, "move_to_trash"); |
78 | if ($move_to_trash == "") |
79 | $move_to_trash = $default_move_to_trash; |
80 | |
81 | |
24fc5dd2 |
82 | $unseen_type = getPref($data_dir, $username, "unseen_type"); |
83 | if ($default_unseen_type == "") |
84 | $default_unseen_type = 1; |
85 | if ($unseen_type == "") |
86 | $unseen_type = $default_unseen_type; |
87 | |
88 | $unseen_notify = getPref($data_dir, $username, "unseen_notify"); |
89 | if ($default_unseen_notify == "") |
90 | $default_unseen_notify = 2; |
91 | if ($unseen_notify == "") |
92 | $unseen_notify = $default_unseen_notify; |
93 | |
94 | |
1e0628fb |
95 | $folder_prefix = getPref($data_dir, $username, "folder_prefix"); |
96 | if ($folder_prefix == "") |
97 | $folder_prefix = $default_folder_prefix; |
98 | |
99 | /** Load special folders **/ |
100 | $new_trash_folder = getPref($data_dir, $username, "trash_folder"); |
101 | if (($new_trash_folder == "") && ($move_to_trash == true)) |
102 | $trash_folder = $folder_prefix . $trash_folder; |
103 | else |
104 | $trash_folder = $new_trash_folder; |
105 | |
106 | /** Load special folders **/ |
107 | $new_sent_folder = getPref($data_dir, $username, "sent_folder"); |
108 | if (($new_sent_folder == "") && ($move_to_sent == true)) |
109 | $sent_folder = $folder_prefix . $sent_folder; |
110 | else |
111 | $sent_folder = $new_sent_folder; |
11307a4c |
112 | |
9c83f905 |
113 | $show_num = getPref($data_dir, $username, "show_num"); |
114 | if ($show_num == "") |
115 | $show_num = 25; |
116 | |
11307a4c |
117 | $wrap_at = getPref($data_dir, $username, "wrap_at"); |
118 | if ($wrap_at == "") |
119 | $wrap_at = 86; |
7aaa81fc |
120 | if ($wrap_at < 15) |
121 | $wrap_at = 15; |
11307a4c |
122 | |
2848c630 |
123 | $left_size = getPref($data_dir, $username, "left_size"); |
124 | if ($left_size == "") { |
125 | if (isset($default_left_size)) |
126 | $left_size = $default_left_size; |
127 | else |
128 | $left_size = 200; |
129 | } |
130 | |
11307a4c |
131 | $editor_size = getPref($data_dir, $username, "editor_size"); |
132 | if ($editor_size == "") |
133 | $editor_size = 76; |
f804972b |
134 | |
135 | $use_signature = getPref($data_dir, $username, "use_signature"); |
136 | if ($use_signature == "") |
137 | $use_signature = false; |
138 | |
025deae0 |
139 | $prefix_sig = getPref($data_dir, $username, "prefix_sig"); |
140 | if ($prefix_sig == "") |
141 | $prefix_sig = false; |
142 | |
469eb37b |
143 | $left_refresh = getPref($data_dir, $username, "left_refresh"); |
144 | if ($left_refresh == "") |
145 | $left_refresh = false; |
5c54e435 |
146 | |
147 | $sort = getPref($data_dir, $username, "sort"); |
148 | if ($sort == "") |
149 | $sort = 6; |
469eb37b |
150 | |
f804972b |
151 | /** Load up the Signature file **/ |
152 | if ($use_signature == true) { |
c36ed9cf |
153 | $signature_abs = $signature = getSig($data_dir, $username); |
f804972b |
154 | } else { |
c36ed9cf |
155 | $signature_abs = getSig($data_dir, $username); |
f804972b |
156 | } |
636e611c |
157 | |
9d157cec |
158 | // highlightX comes in with the form: name,color,header,value |
159 | for ($i=0; $hlt = getPref($data_dir, $username, "highlight$i"); $i++) { |
160 | $ary = explode(",", $hlt); |
161 | $message_highlight_list[$i]["name"] = $ary[0]; |
162 | $message_highlight_list[$i]["color"] = $ary[1]; |
163 | $message_highlight_list[$i]["value"] = $ary[2]; |
3e69e88b |
164 | $message_highlight_list[$i]["match_type"] = $ary[3]; |
9d157cec |
165 | } |
8e265988 |
166 | |
167 | #index order lets you change the order of the message index |
168 | $order = getPref($data_dir, $username, "order1"); |
169 | for ($i=1; $order; $i++) { |
170 | $index_order[$i] = $order; |
171 | $order = getPref($data_dir, $username, "order".($i+1)); |
172 | } |
a7ea7540 |
173 | if (!isset($index_order)) { |
8e265988 |
174 | $index_order[1] = 1; |
175 | $index_order[2] = 2; |
176 | $index_order[3] = 3; |
177 | $index_order[4] = 5; |
178 | $index_order[5] = 4; |
179 | } |
9a732bb6 |
180 | |
181 | $location_of_bar = getPref($data_dir, $username, 'location_of_bar'); |
182 | if ($location_of_bar == '') |
183 | $location_of_bar = 'left'; |
441f2d33 |
184 | |
185 | $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons'); |
186 | if ($location_of_buttons == '') |
187 | $location_of_buttons = 'between'; |
235a65d5 |
188 | |
189 | $collapse_folders = getPref($data_dir, $username, 'collapse_folders'); |
e2ab93e5 |
190 | |
191 | $show_html_default = getPref($data_dir, $username, 'show_html_default'); |
c36ed9cf |
192 | |
6b638171 |
193 | do_hook("loading_prefs"); |
b731cd83 |
194 | |
11307a4c |
195 | ?> |