From 6a783b843b596c46738d76f2db5d539d8f68a815 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 7 Jul 2010 22:17:40 +0100 Subject: [PATCH] [feature/new-tz-handling] Replace user::$timezone with user::$tz. user::$tz will store the new DateTimeZone object representing the users timezone instead of the existing user::$timezone and user::$dst combination. PHPBB3-9558 --- phpBB/includes/session.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index fe690a1a9a..2352e6394a 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1528,7 +1528,14 @@ class user extends session var $help = array(); var $theme = array(); var $date_format; - var $timezone; + + /** + * Users current timezone + * + * @var DateTimeZone Timezone of the user + * @since 3.1 + */ + public $tz; var $lang_name = false; var $lang_id = false; @@ -1586,13 +1593,13 @@ class user extends session $this->lang_name = (file_exists($this->lang_path . $this->data['user_lang'] . "/common.$phpEx")) ? $this->data['user_lang'] : basename($config['default_lang']); $this->date_format = $this->data['user_dateformat']; - $this->timezone = $this->data['user_timezone']; + $this->tz = $this->data['user_timezone']; } else { $this->lang_name = basename($config['default_lang']); $this->date_format = $config['default_dateformat']; - $this->timezone = $config['board_timezone']; + $this->tz = $config['board_timezone']; /** * If a guest user is surfing, we try to guess his/her language first by obtaining the browser language @@ -1631,13 +1638,13 @@ class user extends session */ } - if (is_numeric($this->timezone)) + if (is_numeric($this->tz)) { // Might still be numeric by chance - $this->timezone = sprintf('Etc/GMT%+d', ($this->timezone + ($this->data['user_id'] != ANONYMOUS ? $this->data['user_dst'] : $config['board_dst']))); + $this->tz = sprintf('Etc/GMT%+d', ($this->tz + ($this->data['user_id'] != ANONYMOUS ? $this->data['user_dst'] : $config['board_dst']))); } - $this->timezone = new DateTimeZone($this->timezone); + $this->tz = new DateTimeZone($this->tz); // We include common language file here to not load it every time a custom language file is included $lang = &$this->lang;