From 794c5749696c9fa2595ed3a1d7c836a0d984e11c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 22 Feb 2009 15:29:18 +0000 Subject: remove global and change $user-> to phpbb::$user-> git-svn-id: file:///svn/phpbb/trunk@9334 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/classes/session.php | 18 +++--------------- phpBB/includes/classes/template.php | 10 ++++++++++ phpBB/includes/classes/user.php | 22 +++++++++++++++++++++- 3 files changed, 34 insertions(+), 16 deletions(-) (limited to 'phpBB/includes/classes') diff --git a/phpBB/includes/classes/session.php b/phpBB/includes/classes/session.php index e5f4bd8e0c..04840fff55 100644 --- a/phpBB/includes/classes/session.php +++ b/phpBB/includes/classes/session.php @@ -57,21 +57,6 @@ abstract class phpbb_session */ public $system = NULL; - /** - * @var bool Is true if the user is a logged in registered user - */ - public $is_registered = false; - - /** - * @var bool Is true if the user is logged in and a search engine/bot - */ - public $is_bot = false; - - /** - * @var bool Is true if user is founder - */ - public $is_founder = false; - /** * @var array Extra url parameter to append to every URL in phpBB */ @@ -304,6 +289,7 @@ abstract class phpbb_session else { $this->is_registered = true; + $this->is_guest = false; $this->is_founder = $this->data['user_type'] == phpbb::USER_FOUNDER; } @@ -824,6 +810,7 @@ abstract class phpbb_session { $this->setup('ucp'); $this->is_registered = $this->is_bot = $this->is_founder = false; + $this->is_guest = true; // Set as a precaution to allow login_box() handling this case correctly as well as this function not being executed again. define('IN_CHECK_BAN', 1); @@ -1113,6 +1100,7 @@ abstract class phpbb_session $this->is_registered = ($this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == phpbb::USER_NORMAL || $this->data['user_type'] == phpbb::USER_FOUNDER)) ? true : false; $this->is_bot = (!$this->is_registered && $this->data['user_id'] != ANONYMOUS) ? true : false; $this->is_founder = $this->data['user_type'] == phpbb::USER_FOUNDER; + $this->is_guest = (!$this->is_registered && $this->data['user_id'] == ANONYMOUS) ? true : false; $this->data['user_lang'] = basename($this->data['user_lang']); return true; diff --git a/phpBB/includes/classes/template.php b/phpBB/includes/classes/template.php index a3277475cf..984a9af2e1 100644 --- a/phpBB/includes/classes/template.php +++ b/phpBB/includes/classes/template.php @@ -16,6 +16,16 @@ if (!defined('IN_PHPBB')) exit; } +/** +* @todo +* IMG_ for image substitution? +* {IMG_[key]:[alt]:[type]} +* {IMG_ICON_CONTACT:CONTACT:full} -> phpbb::$user->img('icon_contact', 'CONTACT', 'full'); +* +* More in-depth... +* yadayada +*/ + /** * Base Template class. * @package phpBB3 diff --git a/phpBB/includes/classes/user.php b/phpBB/includes/classes/user.php index beba494e98..e060bcda52 100644 --- a/phpBB/includes/classes/user.php +++ b/phpBB/includes/classes/user.php @@ -91,6 +91,26 @@ class phpbb_user extends phpbb_session */ public $img_array = array(); + /** + * @var bool Is true if the user is a logged in registered user + */ + public $is_registered = false; + + /** + * @var bool Is true if the user is logged in and a search engine/bot + */ + public $is_bot = false; + + /** + * @var bool Is true if user is founder + */ + public $is_founder = false; + + /** + * @var bool Is true if user is anonymous/guest + */ + public $is_guest = true; + /** * Ablility to add new option (id 7). Enabled user options is stored in $data['user_options']. * @var array user options defining their possibilities to view flash, images, etc. User options only supports set/unset (true/false) @@ -539,7 +559,7 @@ class phpbb_user extends phpbb_session // Does the user need to change their password? If so, redirect to the // ucp profile reg_details page ... of course do not redirect if we're already in the ucp - if (!defined('IN_ADMIN') && !defined('ADMIN_START') && phpbb::$config['chg_passforce'] && $this->data['is_registered'] && phpbb::$acl->acl_get('u_chgpasswd') && $this->data['user_passchg'] < time() - (phpbb::$config['chg_passforce'] * 86400)) + if (!defined('IN_ADMIN') && !defined('ADMIN_START') && phpbb::$config['chg_passforce'] && $this->is_registered && phpbb::$acl->acl_get('u_chgpasswd') && $this->data['user_passchg'] < time() - (phpbb::$config['chg_passforce'] * 86400)) { if (strpos($this->page['query_string'], 'mode=reg_details') === false && $this->page['page_name'] != 'ucp.' . PHP_EXT) { -- cgit v1.2.1