Class vB_Session

Description

Class to handle sessions

Creates, updates, and validates sessions; retrieves user info of browsing user

  • version: $Revision: 26512 $
  • date: $Date: 2008-04-29 11:12:48 -0500 (Tue, 29 Apr 2008) $

Located in /includes/class_core.php (line 2592)


	
			
Variable Summary
 array $changes
 bool $created
 array $db_fields
 array $userinfo
 array $vars
 boolean $visible
Method Summary
 vB_Session vB_Session (vB_Registry &$registry, [string $sessionhash = ''], [integer $userid = 0], [string $password = ''], [integer $styleid = 0], [ $languageid = 0])
 void do_lastvisit_update ([integer $lastvisit = 0], [integer $lastactivity = 0])
 array fetch_session ([integer $userid = 0])
 string fetch_sessionhash ()
 string fetch_substr_ip (string $ip, [ $length = null])
 array &fetch_userinfo ()
 void save ()
 void set (string $key, string $value)
 void set_session_visibility (bool $invisible)
Variables
array $changes = array() (line 2630)

An array of changes. Used to prevent superfluous updates from being made.

bool $created = false (line 2637)

Whether the session was created or existed previously

array $db_fields = array(
'sessionhash' => TYPE_STR,
'userid' => TYPE_INT,
'host' => TYPE_STR,
'idhash' => TYPE_STR,
'lastactivity' => TYPE_INT,
'location' => TYPE_STR,
'styleid' => TYPE_INT,
'languageid' => TYPE_INT,
'loggedin' => TYPE_INT,
'inforum' => TYPE_INT,
'inthread' => TYPE_INT,
'incalendar' => TYPE_INT,
'badlocation' => TYPE_INT,
'useragent' => TYPE_STR,
'bypass' => TYPE_INT,
'profileupdate' => TYPE_INT,
)
(line 2606)

A list of variables in the $vars member that are in the database. Includes their types.

vB_Registry $registry = null (line 2644)

Reference to a vB_Registry object that keeps various data we need.

array $userinfo = null (line 2651)

Information about the user that this session belongs to.

array $vars = array() (line 2599)

The individual session variables. Equivalent to $session from the past.

boolean $visible = true (line 2658)

Is the sessionhash to be passed through URLs?

Methods
Constructor vB_Session (line 2669)

Constructor. Attempts to grab a session that matches parameters, but will create one if it can't.

vB_Session vB_Session (vB_Registry &$registry, [string $sessionhash = ''], [integer $userid = 0], [string $password = ''], [integer $styleid = 0], [ $languageid = 0])
  • vB_Registry &$registry: Reference to a registry object
  • string $sessionhash: Previously specified sessionhash
  • integer $userid: User ID (passed in through a cookie)
  • string $password: Password, must arrive in cookie format: md5(md5(md5(password) . salt) . 'abcd1234')
  • integer $styleid: Style ID for this session
  • $languageid
build_query_array (line 2839)

Builds an array that can be used to build a query to insert/update the session

  • return: Array of column name => prepared value
array build_query_array ()
do_lastvisit_update (line 3043)

Updates the last visit and last activity times for guests and registered users (differently).

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.

void do_lastvisit_update ([integer $lastvisit = 0], [integer $lastactivity = 0])
  • integer $lastvisit: Time stamp for last visit time (guest only)
  • integer $lastactivity: Time stamp for last activity time (guest only)
fetch_session (line 2931)

Fetches a default session. Used when creating a new session.

  • return: Array of session variables
array fetch_session ([integer $userid = 0])
  • integer $userid: User ID the session should be for
fetch_sessionhash (line 2903)

Fetches a valid sessionhash value, not necessarily the one tied to this session.

  • return: 32-character sessionhash
string fetch_sessionhash ()
fetch_substr_ip (line 2915)

Returns the IP address with the specified number of octets removed

  • return: truncated IP address
string fetch_substr_ip (string $ip, [ $length = null])
  • string $ip: IP address
  • $length
fetch_userinfo (line 2966)

Returns appropriate user info for the owner of this session.

  • return: Array of user information.
array &fetch_userinfo ()
save (line 2784)

Saves the session into the database by inserting it or updating an existing one.

void save ()
set (line 2865)

Sets a session variable and updates the change list.

void set (string $key, string $value)
  • string $key: Name of session variable to update
  • string $value: Value to update it with
set_session_visibility (line 2879)

Sets the session visibility (whether session info shows up in a URL). Updates are put in the $vars member.

void set_session_visibility (bool $invisible)
  • bool $invisible: Whether the session elements should be visible.

Documentation generated on Fri, 09 May 2008 09:00:57 -0500 by phpDocumentor 1.4.1