commit | author | age
|
614c64
|
1 |
<?php |
A |
2 |
/* |
|
3 |
|
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/utils/save_pref.inc | |
|
6 |
| | |
e019f2
|
7 |
| This file is part of the Roundcube Webmail client | |
f5e7b3
|
8 |
| Copyright (C) 2005-2010, The Roundcube Dev Team | |
7fe381
|
9 |
| | |
T |
10 |
| Licensed under the GNU General Public License version 3 or | |
|
11 |
| any later version with exceptions for skins & plugins. | |
|
12 |
| See the README file for a full license statement. | |
614c64
|
13 |
| | |
A |
14 |
| PURPOSE: | |
|
15 |
| Save preferences setting in database | |
|
16 |
| | |
|
17 |
+-----------------------------------------------------------------------+ |
|
18 |
| Author: Aleksander Machniak <alec@alec.pl> | |
|
19 |
+-----------------------------------------------------------------------+ |
|
20 |
|
ffc040
|
21 |
$Id$ |
614c64
|
22 |
|
A |
23 |
*/ |
|
24 |
|
|
25 |
$name = get_input_value('_name', RCUBE_INPUT_POST); |
|
26 |
$value = get_input_value('_value', RCUBE_INPUT_POST); |
|
27 |
|
|
28 |
// save preference value |
|
29 |
$RCMAIL->user->save_prefs(array($name => $value)); |
|
30 |
|
|
31 |
// update also session if requested |
|
32 |
if ($sessname = get_input_value('_session', RCUBE_INPUT_POST)) { |
|
33 |
// Support multidimensional arrays... |
|
34 |
$vars = explode('/', $sessname); |
|
35 |
|
|
36 |
// ... up to 3 levels |
|
37 |
if (count($vars) == 1) |
|
38 |
$_SESSION[$vars[0]] = $value; |
|
39 |
else if (count($vars) == 2) |
|
40 |
$_SESSION[$vars[0]][$vars[1]] = $value; |
|
41 |
else if (count($vars) == 3) |
|
42 |
$_SESSION[$vars[0]][$vars[1]][$vars[2]] = $value; |
|
43 |
} |
|
44 |
|
|
45 |
$OUTPUT->reset(); |
|
46 |
$OUTPUT->send(); |
|
47 |
|
|
48 |
|