From 6e05a5d7486ede1c8408144b823b895c6282f270 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 19 Jun 2011 15:03:30 -0400 Subject: 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 --- engine/lib/actions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'engine/lib/actions.php') 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; } } -- cgit v1.2.3 From 5240a01d98d7c8b99c9d9c3f820de9c598ec5849 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 20 Jun 2011 21:09:10 -0400 Subject: removed debug code --- engine/lib/actions.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'engine/lib/actions.php') diff --git a/engine/lib/actions.php b/engine/lib/actions.php index 017653aa8..4ccffd267 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -449,9 +449,6 @@ 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; } } -- cgit v1.2.3