diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2009-01-23 12:23:14 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2009-01-23 12:23:14 +0000 |
commit | 90ad76e948950ac20950b040578b5b213fd62bea (patch) | |
tree | a458b2ff0a28235ed4252e9e0222b1c1716c6d8c /phpBB | |
parent | d3fa81c26112f65bac716a15d8d6baafff7dd707 (diff) | |
download | forums-90ad76e948950ac20950b040578b5b213fd62bea.tar forums-90ad76e948950ac20950b040578b5b213fd62bea.tar.gz forums-90ad76e948950ac20950b040578b5b213fd62bea.tar.bz2 forums-90ad76e948950ac20950b040578b5b213fd62bea.tar.xz forums-90ad76e948950ac20950b040578b5b213fd62bea.zip |
let us change the time zone and dst setting correctly (related to Bug #38775)
git-svn-id: file:///svn/phpbb/trunk@9302 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/classes/user.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/phpBB/includes/classes/user.php b/phpBB/includes/classes/user.php index 739c338377..beba494e98 100644 --- a/phpBB/includes/classes/user.php +++ b/phpBB/includes/classes/user.php @@ -792,7 +792,6 @@ class phpbb_user extends phpbb_session // Is the user requesting a friendly date format (i.e. 'Today 12:42')? $date_cache[$format] = array( 'is_short' => strpos($format, '|'), - 'zone_offset' => $this->timezone + $this->dst, 'format_short' => substr($format, 0, strpos($format, '|')) . '||' . substr(strrchr($format, '|'), 1), 'format_long' => str_replace('|', '', $format), 'lang' => $this->lang['datetime'], @@ -805,6 +804,9 @@ class phpbb_user extends phpbb_session } } + // Zone offset + $zone_offset = $this->timezone + $this->dst; + // Show date <= 1 hour ago as 'xx min ago' // A small tolerence is given for times in the future and times in the future but in the same minute are displayed as '< than a minute ago' if ($delta <= 3600 && ($delta >= -5 || (($now / 60) % 60) == (($gmepoch / 60) % 60)) && $date_cache[$format]['is_short'] !== false && !$forcedate && isset($this->lang['datetime']['AGO'])) @@ -814,8 +816,8 @@ class phpbb_user extends phpbb_session if (!$midnight) { - list($d, $m, $y) = explode(' ', gmdate('j n Y', time() + $date_cache[$format]['zone_offset'])); - $midnight = gmmktime(0, 0, 0, $m, $d, $y) - $date_cache[$format]['zone_offset']; + list($d, $m, $y) = explode(' ', gmdate('j n Y', time() + $zone_offset)); + $midnight = gmmktime(0, 0, 0, $m, $d, $y) - $zone_offset; } if ($date_cache[$format]['is_short'] !== false && !$forcedate && !($gmepoch < $midnight - 86400 || $gmepoch > $midnight + 172800)) @@ -837,11 +839,11 @@ class phpbb_user extends phpbb_session if ($day !== false) { - return str_replace('||', $this->lang['datetime'][$day], strtr(@gmdate($date_cache[$format]['format_short'], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang'])); + return str_replace('||', $this->lang['datetime'][$day], strtr(@gmdate($date_cache[$format]['format_short'], $gmepoch + $zone_offset), $date_cache[$format]['lang'])); } } - return strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang']); + return strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $zone_offset), $date_cache[$format]['lang']); } /** |