1 |
1386
|
Luisehahne
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category frontend
|
5 |
|
|
* @package account
|
6 |
|
|
* @author WebsiteBaker Project
|
7 |
|
|
* @copyright 2004-2009, Ryan Djurovich
|
8 |
|
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
9 |
|
|
* @link http://www.websitebaker2.org/
|
10 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
11 |
|
|
* @platform WebsiteBaker 2.8.x
|
12 |
|
|
* @requirements PHP 5.2.2 and higher
|
13 |
|
|
* @version $Id$
|
14 |
|
|
* @filesource $HeadURL$
|
15 |
|
|
* @lastmodified $Date$
|
16 |
|
|
*
|
17 |
|
|
*/
|
18 |
|
|
|
19 |
1420
|
Luisehahne
|
// Must include code to stop this file being access directly
|
20 |
|
|
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
|
21 |
1386
|
Luisehahne
|
|
22 |
1407
|
FrankH
|
// Get and sanitize entered values
|
23 |
1386
|
Luisehahne
|
$display_name = $wb->add_slashes(strip_tags($wb->get_post('display_name')));
|
24 |
1407
|
FrankH
|
$language = strtoupper($wb->get_post('language'));
|
25 |
|
|
$language = (preg_match('/^[A-Z]{2}$/', $language) ? $language : DEFAULT_LANGUAGE);
|
26 |
|
|
$timezone = (int) $wb->get_post_escaped('timezone')*60*60;
|
27 |
1386
|
Luisehahne
|
|
28 |
1407
|
FrankH
|
// date_format must be a key from /interface/date_formats
|
29 |
|
|
$date_format = $wb->get_post('date_format');
|
30 |
|
|
$date_format_key = str_replace(' ', '|', $date_format);
|
31 |
|
|
$user_time = true;
|
32 |
|
|
include( ADMIN_PATH.'/interface/date_formats.php' );
|
33 |
|
|
$date_format = (array_key_exists($date_format_key, $DATE_FORMATS) ? $date_format : 'system_default');
|
34 |
|
|
$date_format = ($date_format == 'system_default' ? '' : $date_format);
|
35 |
|
|
unset($DATE_FORMATS);
|
36 |
|
|
|
37 |
|
|
// time_format must be a key from /interface/time_formats
|
38 |
|
|
$time_format = $wb->get_post('time_format');
|
39 |
|
|
$time_format_key = str_replace(' ', '|', $time_format);
|
40 |
|
|
$user_time = true;
|
41 |
|
|
include( ADMIN_PATH.'/interface/time_formats.php' );
|
42 |
|
|
$time_format = (array_key_exists($time_format_key, $TIME_FORMATS) ? $time_format : 'system_default');
|
43 |
|
|
$time_format = ($time_format == 'system_default' ? '' : $time_format);
|
44 |
|
|
unset($TIME_FORMATS);
|
45 |
|
|
|
46 |
1400
|
FrankH
|
if (!$wb->checkFTAN())
|
47 |
|
|
{
|
48 |
|
|
$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
|
49 |
|
|
exit();
|
50 |
|
|
}
|
51 |
|
|
|
52 |
1386
|
Luisehahne
|
// Create a javascript back link
|
53 |
|
|
$js_back = "javascript: history.go(-1);";
|
54 |
|
|
|
55 |
|
|
// Update the database
|
56 |
|
|
// $database = new database();
|
57 |
|
|
$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()."'";
|
58 |
|
|
$database->query($query);
|
59 |
|
|
if($database->is_error()) {
|
60 |
|
|
$wb->print_error($database->get_error,'index.php',false);
|
61 |
|
|
} else {
|
62 |
|
|
$wb->print_success($MESSAGE['PREFERENCES']['DETAILS_SAVED'], WB_URL.'/account/preferences.php');
|
63 |
|
|
$_SESSION['DISPLAY_NAME'] = $display_name;
|
64 |
|
|
$_SESSION['LANGUAGE'] = $language;
|
65 |
|
|
// Update date format
|
66 |
|
|
if($date_format != '') {
|
67 |
|
|
$_SESSION['DATE_FORMAT'] = $date_format;
|
68 |
|
|
if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); }
|
69 |
|
|
} else {
|
70 |
|
|
$_SESSION['USE_DEFAULT_DATE_FORMAT'] = true;
|
71 |
|
|
if(isset($_SESSION['DATE_FORMAT'])) { unset($_SESSION['DATE_FORMAT']); }
|
72 |
|
|
}
|
73 |
|
|
// Update time format
|
74 |
|
|
if($time_format != '') {
|
75 |
|
|
$_SESSION['TIME_FORMAT'] = $time_format;
|
76 |
|
|
if(isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) { unset($_SESSION['USE_DEFAULT_TIME_FORMAT']); }
|
77 |
|
|
} else {
|
78 |
|
|
$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true;
|
79 |
|
|
if(isset($_SESSION['TIME_FORMAT'])) { unset($_SESSION['TIME_FORMAT']); }
|
80 |
|
|
}
|
81 |
|
|
// Update timezone
|
82 |
|
|
if($timezone != '-72000') {
|
83 |
|
|
$_SESSION['TIMEZONE'] = $timezone;
|
84 |
|
|
if(isset($_SESSION['USE_DEFAULT_TIMEZONE'])) { unset($_SESSION['USE_DEFAULT_TIMEZONE']); }
|
85 |
|
|
} else {
|
86 |
|
|
$_SESSION['USE_DEFAULT_TIMEZONE'] = true;
|
87 |
|
|
if(isset($_SESSION['TIMEZONE'])) { unset($_SESSION['TIMEZONE']); }
|
88 |
|
|
}
|
89 |
|
|
}
|
90 |
|
|
|
91 |
239
|
stefan
|
?>
|