Report invalid schema

This commit is contained in:
Jakub Vrana 2010-10-18 02:15:58 +02:00
parent 09327efdaf
commit d49903b21d
5 changed files with 14 additions and 6 deletions

View 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";

View 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;
}
}

View 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 = "") {

View 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',

View 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";