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