[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/sessions/model/ -> _session.class.php (sommaire)

This file implements the Session class and holds the {@link session_unserialize_callback()} function used by it. A session can be bound to a user and provides functions to store data in its context. All Hitlogs are also bound to a Session.

Author: blueyed: Daniel HAHLER.
Author: fplanque: Francois PLANQUE.
Author: jeffbearer: Jeff BEARER - {@link http://www.jeffbearer.com/}.
Author: mfollett: Matt FOLLETT - {@link http://www.mfollett.com/}.
Copyright: (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}
Version: $Id: _session.class.php,v 1.1 2007/06/25 11:01:00 fplanque Exp $
Poids: 594 lignes (18 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

Session:: (12 méthodes):
  Session()
  set_User()
  set_user_ID()
  logout()
  has_User()
  get()
  set()
  delete()
  dbsave()
  reload_data()
  session_unserialize_callback()
  session_unserialize_load_all_classes()


Classe: Session  - X-Ref

A session tracks a given user (not necessarily logged in) while he's navigating the site.
A sessions also stores data for the length of the session.

Sessions are tracked with a cookie containing the session ID.
The cookie also contains a random key to prevent sessions hacking.

Session()   X-Ref
Constructor


set_User( $User )   X-Ref
Attach a User object to the session.

param: User The user to attach

set_user_ID( $user_ID )   X-Ref
Attach a user ID to the session.

NOTE: ID gets saved to DB on shutdown. This may be a "problem" when querying T_sessions for sess_user_ID.

param: integer The ID of the user to attach

logout()   X-Ref
Logout the user, by invalidating the session key and unsetting {@link $user_ID}.

We want to keep the user in the session log, but we're unsetting {@link $user_ID}, which refers
to the current session.

Because the session key is invalid/broken, on the next request a new session will be started.

NOTE: we MIGHT want to link subsequent sessions together if we want to keep track...

has_User()   X-Ref
Check if session has a user attached.

return: boolean

get( $param, $default = NULL )   X-Ref
Pas de description

set( $param, $value, $expire = 0 )   X-Ref
Set a data value for the session.

param: string Name of the data's key.
param: mixed The value
param: integer Time in seconds for data to expire (0 to disable).

delete( $param )   X-Ref
Delete a value from the session data.

param: string Name of the data's key.

dbsave()   X-Ref
Updates session data in database.

Note: The key actually only needs to be updated on a logout.

reload_data()   X-Ref
Reload session data.

This is needed if the running process waits for a child process to write data
into the Session, e.g. the captcha plugin in test mode waiting for the Debuglog
output from the process that created the image (included through an IMG tag).

session_unserialize_callback( $classname )   X-Ref
This gets used as a {@link unserialize()} callback function, which is
responsible for loading the requested class.

IMPORTANT: when modifying this, modify the following also:
return: boolean True, if the required class could be loaded; false, if not

session_unserialize_load_all_classes()   X-Ref
When session_unserialize_callback() cannot be registered to do some smart loading,
then we fall back to this function and load everything with brute force...

IMPORTANT: when modifying this, modify the following also:



Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics