1 |
1262
|
Luisehahne
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category frontend
|
5 |
|
|
* @package account
|
6 |
1268
|
Luisehahne
|
* @author WebsiteBaker Project
|
7 |
1262
|
Luisehahne
|
* @copyright 2004-2009, Ryan Djurovich
|
8 |
1349
|
Luisehahne
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
9 |
1262
|
Luisehahne
|
* @link http://www.websitebaker2.org/
|
10 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
11 |
|
|
* @platform WebsiteBaker 2.8.x
|
12 |
1374
|
Luisehahne
|
* @requirements PHP 5.2.2 and higher
|
13 |
1268
|
Luisehahne
|
* @version $Id$
|
14 |
|
|
* @filesource $HeadURL$
|
15 |
1262
|
Luisehahne
|
* @lastmodified $Date$
|
16 |
|
|
*
|
17 |
|
|
*/
|
18 |
|
|
|
19 |
|
|
if(!defined('WB_URL')) {
|
20 |
|
|
header('Location: ../pages/index.php');
|
21 |
|
|
exit(0);
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
// Get entered values
|
25 |
|
|
$display_name = $wb->add_slashes(strip_tags($wb->get_post('display_name')));
|
26 |
|
|
$language = $wb->get_post_escaped('language');
|
27 |
|
|
$timezone = $wb->get_post_escaped('timezone')*60*60;
|
28 |
|
|
$date_format = $wb->get_post_escaped('date_format');
|
29 |
|
|
$time_format = $wb->get_post_escaped('time_format');
|
30 |
|
|
|
31 |
|
|
// Create a javascript back link
|
32 |
|
|
$js_back = "javascript: history.go(-1);";
|
33 |
|
|
|
34 |
|
|
// Update the database
|
35 |
|
|
$database = new database();
|
36 |
|
|
$query = "UPDATE ".TABLE_PREFIX."users SET display_name = '$display_name', language = '$language', timezone = '$timezone', date_format = '$date_format', time_format = '$time_format' WHERE user_id = '".$wb->get_user_id()."'";
|
37 |
|
|
$database->query($query);
|
38 |
|
|
if($database->is_error()) {
|
39 |
|
|
$wb->print_error($database->get_error,'index.php',false);
|
40 |
|
|
} else {
|
41 |
|
|
$wb->print_success($MESSAGE['PREFERENCES']['DETAILS_SAVED'], WB_URL.'/account/preferences.php');
|
42 |
|
|
$_SESSION['DISPLAY_NAME'] = $display_name;
|
43 |
|
|
$_SESSION['LANGUAGE'] = $language;
|
44 |
|
|
// Update date format
|
45 |
|
|
if($date_format != '') {
|
46 |
|
|
$_SESSION['DATE_FORMAT'] = $date_format;
|
47 |
|
|
if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); }
|
48 |
|
|
} else {
|
49 |
|
|
$_SESSION['USE_DEFAULT_DATE_FORMAT'] = true;
|
50 |
|
|
if(isset($_SESSION['DATE_FORMAT'])) { unset($_SESSION['DATE_FORMAT']); }
|
51 |
|
|
}
|
52 |
|
|
// Update time format
|
53 |
|
|
if($time_format != '') {
|
54 |
|
|
$_SESSION['TIME_FORMAT'] = $time_format;
|
55 |
|
|
if(isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) { unset($_SESSION['USE_DEFAULT_TIME_FORMAT']); }
|
56 |
|
|
} else {
|
57 |
|
|
$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true;
|
58 |
|
|
if(isset($_SESSION['TIME_FORMAT'])) { unset($_SESSION['TIME_FORMAT']); }
|
59 |
|
|
}
|
60 |
|
|
// Update timezone
|
61 |
|
|
if($timezone != '-72000') {
|
62 |
|
|
$_SESSION['TIMEZONE'] = $timezone;
|
63 |
|
|
if(isset($_SESSION['USE_DEFAULT_TIMEZONE'])) { unset($_SESSION['USE_DEFAULT_TIMEZONE']); }
|
64 |
|
|
} else {
|
65 |
|
|
$_SESSION['USE_DEFAULT_TIMEZONE'] = true;
|
66 |
|
|
if(isset($_SESSION['TIMEZONE'])) { unset($_SESSION['TIMEZONE']); }
|
67 |
|
|
}
|
68 |
|
|
}
|
69 |
|
|
|
70 |
239
|
stefan
|
?>
|