1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 15:47:00 +02:00

Send all forms by AJAX

This commit is contained in:
Jakub Vrana
2010-11-23 11:50:53 +01:00
parent 0e29a6a783
commit 38894b2977
5 changed files with 33 additions and 25 deletions

View File

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