commit | author | age
|
4e17e6
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/settings/save_prefs.inc | |
|
6 |
| | |
|
7 |
| This file is part of the RoundCube Webmail client | |
f11541
|
8 |
| Copyright (C) 2005-2007, RoundCube Dev. - Switzerland | |
30233b
|
9 |
| Licensed under the GNU GPL | |
4e17e6
|
10 |
| | |
T |
11 |
| PURPOSE: | |
|
12 |
| Save user preferences to DB and to the current session | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id$ |
|
19 |
|
|
20 |
*/ |
|
21 |
|
b19097
|
22 |
$a_user_prefs = array( |
T |
23 |
'timezone' => isset($_POST['_timezone']) ? floatval($_POST['_timezone']) : $CONFIG['timezone'], |
|
24 |
'dst_active' => isset($_POST['_dst_active']) ? TRUE : FALSE, |
|
25 |
'pagesize' => is_numeric($_POST['_pagesize']) ? intval($_POST['_pagesize']) : $CONFIG['pagesize'], |
|
26 |
'prettydate' => isset($_POST['_pretty_date']) ? TRUE : FALSE, |
|
27 |
'prefer_html' => isset($_POST['_prefer_html']) ? TRUE : FALSE, |
|
28 |
'htmleditor' => isset($_POST['_htmleditor']) ? TRUE : FALSE, |
|
29 |
'preview_pane' => isset($_POST['_preview_pane']) ? TRUE : FALSE, |
|
30 |
'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0 |
|
31 |
); |
|
32 |
|
|
33 |
// don't override these parameters |
|
34 |
foreach ((array)$CONFIG['dont_override'] as $p) |
|
35 |
$a_user_prefs[$p] = $CONFIG[$p]; |
4e17e6
|
36 |
|
T |
37 |
|
b19097
|
38 |
// switch UI language |
4e17e6
|
39 |
if (isset($_POST['_language'])) |
7cc38e
|
40 |
{ |
d656f1
|
41 |
$sess_user_lang = $_SESSION['user_lang'] = get_input_value('_language', RCUBE_INPUT_POST); |
7cc38e
|
42 |
rcmail_set_locale($sess_user_lang); |
T |
43 |
} |
4e17e6
|
44 |
|
b3a645
|
45 |
// force min size |
ed7dd9
|
46 |
if ($a_user_prefs['pagesize'] < 1) |
b3a645
|
47 |
$a_user_prefs['pagesize'] = 10; |
T |
48 |
|
fba1f5
|
49 |
if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['pagesize'] > $CONFIG['max_pagesize'])) |
T |
50 |
$a_user_prefs['pagesize'] = (int) $CONFIG['max_pagesize']; |
|
51 |
|
|
52 |
if ($USER->save_prefs($a_user_prefs)) |
f11541
|
53 |
$OUTPUT->show_message('successfullysaved', 'confirmation'); |
4e17e6
|
54 |
|
T |
55 |
|
|
56 |
// go to next step |
f11541
|
57 |
rcmail_overwrite_action('preferences'); |
4e17e6
|
58 |
|
a0109c
|
59 |
?> |