Move <h1> to $adminer->navigation

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1118 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-09-19 20:16:15 +00:00
parent 4b81c92582
commit d3227c963f
4 changed files with 58 additions and 32 deletions

View file

@ -414,7 +414,18 @@ class Adminer {
* @return null * @return null
*/ */
function navigation($missing) { function navigation($missing) {
global $dbh; global $VERSION;
?>
<h1>
<a href="http://www.adminer.org/" id="h1"><?php echo $this->name(); ?></a>
<span class="version"><?php echo $VERSION; ?></span>
<a href="http://www.adminer.org/#download" id="version"><?php echo (version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? h($_COOKIE["adminer_version"]) : ""); ?></a>
</h1>
<script type="text/javascript">
body_load();
<?php echo (isset($_COOKIE["adminer_version"]) ? "" : "verify_version();"); ?>
</script>
<?php
if ($missing != "auth") { if ($missing != "auth") {
$databases = get_databases(); $databases = get_databases();
?> ?>
@ -442,19 +453,28 @@ class Adminer {
</p> </p>
</form> </form>
<?php <?php
if ($missing != "db" && strlen(DB) && $dbh->select_db(DB)) { $this->printTables($missing);
$result = $dbh->query("SHOW TABLES"); }
if (!$result->num_rows) { }
echo "<p class='message'>" . lang('No tables.') . "\n";
} else { /** Prints table list in menu
echo "<p id='tables'>\n"; * @param string can be "db" if there is no database selected
while ($row = $result->fetch_row()) { * @return null
echo '<a href="' . h(ME) . 'select=' . urlencode($row[0]) . '">' . lang('select') . '</a> '; */
echo '<a href="' . h(ME) . 'table=' . urlencode($row[0]) . '">' . $this->tableName(array("Name" => $row[0])) . "</a><br>\n"; //! Adminer::tableName may work with full table status function printTables($missing) {
} global $dbh;
if ($missing != "db" && strlen(DB) && $dbh->select_db(DB)) {
$result = $dbh->query("SHOW TABLES");
if (!$result->num_rows) {
echo "<p class='message'>" . lang('No tables.') . "\n";
} else {
echo "<p id='tables'>\n";
while ($row = $result->fetch_row()) {
echo '<a href="' . h(ME) . 'select=' . urlencode($row[0]) . '">' . lang('select') . '</a> ';
echo '<a href="' . h(ME) . 'table=' . urlencode($row[0]) . '">' . $this->tableName(array("Name" => $row[0])) . "</a><br>\n"; //! Adminer::tableName may work with full table status
} }
echo '<p><a href="' . h(ME) . 'create=">' . lang('Create new table') . "</a>\n";
} }
echo '<p><a href="' . h(ME) . 'create=">' . lang('Create new table') . "</a>\n";
} }
} }

View file

@ -15,7 +15,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
<link rel="stylesheet" type="text/css" href="adminer.css"> <link rel="stylesheet" type="text/css" href="adminer.css">
<?php } ?> <?php } ?>
<body onload="body_load();<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verify_version();"); ?>"> <body>
<script type="text/javascript" src="../adminer/functions.js"></script> <script type="text/javascript" src="../adminer/functions.js"></script>
<script type="text/javascript" src="editing.js"></script> <script type="text/javascript" src="editing.js"></script>
@ -56,17 +56,12 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
} }
function page_footer($missing = false) { function page_footer($missing = false) {
global $VERSION, $adminer; global $adminer;
?> ?>
</div> </div>
<?php switch_lang(); ?> <?php switch_lang(); ?>
<div id="menu"> <div id="menu">
<h1>
<a href="http://www.adminer.org/" id="h1"><?php echo $adminer->name(); ?></a>
<span class="version"><?php echo $VERSION; ?></span>
<a href="http://www.adminer.org/#download" id="version"><?php echo (version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? h($_COOKIE["adminer_version"]) : ""); ?></a>
</h1>
<?php $adminer->navigation($missing); ?> <?php $adminer->navigation($missing); ?>
</div> </div>
<?php <?php

View file

@ -1,4 +1,2 @@
// Editor specific functions // Editor specific functions
function body_load() {
}

View file

@ -348,6 +348,15 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5
} }
function navigation($missing) { function navigation($missing) {
global $VERSION;
?>
<h1>
<a href="http://www.adminer.org/" id="h1"><?php echo $this->name(); ?></a>
<span class="version"><?php echo $VERSION; ?></span>
<a href="http://www.adminer.org/editor/#download" id="version"><?php echo (version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? h($_COOKIE["adminer_version"]) : ""); ?></a>
</h1>
<?php
echo (isset($_COOKIE["adminer_version"]) ? "" : "<script type='text/javascript'>verify_version();</script>\n");
if ($missing != "auth") { if ($missing != "auth") {
?> ?>
<form action="" method="post"> <form action="" method="post">
@ -357,17 +366,21 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5
</p> </p>
</form> </form>
<?php <?php
if ($missing != "db") { $this->printTables($missing);
$table_status = table_status(); }
if (!$table_status) { }
echo "<p class='message'>" . lang('No tables.') . "\n";
} else { function printTables($missing) {
echo "<p id='tables'>\n"; if ($missing != "db") {
foreach ($table_status as $row) { $table_status = table_status();
$name = $this->tableName($row); if (!$table_status) {
if (isset($row["Engine"]) && strlen($name)) { // ignore views and tables without name echo "<p class='message'>" . lang('No tables.') . "\n";
echo "<a href='" . h(ME) . 'select=' . urlencode($row["Name"]) . "'>$name</a><br>\n"; } else {
} echo "<p id='tables'>\n";
foreach ($table_status as $row) {
$name = $this->tableName($row);
if (isset($row["Engine"]) && strlen($name)) { // ignore views and tables without name
echo "<a href='" . h(ME) . 'select=' . urlencode($row["Name"]) . "'>$name</a><br>\n";
} }
} }
} }