squirrelmail-webmail  1.4.22
About: SquirrelMail is a standards-based webmail package with strong MIME support, address books, and folder manipulation (written in PHP4).
  Fossies Dox: squirrelmail-webmail-1.4.22.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

load_prefs.php
Go to the documentation of this file.
1 <?php
2 
16 require_once(SM_PATH . 'include/validate.php');
17 require_once(SM_PATH . 'functions/plugin.php');
18 require_once(SM_PATH . 'functions/constants.php');
19 require_once(SM_PATH . 'functions/prefs.php');
20 
21 if( ! sqgetGlobalVar('username', $username, SQ_SESSION) ) {
22  $username = '';
23 }
24 
25 $custom_css = getPref($data_dir, $username, 'custom_css', 'none' );
26 
27 $theme = ( !isset($theme) ? array() : $theme );
28 $color = ( !isset($color) ? array() : $color );
29 
31 $found_theme = false;
32 
33 /* need to adjust $chosen_theme path with SM_PATH */
34 $chosen_theme = preg_replace("/(\.\.\/){1,}/", SM_PATH, $chosen_theme);
35 
36 for ($i = 0; $i < count($theme); ++$i){
37  if ($theme[$i]['PATH'] == $chosen_theme) {
38  $found_theme = true;
39  break;
40  }
41 }
43 
50 $color[0] = '#DCDCDC'; /* light gray TitleBar */
51 $color[1] = '#800000'; /* red */
52 $color[2] = '#CC0000'; /* light red Warning/Error Messages */
53 $color[3] = '#A0B8C8'; /* green-blue Left Bar Background */
54 $color[4] = '#FFFFFF'; /* white Normal Background */
55 $color[5] = '#FFFFCC'; /* light yellow Table Headers */
56 $color[6] = '#000000'; /* black Text on left bar */
57 $color[7] = '#0000CC'; /* blue Links */
58 $color[8] = '#000000'; /* black Normal text */
59 $color[9] = '#ABABAB'; /* mid-gray Darker version of #0 */
60 $color[10] = '#666666'; /* dark gray Darker version of #9 */
61 $color[11] = '#770000'; /* dark red Special Folders color */
62 $color[12] = '#EDEDED';
63 $color[15] = '#002266'; /* (dark blue) Unselectable folders */
64 $color[16] = '#ff9933'; /* (orange) Highlight color */
65 
66 if (isset($chosen_theme) && $found_theme && (file_exists($chosen_theme))) {
67  @include_once($chosen_theme);
68 } else {
69  if (isset($theme) && isset($theme[$theme_default]) && file_exists($theme[$theme_default]['PATH'])) {
70  @include_once($theme[$theme_default]['PATH']);
72  }
73 }
74 
75 
76 if (!defined('download_php')) {
77  sqsession_register($theme_css, 'theme_css');
78 }
79 
80 
81 /* Load the user's special folder preferences */
82 $move_to_sent =
88 
89 if ($default_unseen_type == '') {
91 }
92 if ($default_unseen_notify == '') {
94 }
99 
101  getPref($data_dir, $username, 'unseen_cum', false);
102 
105 
106 /* Load special folder - trash */
108 if (($load_trash_folder == '') && ($move_to_trash)) {
110 } else {
112 }
113 
114 /* Load special folder - sent */
116 if (($load_sent_folder == '') && ($move_to_sent)) {
118 } else {
120 }
121 
122 /* Load special folder - draft */
124 if (($load_draft_folder == '') && ($save_as_draft)) {
126 } else {
128 }
129 
130 $show_num = getPref($data_dir, $username, 'show_num', 15 );
131 
132 $wrap_at = getPref( $data_dir, $username, 'wrap_at', 86 );
133 if ($wrap_at < 15) { $wrap_at = 15; }
134 
136 if ($left_size == '') {
137  if (isset($default_left_size)) {
139  } else {
140  $left_size = 200;
141  }
142 }
143 
144 $editor_size = getPref($data_dir, $username, 'editor_size', 76 );
145 $editor_height = getPref($data_dir, $username, 'editor_height', 20 );
148 
149 /* Load timezone preferences */
151 
152 /* Load preferences for reply citation style. */
153 
155  getPref($data_dir, $username, 'reply_citation_style', SMPREF_NONE );
156 $reply_citation_start = getPref($data_dir, $username, 'reply_citation_start');
157 $reply_citation_end = getPref($data_dir, $username, 'reply_citation_end');
158 
159 $body_quote = getPref($data_dir, $username, 'body_quote', '>');
160 if ($body_quote == 'NONE') $body_quote = '';
161 
162 // Load preference for cursor behavior for replies
163 //
164 $reply_focus = getPref($data_dir, $username, 'reply_focus', '');
165 
166 /* left refresh rate, strtolower makes 1.0.6 prefs compatible */
167 $left_refresh = getPref($data_dir, $username, 'left_refresh', 600 );
168 $left_refresh = strtolower($left_refresh);
169 
171 
172 /* Load up the Signature file */
173 $signature_abs = $signature = getSig($data_dir, $username, 'g');
174 
175 /* Message Highlighting Rules */
177 
178 /* use new way of storing highlighting rules */
179 if( $ser = getPref($data_dir, $username, 'hililist') ) {
180  $message_highlight_list = unserialize($ser);
181 } else {
182  /* use old way */
183  for ($i = 0; $hlt = getPref($data_dir, $username, "highlight$i"); ++$i) {
184  $highlight_array = explode(',', $hlt);
185  $message_highlight_list[$i]['name'] = $highlight_array[0];
186  $message_highlight_list[$i]['color'] = $highlight_array[1];
187  $message_highlight_list[$i]['value'] = $highlight_array[2];
188  $message_highlight_list[$i]['match_type'] = $highlight_array[3];
189  removePref($data_dir, $username, "highlight$i");
190  }
191 // NB: The fact that this preference is always set here means that some plugins rely on testing it to know if a user has logged in before - the "old way" above is probably long since obsolete and unneeded, but the setPref() below should not be removed
192  /* store in new format for the next time */
193  setPref($data_dir, $username, 'hililist', serialize($message_highlight_list));
194 }
195 
196 /* Index order lets you change the order of the message index */
198 for ($i = 1; $order; ++$i) {
199  $index_order[$i] = $order;
200  $order = getPref($data_dir, $username, 'order'.($i+1));
201 }
202 if (!isset($index_order)) {
203  $index_order[1] = 1;
204  $index_order[2] = 2;
205  $index_order[3] = 3;
206  $index_order[4] = 5;
207  $index_order[5] = 4;
208 }
209 
211  getPref($data_dir, $username, 'alt_index_colors', SMPREF_ON );
212 
213 // Folder List Display Format
215  getPref($data_dir, $username, 'location_of_bar', SMPREF_LOC_LEFT);
217  getPref($data_dir, $username, 'location_of_buttons', SMPREF_LOC_BETWEEN);
218 
220  getPref($data_dir, $username, 'collapse_folders', SMPREF_ON);
221 
223  getPref($data_dir, $username, 'show_html_default', SMPREF_OFF);
224 
226  getPref($data_dir, $username, 'addrsrch_fullname', 'fullname');
227 
229  getPref($data_dir, $username, 'enable_forward_as_attachment', SMPREF_ON);
230 
232  getPref($data_dir, $username, 'show_xmailer_default', SMPREF_OFF );
233 $attachment_common_show_images = getPref($data_dir, $username, 'attachment_common_show_images', SMPREF_OFF );
235 
236 /* message disposition notification support setting */
238 
240  getPref($data_dir, $username, 'include_self_reply_all', SMPREF_ON);
241 
242 /* Page selector options */
244 $page_selector_max = getPref($data_dir, $username, 'page_selector_max', 10);
245 
246 /* SqClock now in the core */
247 $date_format = getPref($data_dir, $username, 'date_format', 3);
249 
250 /* compose in new window setting */
251 $compose_new_win = getPref($data_dir, $username, 'compose_new_win', 0);
252 $compose_height = getPref($data_dir, $username, 'compose_height', 550);
253 $compose_width = getPref($data_dir, $username, 'compose_width', 640);
254 
255 
256 /* signature placement settings */
257 $sig_first = getPref($data_dir, $username, 'sig_first', 0);
258 
259 /* strip signature from replies setting */
260 $strip_sigs = getPref($data_dir, $username, 'strip_sigs', 0);
261 
262 /* use the internal date of the message for sorting instead of the supplied header date */
264 
265 /* if server sorting is enabled/disabled */
266 $sort_by_ref = getPref($data_dir, $username, 'sort_by_ref', 1);
267 
268 /* Load the javascript settings. */
272 
273 $search_memory = getPref($data_dir, $username, 'search_memory', 0);
274 
275 $mailbox_select_style = getPref($data_dir, $username, 'mailbox_select_style', 1);
276 
277 /* Allow user to customize, and display the full date, instead of day, or time based
278  on time distance from date of message */
279 $show_full_date = getPref($data_dir, $username, 'show_full_date', 0);
280 
281 /* Allow user to customize length of from field */
282 $truncate_sender = getPref($data_dir, $username, 'truncate_sender', 50);
283 /* Allow user to customize length of subject field */
284 $truncate_subject = getPref($data_dir, $username, 'truncate_subject', 50);
285 
286 do_hook('loading_prefs');
287 
$enable_forward_as_attachment
$enable_forward_as_attachment
Definition: load_prefs.php:228
sqgetGlobalVar
sqgetGlobalVar($name, &$value, $search=SQ_INORDER)
Definition: global.php:344
$default_use_javascript_addr_book
$default_use_javascript_addr_book
Definition: config_default.php:886
$unseen_type
if($default_unseen_type=='') if($default_unseen_notify=='') $unseen_type
Definition: load_prefs.php:95
$page_selector
$page_selector
Definition: load_prefs.php:243
getPref
getPref($data_dir, $username, $string, $default='')
Definition: db_prefs.php:316
$show_full_date
$show_full_date
Definition: load_prefs.php:279
$found_theme
$found_theme
Definition: load_prefs.php:31
$draft_folder
$draft_folder
Definition: config_default.php:396
$mailbox_select_style
$mailbox_select_style
Definition: load_prefs.php:275
$left_size
if($wrap_at< 15) $left_size
Definition: load_prefs.php:135
$unseen_notify
$unseen_notify
Definition: load_prefs.php:97
$theme_css
$theme_css
Definition: config_default.php:696
$load_trash_folder
$load_trash_folder
Definition: load_prefs.php:107
$show_html_default
$show_html_default
Definition: load_prefs.php:222
getSig
getSig($data_dir, $username, $number)
Definition: db_prefs.php:407
$data_dir
$data_dir
Definition: config_default.php:499
SQ_SESSION
const SQ_SESSION
Definition: global.php:18
$sort_by_ref
$sort_by_ref
Definition: load_prefs.php:266
$default_move_to_sent
$default_move_to_sent
Definition: config_default.php:392
$javascript_setting
$javascript_setting
Definition: load_prefs.php:269
$default_save_as_draft
$default_save_as_draft
Definition: config_default.php:393
setPref
setPref($data_dir, $username, $string, $set_to)
Definition: db_prefs.php:352
$trash_folder
$trash_folder
Definition: config_default.php:394
$username
global $username
Definition: validate.php:55
do_hook
do_hook($name)
Definition: plugin.php:42
$alt_index_colors
for($i=1; $order;++$i) if(!isset($index_order)) $alt_index_colors
Definition: load_prefs.php:210
$reply_citation_end
$reply_citation_end
Definition: load_prefs.php:157
$mdn_user_support
$mdn_user_support
Definition: load_prefs.php:237
$compose_height
$compose_height
Definition: load_prefs.php:252
$sort
$sort
Definition: load_prefs.php:170
$sig_first
$sig_first
Definition: load_prefs.php:257
$show_num
$show_num
Definition: load_prefs.php:130
SMPREF_LOC_LEFT
const SMPREF_LOC_LEFT
Definition: constants.php:35
$signature_abs
$signature_abs
Definition: load_prefs.php:173
$default_unseen_notify
$default_unseen_notify
Definition: config_default.php:464
$message_highlight_list
$message_highlight_list
Definition: load_prefs.php:176
$search_memory
$search_memory
Definition: load_prefs.php:273
$custom_css
if(! sqgetGlobalVar('username', $username, SQ_SESSION)) $custom_css
Definition: load_prefs.php:25
$compose_width
$compose_width
Definition: load_prefs.php:253
$sent_folder
$sent_folder
Definition: config_default.php:395
$use_javascript_addr_book
$use_javascript_addr_book
Definition: load_prefs.php:271
$editor_height
$editor_height
Definition: load_prefs.php:145
$chosen_theme
$chosen_theme
Definition: load_prefs.php:30
$save_as_draft
$save_as_draft
Definition: load_prefs.php:86
$reply_focus
$reply_focus
Definition: load_prefs.php:164
removePref
removePref($data_dir, $username, $string)
Definition: db_prefs.php:331
$addrsrch_fullname
$addrsrch_fullname
Definition: load_prefs.php:225
SMPREF_NONE
const SMPREF_NONE
Definition: constants.php:29
$folder_prefix
$folder_prefix
Definition: load_prefs.php:103
$internal_date_sort
$internal_date_sort
Definition: load_prefs.php:263
$load_sent_folder
$load_sent_folder
Definition: load_prefs.php:115
$show_xmailer_default
$show_xmailer_default
Definition: load_prefs.php:231
$theme_default
$theme_default
Definition: config_default.php:695
SMPREF_OFF
const SMPREF_OFF
Definition: constants.php:26
$strip_sigs
$strip_sigs
Definition: load_prefs.php:260
$reply_citation_style
$reply_citation_style
Definition: load_prefs.php:154
$truncate_sender
$truncate_sender
Definition: load_prefs.php:282
$editor_size
if($left_size=='') $editor_size
Definition: load_prefs.php:144
SMPREF_JS_AUTODETECT
const SMPREF_JS_AUTODETECT
Definition: constants.php:54
SM_PATH
const SM_PATH
Definition: decrypt_headers.php:16
$wrap_at
$wrap_at
Definition: load_prefs.php:132
$location_of_buttons
$location_of_buttons
Definition: load_prefs.php:216
sqsession_register
sqsession_register($var, $name)
Definition: global.php:289
$load_draft_folder
$load_draft_folder
Definition: load_prefs.php:123
$unseen_cum
$unseen_cum
Definition: load_prefs.php:100
$attachment_common_show_images
$attachment_common_show_images
Definition: load_prefs.php:233
$default_move_to_trash
$default_move_to_trash
Definition: config_default.php:391
$reply_citation_start
$reply_citation_start
Definition: load_prefs.php:156
$collapse_folders
$collapse_folders
Definition: load_prefs.php:219
$color
$color
Definition: load_prefs.php:28
$include_self_reply_all
$include_self_reply_all
Definition: load_prefs.php:239
$timezone
$timezone
Definition: load_prefs.php:150
$truncate_subject
$truncate_subject
Definition: load_prefs.php:284
$page_selector_max
$page_selector_max
Definition: load_prefs.php:244
SMPREF_TIME_12HR
const SMPREF_TIME_12HR
Definition: constants.php:49
$pf_cleandisplay
$pf_cleandisplay
Definition: load_prefs.php:234
$order
$order
Definition: load_prefs.php:197
$use_signature
$use_signature
Definition: load_prefs.php:146
$date_format
$date_format
Definition: load_prefs.php:247
$body_quote
$body_quote
Definition: load_prefs.php:159
SMPREF_ON
const SMPREF_ON
Definition: constants.php:28
$prefix_sig
$prefix_sig
Definition: load_prefs.php:147
$compose_new_win
$compose_new_win
Definition: load_prefs.php:251
$default_unseen_type
$default_unseen_type
Definition: config_default.php:465
$location_of_bar
$location_of_bar
Definition: load_prefs.php:214
$left_refresh
$left_refresh
Definition: load_prefs.php:167
$move_to_trash
$move_to_trash
Definition: load_prefs.php:84
$default_folder_prefix
$default_folder_prefix
Definition: config_default.php:342
SMPREF_LOC_BETWEEN
const SMPREF_LOC_BETWEEN
Definition: constants.php:33
$theme
$theme
Definition: load_prefs.php:27
$javascript_on
$javascript_on
Definition: load_prefs.php:270
$default_left_size
$default_left_size
Definition: config_default.php:539
$hour_format
$hour_format
Definition: load_prefs.php:248