]> git.joonet.de Git - adminer.git/commitdiff
Simplify AJAX redirect
authorJakub Vrana <jakub@vrana.cz>
Tue, 25 Jan 2011 15:13:31 +0000 (16:13 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 25 Jan 2011 15:13:31 +0000 (16:13 +0100)
adminer/include/design.inc.php
adminer/include/functions.inc.php
adminer/static/functions.js

index 903c12fbaa2fc9878c35f7f8a06ef911966ed524..f22dade9db7e607d3381262d01e423d21c9e84b2 100644 (file)
@@ -14,9 +14,6 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
        $title_page = $title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name();
        if (is_ajax()) {
                header("X-AJAX-Title: " . rawurlencode($title_page));
-               if ($_GET["ajax"]) {
-                       header("X-AJAX-Redirect: " . remove_from_uri("ajax"));
-               }
        } else {
                $protocol = ($HTTPS ? "https" : "http");
                ?>
index 3e2b82775c862b3c84b46f26651e440784a793a4..edb426ec25543ee3f71bacb7ad061a67be69474e 100644 (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;
        }
 }
index d766628be0d1d5d6cdfa18c61157cbc4c6089912..8905713d27039678ea23658cf068ac410927804c 100644 (file)
@@ -194,8 +194,11 @@ function ajax(url, callback, data) {
                xmlhttp.onreadystatechange = function () {
                        if (xmlhttp.readyState == 4) {
                                var redirect = xmlhttp.getResponseHeader('X-AJAX-Redirect');
-                               if (redirect && history.replaceState) {
-                                       history.replaceState(null, '', redirect);
+                               if (redirect) {
+                                       if (history.replaceState) {
+                                               history.replaceState(null, '', redirect);
+                                       }
+                                       return ajaxSend(redirect);
                                }
                                var title = xmlhttp.getResponseHeader('X-AJAX-Title');
                                if (title) {