]> git.joonet.de Git - adminer.git/commitdiff
Report invalid schema
authorJakub Vrana <jakub@vrana.cz>
Mon, 18 Oct 2010 00:15:58 +0000 (02:15 +0200)
committerJakub Vrana <jakub@vrana.cz>
Mon, 18 Oct 2010 00:15:58 +0000 (02:15 +0200)
adminer/include/adminer.inc.php
adminer/include/connect.inc.php
adminer/include/design.inc.php
adminer/lang/cs.inc.php
editor/include/adminer.inc.php

index a9253eae1ca88d008bf827b5bf2b103a5fa030f6..fd5956d754076b48ae44dfc1514fcc38dff59246 100644 (file)
@@ -491,7 +491,7 @@ document.getElementById('username').focus();
        }
        
        /** Prints navigation after Adminer title
-       * @param string can be "auth" if there is no database connection or "db" if there is no database selected
+       * @param string can be "auth" if there is no database connection, "db" if there is no database selected, "ns" with invalid schema
        * @return null
        */
        function navigation($missing) {
@@ -544,7 +544,7 @@ document.getElementById('username').focus();
                                                set_schema($_GET["ns"]);
                                        }
                                }
-                               if ($_GET["ns"] !== "") {
+                               if ($_GET["ns"] !== "" && $missing != "ns") {
                                        $tables = tables_list();
                                        if (!$tables) {
                                                echo "<p class='message'>" . lang('No tables.') . "\n";
index 64cd625490893972560455f034b30f03a1e26038..1f58a6eff18649aad6141ba4851daf048fcccd7f 100644 (file)
@@ -60,6 +60,13 @@ if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET
        exit;
 }
 
-if (support("scheme") && DB != "" && $_GET["ns"] !== "" && (!isset($_GET["ns"]) || !set_schema($_GET["ns"]))) {
-       redirect(preg_replace('~ns=[^&]*&~', '', ME) . "ns=" . get_schema());
+if (support("scheme") && DB != "" && $_GET["ns"] !== "") {
+       if (!isset($_GET["ns"])) {
+               redirect(preg_replace('~ns=[^&]*&~', '', ME) . "ns=" . get_schema());
+       }
+       if (!set_schema($_GET["ns"])) {
+               page_header(lang('Schema') . ": " . h($_GET["ns"]), lang('Invalid schema.'), true);
+               page_footer("ns");
+               exit;
+       }
 }
index 445a7b24a687f112457cf5802b4dc4274efc0289..81b40d115841825545495d64f390cb4cf320b0bc 100644 (file)
@@ -73,7 +73,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
 }
 
 /** Print HTML footer
-* @param string auth|db
+* @param string "auth", "db", "ns"
 * @return null
 */
 function page_footer($missing = "") {
index 538de92080ed4c249101fe085405d519c7b3c6e2..4c91e62ae65a42e0f0e6533cafc55efc7503b035 100644 (file)
@@ -262,6 +262,7 @@ $translations = array(
        'Schema has been altered.' => 'Schéma bylo změněno.',
        'schema' => 'schéma',
        'Schema' => 'Schéma',
+       'Invalid schema.' => 'Nesprávné schéma.',
        
        // PostgreSQL sequences support
        'Sequences' => 'Sekvence',
index 7e80c937f6f41f94530843434cae926a40961454..ac99cc5b418dcf37432a1947936326db9e69d237 100644 (file)
@@ -463,7 +463,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
 </p>
 </form>
 <?php
-                       if ($missing != "db") {
+                       if ($missing != "db" && $missing != "ns") {
                                $table_status = table_status();
                                if (!$table_status) {
                                        echo "<p class='message'>" . lang('No tables.') . "\n";