1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-08 01:36:57 +02:00

[feature/new-tz-handling] Require user argument on phpbb_datetime

PHPBB3-9558
This commit is contained in:
Joas Schilling
2012-07-16 18:29:31 +02:00
parent 82e195ac68
commit f5bb145040
3 changed files with 7 additions and 8 deletions

View File

@@ -35,10 +35,9 @@ class phpbb_datetime extends DateTime
* @param DateTimeZone $timezone Time zone of the time.
* @param user User object for context.
*/
public function __construct($time = 'now', DateTimeZone $timezone = null, $user = null)
public function __construct($user, $time = 'now', DateTimeZone $timezone = null)
{
$this->user = $user ?: $GLOBALS['user'];
$this->user = $user;
$timezone = $timezone ?: $this->user->tz;
parent::__construct($time, $timezone);
@@ -56,7 +55,7 @@ class phpbb_datetime extends DateTime
$format = $format ? $format : $this->user->date_format;
$format = self::format_cache($format, $this->user);
$relative = ($format['is_short'] && !$force_absolute);
$now = new self('now', $this->user->tz, $this->user);
$now = new self($this->user, 'now', $this->user->tz);
$timestamp = $this->getTimestamp();
$now_ts = $now->getTimeStamp();