aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/actions.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-08-21 22:37:45 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-08-21 22:37:45 +0000
commitb81f168b0bfc298c6eb1c0a2a857311f076c40bd (patch)
tree51d2a92ed92a97fa5a6b37e969b4d415a60889f9 /engine/lib/actions.php
parent64aafb5ca73d329663a93f80ac9cf3e68a082866 (diff)
downloadelgg-b81f168b0bfc298c6eb1c0a2a857311f076c40bd.tar.gz
elgg-b81f168b0bfc298c6eb1c0a2a857311f076c40bd.tar.bz2
Merged [6573],[6574],[6582] from 1.7 branch into trunk
git-svn-id: http://code.elgg.org/elgg/trunk@6841 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/actions.php')
-rw-r--r--engine/lib/actions.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/engine/lib/actions.php b/engine/lib/actions.php
index b715577a9..47c0bf7af 100644
--- a/engine/lib/actions.php
+++ b/engine/lib/actions.php
@@ -17,13 +17,14 @@
* @param string $action The requested action
* @param string $forwarder Optionally, the location to forward to
*/
-
function action($action, $forwarder = "") {
global $CONFIG;
+ $action = rtrim($action, '/');
+
// @todo REMOVE THESE ONCE #1509 IS IN PLACE.
// Allow users to disable plugins without a token in order to
- // remove plugins that are imcompatible.
+ // remove plugins that are incompatible.
// Installation cannot use tokens because it requires site secret to be
// working. (#1462)
// Login and logout are for convenience.
@@ -45,8 +46,8 @@ function action($action, $forwarder = "") {
$forwarder = str_replace("http://", "", $forwarder);
$forwarder = str_replace("@", "", $forwarder);
- if (substr($forwarder,0,1) == "/") {
- $forwarder = substr($forwarder,1);
+ if (substr($forwarder, 0, 1) == "/") {
+ $forwarder = substr($forwarder, 1);
}
if (isset($CONFIG->actions[$action])) {
@@ -90,6 +91,10 @@ function action($action, $forwarder = "") {
function register_action($action, $public = false, $filename = "", $admin_only = false) {
global $CONFIG;
+ // plugins are encouraged to call actions with a trailing / to prevent 301
+ // redirects but we store the actions without it
+ $action = rtrim($action, '/');
+
if (!isset($CONFIG->actions)) {
$CONFIG->actions = array();
}
@@ -251,5 +256,5 @@ function elgg_action_exist($action) {
return (isset($CONFIG->actions[$action]) && file_exists($CONFIG->actions[$action]['file']));
}
-// Register some actions ***************************************************
+
register_elgg_event_handler("init","system","actions_init");