Simplify AJAX redirect

This commit is contained in:
Jakub Vrana
2011-01-25 16:13:31 +01:00
parent 4a5eb8b408
commit fdea1970d0
3 changed files with 7 additions and 7 deletions

View File

@@ -371,7 +371,7 @@ function auth_url($driver, $server, $username) {
* @return bool
*/
function is_ajax() {
return ($_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest" || $_GET["ajax"]);
return ($_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest");
}
/** Send Location header and exit
@@ -388,7 +388,7 @@ function redirect($location, $message = null) {
if ($location == "") {
$location = ".";
}
header("Location: $location" . (is_ajax() ? (strpos($location, "?") !== false ? "&" : "?") . "ajax=1" : ""));
header((is_ajax() ? "X-AJAX-Redirect" : "Location") . ": $location");
exit;
}
}