vB_Session
in package
Uses
vB_Trait_NoSerialize
Class to handle sessions
Creates, updates, and validates sessions; retrieves user info of browsing user
Table of Contents
Properties
- $created : bool
- Whether the session was created or existed previously
Methods
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- clearChannelPerms() : mixed
- clearUserInfo() : mixed
- Clear user cached info. Primarily needed for cleaning cache in memory.
- delete() : mixed
- Deletes the session from the session store.
- doLastVisitUpdate() : array<string|int, mixed>
- Updates the last visit and last activity times for guests and registered users (differently).
- doRememberMe() : mixed
- fetch_sessionhash() : string
- Fetches a valid sessionhash value, not necessarily the one tied to this session.
- fetch_userinfo() : array<string|int, mixed>
- Returns appropriate user info for the owner of this session.
- fetch_userinfo_value() : mix
- Returns appropriate value from the user info array for the owner of this session.
- fetchCpsessionHash() : string
- Create new cpsession for the user and insert it into database or fetch current existing one
- finalize() : mixed
- get() : mixed
- Gets a session variable.
- getAllVars() : array<string|int, mixed>
- Returns an array with all session vars
- getChannelPerms() : mixed
- getNewSession() : vB_Session
- Returns a new session of the type specified by defined constants
- getRememberMeToken() : mixed
- getSessionIdHash() : string
- Returns the sessionIdHash
- isCreated() : bool
- Returns whether the session was created
- loadLanguage() : mixed
- Loads basic language information
- processLogout() : mixed
- Process any additionl bookkeeping on logout
- processNewLogin() : mixed
- Process any additionl bookkeeping on login
- save() : mixed
- Saves the session into the database by inserting it or updating an existing one.
- set() : mixed
- Sets a session variable and updates the change list.
- setChannelPerms() : mixed
- setCpsessionHash() : mixed
- validateCpsession() : bool
- Validate cpsession
Properties
$created
Whether the session was created or existed previously
public
bool
$created
= \false
Methods
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
__wakeup()
public
__wakeup() : void
clearChannelPerms()
public
clearChannelPerms() : mixed
clearUserInfo()
Clear user cached info. Primarily needed for cleaning cache in memory.
public
clearUserInfo() : mixed
delete()
Deletes the session from the session store.
public
delete() : mixed
Deletes records matching the session's sessionhash. If there is an apiaccesstoken then sessions matching that are also deleted.
Will have no effect and no error if the session doesn't exist.
Sets the session to "not created", but does not otherwise affect the session object.
doLastVisitUpdate()
Updates the last visit and last activity times for guests and registered users (differently).
public
doLastVisitUpdate([mixed $lastvisit = 0 ][, mixed $lastactivity = 0 ]) : array<string|int, mixed>
Last visit is set to the last activity time (before it's updated) only when a certain time has lapsed. Last activity is always set to the specified time.
Parameters
- $lastvisit : mixed = 0
- $lastactivity : mixed = 0
Return values
array<string|int, mixed> —Updated values for setting cookies (guest only)
doRememberMe()
public
doRememberMe(mixed $restoreSessionInfo[, mixed $gotsession = true ]) : mixed
Parameters
- $restoreSessionInfo : mixed
- $gotsession : mixed = true
fetch_sessionhash()
Fetches a valid sessionhash value, not necessarily the one tied to this session.
public
fetch_sessionhash() : string
Return values
string —32-character sessionhash
fetch_userinfo()
Returns appropriate user info for the owner of this session.
public
& fetch_userinfo() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of user information.
fetch_userinfo_value()
Returns appropriate value from the user info array for the owner of this session.
public
& fetch_userinfo_value(mixed $value) : mix
Parameters
- $value : mixed
Return values
mix —value of user information.
fetchCpsessionHash()
Create new cpsession for the user and insert it into database or fetch current existing one
public
fetchCpsessionHash([bool $renew = false ]) : string
Parameters
- $renew : bool = false
-
Whether to renew cpsession hash (Create a new one and drop the old one)
Tags
Return values
string —The new cpsession hash
finalize()
public
finalize([mixed $styleid = 0 ][, mixed $languageid = 0 ]) : mixed
Parameters
- $styleid : mixed = 0
- $languageid : mixed = 0
get()
Gets a session variable.
public
get(mixed $key) : mixed
Parameters
- $key : mixed
Return values
mixed —- Value of the key, NULL if not found
getAllVars()
Returns an array with all session vars
public
getAllVars() : array<string|int, mixed>
Return values
array<string|int, mixed>getChannelPerms()
public
getChannelPerms(mixed $key) : mixed
Parameters
- $key : mixed
getNewSession()
Returns a new session of the type specified by defined constants
public
static getNewSession(vB_dB_Assertor &$dBAssertor, vB_Datastore &$datastore, array<string|int, mixed> &$config[, string $sessionhash = '' ][, int $userid = 0 ][, string $password = '' ][, int $styleid = 0 ][, int $languageid = 0 ]) : vB_Session
Parameters
- $dBAssertor : vB_dB_Assertor
- $datastore : vB_Datastore
- $config : array<string|int, mixed>
- $sessionhash : string = ''
- $userid : int = 0
- $password : string = ''
- $styleid : int = 0
- $languageid : int = 0
Tags
Return values
vB_SessiongetRememberMeToken()
public
getRememberMeToken() : mixed
getSessionIdHash()
Returns the sessionIdHash
public
getSessionIdHash() : string
Return values
stringisCreated()
Returns whether the session was created
public
isCreated() : bool
Return values
boolloadLanguage()
Loads basic language information
public
loadLanguage() : mixed
processLogout()
Process any additionl bookkeeping on logout
public
processLogout() : mixed
processNewLogin()
Process any additionl bookkeeping on login
public
processNewLogin() : mixed
save()
Saves the session into the database by inserting it or updating an existing one.
public
save() : mixed
set()
Sets a session variable and updates the change list.
public
set(mixed $key, mixed $value) : mixed
Parameters
- $key : mixed
- $value : mixed
setChannelPerms()
public
setChannelPerms(mixed $key, mixed $perms) : mixed
Parameters
- $key : mixed
- $perms : mixed
setCpsessionHash()
public
setCpsessionHash(mixed $cpsessionhash) : mixed
Parameters
- $cpsessionhash : mixed
validateCpsession()
Validate cpsession
public
validateCpsession([bool $updatetimeout = true ]) : bool
Parameters
- $updatetimeout : bool = true
-
Whether to update the table to reset the timeout