Class Session

Description

Session handling class

This class wraps all calls concerning the current session. It also includes session configuration through the phpSATk configuration interface and a possiblity to write object oriented session handlers.

Located in /phpsatk-lib/global/org.eenterphace.sat.session/session.php (line 37)


	
			
Variable Summary
Method Summary
void destroy ()
void exists (string $name)
string getID ()
mixed getVar (string $name)
mixed getVarIfExists (string $name, [mixed $default = null])
array[string=>mixed] getVars (string $filter)
void initialize ()
void regenerateID ()
void removeVar (string $name)
int removeVars (string $filter)
void setVar (string $name, mixed $value)
Variables
SessionHandler $handler = null (line 51)

Session handler

  • static:
boolean $initialized = false (line 44)

Whether a session has been initialized

  • static:
Methods
destroy (line 264)

Destroys the session

This will remove all data of the session

  • access: public
  • static:
void destroy ()
exists (line 144)

Checks wheter a variable exists in the session

  • access: public
  • static:
void exists (string $name)
  • string $name: Variable name
getID (line 131)

Gets the current session's identifier

Initializes a session if not yet initialized.

  • access: public
  • static:
string getID ()
getVar (line 156)

Gets a session variable

Throws an exception if the variable is not present.

  • access: public
  • static:
mixed getVar (string $name)
  • string $name: Variable name
getVarIfExists (line 191)

Gets a session variable (or an empty string)

In opposition to getVar() this call won't throw an exception but return $default (what is null by default) if the variable does not exist.

  • access: public
  • static:
mixed getVarIfExists (string $name, [mixed $default = null])
  • string $name: Variable name
  • mixed $default: Default value to return if not existant
getVars (line 170)

Gets multiple session variables matched by a filter

  • access: public
  • static:
array[string=>mixed] getVars (string $filter)
  • string $filter: Filter including wildcards (?,*)
initialize (line 73)

Initializes a session

If a session has been already initialized the call will return.

Uses the configuration variable "session.handler" to determine the session handler to use ('php' is the default and will use the session handler provided by php - file in most cases);

In case the php session handler is used the save path is set to './cache/session' which is automatically created if non-existant.

Also settings concerning session lifetime are made on the basis of "session.lifetime" (3 hours by default). The session name is set based on the configuration variable "session.name" ("SATKSESSION" by default).

Only cookie based session are supported.

  • access: public
  • static:
  • todo: set the correct path and domain for the session cookie
void initialize ()
regenerateID (line 255)

Regenerates the session id

This should be done when the user switches his level of autorization.

  • access: public
  • static:
void regenerateID ()
removeVar (line 206)

Removes a single variable from the session

Throws an exception if the var does not exist.

  • access: public
  • static:
void removeVar (string $name)
  • string $name: Variable name
removeVars (line 222)

Remove multiple vars by a wildcard.

Returns the number of removed variables.

  • access: public
  • static:
int removeVars (string $filter)
  • string $filter: Wildcard matching pattern
setVar (line 242)

Sets a session variable

Initiailizes a session if not yet initialized.

  • access: public
  • static:
void setVar (string $name, mixed $value)
  • string $name: Variable name
  • mixed $value: Value to set

Documentation generated on Mon, 21 May 2007 10:35:19 +0200 by phpDocumentor 1.3.0RC5