* @return null
*/
function navigation($missing) {
- global $VERSION;
+ global $VERSION, $connection;
?>
<h1>
<a href="http://www.adminer.org/" id="h1"><?php echo $this->name(); ?></a>
</p>
</form>
<?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
- * @param string can be "db" if there is no database selected
+ * @param array
* @return null
*/
- function tablesPrint($missing) {
- 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";
- 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";
+ function tablesPrint($tables) {
+ echo "<p id='tables'>\n";
+ foreach ($tables as $table) {
+ echo '<a href="' . h(ME) . 'select=' . urlencode($table) . '">' . lang('select') . '</a> ';
+ echo '<a href="' . h(ME) . 'table=' . urlencode($table) . '">' . $this->tableName(array("Name" => $table)) . "</a><br>\n"; //! Adminer::tableName may work with full table status
}
}
</p>
</form>
<?php
- $this->tablesPrint($missing);
+ if ($missing != "db") {
+ $table_status = table_status();
+ if (!$table_status) {
+ echo "<p class='message'>" . lang('No tables.') . "\n";
+ } else {
+ $this->tablesPrint($table_status);
+ }
+ }
}
}
- function tablesPrint($missing) {
- if ($missing != "db") {
- $table_status = table_status();
- if (!$table_status) {
- echo "<p class='message'>" . lang('No tables.') . "\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";
- }
- }
+ function tablesPrint($tables) {
+ echo "<p id='tables'>\n";
+ foreach ($tables 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";
}
}
}