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"); |
37df47f5 |
17 | |
18 | $load_prefs_php = true; |
b4da6659 |
19 | checkForPrefs($data_dir, $username); |
20 | |
d0747e26 |
21 | $chosen_theme = getPref($data_dir, $username, "chosen_theme"); |
390372b4 |
22 | if ((substr($chosen_theme, 0, 10) == "../config/")) { |
23 | $chosen_theme = substr($chosen_theme, 10); |
24 | $chosen_theme = "../themes/$chosen_theme"; |
25 | } |
d3cdb279 |
26 | |
f3d17401 |
27 | if ((isset($chosen_theme)) && (file_exists($chosen_theme))) { |
d3cdb279 |
28 | require("$chosen_theme"); |
29 | } else { |
f3d17401 |
30 | if (file_exists($theme[0]["PATH"])) { |
31 | require($theme[0]["PATH"]); |
32 | } else { |
67c62ef9 |
33 | echo _("Theme: "); |
f94ff7ce |
34 | echo $theme[0]["PATH"]; |
35 | echo _(" was not found."); |
36 | echo "<BR>"; |
67c62ef9 |
37 | echo _("Exiting abnormally"); |
f3d17401 |
38 | exit; |
39 | } |
d3cdb279 |
40 | } |
11307a4c |
41 | |
2de8df87 |
42 | session_register("theme_css"); |
43 | |
3806fa52 |
44 | $use_javascript_addr_book = getPref($data_dir, $username, "use_javascript_addr_book"); |
45 | if ($use_javascript_addr_book == "") |
46 | $use_javascript_addr_book = $default_use_javascript_addr_book; |
47 | |
48 | |
1573e796 |
49 | /** Load the user's sent folder preferences **/ |
50 | $move_to_sent = getPref($data_dir, $username, "move_to_sent"); |
51 | if ($move_to_sent == "") |
52 | $move_to_sent = $default_move_to_sent; |
53 | |
54 | /** Load the user's trash folder preferences **/ |
55 | $move_to_trash = getPref($data_dir, $username, "move_to_trash"); |
56 | if ($move_to_trash == "") |
57 | $move_to_trash = $default_move_to_trash; |
58 | |
59 | |
24fc5dd2 |
60 | $unseen_type = getPref($data_dir, $username, "unseen_type"); |
61 | if ($default_unseen_type == "") |
62 | $default_unseen_type = 1; |
63 | if ($unseen_type == "") |
64 | $unseen_type = $default_unseen_type; |
65 | |
66 | $unseen_notify = getPref($data_dir, $username, "unseen_notify"); |
67 | if ($default_unseen_notify == "") |
68 | $default_unseen_notify = 2; |
69 | if ($unseen_notify == "") |
70 | $unseen_notify = $default_unseen_notify; |
71 | |
72 | |
1e0628fb |
73 | $folder_prefix = getPref($data_dir, $username, "folder_prefix"); |
74 | if ($folder_prefix == "") |
75 | $folder_prefix = $default_folder_prefix; |
76 | |
77 | /** Load special folders **/ |
78 | $new_trash_folder = getPref($data_dir, $username, "trash_folder"); |
79 | if (($new_trash_folder == "") && ($move_to_trash == true)) |
80 | $trash_folder = $folder_prefix . $trash_folder; |
81 | else |
82 | $trash_folder = $new_trash_folder; |
83 | |
84 | /** Load special folders **/ |
85 | $new_sent_folder = getPref($data_dir, $username, "sent_folder"); |
86 | if (($new_sent_folder == "") && ($move_to_sent == true)) |
87 | $sent_folder = $folder_prefix . $sent_folder; |
88 | else |
89 | $sent_folder = $new_sent_folder; |
11307a4c |
90 | |
9c83f905 |
91 | $show_num = getPref($data_dir, $username, "show_num"); |
92 | if ($show_num == "") |
93 | $show_num = 25; |
94 | |
11307a4c |
95 | $wrap_at = getPref($data_dir, $username, "wrap_at"); |
96 | if ($wrap_at == "") |
97 | $wrap_at = 86; |
98 | |
2848c630 |
99 | $left_size = getPref($data_dir, $username, "left_size"); |
100 | if ($left_size == "") { |
101 | if (isset($default_left_size)) |
102 | $left_size = $default_left_size; |
103 | else |
104 | $left_size = 200; |
105 | } |
106 | |
11307a4c |
107 | $editor_size = getPref($data_dir, $username, "editor_size"); |
108 | if ($editor_size == "") |
109 | $editor_size = 76; |
f804972b |
110 | |
111 | $use_signature = getPref($data_dir, $username, "use_signature"); |
112 | if ($use_signature == "") |
113 | $use_signature = false; |
114 | |
469eb37b |
115 | $left_refresh = getPref($data_dir, $username, "left_refresh"); |
116 | if ($left_refresh == "") |
117 | $left_refresh = false; |
118 | |
f804972b |
119 | /** Load up the Signature file **/ |
120 | if ($use_signature == true) { |
c36ed9cf |
121 | $signature_abs = $signature = getSig($data_dir, $username); |
f804972b |
122 | } else { |
c36ed9cf |
123 | $signature_abs = getSig($data_dir, $username); |
f804972b |
124 | } |
636e611c |
125 | |
126 | /** Load up the Language preference **/ |
127 | $user_language = getPref($data_dir, $username, "language"); |
128 | if ($user_language == "") { |
129 | if (isset($default_charset)) |
130 | $user_language = $default_charset; |
131 | else |
132 | $user_language = en; |
133 | } |
134 | |
9d157cec |
135 | // highlightX comes in with the form: name,color,header,value |
136 | for ($i=0; $hlt = getPref($data_dir, $username, "highlight$i"); $i++) { |
137 | $ary = explode(",", $hlt); |
138 | $message_highlight_list[$i]["name"] = $ary[0]; |
139 | $message_highlight_list[$i]["color"] = $ary[1]; |
140 | $message_highlight_list[$i]["value"] = $ary[2]; |
3e69e88b |
141 | $message_highlight_list[$i]["match_type"] = $ary[3]; |
9d157cec |
142 | } |
c36ed9cf |
143 | |
11307a4c |
144 | ?> |