]> git.joonet.de Git - adminer.git/commitdiff
Do not display empty action links in main menu
authorPeter Knut <peter@pematon.com>
Mon, 14 Oct 2024 07:52:18 +0000 (09:52 +0200)
committerJakub Vrana <jakub@vrana.cz>
Wed, 19 Feb 2025 10:16:40 +0000 (11:16 +0100)
adminer/include/adminer.inc.php

index 01f1677da11fcf384c7d4f2ad9ada44490edd12d..cb86b1636cd25edcb4a3329eeaa6693bcdfad0be 100644 (file)
@@ -996,18 +996,26 @@ bodyLoad('<?php echo (is_object($connection) ? preg_replace('~^(\d\.?\d).*~s', '
 <?php
                        }
                        $this->databasesPrint($missing);
+                       $actions = array();
                        if (DB == "" || !$missing) {
-                               echo "<p class='links'>" . (support("sql") ? "<a href='" . h(ME) . "sql='" . bold(isset($_GET["sql"]) && !isset($_GET["import"])) . ">" . lang('SQL command') . "</a>\n<a href='" . h(ME) . "import='" . bold(isset($_GET["import"])) . ">" . lang('Import') . "</a>\n" : "") . "";
+                               if (support("sql")) {
+                                       $actions[] = "<a href='" . h(ME) . "sql='" . bold(isset($_GET["sql"]) && !isset($_GET["import"])) . ">" . lang('SQL command') . "</a>";
+                                       $actions[] = "<a href='" . h(ME) . "import='" . bold(isset($_GET["import"])) . ">" . lang('Import') . "</a>";
+                               }
                                if (support("dump")) {
-                                       echo "<a href='" . h(ME) . "dump=" . urlencode(isset($_GET["table"]) ? $_GET["table"] : $_GET["select"]) . "' id='dump'" . bold(isset($_GET["dump"])) . ">" . lang('Export') . "</a>\n";
+                                       $actions[] = "<a href='" . h(ME) . "dump=" . urlencode(isset($_GET["table"]) ? $_GET["table"] : $_GET["select"]) . "' id='dump'" . bold(isset($_GET["dump"])) . ">" . lang('Export') . "</a>";
                                }
                        }
-                       if ($_GET["ns"] !== "" && !$missing && DB != "") {
-                               echo '<a href="' . h(ME) . 'create="' . bold($_GET["create"] === "") . ">" . lang('Create table') . "</a>\n";
-                               if (!$tables) {
-                                       echo "<p class='message'>" . lang('No tables.') . "\n";
-                               } else {
+                       $in_db = $_GET["ns"] !== "" && !$missing && DB != "";
+                       if ($in_db) {
+                               $actions[] = '<a href="' . h(ME) . 'create="' . bold($_GET["create"] === "") . ">" . lang('Create table') . "</a>";
+                       }
+                       echo ($actions ? "<p class='links'>\n" . implode("\n", $actions) . "\n" : "");
+                       if ($in_db) {
+                               if ($tables) {
                                        $this->tablesPrint($tables);
+                               } else {
+                                       echo "<p class='message'>" . lang('No tables.') . "</p>\n";
                                }
                        }
                }