phpBB

Code Changes

File: phpbb/user.php

  Unmodified   Added   Modified   Removed
Line 227Line 227

$this->language->set_user_language($user_lang_name);



$this->language->set_user_language($user_lang_name);


		try
{
$this->timezone = new \DateTimeZone($user_timezone);
}
catch (\Exception $e)
{
// If the timezone the user has selected is invalid, we fall back to UTC.
$this->timezone = new \DateTimeZone('UTC');
}

		$this->create_timezone($user_timezone);










$this->add_lang($lang_set);
unset($lang_set);


$this->add_lang($lang_set);
unset($lang_set);

Line 262Line 254
		}

$sql = 'SELECT *

		}

$sql = 'SELECT *

			FROM ' . STYLES_TABLE . " s
WHERE s.style_id = $style_id";

			FROM ' . STYLES_TABLE . '
WHERE style_id = ' . (int) $style_id;

		$result = $db->sql_query($sql, 3600);
$this->style = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

		$result = $db->sql_query($sql, 3600);
$this->style = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

Line 274Line 266
			$style_id = $this->data['user_style'];

$sql = 'SELECT *

			$style_id = $this->data['user_style'];

$sql = 'SELECT *

				FROM ' . STYLES_TABLE . " s
WHERE s.style_id = $style_id";

				FROM ' . STYLES_TABLE . '
WHERE style_id = ' . (int) $style_id;

			$result = $db->sql_query($sql, 3600);
$this->style = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

			$result = $db->sql_query($sql, 3600);
$this->style = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

Line 334Line 326

if (is_string($default_value))
{


if (is_string($default_value))
{

				$this->style[$key] = htmlspecialchars($this->style[$key]);

				$this->style[$key] = htmlspecialchars($this->style[$key], ENT_COMPAT);

			}
}


			}
}


Line 635Line 627
		if (!$format_date_override)
{
$time = new $this->datetime($this, '@' . (int) $gmepoch, $utc);

		if (!$format_date_override)
{
$time = new $this->datetime($this, '@' . (int) $gmepoch, $utc);

			$time->setTimezone($this->timezone);

			$time->setTimezone($this->create_timezone());


return $time->format($format, $forcedate);
}


return $time->format($format, $forcedate);
}

Line 643Line 635
		{
return $format_date_override;
}

		{
return $format_date_override;
}

 
	}

/**
* Create a DateTimeZone object in the context of the current user
*
* @param string $user_timezone Time zone of the current user.
* @return \DateTimeZone DateTimeZone object linked to the current users locale
*/
public function create_timezone($user_timezone = null)
{
if (!$this->timezone)
{
if (!$user_timezone)
{
global $config;
$user_timezone = ($this->data['user_id'] != ANONYMOUS) ? $this->data['user_timezone'] : $config['board_timezone'];
}

try
{
$this->timezone = new \DateTimeZone($user_timezone);
}
catch (\Exception $e)
{
// If the timezone the user has selected is invalid, we fall back to UTC.
$this->timezone = new \DateTimeZone('UTC');
}
}

return $this->timezone;

	}

/**

	}

/**

Line 655Line 677
	*/
public function create_datetime($time = 'now', \DateTimeZone $timezone = null)
{

	*/
public function create_datetime($time = 'now', \DateTimeZone $timezone = null)
{

		$timezone = $timezone ?: $this->timezone;

		$timezone = $timezone ?: $this->create_timezone();

		return new $this->datetime($this, $time, $timezone);
}


		return new $this->datetime($this, $time, $timezone);
}


Line 669Line 691
	*/
public function get_timestamp_from_format($format, $time, \DateTimeZone $timezone = null)
{

	*/
public function get_timestamp_from_format($format, $time, \DateTimeZone $timezone = null)
{

		$timezone = $timezone ?: $this->timezone;

		$timezone = $timezone ?: $this->create_timezone();

		$date = \DateTime::createFromFormat($format, $time, $timezone);
return ($date !== false) ? $date->format('U') : false;
}

		$date = \DateTime::createFromFormat($format, $time, $timezone);
return ($date !== false) ? $date->format('U') : false;
}