Simplify tablesPrint
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1135 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
09e93ded96
commit
df0c4bba95
|
@ -435,7 +435,7 @@ class Adminer {
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function navigation($missing) {
|
function navigation($missing) {
|
||||||
global $VERSION;
|
global $VERSION, $connection;
|
||||||
?>
|
?>
|
||||||
<h1>
|
<h1>
|
||||||
<a href="http://www.adminer.org/" id="h1"><?php echo $this->name(); ?></a>
|
<a href="http://www.adminer.org/" id="h1"><?php echo $this->name(); ?></a>
|
||||||
|
@ -470,28 +470,27 @@ class Adminer {
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
$this->tablesPrint($missing);
|
if ($missing != "db" && strlen(DB) && $connection->select_db(DB)) {
|
||||||
|
$tables = get_vals("SHOW TABLES");
|
||||||
|
if (!$tables) {
|
||||||
|
echo "<p class='message'>" . lang('No tables.') . "\n";
|
||||||
|
} else {
|
||||||
|
$this->tablesPrint($tables);
|
||||||
|
}
|
||||||
|
echo '<p><a href="' . h(ME) . 'create=">' . lang('Create new table') . "</a>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Prints table list in menu
|
/** Prints table list in menu
|
||||||
* @param string can be "db" if there is no database selected
|
* @param array
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function tablesPrint($missing) {
|
function tablesPrint($tables) {
|
||||||
global $connection;
|
|
||||||
if ($missing != "db" && strlen(DB) && $connection->select_db(DB)) {
|
|
||||||
$result = $connection->query("SHOW TABLES");
|
|
||||||
if (!$result->num_rows) {
|
|
||||||
echo "<p class='message'>" . lang('No tables.') . "\n";
|
|
||||||
} else {
|
|
||||||
echo "<p id='tables'>\n";
|
echo "<p id='tables'>\n";
|
||||||
while ($row = $result->fetch_row()) {
|
foreach ($tables as $table) {
|
||||||
echo '<a href="' . h(ME) . 'select=' . urlencode($row[0]) . '">' . lang('select') . '</a> ';
|
echo '<a href="' . h(ME) . 'select=' . urlencode($table) . '">' . 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 '<a href="' . h(ME) . 'table=' . urlencode($table) . '">' . $this->tableName(array("Name" => $table)) . "</a><br>\n"; //! Adminer::tableName may work with full table status
|
||||||
}
|
|
||||||
}
|
|
||||||
echo '<p><a href="' . h(ME) . 'create=">' . lang('Create new table') . "</a>\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -415,26 +415,26 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
$this->tablesPrint($missing);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function tablesPrint($missing) {
|
|
||||||
if ($missing != "db") {
|
if ($missing != "db") {
|
||||||
$table_status = table_status();
|
$table_status = table_status();
|
||||||
if (!$table_status) {
|
if (!$table_status) {
|
||||||
echo "<p class='message'>" . lang('No tables.') . "\n";
|
echo "<p class='message'>" . lang('No tables.') . "\n";
|
||||||
} else {
|
} else {
|
||||||
|
$this->tablesPrint($table_status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function tablesPrint($tables) {
|
||||||
echo "<p id='tables'>\n";
|
echo "<p id='tables'>\n";
|
||||||
foreach ($table_status as $row) {
|
foreach ($tables as $row) {
|
||||||
$name = $this->tableName($row);
|
$name = $this->tableName($row);
|
||||||
if (isset($row["Engine"]) && strlen($name)) { // ignore views and tables without name
|
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";
|
echo "<a href='" . h(ME) . 'select=' . urlencode($row["Name"]) . "'>$name</a><br>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue