Documentation

Horde_Session
in package

The Horde_Session class provides a set of methods for handling the administration and contents of the Horde session variable.

Tags
author

Michael Slusarz slusarz@horde.org

category

Horde

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

Constants

BEGIN  = '_b'
DATA  = '_d'
ENCRYPT  = 4
ENCRYPTED  = '_e'
MODIFIED  = '_m'
NONCE_ID  = 'session_nonce'
NOT_SERIALIZED  = "\x00"
PRUNE  = '_p'
REGENERATE  = '_r'
TOKEN_ID  = 'session_token'
TYPE_ARRAY  = 1
TYPE_OBJECT  = 2

Properties

$begin  : int
$maxStore  : int
Maximum size of the pruneable data store.
$regenerate_due  : bool
$regenerate_interval  : int
$session_data  : array<string|int, mixed>
$sessionHandler  : Horde_SessionHandler
The session handler object.
$_active  : bool
Indicates that the session is active (read/write).
$_cleansession  : bool
Indicate that a new session ID has been generated for this page load.
$_data  : array<string|int, mixed>
Pointer to the session data.
$_readonly  : bool
Indicates that session data is read-only.
$_relogin  : int
On re-login, indicate whether we were previously authenticated.

Methods

__construct()  : mixed
Constructor.
__get()  : mixed
__set()  : mixed
checkNonce()  : mixed
Checks the validity of the session nonce.
checkToken()  : mixed
Checks the validity of the session token.
clean()  : bool
Destroys any existing session on login and make sure to use a new session ID, to avoid session fixation issues. Should be called before checking a login.
close()  : mixed
Close the current session.
destroy()  : mixed
Destroy session data.
exists()  : bool
Does the session variable exist?
get()  : mixed
Get the value of a session variable.
getNonce()  : string
Returns a single-use, session nonce.
getToken()  : string
Returns the session token.
isActive()  : bool
Is the current session active (read/write)?
purge()  : mixed
regenerate()  : mixed
Regenerate the session ID.
remove()  : mixed
Remove session key(s).
retrieve()  : mixed
set()  : mixed
Sets the value of a session variable.
setup()  : mixed
Sets a custom session handler up, if there is one.
start()  : mixed
Starts the session.
store()  : mixed
_getKey()  : string
Generates the unique storage key.
_start()  : mixed
Tasks to perform when starting a session.
_subkeys()  : array<string|int, mixed>
Return the list of subkeys for a master key.

Constants

DATA

public mixed DATA = '_d'
Tags
deprecated

ENCRYPTED

public mixed ENCRYPTED = '_e'

MODIFIED

public mixed MODIFIED = '_m'

NONCE_ID

public mixed NONCE_ID = 'session_nonce'

NOT_SERIALIZED

public mixed NOT_SERIALIZED = "\x00"

REGENERATE

public mixed REGENERATE = '_r'

TOKEN_ID

public mixed TOKEN_ID = 'session_token'

TYPE_ARRAY

public mixed TYPE_ARRAY = 1

TYPE_OBJECT

public mixed TYPE_OBJECT = 2

Properties

$begin read-only

public int $begin

The timestamp when this session began (0 if session is not active).

$maxStore

Maximum size of the pruneable data store.

public int $maxStore = 20

$regenerate_due read-only

public bool $regenerate_due

True if session ID is due for regeneration (since 2.5.0).

$regenerate_interval read-only

public int $regenerate_interval

The regeneration interval (since 2.5.0).

$session_data write-only

public array<string|int, mixed> $session_data

Manually set session data (since 2.5.0).

$sessionHandler

The session handler object.

public Horde_SessionHandler $sessionHandler = \null

$_active

Indicates that the session is active (read/write).

protected bool $_active = \false

$_cleansession

Indicate that a new session ID has been generated for this page load.

protected bool $_cleansession = \false

$_data

Pointer to the session data.

protected array<string|int, mixed> $_data

$_readonly

Indicates that session data is read-only.

protected bool $_readonly = \false

$_relogin

On re-login, indicate whether we were previously authenticated.

protected int $_relogin = \null

Methods

__construct()

Constructor.

public __construct() : mixed

__get()

public __get(mixed $name) : mixed
Parameters
$name : mixed

__set()

public __set(mixed $name, mixed $value) : mixed
Parameters
$name : mixed
$value : mixed

checkNonce()

Checks the validity of the session nonce.

public checkNonce(string $nonce) : mixed
Parameters
$nonce : string

Nonce to check.

Tags
since
2.11.0
throws
Horde_Exception

checkToken()

Checks the validity of the session token.

public checkToken(string $token) : mixed
Parameters
$token : string

Token to check.

Tags
throws
Horde_Exception

clean()

Destroys any existing session on login and make sure to use a new session ID, to avoid session fixation issues. Should be called before checking a login.

public clean() : bool
Return values
bool

True if the session was cleaned.

close()

Close the current session.

public close() : mixed

destroy()

Destroy session data.

public destroy() : mixed

exists()

Does the session variable exist?

public exists(string $app, string $name) : bool
Parameters
$app : string

Application name.

$name : string

Session variable name.

Return values
bool

True if session variable exists.

get()

Get the value of a session variable.

public get(string $app, string $name[, int $mask = 0 ]) : mixed
Parameters
$app : string

Application name.

$name : string

Session variable name.

$mask : int = 0

One of:

  • Horde_Session::TYPE_ARRAY - Return an array value.
  • Horde_Session::TYPE_OBJECT - Return an object value.
Return values
mixed

The value or null if the value doesn't exist.

getNonce()

Returns a single-use, session nonce.

public getNonce() : string
Tags
since
2.11.0
Return values
string

Session nonce.

getToken()

Returns the session token.

public getToken() : string
Return values
string

Session token.

isActive()

Is the current session active (read/write)?

public isActive() : bool
Return values
bool

True if the current session is active.

purge()

public purge(mixed $id) : mixed
Parameters
$id : mixed
Tags
deprecated

Use Horde_Core_Cache_SessionObjects instead.

regenerate()

Regenerate the session ID.

public regenerate() : mixed
Tags
since
2.5.0

remove()

Remove session key(s).

public remove(string $app[, string $name = null ]) : mixed
Parameters
$app : string

Application name.

$name : string = null

Session variable name.

retrieve()

public retrieve(mixed $id) : mixed
Parameters
$id : mixed
Tags
deprecated

Use Horde_Core_Cache_SessionObjects instead.

set()

Sets the value of a session variable.

public set(string $app, string $name, mixed $value[, int $mask = 0 ]) : mixed
Parameters
$app : string

Application name.

$name : string

Session variable name.

$value : mixed

Session variable value.

$mask : int = 0

One of:

  • Horde_Session::TYPE_ARRAY: Force save as an array value.
  • Horde_Session::TYPE_OBJECT: Force save as an object value.
  • Horde_Session::ENCRYPT: Encrypt the value. (since 2.7.0)

setup()

Sets a custom session handler up, if there is one.

public setup([bool $start = true ][, string $cache_limiter = null ][, string $session_id = null ]) : mixed
Parameters
$start : bool = true

Initiate the session?

$cache_limiter : string = null

Override for the session cache limiter value.

$session_id : string = null

The session ID to use.

Tags
throws
Horde_Exception

start()

Starts the session.

public start() : mixed

store()

public store(mixed $data[, mixed $prune = true ][, mixed $id = null ]) : mixed
Parameters
$data : mixed
$prune : mixed = true
$id : mixed = null
Tags
deprecated

Use Horde_Core_Cache_SessionObjects instead.

_getKey()

Generates the unique storage key.

private _getKey(string $app, string $name) : string
Parameters
$app : string

Application name.

$name : string

Session variable name.

Return values
string

The unique storage key.

_start()

Tasks to perform when starting a session.

private _start() : mixed

_subkeys()

Return the list of subkeys for a master key.

private _subkeys(string $app, string $name) : array<string|int, mixed>
Parameters
$app : string

Application name.

$name : string

Session variable name.

Return values
array<string|int, mixed>

Subkeyname (keys) and session variable name (values).


        
On this page

Search results