Revision 1872
Added by Dietmar over 11 years ago
- bugfix preferences timezone, date_format, time_format settings, backend and frontend
branches/2.8.x/CHANGELOG | ||
---|---|---|
12 | 12 |
=============================================================================== |
13 | 13 |
|
14 | 14 |
|
15 |
25 Feb-2013 Build 1872 Dietmar Woellbrink (Luisehahne) |
|
16 |
# bugfix preferences timezone, date_format, time_format settings, backend and frontend |
|
15 | 17 |
23 Feb-2013 Build 1871 Dietmar Woellbrink (Luisehahne) |
16 | 18 |
# bugfix Undefined variable: sName in .../framework/functions.php |
17 | 19 |
# bugfix droplet ShowWysiwyg Undefined variable: module |
branches/2.8.x/wb/admin/interface/time_formats.php | ||
---|---|---|
35 | 35 |
$TIME_FORMATS = array(); |
36 | 36 |
|
37 | 37 |
// Get the current time (in the users timezone if required) |
38 |
$actual_time = time()+ ((isset($user_time) AND $user_time == true) ? TIMEZONE : DEFAULT_TIMEZONE); |
|
39 |
|
|
38 |
$iTimeZone = TIMEZONE!=0 ? TIMEZONE/3600 : 0; |
|
39 |
$iTimeZone = ( ($iTimeZone >= -12 && $iTimeZone <= 13) ? TIMEZONE : $iTimeZone ); |
|
40 |
$actual_time = time()+ ((isset($user_time) AND $user_time == true) ? $iTimeZone : DEFAULT_TIMEZONE); |
|
40 | 41 |
// Add values to list |
41 | 42 |
$TIME_FORMATS['h:i|A'] = gmdate('h:i A', $actual_time); |
42 | 43 |
$TIME_FORMATS['h:i|a'] = gmdate('h:i a', $actual_time); |
branches/2.8.x/wb/admin/interface/version.php | ||
---|---|---|
51 | 51 |
|
52 | 52 |
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled) |
53 | 53 |
if(!defined('VERSION')) define('VERSION', '2.8.3'); |
54 |
if(!defined('REVISION')) define('REVISION', '1871');
|
|
54 |
if(!defined('REVISION')) define('REVISION', '1872');
|
|
55 | 55 |
if(!defined('SP')) define('SP', ''); |
branches/2.8.x/wb/admin/interface/date_formats.php | ||
---|---|---|
35 | 35 |
$DATE_FORMATS = array(); |
36 | 36 |
|
37 | 37 |
// Get the current time (in the users timezone if required) |
38 |
$actual_time = time()+ ((isset($user_time) && $user_time == true) ? TIMEZONE : DEFAULT_TIMEZONE); |
|
38 |
$iTimeZone = TIMEZONE!=0 ? TIMEZONE/3600 : 0; |
|
39 |
$iTimeZone = ( ($iTimeZone >= -12 && $iTimeZone <= 13) ? TIMEZONE : $iTimeZone ); |
|
40 |
$actual_time = time()+ ((isset($user_time) && $user_time == true) ? $iTimeZone : DEFAULT_TIMEZONE); |
|
39 | 41 |
|
40 | 42 |
// Add values to list |
41 | 43 |
$DATE_FORMATS['l,|jS|F,|Y'] = gmdate('l, jS F, Y', $actual_time); |
branches/2.8.x/wb/admin/preferences/save.php | ||
---|---|---|
38 | 38 |
$language = strtoupper($admin->get_post('language')); |
39 | 39 |
$language = (preg_match('/^[A-Z]{2}$/', $language) ? $language : DEFAULT_LANGUAGE); |
40 | 40 |
// timezone must be between -12 and +13 or -20 as system_default |
41 |
$timezone = $admin->get_post('timezone');
|
|
42 |
$timezone = (is_numeric($timezone) ? $timezone : -20);
|
|
43 |
$timezone = ( ($timezone >= -12 && $timezone <= 13) ? $timezone : -20 ) * 3600;
|
|
41 |
$timezone = ($admin->get_post('timezone'));
|
|
42 |
$timezone = ( (is_numeric($timezone) && ($timezone!=0)) ? $timezone : -20);
|
|
43 |
$timezone = ( ($timezone >= -12 && $timezone <= 13) ? $timezone : -20 ) * 3600;
|
|
44 | 44 |
// date_format must be a key from /interface/date_formats |
45 |
$date_format = $admin->get_post('date_format'); |
|
46 |
$date_format_key = str_replace(' ', '|', $date_format); |
|
47 |
$user_time = true; |
|
48 |
include( ADMIN_PATH.'/interface/date_formats.php' ); |
|
49 |
$date_format = (array_key_exists($date_format_key, $DATE_FORMATS) ? $date_format : 'system_default'); |
|
50 |
$date_format = ($date_format == 'system_default' ? '' : $date_format); |
|
51 |
unset($DATE_FORMATS); |
|
45 |
$date_format = $admin->get_post('date_format'); |
|
46 |
$date_format = (($date_format==DEFAULT_DATE_FORMAT) ? '' : $date_format); |
|
47 |
$date_format_key = str_replace(' ', '|', $date_format); |
|
48 |
$user_time = true; |
|
49 |
include( ADMIN_PATH.'/interface/date_formats.php' ); |
|
50 |
$date_format = (array_key_exists($date_format_key, $DATE_FORMATS) ? $date_format : 'system_default'); |
|
51 |
$date_format = ($date_format == 'system_default' ? '' : $date_format); |
|
52 |
unset($DATE_FORMATS); |
|
52 | 53 |
// time_format must be a key from /interface/time_formats |
53 |
$time_format = $admin->get_post('time_format'); |
|
54 |
$time_format_key = str_replace(' ', '|', $time_format); |
|
55 |
$user_time = true; |
|
56 |
include( ADMIN_PATH.'/interface/time_formats.php' ); |
|
57 |
$time_format = (array_key_exists($time_format_key, $TIME_FORMATS) ? $time_format : 'system_default'); |
|
58 |
$time_format = ($time_format == 'system_default' ? '' : $time_format); |
|
59 |
unset($TIME_FORMATS); |
|
54 |
$time_format = $admin->get_post('time_format'); |
|
55 |
$time_format = (($time_format==DEFAULT_TIME_FORMAT) ? '' : $time_format); |
|
56 |
$time_format_key = str_replace(' ', '|', $time_format); |
|
57 |
$user_time = true; |
|
58 |
include( ADMIN_PATH.'/interface/time_formats.php' ); |
|
59 |
$time_format = (array_key_exists($time_format_key, $TIME_FORMATS) ? $time_format : 'system_default'); |
|
60 |
$time_format = ($time_format == 'system_default' ? '' : $time_format); |
|
61 |
unset($TIME_FORMATS); |
|
60 | 62 |
// email should be validatet by core |
61 | 63 |
|
62 | 64 |
// $email = trim( $admin->get_post('email') == null ? '' : $admin->get_post('email') ); |
... | ... | |
83 | 85 |
} |
84 | 86 |
|
85 | 87 |
// receive password vars and calculate needed action |
86 |
$sCurrentPassword = $admin->add_slashes($admin->StripCodeFromText($admin->get_post('current_password'),true));
|
|
87 |
$sNewPassword = $admin->add_slashes($admin->StripCodeFromText($admin->get_post('new_password_1'),true));
|
|
88 |
$sNewPasswordRetyped = $admin->add_slashes($admin->StripCodeFromText($admin->get_post('new_password_2'),true));
|
|
88 |
$sCurrentPassword = $admin->add_slashes($admin->StripCodeFromText($admin->get_post('current_password'),true));
|
|
89 |
$sNewPassword = $admin->add_slashes($admin->StripCodeFromText($admin->get_post('new_password_1'),true));
|
|
90 |
$sNewPasswordRetyped = $admin->add_slashes($admin->StripCodeFromText($admin->get_post('new_password_2'),true));
|
|
89 | 91 |
|
90 |
if($bMailHasChanged == true)
|
|
91 |
{
|
|
92 |
$bPassRequest = $bMailHasChanged;
|
|
93 |
} else {
|
|
94 |
$bPassRequest = ( ( $sCurrentPassword != '') || ($sNewPassword != '') || ($sNewPasswordRetyped != '') ) ? true : false;
|
|
95 |
}
|
|
96 |
// Check existing password
|
|
97 |
$sql = 'SELECT `password` ';
|
|
98 |
$sql .= 'FROM `'.TABLE_PREFIX.'users` ';
|
|
99 |
$sql .= 'WHERE `user_id` = '.$admin->get_user_id();
|
|
100 |
if ( $bPassRequest && md5($sCurrentPassword) != $database->get_one($sql) ) {
|
|
101 |
// access denied
|
|
102 |
$err_msg[] = $MESSAGE['PREFERENCES_CURRENT_PASSWORD_INCORRECT'];
|
|
103 |
} else {
|
|
104 |
// validate new password
|
|
105 |
$sPwHashNew = false;
|
|
106 |
if( ($sNewPassword != '') || ($sNewPasswordRetyped != '') ) {
|
|
107 |
if(strlen($sNewPassword) < $iMinPassLength) {
|
|
108 |
$err_msg[] = $MESSAGE['USERS_PASSWORD_TOO_SHORT'];
|
|
109 |
} else {
|
|
110 |
if($sNewPassword != $sNewPasswordRetyped) {
|
|
111 |
$err_msg[] = $MESSAGE['USERS_PASSWORD_MISMATCH'];
|
|
112 |
} else {
|
|
113 |
$pattern = '/[^'.$admin->password_chars.']/';
|
|
114 |
if (preg_match($pattern, $sNewPassword)) {
|
|
115 |
$err_msg[] = $MESSAGE['PREFERENCES_INVALID_CHARS'];
|
|
116 |
} else {
|
|
117 |
$sPwHashNew = md5($sNewPassword);
|
|
118 |
}
|
|
119 |
}
|
|
120 |
}
|
|
121 |
}
|
|
92 |
if($bMailHasChanged == true)
|
|
93 |
{
|
|
94 |
$bPassRequest = $bMailHasChanged;
|
|
95 |
} else {
|
|
96 |
$bPassRequest = ( ( $sCurrentPassword != '') || ($sNewPassword != '') || ($sNewPasswordRetyped != '') ) ? true : false;
|
|
97 |
}
|
|
98 |
// Check existing password
|
|
99 |
$sql = 'SELECT `password` ';
|
|
100 |
$sql .= 'FROM `'.TABLE_PREFIX.'users` ';
|
|
101 |
$sql .= 'WHERE `user_id` = '.$admin->get_user_id();
|
|
102 |
if ( $bPassRequest && md5($sCurrentPassword) != $database->get_one($sql) ) {
|
|
103 |
// access denied
|
|
104 |
$err_msg[] = $MESSAGE['PREFERENCES_CURRENT_PASSWORD_INCORRECT'];
|
|
105 |
} else { |
|
106 |
// validate new password
|
|
107 |
$sPwHashNew = false;
|
|
108 |
if( ($sNewPassword != '') || ($sNewPasswordRetyped != '') ) {
|
|
109 |
if(strlen($sNewPassword) < $iMinPassLength) {
|
|
110 |
$err_msg[] = $MESSAGE['USERS_PASSWORD_TOO_SHORT'];
|
|
111 |
} else {
|
|
112 |
if($sNewPassword != $sNewPasswordRetyped) {
|
|
113 |
$err_msg[] = $MESSAGE['USERS_PASSWORD_MISMATCH'];
|
|
114 |
} else {
|
|
115 |
$pattern = '/[^'.$admin->password_chars.']/';
|
|
116 |
if (preg_match($pattern, $sNewPassword)) {
|
|
117 |
$err_msg[] = $MESSAGE['PREFERENCES_INVALID_CHARS'];
|
|
118 |
} else {
|
|
119 |
$sPwHashNew = md5($sNewPassword);
|
|
120 |
}
|
|
121 |
}
|
|
122 |
}
|
|
123 |
}
|
|
122 | 124 |
|
123 |
// if no validation errors, try to update the database, otherwise return errormessages |
|
124 |
if(sizeof($err_msg) == 0) |
|
125 |
{ |
|
126 |
$sql = 'UPDATE `'.TABLE_PREFIX.'users` '; |
|
127 |
$sql .= 'SET `display_name`=\''.$display_name.'\', '; |
|
128 |
if($sPwHashNew) { |
|
129 |
$sql .= '`password`=\''.$sPwHashNew.'\', '; |
|
130 |
} |
|
131 |
if($email != '') { |
|
132 |
$sql .= '`email`=\''.$email.'\', '; |
|
133 |
} |
|
134 |
$sql .= '`language`=\''.$language.'\', '; |
|
135 |
$sql .= '`timezone`=\''.$timezone.'\', '; |
|
136 |
$sql .= '`date_format`=\''.$date_format.'\', '; |
|
137 |
$sql .= '`time_format`=\''.$time_format.'\' '; |
|
138 |
$sql .= 'WHERE `user_id`='.(int)$admin->get_user_id(); |
|
139 |
if( $database->query($sql) ) |
|
140 |
{ |
|
141 |
// update successfull, takeover values into the session |
|
142 |
$_SESSION['DISPLAY_NAME'] = $display_name; |
|
143 |
$_SESSION['LANGUAGE'] = $language; |
|
144 |
$_SESSION['TIMEZONE'] = $timezone; |
|
145 |
$_SESSION['EMAIL'] = $email; |
|
146 |
// Update date format |
|
147 |
if($date_format != '') { |
|
148 |
$_SESSION['DATE_FORMAT'] = $date_format; |
|
149 |
if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); } |
|
150 |
} else { |
|
151 |
$_SESSION['USE_DEFAULT_DATE_FORMAT'] = true; |
|
152 |
if(isset($_SESSION['DATE_FORMAT'])) { unset($_SESSION['DATE_FORMAT']); } |
|
153 |
} |
|
154 |
// Update time format |
|
155 |
if($time_format != '') { |
|
156 |
$_SESSION['TIME_FORMAT'] = $time_format; |
|
157 |
if(isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) { unset($_SESSION['USE_DEFAULT_TIME_FORMAT']); } |
|
158 |
} else { |
|
159 |
$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true; |
|
160 |
if(isset($_SESSION['TIME_FORMAT'])) { unset($_SESSION['TIME_FORMAT']); } |
|
161 |
} |
|
162 |
} else { |
|
163 |
$err_msg[] = 'invalid database UPDATE call in '.__FILE__.'::'.__FUNCTION__.'before line '.__LINE__; |
|
164 |
} |
|
165 |
} |
|
166 |
} |
|
125 |
// if no validation errors, try to update the database, otherwise return errormessages |
|
126 |
if(sizeof($err_msg) == 0) |
|
127 |
{ |
|
128 |
$sql = 'UPDATE `'.TABLE_PREFIX.'users` '; |
|
129 |
$sql .= 'SET `display_name`=\''.$display_name.'\', '; |
|
130 |
if($sPwHashNew) { |
|
131 |
$sql .= '`password`=\''.$sPwHashNew.'\', '; |
|
132 |
} |
|
133 |
if($email != '') { |
|
134 |
$sql .= '`email`=\''.$email.'\', '; |
|
135 |
} |
|
136 |
$sql .= '`language`=\''.$language.'\', '; |
|
137 |
$sql .= '`timezone`=\''.$timezone.'\', '; |
|
138 |
$sql .= '`date_format`=\''.$date_format.'\', '; |
|
139 |
$sql .= '`time_format`=\''.$time_format.'\' '; |
|
140 |
$sql .= 'WHERE `user_id`='.(int)$admin->get_user_id(); |
|
141 |
if( $database->query($sql) ) |
|
142 |
{ |
|
143 |
// update successfull, takeover values into the session |
|
144 |
$_SESSION['DISPLAY_NAME'] = $display_name; |
|
145 |
$_SESSION['LANGUAGE'] = $language; |
|
146 |
$_SESSION['EMAIL'] = $email; |
|
147 |
$_SESSION['TIMEZONE'] = $timezone; |
|
148 |
if(isset($_SESSION['USE_DEFAULT_TIMEZONE'])) { unset($_SESSION['USE_DEFAULT_TIMEZONE']); } |
|
149 |
// Update date format |
|
150 |
if($date_format != '') { |
|
151 |
$_SESSION['DATE_FORMAT'] = $date_format; |
|
152 |
if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); } |
|
153 |
} else { |
|
154 |
$_SESSION['USE_DEFAULT_DATE_FORMAT'] = true; |
|
155 |
if(isset($_SESSION['DATE_FORMAT'])) { unset($_SESSION['DATE_FORMAT']); } |
|
156 |
} |
|
157 |
// Update time format |
|
158 |
if($time_format != '') { |
|
159 |
$_SESSION['TIME_FORMAT'] = $time_format; |
|
160 |
if(isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) { unset($_SESSION['USE_DEFAULT_TIME_FORMAT']); } |
|
161 |
} else { |
|
162 |
$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true; |
|
163 |
if(isset($_SESSION['TIME_FORMAT'])) { unset($_SESSION['TIME_FORMAT']); } |
|
164 |
} |
|
165 |
} else { |
|
166 |
$err_msg[] = 'invalid database UPDATE call in '.__FILE__.'::'.__FUNCTION__.'before line '.__LINE__; |
|
167 |
} |
|
168 |
} |
|
169 |
} |
|
167 | 170 |
|
168 |
}
|
|
171 |
}
|
|
169 | 172 |
|
170 | 173 |
return ( (sizeof($err_msg) > 0) ? implode('<br />', $err_msg) : '' ); |
171 | 174 |
} |
branches/2.8.x/wb/admin/preferences/index.php | ||
---|---|---|
60 | 60 |
} |
61 | 61 |
} |
62 | 62 |
// Insert default timezone values |
63 |
$user_time = true; |
|
63 | 64 |
include_once( ADMIN_PATH.'/interface/timezones.php' ); |
64 | 65 |
$template->set_block('main_block', 'timezone_list_block', 'timezone_list'); |
65 | 66 |
foreach( $TIMEZONES AS $hour_offset => $title ) |
... | ... | |
73 | 74 |
$user_time = true; |
74 | 75 |
include_once( ADMIN_PATH.'/interface/date_formats.php' ); |
75 | 76 |
$template->set_block('main_block', 'date_format_list_block', 'date_format_list'); |
77 |
|
|
76 | 78 |
foreach( $DATE_FORMATS AS $format => $title ) |
77 | 79 |
{ |
78 | 80 |
$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key) |
79 | 81 |
$template->set_var( 'VALUE', ($format != 'system_default' ? $format : 'system_default') ); |
80 | 82 |
$template->set_var( 'NAME', $title ); |
81 |
if( (DATE_FORMAT == $format && !isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) ||
|
|
83 |
if( ($admin->get_session('DATE_FORMAT') == $format && !isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) ||
|
|
82 | 84 |
('system_default' == $format && isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) ) |
83 | 85 |
{ |
84 | 86 |
$template->set_var('SELECTED', ' selected="selected"'); |
... | ... | |
88 | 90 |
$template->parse('date_format_list', 'date_format_list_block', true); |
89 | 91 |
} |
90 | 92 |
// Insert time format list |
93 |
$user_time = true; |
|
91 | 94 |
include_once( ADMIN_PATH.'/interface/time_formats.php' ); |
92 | 95 |
$template->set_block('main_block', 'time_format_list_block', 'time_format_list'); |
93 | 96 |
foreach( $TIME_FORMATS AS $format => $title ) |
... | ... | |
95 | 98 |
$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key) |
96 | 99 |
$template->set_var('VALUE', $format != 'system_default' ? $format : 'system_default' ); |
97 | 100 |
$template->set_var('NAME', $title); |
98 |
if( (TIME_FORMAT == $format && !isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) ||
|
|
101 |
if( ($admin->get_session('TIME_FORMAT') == $format && !isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) ||
|
|
99 | 102 |
('system_default' == $format && isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) ) |
100 | 103 |
{ |
101 | 104 |
$template->set_var('SELECTED', ' selected="selected"'); |
branches/2.8.x/wb/account/htt/preferences.htt | ||
---|---|---|
34 | 34 |
<td>{TEXT_TIMEZONE}:</td> |
35 | 35 |
<td class="input"> |
36 | 36 |
<select name="timezone" style="width: 98%;"> |
37 |
<option value="0">{MOD_PREFERENCE_PLEASE_SELECT}</option> |
|
38 | 37 |
<!-- BEGIN timezone_list_block --> |
39 | 38 |
<option value="{VALUE}" {SELECTED}>{NAME}</option> |
40 | 39 |
<!-- END timezone_list_block --> |
... | ... | |
45 | 44 |
<td>{TEXT_DATE_FORMAT}:</td> |
46 | 45 |
<td class="input"> |
47 | 46 |
<select name="date_format" style="width: 98%;"> |
48 |
<option value="">{MOD_PREFERENCE_PLEASE_SELECT}</option> |
|
49 | 47 |
<!-- BEGIN date_format_list_block --> |
50 | 48 |
<option value="{VALUE}" {SELECTED}>{NAME}</option> |
51 | 49 |
<!-- END date_format_list_block --> |
... | ... | |
56 | 54 |
<td>{TEXT_TIME_FORMAT}:</td> |
57 | 55 |
<td class="input"> |
58 | 56 |
<select name="time_format" style="width: 98%;"> |
59 |
<option value="">{MOD_PREFERENCE_PLEASE_SELECT}</option> |
|
60 | 57 |
<!-- BEGIN time_format_list_block --> |
61 | 58 |
<option value="{VALUE}" {SELECTED}>{NAME}</option> |
62 | 59 |
<!-- END time_format_list_block --> |
branches/2.8.x/wb/account/preferences_form.php | ||
---|---|---|
60 | 60 |
$sIncludeHeadLinkCss .= ' rel="stylesheet" type="text/css" media="screen" />'."\n"; |
61 | 61 |
} |
62 | 62 |
|
63 |
$user_time = true; |
|
64 |
require(ADMIN_PATH.'/interface/timezones.php'); |
|
65 |
require(ADMIN_PATH.'/interface/date_formats.php'); |
|
66 |
require(ADMIN_PATH.'/interface/time_formats.php'); |
|
67 | 63 |
$error = array(); |
68 | 64 |
$success = array(); |
69 | 65 |
|
... | ... | |
172 | 168 |
$template->set_block('main_block', 'language_list_block', 'language_list'); |
173 | 169 |
foreach( $aLangUsed as $sDirectory => $sName ) |
174 | 170 |
{ |
175 |
$langIcons = ( empty($sDirectory) ? 'none' : strtolower($sDirectory));
|
|
171 |
$langIcons = ( empty($sDirectory) ? 'none' : strtolower($sDirectory));
|
|
176 | 172 |
|
177 |
$template->set_var('CODE', $sDirectory);
|
|
178 |
$template->set_var('NAME', $sName);
|
|
179 |
$template->set_var('FLAG', THEME_URL.'/images/flags/'.$langIcons);
|
|
180 |
$template->set_var('SELECTED', ( $_SESSION['LANGUAGE'] == $sDirectory ? ' selected="selected"' : '') );
|
|
173 |
$template->set_var('CODE', $sDirectory);
|
|
174 |
$template->set_var('NAME', $sName);
|
|
175 |
$template->set_var('FLAG', THEME_URL.'/images/flags/'.$langIcons);
|
|
176 |
$template->set_var('SELECTED', ( $_SESSION['LANGUAGE'] == $sDirectory ? ' selected="selected"' : '') );
|
|
181 | 177 |
|
182 |
$template->parse('language_list', 'language_list_block', true);
|
|
178 |
$template->parse('language_list', 'language_list_block', true);
|
|
183 | 179 |
} |
184 | 180 |
|
185 | 181 |
// Insert default timezone values |
182 |
$user_time = true; |
|
183 |
require(ADMIN_PATH.'/interface/timezones.php'); |
|
186 | 184 |
$template->set_block('main_block', 'timezone_list_block', 'timezone_list'); |
187 | 185 |
foreach($TIMEZONES AS $hour_offset => $title) { |
188 |
$template->set_var('VALUE', $hour_offset); |
|
189 |
$template->set_var('NAME', $title); |
|
190 |
if($wb->get_timezone() == $hour_offset*3600) { |
|
191 |
$template->set_var('SELECTED', 'selected="selected"'); |
|
192 |
} else { |
|
193 |
$template->set_var('SELECTED', ''); |
|
194 |
} |
|
195 |
$template->parse('timezone_list', 'timezone_list_block', true); |
|
186 |
$template->set_var('VALUE', $hour_offset); |
|
187 |
$template->set_var('NAME', $title); |
|
188 |
$template->set_var('SELECTED', ($wb->get_timezone() == ($hour_offset * 3600) ? ' selected="selected"' : '') ); |
|
189 |
$template->parse('timezone_list', 'timezone_list_block', true); |
|
196 | 190 |
} |
197 |
|
|
198 | 191 |
// Insert date format list |
192 |
$user_time = true; |
|
193 |
require(ADMIN_PATH.'/interface/date_formats.php'); |
|
199 | 194 |
$template->set_block('main_block', 'date_format_list_block', 'date_format_list'); |
200 | 195 |
foreach($DATE_FORMATS AS $format => $title) |
201 | 196 |
{ |
202 |
$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
|
|
203 |
if($format != 'system_default') {
|
|
204 |
$template->set_var('VALUE', $format);
|
|
205 |
} else {
|
|
206 |
$template->set_var('VALUE', '');
|
|
207 |
}
|
|
208 |
$template->set_var('NAME', $title);
|
|
209 |
if($wb->get_session('DATE_FORMAT') == $format AND !isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
|
|
210 |
$template->set_var('SELECTED', 'selected="selected"');
|
|
211 |
} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
|
|
212 |
$template->set_var('SELECTED', 'selected="selected"');
|
|
213 |
} else {
|
|
214 |
$template->set_var('SELECTED', '');
|
|
215 |
}
|
|
216 |
$template->parse('date_format_list', 'date_format_list_block', true);
|
|
197 |
$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
|
|
198 |
if($format != 'system_default') {
|
|
199 |
$template->set_var('VALUE', $format);
|
|
200 |
} else {
|
|
201 |
$template->set_var('VALUE', '');
|
|
202 |
}
|
|
203 |
$template->set_var('NAME', $title);
|
|
204 |
if($wb->get_session('DATE_FORMAT') == $format AND !isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
|
|
205 |
$template->set_var('SELECTED', 'selected="selected"');
|
|
206 |
} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
|
|
207 |
$template->set_var('SELECTED', 'selected="selected"');
|
|
208 |
} else {
|
|
209 |
$template->set_var('SELECTED', '');
|
|
210 |
}
|
|
211 |
$template->parse('date_format_list', 'date_format_list_block', true);
|
|
217 | 212 |
} |
218 | 213 |
|
214 |
// Insert time format list |
|
219 | 215 |
$user_time = true; |
220 |
// Insert time format list
|
|
216 |
require(ADMIN_PATH.'/interface/time_formats.php');
|
|
221 | 217 |
$template->set_block('main_block', 'time_format_list_block', 'time_format_list'); |
222 | 218 |
foreach($TIME_FORMATS AS $format => $title) |
223 | 219 |
{ |
224 |
$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
|
|
225 |
if($format != 'system_default') {
|
|
226 |
$template->set_var('VALUE', $format);
|
|
227 |
} else {
|
|
228 |
$template->set_var('VALUE', '');
|
|
229 |
}
|
|
230 |
$template->set_var('NAME', $title);
|
|
231 |
if($wb->get_session('TIME_FORMAT') == $format AND !isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
|
|
232 |
$template->set_var('SELECTED', 'selected="selected"');
|
|
233 |
} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
|
|
234 |
$template->set_var('SELECTED', 'selected="selected"');
|
|
235 |
} else {
|
|
236 |
$template->set_var('SELECTED', '');
|
|
237 |
}
|
|
238 |
$template->parse('time_format_list', 'time_format_list_block', true);
|
|
220 |
$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
|
|
221 |
if($format != 'system_default') {
|
|
222 |
$template->set_var('VALUE', $format);
|
|
223 |
} else {
|
|
224 |
$template->set_var('VALUE', '');
|
|
225 |
}
|
|
226 |
$template->set_var('NAME', $title);
|
|
227 |
if($wb->get_session('TIME_FORMAT') == $format AND !isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
|
|
228 |
$template->set_var('SELECTED', 'selected="selected"');
|
|
229 |
} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
|
|
230 |
$template->set_var('SELECTED', 'selected="selected"');
|
|
231 |
} else {
|
|
232 |
$template->set_var('SELECTED', '');
|
|
233 |
}
|
|
234 |
$template->parse('time_format_list', 'time_format_list_block', true);
|
|
239 | 235 |
} |
240 | 236 |
// Insert language headings |
241 | 237 |
$template->set_var(array( |
branches/2.8.x/wb/account/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; |
branches/2.8.x/wb/framework/initialize.php | ||
---|---|---|
203 | 203 |
} |
204 | 204 |
} |
205 | 205 |
}else { throw new AppException($database->get_error()); } |
206 |
// set error-reporting from loaded settings --- |
|
207 |
if(intval(ER_LEVEL) > 0 ) { |
|
208 |
error_reporting(ER_LEVEL); |
|
209 |
if( intval(ini_get ( 'display_errors' )) == 0 ) { |
|
210 |
ini_set('display_errors', 1); |
|
211 |
} |
|
212 |
} |
|
213 |
// Start a session --- |
|
214 |
if(!defined('SESSION_STARTED')) { |
|
215 |
session_name(APP_NAME.'_session_id'); |
|
216 |
@session_start(); |
|
217 |
define('SESSION_STARTED', true); |
|
218 |
} |
|
206 | 219 |
// get/set users timezone --- |
207 | 220 |
define('TIMEZONE', (isset($_SESSION['TIMEZONE']) ? $_SESSION['TIMEZONE'] : DEFAULT_TIMEZONE)); |
208 | 221 |
define('DATE_FORMAT', (isset($_SESSION['DATE_FORMAT']) ? $_SESSION['DATE_FORMAT'] : DEFAULT_DATE_FORMAT)); |
... | ... | |
218 | 231 |
$sSecMod = (defined('SECURE_FORM_MODULE') && SECURE_FORM_MODULE != '') ? '.'.SECURE_FORM_MODULE : ''; |
219 | 232 |
$sSecMod = WB_PATH.'/framework/SecureForm'.$sSecMod.'.php'; |
220 | 233 |
require_once($sSecMod); |
221 |
// set error-reporting from loaded settings --- |
|
222 |
if(intval(ER_LEVEL) > 0 ) { |
|
223 |
error_reporting(ER_LEVEL); |
|
224 |
if( intval(ini_get ( 'display_errors' )) == 0 ) { |
|
225 |
ini_set('display_errors', 1); |
|
226 |
} |
|
227 |
} |
|
228 |
// Start a session --- |
|
229 |
if(!defined('SESSION_STARTED')) { |
|
230 |
session_name(APP_NAME.'_session_id'); |
|
231 |
@session_start(); |
|
232 |
define('SESSION_STARTED', true); |
|
233 |
} |
|
234 | 234 |
// *** begin deprecated part ************************************************************* |
235 | 235 |
// load settings for use in Captch and ASP module |
236 | 236 |
if (!defined("WB_INSTALL_PROCESS")) { |
branches/2.8.x/wb/framework/class.wb.php | ||
---|---|---|
305 | 305 |
|
306 | 306 |
// Get the current users timezone |
307 | 307 |
function get_timezone() { |
308 |
return (isset($_SESSION['USE_DEFAULT_TIMEZONE']) ? '-72000' : $_SESSION['TIMEZONE']); |
|
308 |
|
|
309 |
return (isset($_SESSION['USE_DEFAULT_TIMEZONE']) ? '-72000' : $this->get_session('TIMEZONE')); |
|
309 | 310 |
} |
310 | 311 |
|
311 | 312 |
// Validate supplied email address |
branches/2.8.x/wb/framework/class.frontend.php | ||
---|---|---|
170 | 170 |
|
171 | 171 |
public function get_page_details() { |
172 | 172 |
global $database; |
173 |
if($this->page_id != 0) { |
|
173 |
|
|
174 |
$bCanRedirect = false; |
|
175 |
// set defaults |
|
176 |
$aLanguagesDetailsInUsed = $this->GetLanguagesDetailsInUsed(); |
|
177 |
$_SESSION['HTTP_REFERER'] = WB_URL; |
|
178 |
$_SESSION['PAGE_ID'] = $this->page_id; |
|
179 |
if($this->page_id != 0) { |
|
174 | 180 |
// Query page details |
175 | 181 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `page_id`='.(int)$this->page_id; |
176 | 182 |
$get_page = $database->query($sql); |
... | ... | |
244 | 250 |
$this->page_keywords=$this->page['keywords']; |
245 | 251 |
// Page link |
246 | 252 |
|
247 |
$bCanRedirect = ($this->visibility == 'registered' || $this->visibility == 'privat');
|
|
253 |
$bCanRedirect = ($this->visibility == 'registered' || $this->visibility == 'privat');
|
|
248 | 254 |
|
249 | 255 |
$this->link=$this->page_link($this->page['link']); |
250 | 256 |
|
251 | 257 |
$_SESSION['PAGE_ID'] = $this->page_id; |
252 |
|
|
253 | 258 |
$_SESSION['HTTP_REFERER'] = $bCanRedirect != true ? $this->link : WB_URL; |
254 |
$_SESSION['HTTP_REFERER'] = !$this->is_authenticated() ? $this->link : $_SESSION['HTTP_REFERER'];
|
|
259 |
$_SESSION['HTTP_REFERER'] = !$this->is_authenticated() ? $this->link : $_SESSION['HTTP_REFERER'];
|
|
255 | 260 |
|
256 | 261 |
// End code to set details as either variables of constants |
257 | 262 |
} |
Also available in: Unified diff