Class vB_Session

Description

Class to handle sessions

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

  • version: $Revision: 35065 $
  • date: $Date: 2010-01-21 14:01:23 -0600 (Thu, 21 Jan 2010) $

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


	
			
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], [integer $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 3170)

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

bool $created = false (line 3177)

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 3146)

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

vB_Registry $registry = null (line 3184)

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

array $userinfo = null (line 3191)

Information about the user that this session belongs to.

array $vars = array() (line 3139)

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

boolean $visible = true (line 3198)

Is the sessionhash to be passed through URLs?

Methods
Constructor vB_Session (line 3210)

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], [integer $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
  • integer $languageid: Language ID for this session
build_query_array (line 3380)

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 3584)

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 3472)

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 3444)

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

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

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 3507)

Returns appropriate user info for the owner of this session.

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

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

void save ()
set (line 3406)

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 3420)

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 Tue, 26 Jan 2010 15:15:06 -0600 by phpDocumentor 1.4.3