source: subversion/trunk/roundcubemail/program/steps/settings/save_prefs.inc @ 1540

Last change on this file since 1540 was 1540, checked in by alec, 5 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
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-2007, 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$
19
20*/
21
22$a_user_prefs = array(
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']) ? max(2, intval($_POST['_pagesize'])) : $CONFIG['pagesize'],
26  'prettydate'   => isset($_POST['_pretty_date']) ? TRUE : FALSE,
27  'prefer_html'  => isset($_POST['_prefer_html']) ? TRUE : FALSE,
28  'addrbook_show_images' => isset($_POST['_addrbook_show_images']) ? TRUE : FALSE,
29  'htmleditor'   => isset($_POST['_htmleditor']) ? TRUE : FALSE,
30  'inline_images'   => isset($_POST['_inline_images']) ? TRUE : FALSE,
31  'preview_pane' => isset($_POST['_preview_pane']) ? TRUE : FALSE,
32  'read_when_deleted' => isset($_POST['_read_when_deleted']) ? TRUE : FALSE,
33  'flag_for_deletion' => isset($_POST['_flag_for_deletion']) ? TRUE : FALSE,
34  'logout_purge' => isset($_POST['_logout_purge']) ? TRUE : FALSE,
35  'logout_expunge' => isset($_POST['_logout_expunge']) ? TRUE : FALSE,
36  'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0,
37  'mdn_requests' => isset($_POST['_mdn_requests']) ? intval($_POST['_mdn_requests']) : 0,
38  'skin' => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['default_skin'],
39  );
40
41// don't override these parameters
42foreach ((array)$CONFIG['dont_override'] as $p)
43  $a_user_prefs[$p] = $CONFIG[$p];
44
45
46// switch UI language
47if (isset($_POST['_language'])) {
48  $RCMAIL->load_language(get_input_value('_language', RCUBE_INPUT_POST));
49}
50
51// switch skin
52$OUTPUT->set_skin($a_user_prefs['skin']);
53
54// force min size
55if ($a_user_prefs['pagesize'] < 1)
56  $a_user_prefs['pagesize'] = 10;
57
58if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['pagesize'] > $CONFIG['max_pagesize']))
59  $a_user_prefs['pagesize'] = (int) $CONFIG['max_pagesize'];
60
61if ($USER->save_prefs($a_user_prefs))
62  $OUTPUT->show_message('successfullysaved', 'confirmation');
63
64
65// go to next step
66rcmail_overwrite_action('preferences');
67
68?>
Note: See TracBrowser for help on using the repository browser.