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