aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/actions.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-03 19:46:47 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-03 19:46:47 +0000
commit998a39940b27561d7a2e98b68c8929dab68fe62f (patch)
tree79e73eb7bd8ae843609a2f4f0a526377800430e1 /engine/lib/actions.php
parent4b3749440c560da36b7deadcee65133062fd10a1 (diff)
downloadelgg-998a39940b27561d7a2e98b68c8929dab68fe62f.tar.gz
elgg-998a39940b27561d7a2e98b68c8929dab68fe62f.tar.bz2
Refs #1320. Updated core to use elgg_echo()'s native string replacement.
git-svn-id: http://code.elgg.org/elgg/trunk@7227 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/actions.php')
-rw-r--r--engine/lib/actions.php30
1 files changed, 15 insertions, 15 deletions
diff --git a/engine/lib/actions.php b/engine/lib/actions.php
index bcd7e759e..35f9dc4b3 100644
--- a/engine/lib/actions.php
+++ b/engine/lib/actions.php
@@ -100,7 +100,7 @@ function action($action, $forwarder = "") {
// @todo make this better!
if ($event_result) {
if (!include($CONFIG->actions[$action]['file'])) {
- register_error(sprintf(elgg_echo('actionnotfound'), $action));
+ register_error(elgg_echo('actionnotfound', array($action)));
}
}
} else {
@@ -110,7 +110,7 @@ function action($action, $forwarder = "") {
register_error(elgg_echo('actionunauthorized'));
}
} else {
- register_error(sprintf(elgg_echo('actionundefined'), $action));
+ register_error(elgg_echo('actionundefined', array($action)));
}
forward($forwarder);
@@ -359,26 +359,26 @@ function elgg_action_exist($action) {
function actions_init()
{
register_action('security/refreshtoken', TRUE);
-
+
elgg_view_register_simplecache('js/languages/en');
-
+
register_plugin_hook('action', 'all', 'ajax_action_hook');
register_plugin_hook('forward', 'all', 'ajax_forward_hook');
}
/**
* Checks whether the request was requested via ajax
- *
+ *
* @return bool whether page was requested via ajax
*/
function elgg_is_xhr() {
- return isset($_SERVER['HTTP_X_REQUESTED_WITH'])
- && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
+ return isset($_SERVER['HTTP_X_REQUESTED_WITH'])
+ && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
}
/**
* Catch calls to forward() in ajax request and force an exit.
- *
+ *
* Forces response is json of the following form:
* <pre>
* {
@@ -392,18 +392,18 @@ function elgg_is_xhr() {
* }
* </pre>
* where "system_messages" is all message registers at the point of forwarding
- *
+ *
* @param string $hook
- * @param string $type
+ * @param string $type
* @param string $reason
* @param array $params
- *
+ *
*/
function ajax_forward_hook($hook, $type, $reason, $params) {
if (elgg_is_xhr()) {
//grab any data echo'd in the action
$output = ob_get_clean();
-
+
//Avoid double-encoding in case data is json
$json = json_decode($output);
if (isset($json)) {
@@ -411,16 +411,16 @@ function ajax_forward_hook($hook, $type, $reason, $params) {
} else {
$params['output'] = $output;
}
-
+
//Grab any system messages so we can inject them via ajax too
$params['system_messages'] = system_messages(NULL, "");
-
+
if (isset($params['system_messages']['errors'])) {
$params['status'] = -1;
} else {
$params['status'] = 0;
}
-
+
header("Content-type: application/json");
echo json_encode($params);
exit;