]> git.joonet.de Git - adminer.git/commitdiff
Separate printing databases in customization
authorJakub Vrana <jakub@vrana.cz>
Tue, 21 Aug 2012 05:03:39 +0000 (22:03 -0700)
committerJakub Vrana <jakub@vrana.cz>
Tue, 21 Aug 2012 05:03:39 +0000 (22:03 -0700)
adminer/include/adminer.inc.php
editor/include/adminer.inc.php

index 6bebe42201c5eaedff0000ad3092de280ea0b04f..65bc2dbbeb09844efa0c53fe020e5dcf4eeb9523 100644 (file)
@@ -771,7 +771,7 @@ DROP PROCEDURE adminer_alter;
        * @return null
        */
        function navigation($missing) {
-               global $VERSION, $connection, $token, $jush, $drivers;
+               global $VERSION, $token, $jush, $drivers;
                ?>
 <h1>
 <?php echo $this->name(); ?> <span class="version"><?php echo $VERSION; ?></span>
@@ -809,26 +809,8 @@ DROP PROCEDURE adminer_alter;
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 </p>
 </form>
-<?php $databases = $this->databases(); ?>
-<form action="">
-<p id="dbs">
-<?php hidden_fields_get(); ?>
-<?php echo ($databases ? html_select("db", array("" => "(" . lang('database') . ")") + $databases, DB, "this.form.submit();") : '<input name="db" value="' . h(DB) . '">'); ?>
-<input type="submit" value="<?php echo lang('Use'); ?>"<?php echo ($databases ? " class='hidden'" : ""); ?>>
 <?php
-                       if ($missing != "db" && DB != "" && $connection->select_db(DB)) {
-                               if (support("scheme")) {
-                                       echo "<br>" . html_select("ns", array("" => "(" . lang('schema') . ")") + schemas(), $_GET["ns"], "this.form.submit();");
-                                       if ($_GET["ns"] != "") {
-                                               set_schema($_GET["ns"]);
-                                       }
-                               }
-                       }
-                       echo (isset($_GET["sql"]) ? '<input type="hidden" name="sql" value="">'
-                               : (isset($_GET["schema"]) ? '<input type="hidden" name="schema" value="">'
-                               : (isset($_GET["dump"]) ? '<input type="hidden" name="dump" value="">'
-                       : "")));
-                       echo "</p></form>\n";
+                       $this->databasesPrint($missing);
                        if ($_GET["ns"] !== "" && !$missing && DB != "") {
                                echo '<p><a href="' . h(ME) . 'create="' . bold($_GET["create"] === "") . ">" . lang('Create new table') . "</a>\n";
                                $tables = tables_list();
@@ -851,6 +833,35 @@ DROP PROCEDURE adminer_alter;
                }
        }
        
+       /** Prints databases list in menu
+       * @param string
+       * @return null
+       */
+       function databasesPrint($missing) {
+               global $connection;
+               $databases = $this->databases();
+               ?>
+<form action="">
+<p id="dbs">
+<?php hidden_fields_get(); ?>
+<?php echo ($databases ? html_select("db", array("" => "(" . lang('database') . ")") + $databases, DB, "this.form.submit();") : '<input name="db" value="' . h(DB) . '">'); ?>
+<input type="submit" value="<?php echo lang('Use'); ?>"<?php echo ($databases ? " class='hidden'" : ""); ?>>
+<?php
+               if ($missing != "db" && DB != "" && $connection->select_db(DB)) {
+                       if (support("scheme")) {
+                               echo "<br>" . html_select("ns", array("" => "(" . lang('schema') . ")") + schemas(), $_GET["ns"], "this.form.submit();");
+                               if ($_GET["ns"] != "") {
+                                       set_schema($_GET["ns"]);
+                               }
+                       }
+               }
+               echo (isset($_GET["sql"]) ? '<input type="hidden" name="sql" value="">'
+                       : (isset($_GET["schema"]) ? '<input type="hidden" name="schema" value="">'
+                       : (isset($_GET["dump"]) ? '<input type="hidden" name="dump" value="">'
+               : "")));
+               echo "</p></form>\n";
+       }
+       
        /** Prints table list in menu
        * @param array
        * @return null
index 54a0796acb32c2055f4d1c4f4d50524ec7630bb0..019833b67e77268084a57227513b41eceee09104 100644 (file)
@@ -553,6 +553,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
 </p>
 </form>
 <?php
+                       $this->databasesPrint($missing);
                        if ($missing != "db" && $missing != "ns") {
                                $table_status = table_status();
                                if (!$table_status) {
@@ -564,6 +565,9 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
                }
        }
        
+       function databasesPrint($missing) {
+       }
+       
        function tablesPrint($tables) {
                echo "<p id='tables' onmouseover='menuOver(this);' onmouseout='menuOut(this);'>\n";
                foreach ($tables as $row) {