add more properties to the session...

git-svn-id: file:///svn/phpbb/trunk@9268 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2009-01-16 17:37:44 +00:00
parent d353f4bdfc
commit 4f9028df60

View file

@ -67,6 +67,11 @@ abstract class phpbb_session
*/ */
public $is_bot = false; 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 * @var array Extra url parameter to append to every URL in phpBB
*/ */
@ -77,6 +82,16 @@ abstract class phpbb_session
*/ */
public $need_sid = false; public $need_sid = false;
/**
* @var array Information about current page
*/
public $page = array();
/**
* @var string The users IP
*/
public $ip = '127.0.0.1';
/** /**
* Init session. Empties the user data and assigns the system object (phpbb::$instances['system']) * Init session. Empties the user data and assigns the system object (phpbb::$instances['system'])
* @access public * @access public
@ -127,6 +142,8 @@ abstract class phpbb_session
$this->time_now = time(); $this->time_now = time();
$this->cookie_data = array('u' => 0, 'k' => ''); $this->cookie_data = array('u' => 0, 'k' => '');
$this->update_session_page = $update_session_page; $this->update_session_page = $update_session_page;
$this->page = $this->system['page'];
$this->ip = $this->system['ip'];
if (phpbb_request::is_set(phpbb::$config['cookie_name'] . '_sid', phpbb_request::COOKIE) || phpbb_request::is_set(phpbb::$config['cookie_name'] . '_u', phpbb_request::COOKIE)) if (phpbb_request::is_set(phpbb::$config['cookie_name'] . '_sid', phpbb_request::COOKIE) || phpbb_request::is_set(phpbb::$config['cookie_name'] . '_u', phpbb_request::COOKIE))
{ {
@ -287,6 +304,7 @@ abstract class phpbb_session
else else
{ {
$this->is_registered = true; $this->is_registered = true;
$this->is_founder = $this->data['user_type'] == phpbb::USER_FOUNDER;
} }
// Force user id to be integer... // Force user id to be integer...
@ -805,7 +823,7 @@ abstract class phpbb_session
if (defined('IN_LOGIN') && $this->data['user_id'] == ANONYMOUS) if (defined('IN_LOGIN') && $this->data['user_id'] == ANONYMOUS)
{ {
$this->setup('ucp'); $this->setup('ucp');
$this->is_registered = $this->is_bot = false; $this->is_registered = $this->is_bot = $this->is_founder = false;
// Set as a precaution to allow login_box() handling this case correctly as well as this function not being executed again. // 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); define('IN_CHECK_BAN', 1);
@ -1094,6 +1112,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_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_bot = (!$this->is_registered && $this->data['user_id'] != ANONYMOUS) ? true : false;
$this->is_founder = $this->data['user_type'] == phpbb::USER_FOUNDER;
$this->data['user_lang'] = basename($this->data['user_lang']); $this->data['user_lang'] = basename($this->data['user_lang']);
return true; return true;