aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-06-19 15:03:30 -0400
committercash <cash.costello@gmail.com>2011-06-19 15:03:30 -0400
commit6e05a5d7486ede1c8408144b823b895c6282f270 (patch)
treefe2eb5eed4ce498f5f620963ad773fc347599179 /engine
parent0afdb10ff1d079e623685a91c59bac4802aa0069 (diff)
downloadelgg-6e05a5d7486ede1c8408144b823b895c6282f270.tar.gz
elgg-6e05a5d7486ede1c8408144b823b895c6282f270.tar.bz2
added another way for an action to be detected as an Ajax action: set the request variable X-Requested-With = XMLHttpRequest. This is because files cannot be uploaded with XMLHttpRequest
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/actions.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/engine/lib/actions.php b/engine/lib/actions.php
index ff598916f..017653aa8 100644
--- a/engine/lib/actions.php
+++ b/engine/lib/actions.php
@@ -384,7 +384,8 @@ function actions_init() {
*/
function elgg_is_xhr() {
return isset($_SERVER['HTTP_X_REQUESTED_WITH'])
- && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
+ && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ||
+ get_input('X-Requested-With') === 'XMLHttpRequest';
}
/**
@@ -448,6 +449,9 @@ function ajax_forward_hook($hook, $type, $reason, $params) {
header("Content-type: application/json");
echo json_encode($params);
exit;
+ } else {
+ echo json_encode('not ajax');
+ exit;
}
}