Session object.
package | XenForo_Core |
---|
__construct(array $config, \Zend_Cache_Core $cache, \Zend_Db_Adapter_Abstract $db)
array
Config elements to override default.
\Zend_Cache_Core
null
\Zend_Db_Adapter_Abstract
null
changeUserId(integer $userId, boolean $keepExisting)
integer
boolean
If true, keeps existing session info; usually want this to be false to ensure things are built as needed
delete()
The session cookie will be removed as well.
deleteExpiredSessions()
deleteSessionFromSource(string $sessionId)
string
get(string $key) : mixed
string
mixed
getAll() : array
array
getPublicSession(\Zend_Controller_Request_Http $request) : \XenForo_Session
getSessionFromSource(string $sessionId) : array | false
string
array
false
getSessionId() : string
string
isRegistered(string $key) : boolean
string
boolean
isRobot(string $userAgent) : string | boolean
string
string
boolean
isSearchReferer(string $referer) : string | boolean
string
string
boolean
regenerate(boolean $keepExisting)
Use this when the context (eg, user ID) of a session changes.
boolean
If true, keeps the existing info; if false, session data is removed
remove(string $key)
string
save()
If a session is being created, the session cookie will be created.
saveSessionToSource($sessionId, $isUpdate)
saved() : boolean
boolean
sessionExists() : boolean
boolean
sessionMatchesIp(array $session, integer | false $ipAddress) : boolean
Looks for the session's IP in the ip key. If not found or not an int, check passes.
array
integer
false
IPv4 address as int or false to prevent IP check
boolean
set(string $key, mixed $value)
Can't be called after saving.
string
mixed
start(string | null $sessionId, string | null $ipAddress)
string
null
Session ID. If not provided, read from cookie.
string
null
IPv4 address in string format, for limiting access. If null, grabbed automatically.
startAdminSession(\Zend_Controller_Request_Http $request) : \XenForo_Session
startPublicSession(\Zend_Controller_Request_Http $request) : \XenForo_Session
This will automatically log in the user via cookies if needed, and setup the visitor object. The session will be registered in the registry.
\Zend_Controller_Request_Http
null
_getSessionCacheName($sessionId)
_setup(string $sessionId, integer | false $ipAddress, array $defaultSession)
string
Session ID to look up, if one exists
integer
false
IPv4 address in int format (ip2long), for access limiting.
array
null
If no session can be found, uses this as the default session value
$knownRobots : array
$searchDomains : array
$_cache : \Zend_Cache_Core
If specified, the session will be stored here instead of the DB.
$_config : array
See constructor.
$_dataChanged : boolean
$_db : \Zend_Db_Adapter_Abstract
If no cache is specified, the session will be stored in the DB.
$_saved : boolean
$_session : string
$_sessionExists : boolean
Becomes true after a session is saved.
$_sessionId : string
An md5 hash.