20 private $actions = array();
26 private $currentAction = null;
42 'admin/plugins/disable',
47 if (!in_array(
$action, $exceptions)) {
53 $forwarder = str_replace(
"http://",
"", $forwarder);
54 $forwarder = str_replace(
"@",
"", $forwarder);
55 if (substr($forwarder, 0, 1) ==
"/") {
56 $forwarder = substr($forwarder, 1);
59 if (!isset($this->actions[
$action])) {
63 } elseif (!
elgg_is_logged_in() && ($this->actions[$action][
'access'] !==
'public')) {
69 if (!include($this->actions[$action][
'file'])) {
75 $forwarder = empty($forwarder) ?
REFERER : $forwarder;
88 if (empty($filename)) {
98 $this->actions[
$action] = array(
110 if (isset($this->actions[
$action])) {
111 unset($this->actions[$action]);
133 if ((
$token) && (
$ts) && ($session_id)) {
138 if (
$token == $required_token) {
149 }
else if ($visible_errors) {
152 }
else if ($visible_errors) {
160 }
else if ($visible_errors) {
170 $length = $req->server->get(
'CONTENT_LENGTH');
171 $post_count = count($req->request);
172 if ($length && $post_count < 1) {
175 'post_size' => $length,
176 'visible_errors' => $visible_errors,
177 ),
elgg_echo(
'actiongatekeeper:uploadexceeded'));
179 $error_msg =
elgg_echo(
'actiongatekeeper:missingfields');
181 if ($visible_errors) {
199 return ($timeout == 0 || (
$ts > $now - $timeout) && (
$ts < $now + $timeout));
214 return (
int)((float)$timeout * $hour);
256 if (($site_secret) && ($session_id)) {
257 return md5($site_secret .
$timestamp . $session_id . $st);
268 return (isset($this->actions[
$action]) && file_exists($this->actions[$action][
'file']));
281 'system_messages' => array(
301 if (isset($system_messages[
'success'])) {
302 $params[
'system_messages'][
'success'] = $system_messages[
'success'];
305 if (isset($system_messages[
'error'])) {
306 $params[
'system_messages'][
'error'] = $system_messages[
'error'];
310 $context = array(
'action' => $this->currentAction);
317 $http_accept =
_elgg_services()->request->server->get(
'HTTP_ACCEPT');
318 if (stripos($http_accept,
'application/json') ===
false) {
319 header(
"Content-type: text/plain");
321 header(
"Content-type: application/json");
345 return $this->actions;
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
generateActionToken($timestamp)
elgg_is_logged_in()
Returns whether or not the user is currently logged in.
elgg_is_xhr()
Checks whether the request was requested via ajax.
validateActionToken($visible_errors=true, $token=null, $ts=null)
action_gatekeeper($action)
Validates the presence of action tokens.
getAllActions()
Get all actions.
elgg_is_admin_logged_in()
Returns whether or not the viewer is currently logged in and an admin user.
ajaxForwardHook($hook, $reason, $return, $params)
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
generate_action_token($timestamp)
Generate an action token.
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
elgg echo
Translates a string.
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Trigger a Plugin Hook and run all handler callbacks registered to that hook:type. ...
elgg_get_site_url($site_guid=0)
Get the URL for the current (or specified) site.
get_site_secret()
Returns the site secret.
system_messages($message=null, $register="success", $count=false)
Queues a message to be displayed.
validate_action_token($visible_errors=true, $token=null, $ts=null)
Validate an action token.
execute($action, $forwarder="")
validateTokenTimestamp($ts)
Is the token timestamp within acceptable range?
elgg register_error
Wrapper function for system_messages.
clearfix elgg elgg elgg elgg page header