Go to the source code of this file.
Functions | |
| eZRegisterSessionFunctions () | |
| eZSessionClose () | |
| eZSessionCountActive () | |
| eZSessionDestroy ($key) | |
| eZSessionEmpty () | |
| eZSessionGarbageCollector () | |
| eZSessionOpen () | |
| & | eZSessionRead ($key) |
| eZSessionRegenerate () | |
| eZSessionRemove () | |
| eZSessionSetUserID ($userID) | |
| eZSessionStart () | |
| eZSessionStop () | |
| eZSessionUserID () | |
| eZSessionWrite ($key, $value) | |
| eZRegisterSessionFunctions | ( | ) |
Register the needed session functions. Call this only once.
Definition at line 321 of file ezsession.php.
Referenced by eZSessionStart().
| eZSessionClose | ( | ) |
Definition at line 89 of file ezsession.php.
| eZSessionCountActive | ( | ) |
Counts the number of active session and returns it.
Definition at line 307 of file ezsession.php.
| eZSessionDestroy | ( | $ | key | ) |
Will remove a session from the database.
Definition at line 219 of file ezsession.php.
| eZSessionEmpty | ( | ) |
Removes all entries from session.
Definition at line 278 of file ezsession.php.
| eZSessionGarbageCollector | ( | ) |
Handles session cleanup. Will delete timed out sessions from the database.
Definition at line 248 of file ezsession.php.
| eZSessionOpen | ( | ) |
Re-implementation of PHP session management using database.
The session system has a hook system which allows external code to perform extra tasks before and after a certain action is executed. For instance to cleanup a table when sessions are removed. To create a hook function the global variable eZSessionFunctions must be filled in. This contains an associative array with hook points, e.g. destroy_pre which is checked by the session system. Each hook point must contain an array with function names to execute, if the hook point does not exist the session handler will not handle the hooks.
function cleanupStuff( &$db, $key, $escKey )
{
// Do cleanup here
}
if ( !isset( $GLOBALS['eZSessionFunctions']['destroy_pre'] ) )
$GLOBALS['eZSessionFunctions']['destroy_pre'] = array();
$GLOBALS['eZSessionFunctions']['destroy_pre'][] = 'cleanupstuff';
When new data is inserted to the database it will call the update_pre and update_post hooks. The signature of the function is function insert( &$db, $key, $escapedKey, $expirationTime, $userID, $value )
When existing data is updated in the databbase it will call the insert_pre and insert_post hook. The signature of the function is function update( &$db, $key, $escapedKey, $expirationTime, $userID, $value )
When a specific session is destroyed in the database it will call the destroy_pre and destroy_post hooks. The signature of the function is function destroy( &$db, $key, $escapedKey )
When multiple sessions are expired (garbage collector) in the database it will call the gc_pre and gc_post hooks. The signature of the function is function gcollect( &$db, $expiredTime )
When all sessionss are removed from the database it will call the empty_pre and empty_post hooks. The signature of the function is function empty( &$db )
| $db | The database object used by the session manager. | |
| $key | The session key which are being worked on, see also $escapedKey | |
| $escapedKey | The same key as $key but is escaped correctly for the database. Use this to save a call to eZDBInterface::escapeString() | |
| $expirationTime | An integer specifying the timestamp of when the session will expire. | |
| $expiredTime | Similar to $expirationTime but is the time used to figure if a session is expired in the database. ie. all sessions with lower expiration times will be removed. |
Definition at line 84 of file ezsession.php.
| & eZSessionRead | ( | $ | key | ) |
Definition at line 94 of file ezsession.php.
| eZSessionRegenerate | ( | ) |
Will make sure the user gets a new session ID while keepin the session data. This is useful to call on logins, to avoid sessions theft from users.
true if succesful Definition at line 400 of file ezsession.php.
Referenced by eZUser::setCurrentlyLoggedInUser().
| eZSessionRemove | ( | ) |
Removes the current session and resets session variables.
Definition at line 416 of file ezsession.php.
Referenced by eZScript::shutdown().
| eZSessionSetUserID | ( | $ | userID | ) |
Sets the current user ID to $userID, this ID will be written to the session table field user_id when the page is done.
Definition at line 438 of file ezsession.php.
Referenced by eZUser::instance(), eZUser::logoutCurrent(), and eZUser::setCurrentlyLoggedInUser().
| eZSessionStart | ( | ) |
Makes sure that the session is started properly. Multiple calls will just be ignored.
Definition at line 348 of file ezsession.php.
Referenced by eZScript::initialize(), and eZHTTPTool::instance().
| eZSessionStop | ( | ) |
Makes sure session data is stored in the session and stops the session.
Definition at line 379 of file ezsession.php.
| eZSessionUserID | ( | ) |
Returns the current session ID. The session handler will not care about value of the ID, it's entirely up to the clients of the session handler to use and update this value.
Definition at line 448 of file ezsession.php.
| eZSessionWrite | ( | $ | key, | |
| $ | value | |||
| ) |
Will write the session information to database.
Definition at line 133 of file ezsession.php.
1.6.3