mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/11700] Move all recent code to namespaces
PHPBB3-11700
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
@@ -23,7 +25,7 @@ if (!defined('IN_PHPBB'))
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_user extends phpbb_session
|
||||
class user extends \phpbb\session
|
||||
{
|
||||
var $lang = array();
|
||||
var $help = array();
|
||||
@@ -41,7 +43,7 @@ class phpbb_user extends phpbb_session
|
||||
var $img_lang;
|
||||
var $img_array = array();
|
||||
|
||||
// Able to add new options (up to id 31)
|
||||
// Able to add new \options (up to id 31)
|
||||
var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17);
|
||||
|
||||
/**
|
||||
@@ -151,12 +153,12 @@ class phpbb_user extends phpbb_session
|
||||
|
||||
try
|
||||
{
|
||||
$this->timezone = new DateTimeZone($user_timezone);
|
||||
$this->timezone = new \DateTimeZone($user_timezone);
|
||||
}
|
||||
catch (Exception $e)
|
||||
catch (\Exception $e)
|
||||
{
|
||||
// If the timezone the user has selected is invalid, we fall back to UTC.
|
||||
$this->timezone = new DateTimeZone('UTC');
|
||||
$this->timezone = new \DateTimeZone('UTC');
|
||||
}
|
||||
|
||||
// We include common language file here to not load it every time a custom language file is included
|
||||
@@ -649,27 +651,27 @@ class phpbb_user extends phpbb_session
|
||||
|
||||
if (!isset($utc))
|
||||
{
|
||||
$utc = new DateTimeZone('UTC');
|
||||
$utc = new \DateTimeZone('UTC');
|
||||
}
|
||||
|
||||
$time = new phpbb_datetime($this, "@$gmepoch", $utc);
|
||||
$time = new \phpbb\datetime($this, "@$gmepoch", $utc);
|
||||
$time->setTimezone($this->timezone);
|
||||
|
||||
return $time->format($format, $forcedate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a phpbb_datetime object in the context of the current user
|
||||
* Create a \phpbb\datetime object in the context of the current user
|
||||
*
|
||||
* @since 3.1
|
||||
* @param string $time String in a format accepted by strtotime().
|
||||
* @param DateTimeZone $timezone Time zone of the time.
|
||||
* @return phpbb_datetime Date time object linked to the current users locale
|
||||
* @return \phpbb\datetime Date time object linked to the current users locale
|
||||
*/
|
||||
public function create_datetime($time = 'now', DateTimeZone $timezone = null)
|
||||
public function create_datetime($time = 'now', \DateTimeZone $timezone = null)
|
||||
{
|
||||
$timezone = $timezone ?: $this->timezone;
|
||||
return new phpbb_datetime($this, $time, $timezone);
|
||||
return new \phpbb\datetime($this, $time, $timezone);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -680,10 +682,10 @@ class phpbb_user extends phpbb_session
|
||||
* @param DateTimeZone $timezone Timezone of the date/time, falls back to timezone of current user
|
||||
* @return int Returns the unix timestamp
|
||||
*/
|
||||
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;
|
||||
$date = DateTime::createFromFormat($format, $time, $timezone);
|
||||
$date = \DateTime::createFromFormat($format, $time, $timezone);
|
||||
return ($date !== false) ? $date->format('U') : false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user