PHP Class Elgg\ActionsService

Use the elgg_* versions instead.
Since: 1.9.0
Inheritance: use trait Elgg\TimeUsing
Datei anzeigen Open project: elgg/elgg Class Usage Examples

Public Methods

Method Description
__construct ( Config $config, ElggSession $session, ElggCrypto $crypto ) Constructor
ajaxActionHook ( )
ajaxForwardHook ( $hook, $reason, $forward_url, $params )
execute ( string $action, string $forwarder = "" ) : Elgg\Http\ResponseBuilder | null Executes an action If called from action() redirect will be issued by the response factory If called as /action page handler response will be handled by \Elgg\Router
exists ( $action )
gatekeeper ( $action ) : boolean
generateActionToken ( integer $timestamp, string $session_token = '' ) : string Generate a token from a session token (specifying the user), the timestamp, and the site key.
getActionTokenTimeout ( ) : integer
getAllActions ( ) : array Get all actions
handleTokenRefreshRequest ( ) : Elgg\Http\ResponseBuilder Send an updated CSRF token, provided the page's current tokens were not fake.
register ( $action, $filename = "", $access = 'logged_in' )
unregister ( $action )
validateActionToken ( $visible_errors = true, $token = null, $ts = null )
validateTokenOwnership ( string $token, integer $timestamp, string $session_token = '' ) : boolean Was the given token generated for the session defined by session_token?

Protected Methods

Method Description
validateTokenTimestamp ( integer $ts ) : boolean Is the token timestamp within acceptable range?

Method Details

__construct() public method

Constructor
public __construct ( Config $config, ElggSession $session, ElggCrypto $crypto )
$config Config Config
$session ElggSession Session
$crypto ElggCrypto Crypto service

ajaxActionHook() public method

See also: ajax_action_hook
Deprecation: 2.3
public ajaxActionHook ( )

ajaxForwardHook() public method

See also: ajax_forward_hook
Deprecation: 2.3
public ajaxForwardHook ( $hook, $reason, $forward_url, $params )

execute() public method

Executes an action If called from action() redirect will be issued by the response factory If called as /action page handler response will be handled by \Elgg\Router
See also: action
public execute ( string $action, string $forwarder = "" ) : Elgg\Http\ResponseBuilder | null
$action string Action name
$forwarder string URL to forward to after completion
return Elgg\Http\ResponseBuilder | null

exists() public method

See also: elgg_action_exists
public exists ( $action )

gatekeeper() public method

See also: action_gatekeeper
public gatekeeper ( $action ) : boolean
return boolean

generateActionToken() public method

Generate a token from a session token (specifying the user), the timestamp, and the site key.
See also: generate_action_token
public generateActionToken ( integer $timestamp, string $session_token = '' ) : string
$timestamp integer Unix timestamp
$session_token string Session-specific token
return string

getActionTokenTimeout() public method

See also: ActionsService::validateActionToken
Since: 1.9.0
public getActionTokenTimeout ( ) : integer
return integer number of seconds that action token is valid

getAllActions() public method

Get all actions
public getAllActions ( ) : array
return array

handleTokenRefreshRequest() public method

Send an updated CSRF token, provided the page's current tokens were not fake.
public handleTokenRefreshRequest ( ) : Elgg\Http\ResponseBuilder
return Elgg\Http\ResponseBuilder

register() public method

See also: elgg_register_action
public register ( $action, $filename = "", $access = 'logged_in' )

unregister() public method

See also: elgg_unregister_action
public unregister ( $action )

validateActionToken() public method

See also: validate_action_token
public validateActionToken ( $visible_errors = true, $token = null, $ts = null )

validateTokenOwnership() public method

Was the given token generated for the session defined by session_token?
public validateTokenOwnership ( string $token, integer $timestamp, string $session_token = '' ) : boolean
$token string CSRF token
$timestamp integer Unix time
$session_token string Session-specific token
return boolean

validateTokenTimestamp() protected method

Is the token timestamp within acceptable range?
protected validateTokenTimestamp ( integer $ts ) : boolean
$ts integer timestamp from the CSRF token
return boolean