From 09499fb128802bd19cee1550bf6e9af80a9388e2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 4 Jun 2012 22:33:03 +0200 Subject: [PATCH] [feature/new-tz-handling] Fix handling of timezone and dst in dateformat_select PHPBB3-9558 --- phpBB/includes/acp/acp_board.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index d537885ef1..ce2ddc3b0b 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -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'] . ''; // Reset users date options - $user->timezone = $old_tz; - $user->dst = $old_dst; + $user->tz = $old_tz; return " ";