mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/16397] Add method for retrieving user ID
This replaces the previously added public property. PHPBB3-16397
This commit is contained in:
parent
8bb9a9803b
commit
a7bfe9afed
1 changed files with 11 additions and 4 deletions
|
@ -25,7 +25,6 @@ class session
|
||||||
var $forwarded_for = '';
|
var $forwarded_for = '';
|
||||||
var $host = '';
|
var $host = '';
|
||||||
var $session_id = '';
|
var $session_id = '';
|
||||||
public $id = ANONYMOUS;
|
|
||||||
var $ip = '';
|
var $ip = '';
|
||||||
var $load = 0;
|
var $load = 0;
|
||||||
var $time_now = 0;
|
var $time_now = 0;
|
||||||
|
@ -363,8 +362,6 @@ class session
|
||||||
// Did the session exist in the DB?
|
// Did the session exist in the DB?
|
||||||
if (isset($this->data['user_id']))
|
if (isset($this->data['user_id']))
|
||||||
{
|
{
|
||||||
$this->id = (int) $this->data['user_id'];
|
|
||||||
|
|
||||||
// Validate IP length according to admin ... enforces an IP
|
// Validate IP length according to admin ... enforces an IP
|
||||||
// check on bots if admin requires this
|
// check on bots if admin requires this
|
||||||
// $quadcheck = ($config['ip_check_bot'] && $this->data['user_type'] & USER_BOT) ? 4 : $config['ip_check'];
|
// $quadcheck = ($config['ip_check_bot'] && $this->data['user_type'] & USER_BOT) ? 4 : $config['ip_check'];
|
||||||
|
@ -650,7 +647,7 @@ class session
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force user id to be integer...
|
// Force user id to be integer...
|
||||||
$this->id = $this->data['user_id'] = (int) $this->data['user_id'];
|
$this->data['user_id'] = (int) $this->data['user_id'];
|
||||||
|
|
||||||
// At this stage we should have a filled data array, defined cookie u and k data.
|
// At this stage we should have a filled data array, defined cookie u and k data.
|
||||||
// data array should contain recent session info if we're a real user and a recent
|
// data array should contain recent session info if we're a real user and a recent
|
||||||
|
@ -1667,4 +1664,14 @@ class session
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get user ID
|
||||||
|
*
|
||||||
|
* @return int User ID
|
||||||
|
*/
|
||||||
|
public function id() : int
|
||||||
|
{
|
||||||
|
return isset($this->data['user_id']) ? (int) $this->data['user_id'] : ANONYMOUS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue