1
|
<?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: details.php 1872 2013-02-25 11:48:24Z Luisehahne $
|
14
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/account/details.php $
|
15
|
* @lastmodified $Date: 2013-02-25 12:48:24 +0100 (Mon, 25 Feb 2013) $
|
16
|
*
|
17
|
*/
|
18
|
|
19
|
/* -------------------------------------------------------- */
|
20
|
// Must include code to stop this file being accessed directly
|
21
|
if(!defined('WB_PATH')) {
|
22
|
require_once(dirname(dirname(__FILE__)).'/framework/globalExceptionHandler.php');
|
23
|
throw new IllegalFileException();
|
24
|
}
|
25
|
/* -------------------------------------------------------- */
|
26
|
|
27
|
// Get entered values
|
28
|
$display_name = strip_tags($wb->StripCodeFromText($wb->get_post('display_name')));
|
29
|
// language must be 2 upercase letters only
|
30
|
$sUserLanguage = strip_tags($wb->StripCodeFromText($wb->get_post('language')));
|
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
|
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
|
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);
|
54
|
|
55
|
// Update the database
|
56
|
$sql = "UPDATE `".TABLE_PREFIX."users` SET ";
|
57
|
$sql .= "`display_name` = '".$display_name."', `language` = '".$sUserLanguage."', ";
|
58
|
$sql .= "`timezone` = '".$timezone."', `date_format` = '".$date_format."', ";
|
59
|
$sql .= "`time_format` = '".$time_format."' ";
|
60
|
$sql .= "WHERE `user_id` = '".$wb->get_user_id()."'";
|
61
|
$database->query($sql);
|
62
|
if($database->is_error()) {
|
63
|
$error[] = $database->get_error();
|
64
|
} else {
|
65
|
$success[] = $MOD_PREFERENCE['DETAILS_SAVED'];
|
66
|
$_SESSION['DISPLAY_NAME'] = $display_name;
|
67
|
$_SESSION['LANGUAGE'] = $sUserLanguage;
|
68
|
$_SESSION['TIMEZONE'] = $timezone;
|
69
|
if(isset($_SESSION['USE_DEFAULT_TIMEZONE'])) { unset($_SESSION['USE_DEFAULT_TIMEZONE']); }
|
70
|
// Update date format
|
71
|
if($date_format != '') {
|
72
|
$_SESSION['DATE_FORMAT'] = $date_format;
|
73
|
if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); }
|
74
|
} else {
|
75
|
$_SESSION['USE_DEFAULT_DATE_FORMAT'] = true;
|
76
|
if(isset($_SESSION['DATE_FORMAT'])) { unset($_SESSION['DATE_FORMAT']); }
|
77
|
}
|
78
|
// Update time format
|
79
|
if($time_format != '') {
|
80
|
$_SESSION['TIME_FORMAT'] = $time_format;
|
81
|
if(isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) { unset($_SESSION['USE_DEFAULT_TIME_FORMAT']); }
|
82
|
} else {
|
83
|
$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true;
|
84
|
if(isset($_SESSION['TIME_FORMAT'])) { unset($_SESSION['TIME_FORMAT']); }
|
85
|
}
|
86
|
}
|