]> git.donarmstrong.com Git - roundcube.git/blob - program/steps/settings/save_prefs.inc
Imported Upstream version 0.1~beta2.2~dfsg
[roundcube.git] / program / steps / settings / save_prefs.inc
1 <?php
2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/steps/settings/save_prefs.inc                                 |
6  |                                                                       |
7  | This file is part of the RoundCube Webmail client                     |
8  | Copyright (C) 2005, RoundCube Dev. - Switzerland                      |
9  | Licensed under the GNU GPL                                            |
10  |                                                                       |
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: save_prefs.inc 194 2006-04-13 18:23:48Z roundcube $
19
20 */
21
22 $a_user_prefs = $_SESSION['user_prefs'];
23 if (!is_array($a_user_prefs))
24   $a_user_prefs = array();
25
26
27 $a_user_prefs['timezone'] = isset($_POST['_timezone']) ? floatval($_POST['_timezone']) : $CONFIG['timezone'];
28 $a_user_prefs['dst_active'] = isset($_POST['_dst_active']) ? TRUE : FALSE;
29 $a_user_prefs['pagesize'] = is_numeric($_POST['_pagesize']) ? (int)$_POST['_pagesize'] : $CONFIG['pagesize'];
30 $a_user_prefs['prefer_html'] = isset($_POST['_prefer_html']) ? TRUE : FALSE;
31
32 // MM: Date format toggle (Pretty / Standard)
33 $a_user_prefs['prettydate'] = isset($_POST['_pretty_date']) ? TRUE : FALSE;
34
35 if (isset($_POST['_language']))
36   {
37   $sess_user_lang = $_SESSION['user_lang'] = $_POST['_language'];
38   rcmail_set_locale($sess_user_lang);
39   }
40
41 if (rcmail_save_user_prefs($a_user_prefs))
42   show_message('successfullysaved', 'confirmation');
43
44
45 // go to next step
46 $_action = 'preferences';
47
48 // overwrite action variable  
49 $OUTPUT->add_script(sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $_action));  
50
51 ?>