Revision 1872
Added by Dietmar over 11 years ago
- bugfix preferences timezone, date_format, time_format settings, backend and frontend
details.php | ||
---|---|---|
26 | 26 |
|
27 | 27 |
// Get entered values |
28 | 28 |
$display_name = strip_tags($wb->StripCodeFromText($wb->get_post('display_name'))); |
29 |
// language must be 2 upercase letters only |
|
29 | 30 |
$sUserLanguage = strip_tags($wb->StripCodeFromText($wb->get_post('language'))); |
30 |
$timezone = intval($wb->StripCodeFromText($wb->get_post('timezone')))*60*60; |
|
31 |
$sUserLanguage = (preg_match('/^[A-Z]{2}$/', $sUserLanguage) ? $sUserLanguage : DEFAULT_LANGUAGE); |
|
32 |
// timezone must be between -12 and +13 or -20 as system_default |
|
33 |
$timezone = ($wb->StripCodeFromText($wb->get_post('timezone'))); |
|
34 |
$timezone = ( (is_numeric($timezone) && ($timezone!=0)) ? $timezone : -20); |
|
35 |
$timezone = ( ($timezone >= -12 && $timezone <= 13) ? $timezone : -20 ) * 3600; |
|
36 |
// date_format must be a key from /interface/date_formats |
|
31 | 37 |
$date_format = strip_tags($wb->StripCodeFromText($wb->get_post('date_format'))); |
38 |
$date_format = (($date_format==DEFAULT_DATE_FORMAT) ? '' : $date_format); |
|
39 |
$date_format_key = str_replace(' ', '|', $date_format); |
|
40 |
$user_time = true; |
|
41 |
include( ADMIN_PATH.'/interface/date_formats.php' ); |
|
42 |
$date_format = (array_key_exists($date_format_key, $DATE_FORMATS) ? $date_format : 'system_default'); |
|
43 |
$date_format = ($date_format == 'system_default' ? '' : $date_format); |
|
44 |
unset($DATE_FORMATS); |
|
45 |
// time_format must be a key from /interface/time_formats |
|
32 | 46 |
$time_format = strip_tags($wb->StripCodeFromText($wb->get_post('time_format'))); |
47 |
$time_format = (($time_format==DEFAULT_TIME_FORMAT) ? '' : $time_format); |
|
48 |
$time_format_key = str_replace(' ', '|', $time_format); |
|
49 |
$user_time = true; |
|
50 |
include( ADMIN_PATH.'/interface/time_formats.php' ); |
|
51 |
$time_format = (array_key_exists($time_format_key, $TIME_FORMATS) ? $time_format : 'system_default'); |
|
52 |
$time_format = ($time_format == 'system_default' ? '' : $time_format); |
|
53 |
unset($TIME_FORMATS); |
|
33 | 54 |
|
34 | 55 |
// Update the database |
35 | 56 |
$sql = "UPDATE `".TABLE_PREFIX."users` SET "; |
... | ... | |
44 | 65 |
$success[] = $MOD_PREFERENCE['DETAILS_SAVED']; |
45 | 66 |
$_SESSION['DISPLAY_NAME'] = $display_name; |
46 | 67 |
$_SESSION['LANGUAGE'] = $sUserLanguage; |
47 |
$_SESSION['TIME_FORMAT'] = $time_format; |
|
48 |
$_SESSION['DATE_FORMAT'] = $date_format; |
|
49 | 68 |
$_SESSION['TIMEZONE'] = $timezone; |
69 |
if(isset($_SESSION['USE_DEFAULT_TIMEZONE'])) { unset($_SESSION['USE_DEFAULT_TIMEZONE']); } |
|
50 | 70 |
// Update date format |
51 | 71 |
if($date_format != '') { |
52 | 72 |
$_SESSION['DATE_FORMAT'] = $date_format; |
Also available in: Unified diff