[feature/new-tz-handling] Rename $user->tz back to $user->timezone

PHPBB3-9558
This commit is contained in:
Joas Schilling 2012-07-18 16:52:52 +02:00
parent 515e1662a9
commit a71e60cdbd
5 changed files with 13 additions and 13 deletions

View file

@ -915,8 +915,8 @@ class acp_board
global $user, $config;
// Let the format_date function operate with the acp values
$old_tz = $user->tz;
$user->tz = new DateTimeZone($config['board_timezone']);
$old_tz = $user->timezone;
$user->timezone = new DateTimeZone($config['board_timezone']);
$dateformat_options = '';
@ -935,7 +935,7 @@ class acp_board
$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
// Reset users date options
$user->tz = $old_tz;
$user->timezone = $old_tz;
return "<select name=\"dateoptions\" id=\"dateoptions\" onchange=\"if (this.value == 'custom') { document.getElementById('" . addslashes($key) . "').value = '" . addslashes($value) . "'; } else { document.getElementById('" . addslashes($key) . "').value = this.value; }\">$dateformat_options</select>
<input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"30\" />";

View file

@ -38,7 +38,7 @@ class phpbb_datetime extends DateTime
public function __construct($user, $time = 'now', DateTimeZone $timezone = null)
{
$this->user = $user;
$timezone = $timezone ?: $this->user->tz;
$timezone = $timezone ?: $this->user->timezone;
parent::__construct($time, $timezone);
}
@ -55,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($this->user, 'now', $this->user->tz);
$now = new self($this->user, 'now', $this->user->timezone);
$timestamp = $this->getTimestamp();
$now_ts = $now->getTimeStamp();

View file

@ -4821,9 +4821,9 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
}
}
$dt = new phpbb_datetime($user, 'now', $user->tz);
$dt = new phpbb_datetime($user, 'now', $user->timezone);
$timezone_offset = 'GMT' . phpbb_format_timezone_offset($dt->getOffset());
$timezone_name = $user->tz->getName();
$timezone_name = $user->timezone->getName();
if (isset($user->lang['timezones'][$timezone_name]))
{
$timezone_name = $user->lang['timezones'][$timezone_name];

View file

@ -679,7 +679,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
$ban_end = max($current_time, $user->create_datetime()
->setDate((int) $ban_other[0], (int) $ban_other[1], (int) $ban_other[2])
->setTime(0, 0, 0)
->getTimestamp() + $user->tz->getOffset(new DateTime('UTC')));
->getTimestamp() + $user->timezone->getOffset(new DateTime('UTC')));
}
else
{

View file

@ -33,7 +33,7 @@ class phpbb_user extends phpbb_session
/**
* DateTimeZone object holding the timezone of the user
*/
public $tz;
public $timezone;
var $lang_name = false;
var $lang_id = false;
@ -127,7 +127,7 @@ class phpbb_user extends phpbb_session
*/
}
$this->tz = new DateTimeZone($user_timezone);
$this->timezone = new DateTimeZone($user_timezone);
// We include common language file here to not load it every time a custom language file is included
$lang = &$this->lang;
@ -623,7 +623,7 @@ class phpbb_user extends phpbb_session
}
$time = new phpbb_datetime($this, "@$gmepoch", $utc);
$time->setTimezone($this->tz);
$time->setTimezone($this->timezone);
return $time->format($format, $forcedate);
}
@ -638,7 +638,7 @@ class phpbb_user extends phpbb_session
*/
public function create_datetime($time = 'now', DateTimeZone $timezone = null)
{
$timezone = $timezone ?: $this->tz;
$timezone = $timezone ?: $this->timezone;
return new phpbb_datetime($this, $time, $timezone);
}
@ -652,7 +652,7 @@ class phpbb_user extends phpbb_session
*/
public function get_timestamp_from_format($format, $time, DateTimeZone $timezone = null)
{
$timezone = $timezone ?: $this->tz;
$timezone = $timezone ?: $this->timezone;
$date = DateTime::createFromFormat($format, $time, $timezone);
return ($date !== false) ? $date->format('U') : false;
}