Implemented links bar through function
This commit is contained in:
parent
bdba89e484
commit
7442183b40
|
@ -195,7 +195,7 @@ if ($adminer->homepage()) {
|
||||||
}
|
}
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
}
|
}
|
||||||
echo "<p class='links'><a href='" . h(ME) . "sequence='>" . lang('Create sequence') . "</a>\n";
|
echo generate_linksbar(["<a href='" . h(ME) . "sequence='>" . lang('Create sequence') . "</a>"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (support("type")) {
|
if (support("type")) {
|
||||||
|
@ -210,7 +210,7 @@ if ($adminer->homepage()) {
|
||||||
}
|
}
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
}
|
}
|
||||||
echo "<p class='links'><a href='" . h(ME) . "type='>" . lang('Create type') . "</a>\n";
|
echo generate_linksbar(["<a href='" . h(ME) . "type='>" . lang('Create type') . "</a>"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (support("event")) {
|
if (support("event")) {
|
||||||
|
|
|
@ -234,18 +234,18 @@ class Adminer {
|
||||||
*/
|
*/
|
||||||
function selectQuery($query, $start, $failed = false) {
|
function selectQuery($query, $start, $failed = false) {
|
||||||
global $jush, $driver;
|
global $jush, $driver;
|
||||||
$return = "</p>\n"; // required for IE9 inline edit
|
|
||||||
if (!$failed && ($warnings = $driver->warnings())) {
|
if (!$failed && ($warnings = $driver->warnings())) {
|
||||||
$id = "warnings";
|
$id = "warnings";
|
||||||
$return = ", <a href='#$id'>" . lang('Warnings') . "</a>" . script("qsl('a').onclick = partial(toggle, '$id');", "")
|
$return = ", <a href='#$id'>" . lang('Warnings') . "</a>" . script("qsl('a').onclick = partial(toggle, '$id');", "")
|
||||||
. "$return<div id='$id' class='hidden'>\n$warnings</div>\n"
|
. "$return<div id='$id' class='hidden'>\n$warnings</div>\n"
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
return "<p class='links' style='margin-bottom: 25px;'><code class='jush-$jush copy-to-clipboard'>" . h(str_replace("\n", " ", $query)) . "</code> <span class='time'>(" . format_time($start) . ")</span>"
|
$links = [
|
||||||
. (support("sql") ? "<br><a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>" : "")
|
(support("sql") ? "<a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>" : ""),
|
||||||
. " | <a href='#' class='copy-to-clipboard'>" . lang('Copy to clipboard') . "</a>"
|
"<a href='#' class='copy-to-clipboard'>" . lang('Copy to clipboard') . "</a>",
|
||||||
. $return
|
];
|
||||||
;
|
return "<code class='jush-$jush copy-to-clipboard'>" . h(str_replace("\n", " ", $query)) . "</code> <span class='time'>(" . format_time($start) . ")</span>"
|
||||||
|
. generate_linksbar($links);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Query printed in SQL command before execution
|
/** Query printed in SQL command before execution
|
||||||
|
@ -991,14 +991,20 @@ bodyLoad('<?php echo (is_object($connection) ? preg_replace('~^(\d\.?\d).*~s', '
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
$this->databasesPrint($missing);
|
$this->databasesPrint($missing);
|
||||||
|
$links = [];
|
||||||
if (DB == "" || !$missing) {
|
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")) {
|
||||||
|
$links[] = "<a href='" . h(ME) . "sql='" . bold(isset($_GET["sql"]) && !isset($_GET["import"])) . ">" . lang('SQL command') . "</a>";
|
||||||
|
$links[] = "<a href='" . h(ME) . "import='" . bold(isset($_GET["import"])) . ">" . lang('Import') . "</a>";
|
||||||
|
}
|
||||||
if (support("dump")) {
|
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";
|
$links[] = "<a href='" . h(ME) . "dump=" . urlencode(isset($_GET["table"]) ? $_GET["table"] : $_GET["select"]) . "' id='dump'" . bold(isset($_GET["dump"])) . ">" . lang('Export') . "</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
echo generate_linksbar($links);
|
||||||
|
|
||||||
if ($_GET["ns"] !== "" && !$missing && DB != "") {
|
if ($_GET["ns"] !== "" && !$missing && DB != "") {
|
||||||
echo '<br><a href="' . h(ME) . 'create="' . bold($_GET["create"] === "") . ">" . lang('Create table') . "</a>\n";
|
echo generate_linksbar(['<a href="' . h(ME) . 'create="' . bold($_GET["create"] === "") . ">" . lang('Create table') . "</a>"]);
|
||||||
if (!$tables) {
|
if (!$tables) {
|
||||||
echo "<p class='message'>" . lang('No tables.') . "\n";
|
echo "<p class='message'>" . lang('No tables.') . "\n";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10,22 +10,20 @@ function connect_error() {
|
||||||
}
|
}
|
||||||
|
|
||||||
page_header(lang('Select database'), $error, false);
|
page_header(lang('Select database'), $error, false);
|
||||||
echo "<p class='links'>\n";
|
$actions = [
|
||||||
$links = array(
|
|
||||||
'database' => lang('Create database'),
|
'database' => lang('Create database'),
|
||||||
'privileges' => lang('Privileges'),
|
'privileges' => lang('Privileges'),
|
||||||
'processlist' => lang('Process list'),
|
'processlist' => lang('Process list'),
|
||||||
'variables' => lang('Variables'),
|
'variables' => lang('Variables'),
|
||||||
'status' => lang('Status'),
|
'status' => lang('Status'),
|
||||||
);
|
];
|
||||||
foreach ($links as $key => $val) {
|
$links = [];
|
||||||
|
foreach ($actions as $key => $val) {
|
||||||
if (support($key)) {
|
if (support($key)) {
|
||||||
if ($key !== array_key_first($links)) {
|
$links[] = "<a href='" . h(ME) . "$key='>$val</a>";
|
||||||
echo " | ";
|
|
||||||
}
|
|
||||||
echo "<a href='" . h(ME) . "$key='>$val</a>\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
echo generate_linksbar($links);
|
||||||
echo "<p>" . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>" . h($connection->server_info) . "</b>", "<b>$connection->extension</b>") . "\n";
|
echo "<p>" . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>" . h($connection->server_info) . "</b>", "<b>$connection->extension</b>") . "\n";
|
||||||
echo "<p>" . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n";
|
echo "<p>" . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n";
|
||||||
$databases = $adminer->databases();
|
$databases = $adminer->databases();
|
||||||
|
|
|
@ -271,6 +271,18 @@ function print_fieldset($id, $legend, $visible = false) {
|
||||||
echo "<div id='fieldset-$id'" . ($visible ? "" : " class='hidden'") . ">\n";
|
echo "<div id='fieldset-$id'" . ($visible ? "" : " class='hidden'") . ">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generate_linksbar($links) {
|
||||||
|
$linksbar = "<p class='links'>\n";
|
||||||
|
foreach ($links as $key => $link) {
|
||||||
|
if ($key !== key(array_keys($links))) {
|
||||||
|
$linksbar .= " | ";
|
||||||
|
}
|
||||||
|
$linksbar .= $link . "\n";
|
||||||
|
}
|
||||||
|
$linksbar .= "</p>\n";
|
||||||
|
return $linksbar;
|
||||||
|
}
|
||||||
|
|
||||||
/** Return class='active' if $bold is true
|
/** Return class='active' if $bold is true
|
||||||
* @param bool
|
* @param bool
|
||||||
* @param string
|
* @param string
|
||||||
|
|
Loading…
Reference in a new issue