]> git.joonet.de Git - adminer.git/commitdiff
Minimize the chance of displaying message on different page (thanks to Tomas Brukner)
authorJakub Vrana <jakub@vrana.cz>
Sun, 30 Jan 2011 19:37:22 +0000 (20:37 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 31 Jan 2011 19:09:08 +0000 (20:09 +0100)
adminer/include/adminer.inc.php
adminer/include/design.inc.php
adminer/include/editing.inc.php
adminer/include/functions.inc.php

index ebb58e6b645686c6a9dd8008cf9ac4796d8bff92..5e2f3adf13e50e5550fc195ffd124790b704a9ab 100644 (file)
@@ -404,8 +404,9 @@ username.form['driver'].onchange();
        */
        function messageQuery($query) {
                global $jush;
+               static $count = 0;
                restart_session();
-               $id = "sql-" . count($_SESSION["messages"]);
+               $id = "sql-" . ($count++);
                $history = &get_session("queries");
                $history[$_GET["db"]][] = (strlen($query) > 1e6 // not DB - reset in drop database
                        ? ereg_replace('[\x80-\xFF]+$', '', substr($query, 0, 1e6)) . "\n..." // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment
index f22dade9db7e607d3381262d01e423d21c9e84b2..c347271e51b23b488cf8d935ecb4a8eab3a3dd4b 100644 (file)
@@ -64,9 +64,11 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
        }
        echo "<h2>$title_all</h2>\n";
        restart_session();
-       if ($_SESSION["messages"]) {
-               echo "<div class='message'>" . implode("</div>\n<div class='message'>", $_SESSION["messages"]) . "</div>\n";
-               $_SESSION["messages"] = array();
+       $uri = preg_replace('~^[^?]*/~', '', $_SERVER["REQUEST_URI"]);
+       $messages = $_SESSION["messages"][$uri];
+       if ($messages) {
+               echo "<div class='message'>" . implode("</div>\n<div class='message'>", $messages) . "</div>\n";
+               unset($_SESSION["messages"][$uri]);
        }
        $databases = &get_session("dbs");
        if (DB != "" && $databases && !in_array(DB, $databases, true)) {
index 32658ebf958e7a618863b83c0125dc080159176e..b9ca4147a9ec93694c98758f08e3d32de4630cc2 100644 (file)
@@ -349,7 +349,7 @@ function drop_create($drop, $create, $location, $message_drop, $message_alter, $
        $created = queries($create);
        if (!queries_redirect($location, ($name != "" ? $message_alter : $message_create), $created) && $dropped) {
                restart_session();
-               $_SESSION["messages"][] = $message_drop;
+               $_SESSION["messages"][preg_replace('~^[^?]*/~', '', $_SERVER["REQUEST_URI"])][] = $message_drop;
        }
        return $dropped;
 }
index aff62aac3c73dc0ad5f77e2f6c16d99529def79f..54d504ef6d883b8b3615c02ff577bc1d668b75b8 100644 (file)
@@ -384,7 +384,7 @@ function is_ajax() {
 function redirect($location, $message = null) {
        if (isset($message)) {
                restart_session();
-               $_SESSION["messages"][] = $message;
+               $_SESSION["messages"][preg_replace('~^[^?]*/~', '', $location)][] = $message;
        }
        if (isset($location)) {
                if ($location == "") {