public
|
#
__construct( string $store = 'none', array $options = array(), JSessionHandlerInterface $handlerInterface = null )
Constructor
Parameters
- $store
string - $store The type of storage for the session.
- $options
array - $options Optional parameters
- $handlerInterface
JSessionHandlerInterface - $handlerInterface The session handler
Since
11.1
|
public
mixed
|
#
__get( string $name )
Magic method to get read-only access to properties.
Magic method to get read-only access to properties.
Parameters
- $name
string - $name Name of property to retrieve
Returns
mixed - The value of the property
Since
12.2
|
public static
JSession
|
#
getInstance( string $store, array $options, JSessionHandlerInterface $handlerInterface = null )
Returns the global Session object, only creating it if it doesn't already
exist.
Returns the global Session object, only creating it if it doesn't already
exist.
Parameters
- $store
string - $store The type of storage for the session.
- $options
array - $options An array of configuration options.
- $handlerInterface
JSessionHandlerInterface - $handlerInterface The session handler
Returns
Since
11.1
|
public
string
|
#
getState( )
Get current state of session
Get current state of session
Returns
string - The session state
Since
11.1
|
public
integer
|
#
getExpire( )
Get expiration time in seconds
Get expiration time in seconds
Returns
integer - The session expiration time in seconds
Since
11.1
|
public
string
|
#
getToken( boolean $forceNew = false )
Get a session token, if a token isn't set yet one will be generated.
Get a session token, if a token isn't set yet one will be generated.
Tokens are used to secure forms from spamming attacks. Once a token has been
generated the system will check the post request to see if it is present, if not
it will invalidate the session.
Parameters
- $forceNew
boolean - $forceNew If true, force a new token to be created
Returns
string - The session token
Since
11.1
|
public
boolean
|
#
hasToken( string $tCheck, boolean $forceExpire = true )
Method to determine if a token exists in the session. If not the session will
be set to expired
Method to determine if a token exists in the session. If not the session will
be set to expired
Parameters
- $tCheck
string - $tCheck Hashed token to be verified
- $forceExpire
boolean - $forceExpire If true, expires the session
Returns
boolean
Since
11.1
|
public static
string
|
#
getFormToken( boolean $forceNew = false )
Method to determine a hash for anti-spoofing variable names
Method to determine a hash for anti-spoofing variable names
Parameters
- $forceNew
boolean - $forceNew If true, force a new token to be created
Returns
string - Hashed var name
Since
11.1
|
public
ArrayIterator
|
#
getIterator( )
Retrieve an external iterator.
Retrieve an external iterator.
Returns
Since
12.2
Implementation of
|
public static
boolean
|
#
checkToken( string $method = 'post' )
Checks for a form token in the request.
Checks for a form token in the request.
Use in conjunction with JHtml::_('form.token') or JSession::getFormToken.
Parameters
- $method
string - $method The request method in which to look for the token key.
Returns
boolean - True if found and valid, false otherwise.
Since
12.1
|
public
string
|
#
getName( )
Get session name
Returns
string - The session name
Since
11.1
|
public
string
|
#
getId( )
Get session id
Returns
string - The session name
Since
11.1
|
public
Joomla\Registry\Registry
|
#
getData( )
Returns a clone of the internal data pointer
Returns a clone of the internal data pointer
Returns
|
public static
array
|
#
getStores( )
Get the session handlers
Returns
array - An array of available session handlers
Since
11.1
|
public
boolean
|
#
isActive( )
Shorthand to check if the session is active
Shorthand to check if the session is active
Returns
boolean
Since
12.2
|
public
boolean
|
#
isNew( )
Check whether this session is currently created
Check whether this session is currently created
Returns
boolean - True on success.
Since
11.1
|
public
|
#
initialise( JInput $input, JEventDispatcher $dispatcher = null )
Check whether this session is currently created
Check whether this session is currently created
Parameters
- $input
JInput - $input JInput object for the session to use.
- $dispatcher
JEventDispatcher - $dispatcher Dispatcher object for the session to use.
Since
12.2
|
public
mixed
|
#
get( string $name, mixed $default = null, string $namespace = 'default' )
Get data from the session store
Get data from the session store
Parameters
- $name
string - $name Name of a variable
- $default
mixed - $default Default value of a variable if not set
- $namespace
string - $namespace Namespace to use, default to 'default'
Returns
mixed - Value of a variable
Since
11.1
|
public
mixed
|
#
set( string $name, mixed $value = null, string $namespace = 'default' )
Set data into the session store.
Set data into the session store.
Parameters
- $name
string - $name Name of a variable.
- $value
mixed - $value Value of a variable.
- $namespace
string - $namespace Namespace to use, default to 'default'.
Returns
mixed - Old value of a variable.
Since
11.1
|
public
boolean
|
#
has( string $name, string $namespace = 'default' )
Check whether data exists in the session store
Check whether data exists in the session store
Parameters
- $name
string - $name Name of variable
- $namespace
string - $namespace Namespace to use, default to 'default'
Returns
boolean - True if the variable exists
Since
11.1
|
public
mixed
|
#
clear( string $name, string $namespace = 'default' )
Unset data from the session store
Unset data from the session store
Parameters
- $name
string - $name Name of variable
- $namespace
string - $namespace Namespace to use, default to 'default'
Returns
mixed - The value from session or NULL if not set
Since
11.1
|
public
|
#
start( )
Start a session.
Since
12.2
|
protected
boolean
|
#
_start( )
Start a session.
Creates a session (or resumes the current one based on the state of the
session)
Returns
boolean - true on success
Since
11.1
|
public
boolean
|
#
destroy( )
Frees all session variables and destroys all data registered to a session
Frees all session variables and destroys all data registered to a session
This method resets the data pointer and destroys all of the data associated
with the current session in its storage. It forces a new session to be started
after this method is called. It does not unset the session cookie.
Returns
boolean - True on success
Since
11.1
See
session_destroy()
session_unset()
|
public
boolean
|
#
restart( )
Restart an expired or locked session.
Restart an expired or locked session.
Returns
boolean - True on success
Since
11.1
See
|
public
boolean
|
#
fork( )
Create a new session and copy variables from the old one
Create a new session and copy variables from the old one
Returns
boolean - $result true on success
Since
11.1
|
public
|
#
close( )
Writes session data and ends session
Writes session data and ends session
Session data is usually stored after your script terminated without the need
to call JSession::close(), but as session data is locked to prevent concurrent
writes only one script may operate on a session at any time. When using
framesets together with sessions you will experience the frames loading one by
one due to this locking. You can reduce the time needed to load all the frames
by ending the session as soon as all changes to session variables are done.
Since
11.1
|
public
|
|
protected
string
|
#
_createToken( integer $length = 32 )
Create a token-string
Parameters
- $length
integer - $length Length of string
Returns
string - Generated token
Since
11.1
|
protected
boolean
|
#
_setCounter( )
Set counter of session usage
Set counter of session usage
Returns
boolean - True on success
Since
11.1
|
protected
boolean
|
#
_setTimers( )
Set the session timers
Returns
boolean - True on success
Since
11.1
|
protected
boolean
|
#
_setOptions( array $options )
Set additional session options
Set additional session options
Parameters
- $options
array - $options List of parameter
Returns
boolean - True on success
Since
11.1
|
protected
boolean
|
#
_validate( boolean $restart = false )
Do some checks for security reason
Do some checks for security reason
- timeout check (expire)
- ip-fixiation
- browser-fixiation
If one check failed, session data has to be cleaned.
Parameters
- $restart
boolean - $restart Reactivate session
Returns
boolean - True on success
Since
11.1
Link
|