Overview

Namespaces

  • None
  • PHP

Classes

  • Breadcrumb
  • Breadcrumbs
  • CacheFile
  • Comment
  • CommentArray
  • CommentFilter
  • CommentForm
  • CommentList
  • Config
  • Database
  • DatabaseQuery
  • DatabaseQuerySelect
  • DatabaseQuerySelectFulltext
  • DatabaseStopwords
  • Debug
  • Field
  • Fieldgroup
  • Fieldgroups
  • FieldgroupsArray
  • Fields
  • FieldsArray
  • Fieldtype
  • FieldtypeMulti
  • Fieldtypes
  • FileLog
  • FilenameArray
  • Fuel
  • HookEvent
  • ImageSizer
  • Inputfield
  • InputfieldsArray
  • InputfieldWrapper
  • Language
  • LanguageParser
  • Languages
  • LanguagesPageFieldValue
  • LanguageSupportInstall
  • LanguageTranslator
  • Markdown_Parser
  • MarkdownExtra_Parser
  • ModuleJS
  • ModulePlaceholder
  • Modules
  • Notice
  • NoticeError
  • NoticeMessage
  • Notices
  • NullPage
  • Page
  • PageArray
  • Pagefile
  • Pagefiles
  • PagefilesManager
  • PageFinder
  • Pageimage
  • Pageimages
  • PagerNav
  • PagerNavItem
  • Pages
  • PagesAccess
  • PagesSortfields
  • PagesType
  • Paths
  • Permission
  • Permissions
  • Process
  • ProcessController
  • ProcessWire
  • Role
  • Roles
  • Sanitizer
  • Selector
  • SelectorBitwiseAnd
  • SelectorContains
  • SelectorContainsLike
  • SelectorContainsWords
  • SelectorEnds
  • SelectorEqual
  • SelectorGreaterThan
  • SelectorGreaterThanEqual
  • SelectorLessThan
  • SelectorLessThanEqual
  • SelectorNotEqual
  • Selectors
  • SelectorStarts
  • Session
  • SessionCSRF
  • SmartyPants_Parser
  • SmartyPantsTypographer_Parser
  • SystemUpdate1
  • Template
  • TemplateFile
  • Templates
  • TemplatesArray
  • Textformatter
  • Textile
  • User
  • Users
  • Wire
  • WireArray
  • WireData
  • WireInput
  • WireInputData
  • WireSaveableItems
  • WireSaveableItemsLookup
  • WireUpload

Interfaces

  • CommentFormInterface
  • CommentListInterface
  • ConfigurableModule
  • FieldtypeLanguageInterface
  • FieldtypePageTitleCompatible
  • HasLookupItems
  • HasRoles
  • InputfieldHasArrayValue
  • Module
  • Saveable
  • TrackChanges

Exceptions

  • ProcessController404Exception
  • ProcessControllerPermissionException
  • Wire404Exception
  • WireDatabaseException
  • WireException
  • WirePermissionException

Functions

  • __
  • _n
  • _x
  • fuel
  • identify_modifier_markdown
  • Markdown
  • mdwp_add_p
  • mdwp_hide_tags
  • mdwp_show_tags
  • mdwp_strip_p
  • ProcessWireClassLoader
  • ProcessWireHostSiteConfig
  • ProcessWireShutdown
  • removeNewlines
  • SmartDashes
  • SmartEllipsis
  • SmartQuotes
  • smarty_modifier_markdown
  • smarty_modifier_smartypants
  • SmartyPants
  • tabIndent
  • unregisterGLOBALS
  • wire
  • wireDecodeJSON
  • wireEncodeJSON
  • wireMkdir
  • Overview
  • Namespace
  • Class
  • Tree
  • Download

Class Session

ProcessWire Session

Start a session with login/logout capability

This should be used instead of the $_SESSION superglobal, though the $_SESSION superglobal can still be used, but it's in a different namespace than this. A value set in $_SESSION won't appear in $session and likewise a value set in $session won't appear in $_SESSION. It's also good to use this class over the $_SESSION superglobal just in case we ever need to replace PHP's session handling in the future.

ProcessWire 2.x Copyright (C) 2010 by Ryan Cramer Licensed under GNU/GPL v2, see LICENSE.TXT

http://www.processwire.com http://www.ryancramer.com

Wire implements TrackChanges
Extended by Session implements IteratorAggregate
Located at core/Session.php
Methods summary
public
# __construct( )

Start the session and set the current User if a session is active

Start the session and set the current User if a session is active

Assumes that you have already performed all session-specific ini_set() and session_name() calls

protected boolean
# ___isValidSession( )

Checks if the session is valid based on a challenge cookie and fingerprint

Checks if the session is valid based on a challenge cookie and fingerprint

These items may be disabled at the config level, in which case this method always returns true

Returns

boolean
public mixed
# get( string $key )

Get a session variable

Get a session variable

Parameters

$key
string

Returns

mixed
public array
# getAll( )

Get all session variables

Get all session variables

Returns

array
public this
# set( string $key, mixed $value )

Set a session variable

Set a session variable

Parameters

$key
string
$value
mixed

Returns

this
public this
# remove( string $key )

Unsets a session variable

Unsets a session variable

Parameters

$key
string
$value

Returns

this
public mixed|null
# __get( string $key )

Provide $session->variable get access

Provide $session->variable get access

Parameters

$key
string
$name

Returns

mixed|null
public
# __set( $key, $value )

Provide $session->variable = variable set access

Provide $session->variable = variable set access

public
# getIterator( )

Allow iteration of session variables, i.e. foreach($session as $key => $var) {}

Allow iteration of session variables, i.e. foreach($session as $key => $var) {}

Implementation of

IteratorAggregate::getIterator
public User
# ___login( string $name, string $pass )

Login a user with the given name and password

Login a user with the given name and password

Also sets them to the current user

Parameters

$name
string
$pass
string
Raw, non-hashed password

Returns

User
Return the $user if the login was successful or null if not.
public boolean
# ___authenticate( User $user, string $pass )

Return true or false whether the user authenticated with the supplied password

Return true or false whether the user authenticated with the supplied password

Parameters

$user
User
$pass
string

Returns

boolean
public this
# ___logout( )

Logout the current user, and clear all session variables

Logout the current user, and clear all session variables

Returns

this
public
# ___redirect( $url, $http301 = true )

Redirect this session to another URL

Redirect this session to another URL

protected
# queueNotice( $text, $type, $flags )

Queue a notice (message/error) to be shown the next time this ession class is instantiated

Queue a notice (message/error) to be shown the next time this ession class is instantiated

public this
# message( string $text, flags $flags = 0 )

Queue a message to appear the next time session is instantiated

Queue a message to appear the next time session is instantiated

Parameters

$text
string
$flags
flags
int See Notices::flags

Returns

this
public this
# error( string $text, flags $flags = 0 )

Queue an error to appear the next time session is instantiated

Queue an error to appear the next time session is instantiated

Parameters

$text
string
$flags
flags
int See Notices::flags

Returns

this
Methods inherited from Wire
_(), ___changed(), __call(), __toString(), _n(), _x(), addHook(), addHookAfter(), addHookBefore(), addHookProperty(), className(), fuel(), getAllFuel(), getChanges(), getFuel(), getHooks(), isChanged(), isHooked(), removeHook(), resetTrackChanges(), runHooks(), setFuel(), setTrackChanges(), trackChange(), trackChanges(), untrackChange(), useFuel()
Properties summary
protected $config
#

Reference to ProcessWire $config object

Reference to ProcessWire $config object

For convenience, since our __get() does not reference the Fuel, unlike other Wire derived classes.

protected $CSRF null
#

Instance of the SessionCSRF protection class, instantiated when requested from $session->CSRF.

Instance of the SessionCSRF protection class, instantiated when requested from $session->CSRF.

Properties inherited from Wire
$changes, $defaultHookOptions, $fuel, $hookMethodCache, $localHooks, $staticHooks, $trackChanges, $useFuel
ProcessWire API documentation generated by ApiGen 2.6.0