1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-19 22:10:14 +02:00

[feature/new-tz-handling] Fix handling of timezone and dst in dateformat_select

PHPBB3-9558
This commit is contained in:
Joas Schilling 2012-06-04 22:33:03 +02:00
parent 00b5e5345d
commit 09499fb128

View File

@ -906,11 +906,13 @@ class acp_board
global $user, $config;
// Let the format_date function operate with the acp values
$old_tz = $user->timezone;
$old_dst = $user->dst;
$user->timezone = $config['board_timezone'] * 3600;
$user->dst = $config['board_dst'] * 3600;
$old_tz = $user->tz;
if (is_numeric($config['board_timezone']))
{
// Might still be numeric by chance
$config['board_timezone'] = sprintf('Etc/GMT%+d', $config['board_timezone']);
}
$user->tz = new DateTimeZone($config['board_timezone']);
$dateformat_options = '';
@ -929,8 +931,7 @@ class acp_board
$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
// Reset users date options
$user->timezone = $old_tz;
$user->dst = $old_dst;
$user->tz = $old_tz;
return "<select name=\"dateoptions\" id=\"dateoptions\" onchange=\"if (this.value == 'custom') { document.getElementById('" . addslashes($key) . "').value = '" . addslashes($value) . "'; } else { document.getElementById('" . addslashes($key) . "').value = this.value; }\">$dateformat_options</select>
<input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"30\" />";