]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
added another way for an action to be detected as an Ajax action: set the request...
authorcash <cash.costello@gmail.com>
Sun, 19 Jun 2011 19:03:30 +0000 (15:03 -0400)
committercash <cash.costello@gmail.com>
Sun, 19 Jun 2011 19:03:30 +0000 (15:03 -0400)
engine/lib/actions.php

index ff598916f2598fe5bcde07dd0f6abe23668740f6..017653aa8755b758cfaa66c64156d566a0cb61b0 100644 (file)
@@ -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;
        }
 }