[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/includes/ -> session.php (summary)

(no description)

Copyright: (c) 2005 phpBB Group
License: http://opensource.org/licenses/gpl-license.php GNU Public License
Version: $Id$
File Size: 2459 lines (78 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

session:: (13 methods):
  extract_current_page()
  extract_current_hostname()
  session_begin()
  session_create()
  session_kill()
  session_gc()
  set_cookie()
  check_ban()
  check_dnsbl()
  set_login_key()
  reset_login_keys()
  validate_referer()
  unset_admin()

user:: (14 methods):
  user()
  set_custom_lang_path()
  setup()
  lang()
  add_lang()
  set_lang()
  format_date()
  get_iso_lang_id()
  get_profile_fields()
  img()
  optionget()
  optionset()
  leave_newly_registered()
  get_passworded_forums()


Class: session  - X-Ref

Session class

extract_current_page($root_path)   X-Ref
Extract current session page

param: string $root_path current root path (phpbb_root_path)

extract_current_hostname()   X-Ref
Get valid hostname/port. HTTP_HOST is used, SERVER_NAME if HTTP_HOST not present.


session_begin($update_session_page = true)   X-Ref
Start session management

This is where all session activity begins. We gather various pieces of
information from the client and server. We test to see if a session already
exists. If it does, fine and dandy. If it doesn't we'll go on to create a
new one ... pretty logical heh? We also examine the system load (if we're
running on a system which makes such information readily available) and
halt if it's above an admin definable limit.

param: bool $update_session_page if true the session page gets updated.

session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true)   X-Ref
Create a new session

If upon trying to start a session we discover there is nothing existing we
jump here. Additionally this method is called directly during login to regenerate
the session for the specific user. In this method we carry out a number of tasks;
garbage collection, (search)bot checking, banned user comparison. Basically
though this method will result in a new session for a specific user.

session_kill($new_session = true)   X-Ref
Kills a session

This method does what it says on the tin. It will delete a pre-existing session.
It resets cookie information (destroying any autologin key within that cookie data)
and update the users information from the relevant session data. It will then
grab guest user information.

session_gc()   X-Ref
Session garbage collection

This looks a lot more complex than it really is. Effectively we are
deleting any sessions older than an admin definable limit. Due to the
way in which we maintain session data we have to ensure we update user
data before those sessions are destroyed. In addition this method
removes autologin key information that is older than an admin defined
limit.

set_cookie($name, $cookiedata, $cookietime)   X-Ref
Sets a cookie

Sets a cookie of the given name with the specified data for the given length of time. If no time is specified, a session cookie will be set.

param: string $name        Name of the cookie, will be automatically prefixed with the phpBB cookie name. track becomes [cookie_name]_track then.
param: string $cookiedata    The data to hold within the cookie
param: int $cookietime    The expiration time as UNIX timestamp. If 0 is provided, a session cookie is set.

check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false)   X-Ref
Check for banned user

Checks whether the supplied user is banned by id, ip or email. If no parameters
are passed to the method pre-existing session data is used. If $return is false
this routine does not return on finding a banned user, it outputs a relevant
message and stops execution.

param: string|array    $user_ips    Can contain a string with one IP or an array of multiple IPs

check_dnsbl($mode, $ip = false)   X-Ref
Check if ip is blacklisted
This should be called only where absolutly necessary

Only IPv4 (rbldns does not support AAAA records/IPv6 lookups)

author: satmd (from the php manual)
param: string $mode register/post - spamcop for example is ommitted for posting
return: false if ip is not blacklisted, else an array([checked server], [lookup])

set_login_key($user_id = false, $key = false, $user_ip = false)   X-Ref
Set/Update a persistent login key

This method creates or updates a persistent session key. When a user makes
use of persistent (formerly auto-) logins a key is generated and stored in the
DB. When they revisit with the same key it's automatically updated in both the
DB and cookie. Multiple keys may exist for each user representing different
browsers or locations. As with _any_ non-secure-socket no passphrase login this
remains vulnerable to exploit.

reset_login_keys($user_id = false)   X-Ref
Reset all login keys for the specified user

This method removes all current login keys for a specified (or the current)
user. It will be called on password change to render old keys unusable

validate_referer($check_script_path = false)   X-Ref
Check if the request originated from the same page.

param: bool $check_script_path If true, the path will be checked as well

unset_admin()   X-Ref
No description

Class: user  - X-Ref

Base user class

This is the overarching class which contains (through session extend)
all methods utilised for user functionality during a session.

user()   X-Ref
Constructor to set the lang path


set_custom_lang_path($lang_path)   X-Ref
Function to set custom language path (able to use directory outside of phpBB)

param: string $lang_path New language path used.

setup($lang_set = false, $style = false)   X-Ref
Setup basic user-specific items (style, language, ...)


lang()   X-Ref
More advanced language substitution
Function to mimic sprintf() with the possibility of using phpBB's language system to substitute nullar/singular/plural forms.
Params are the language key and the parameters to be substituted.
This function/functionality is inspired by SHS` and Ashe.

Example call: <samp>$user->lang('NUM_POSTS_IN_QUEUE', 1);</samp>

add_lang($lang_set, $use_db = false, $use_help = false)   X-Ref
Add Language Items - use_db and use_help are assigned where needed (only use them to force inclusion)

param: mixed $lang_set specifies the language entries to include
param: bool $use_db internal variable for recursion, do not use
param: bool $use_help internal variable for recursion, do not use

set_lang(&$lang, &$help, $lang_file, $use_db = false, $use_help = false)   X-Ref
Set language entry (called by add_lang)


format_date($gmepoch, $format = false, $forcedate = false)   X-Ref
Format user date

param: int $gmepoch unix timestamp
param: string $format date format in date() notation. | used to indicate relative dates, for example |d m Y|, h:i is translated to Today, h:i.
param: bool $forcedate force non-relative date format.
return: mixed translated date

get_iso_lang_id()   X-Ref
Get language id currently used by the user


get_profile_fields($user_id)   X-Ref
Get users profile fields


img($img, $alt = '', $width = false, $suffix = '', $type = 'full_tag')   X-Ref
Specify/Get image
$suffix is no longer used - we know it. ;) It is there for backward compatibility.


optionget($key, $data = false)   X-Ref
Get option bit field from user options.

param: int $key option key, as defined in $keyoptions property.
param: int $data bit field value to use, or false to use $this->data['user_options']
return: bool true if the option is set in the bit field, false otherwise

optionset($key, $value, $data = false)   X-Ref
Set option bit field for user options.

param: int $key Option key, as defined in $keyoptions property.
param: bool $value True to set the option, false to clear the option.
param: int $data Current bit field value, or false to use $this->data['user_options']
return: int|bool If $data is false, the bit field is modified and

leave_newly_registered()   X-Ref
Funtion to make the user leave the NEWLY_REGISTERED system group.


get_passworded_forums()   X-Ref
Returns all password protected forum ids the user is currently NOT authenticated for.

return: array        Array of forum ids



Generated: Wed Oct 2 15:03:47 2013 Cross-referenced by PHPXref 0.7.1