1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 03:54:10 +01:00

[feature/new-tz-handling] Renamed old variables and removed extra conditional.

PHPBB3-9558
This commit is contained in:
Chris Smith 2010-04-20 19:30:05 +01:00 committed by Oleg Pudeyev
parent e8b60fc3d8
commit a5c3ff3769

View File

@ -87,32 +87,27 @@ class phpbb_datetime extends DateTime
$midnight = clone $now;
$midnight->setTime(0, 0, 0);
$midnight = $midnight->getTimestamp();
$gmepoch = $this->getTimestamp();
$midnight = $midnight->getTimestamp();
$timestamp = $this->getTimestamp();
if (!($gmepoch < $midnight - 86400 || $gmepoch > $midnight + 172800))
if ($timestamp > $midnight + 86400)
{
$day = false;
$day = 'TOMORROW';
}
else if ($timestamp > $midnight)
{
$day = 'TODAY';
}
else if ($timestamp > $midnight - 86400)
{
$day = 'YESTERDAY';
}
if ($gmepoch > $midnight + 86400)
{
$day = 'TOMORROW';
}
else if ($gmepoch > $midnight)
{
$day = 'TODAY';
}
else if ($gmepoch > $midnight - 86400)
{
$day = 'YESTERDAY';
}
if ($day !== false)
{
$format = self::_format_cache($format, $this->_user);
if ($day !== false)
{
$format = self::_format_cache($format, $this->_user);
return str_replace(self::RELATIVE_WRAPPER . self::RELATIVE_WRAPPER, $this->_user->lang['datetime'][$day], strtr(parent::format($format['format_short']), $format['lang']));
}
return str_replace(self::RELATIVE_WRAPPER . self::RELATIVE_WRAPPER, $this->_user->lang['datetime'][$day], strtr(parent::format($format['format_short']), $format['lang']));
}
}
}