diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-05-19 10:55:05 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-05-19 10:55:05 +0000 |
commit | 639b093e700b7dd7ea52b03f4498f7731b66a072 (patch) | |
tree | 373720bef807ef15ce914bd4c4020c022fd17cff /engine | |
parent | bfb331611d6a4fbb09e3b4a2eb8425a61445dd30 (diff) | |
download | elgg-639b093e700b7dd7ea52b03f4498f7731b66a072.tar.gz elgg-639b093e700b7dd7ea52b03f4498f7731b66a072.tar.bz2 |
Closes #1026: Removed "@" from include statement
git-svn-id: https://code.elgg.org/elgg/trunk@3295 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/actions.php | 212 |
1 files changed, 106 insertions, 106 deletions
diff --git a/engine/lib/actions.php b/engine/lib/actions.php index 88dfde97c..d7de3961c 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -1,59 +1,59 @@ -<?php
-
- /**
- * Elgg actions
- * Allows system modules to specify actions
- *
- * @package Elgg
- * @subpackage Core
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2009
- * @link http://elgg.org/
- */
-
- // Action setting and run *************************************************
-
- /**
- * Loads an action script, if it exists, then forwards elsewhere
- *
- * @param string $action The requested action
- * @param string $forwarder Optionally, the location to forward to
- */
-
- function action($action, $forwarder = "") {
-
+<?php + + /** + * Elgg actions + * Allows system modules to specify actions + * + * @package Elgg + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2009 + * @link http://elgg.org/ + */ + + // Action setting and run ************************************************* + + /** + * Loads an action script, if it exists, then forwards elsewhere + * + * @param string $action The requested action + * @param string $forwarder Optionally, the location to forward to + */ + + function action($action, $forwarder = "") { + global $CONFIG; -
-
- $query = parse_url($_SERVER['REQUEST_URI']);
- if (isset($query['query'])) {
- $query = $query['query'];
- $query = rawurldecode($query);
- $query = explode('&',$query);
- if (sizeof($query) > 0) {
- foreach($query as $queryelement) {
- $vals = explode('=',$queryelement);
- if (sizeof($vals) > 1) {
- set_input(trim($vals[0]),trim($vals[1]));
- }
- }
- }
- }
-
- $forwarder = str_replace($CONFIG->url, "", $forwarder);
- $forwarder = str_replace("http://", "", $forwarder);
- $forwarder = str_replace("@", "", $forwarder);
-
- if (substr($forwarder,0,1) == "/") {
- $forwarder = substr($forwarder,1);
- }
-
+ + + $query = parse_url($_SERVER['REQUEST_URI']); + if (isset($query['query'])) { + $query = $query['query']; + $query = rawurldecode($query); + $query = explode('&',$query); + if (sizeof($query) > 0) { + foreach($query as $queryelement) { + $vals = explode('=',$queryelement); + if (sizeof($vals) > 1) { + set_input(trim($vals[0]),trim($vals[1])); + } + } + } + } + + $forwarder = str_replace($CONFIG->url, "", $forwarder); + $forwarder = str_replace("http://", "", $forwarder); + $forwarder = str_replace("@", "", $forwarder); + + if (substr($forwarder,0,1) == "/") { + $forwarder = substr($forwarder,1); + } + if (isset($CONFIG->actions[$action])) { if ( (isadminloggedin()) || (!$CONFIG->actions[$action]['admin']) - ) {
+ ) { if ($CONFIG->actions[$action]['public'] || $_SESSION['id'] != -1) { // Trigger action event TODO: This is only called before the primary action is called. We need to rethink actions for 1.5 @@ -74,63 +74,63 @@ error_log($message); } -
- if (@include($CONFIG->actions[$action]['file'])) {
- } else {
- register_error(sprintf(elgg_echo('actionundefined'),$action));
+ + if (include($CONFIG->actions[$action]['file'])) { + } else { + register_error(sprintf(elgg_echo('actionundefined'),$action)); } - }
- } else {
- register_error(elgg_echo('actionloggedout'));
+ } + } else { + register_error(elgg_echo('actionloggedout')); } - }
- } else {
- register_error(sprintf(elgg_echo('actionundefined'),$action));
+ } + } else { + register_error(sprintf(elgg_echo('actionundefined'),$action)); } -
- forward($CONFIG->url . $forwarder);
-
- }
-
- /**
- * Registers a particular action in memory
- *
- * @param string $action The name of the action (eg "register", "account/settings/save")
- * @param boolean $public Can this action be accessed by people not logged into the system?
+ + forward($CONFIG->url . $forwarder); + + } + + /** + * Registers a particular action in memory + * + * @param string $action The name of the action (eg "register", "account/settings/save") + * @param boolean $public Can this action be accessed by people not logged into the system? * @param string $filename Optionally, the filename where this action is located - * @param boolean $admin_only Whether this action is only available to admin users.
- */
-
- function register_action($action, $public = false, $filename = "", $admin_only = false) {
- global $CONFIG;
-
- if (!isset($CONFIG->actions)) {
- $CONFIG->actions = array();
- }
-
+ * @param boolean $admin_only Whether this action is only available to admin users. + */ + + function register_action($action, $public = false, $filename = "", $admin_only = false) { + global $CONFIG; + + if (!isset($CONFIG->actions)) { + $CONFIG->actions = array(); + } + if (empty($filename)) { $path = ""; if (isset($CONFIG->path)) $path = $CONFIG->path; -
- $filename = $path . "actions/" . $action . ".php";
- }
-
- $CONFIG->actions[$action] = array('file' => $filename, 'public' => $public, 'admin' => $admin_only);
- return true;
- }
-
- /**
- * Actions to perform on initialisation
- *
- * @param string $event Events API required parameters
- * @param string $object_type Events API required parameters
- * @param string $object Events API required parameters
- */
-
- function actions_init($event, $object_type, $object) {
- register_action("error");
- return true;
+ + $filename = $path . "actions/" . $action . ".php"; + } + + $CONFIG->actions[$action] = array('file' => $filename, 'public' => $public, 'admin' => $admin_only); + return true; + } + + /** + * Actions to perform on initialisation + * + * @param string $event Events API required parameters + * @param string $object_type Events API required parameters + * @param string $object Events API required parameters + */ + + function actions_init($event, $object_type, $object) { + register_action("error"); + return true; } /** @@ -246,10 +246,10 @@ if (!$secret) $secret = init_site_secret(); return $secret; - }
-
- // Register some actions ***************************************************
-
- register_elgg_event_handler("init","system","actions_init");
-
+ } + + // Register some actions *************************************************** + + register_elgg_event_handler("init","system","actions_init"); + ?>
\ No newline at end of file |