mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
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
This commit is contained in:
parent
d3fa81c261
commit
90ad76e948
1 changed files with 7 additions and 5 deletions
|
@ -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']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue