Homepage customization

This commit is contained in:
Jakub Vrana 2011-01-06 09:30:07 +01:00
parent d7a3e415d5
commit 7416164966
5 changed files with 144 additions and 127 deletions

View file

@ -32,10 +32,8 @@ if ($tables_views && !$error && !$_POST["search"]) {
}
page_header(($_GET["ns"] == "" ? lang('Database') . ": " . h(DB) : lang('Schema') . ": " . h($_GET["ns"])), $error, true);
echo '<p>' . ($_GET["ns"] == "" ? '<a href="' . h(ME) . 'database=">' . lang('Alter database') . "</a>\n" : "");
if (support("scheme")) {
echo "<a href='" . h(ME) . "scheme='>" . ($_GET["ns"] != "" ? lang('Alter schema') : lang('Create schema')) . "</a>\n";
}
if ($adminer->homepage()) {
if ($_GET["ns"] !== "") {
echo '<a href="' . h(ME) . 'schema=">' . lang('Database schema') . "</a>\n";
echo "<h3>" . lang('Tables and views') . "</h3>\n";
@ -158,3 +156,4 @@ if ($_GET["ns"] !== "") {
echo "<script type='text/javascript'>ajaxSetHtml('" . js_escape(ME) . "script=db');</script>\n";
}
}
}

View file

@ -682,6 +682,17 @@ DROP PROCEDURE adminer_alter;
return $ext;
}
/** Print homepage
* @return bool whether to print default homepage
*/
function homepage() {
echo '<p>' . ($_GET["ns"] == "" ? '<a href="' . h(ME) . 'database=">' . lang('Alter database') . "</a>\n" : "");
if (support("scheme")) {
echo "<a href='" . h(ME) . "scheme='>" . ($_GET["ns"] != "" ? lang('Alter schema') : lang('Create schema')) . "</a>\n";
}
return true;
}
/** Prints navigation after Adminer title
* @param string can be "auth" if there is no database connection, "db" if there is no database selected, "ns" with invalid schema
* @return null

View file

@ -7,6 +7,7 @@ History: edit all
MS SQL: auto primary and foreign key
SQLite: display 0
Create table default data type: int
Homepage customization
Work without session.use_cookies (bug #3138640)
Portuguese translation

View file

@ -1,6 +1,7 @@
<?php
page_header(lang('Server'), "", false);
if ($adminer->homepage()) {
echo "<form action='' method='post'>\n";
echo "<p>" . lang('Search data in tables') . ": <input name='query' value='" . h($_POST["query"]) . "'> <input type='submit' value='" . lang('Search') . "'>\n";
if ($_POST["query"] != "") {
@ -19,3 +20,4 @@ foreach (table_status() as $table => $row) {
}
echo "</table>\n";
echo "</form>\n";
}

View file

@ -465,6 +465,10 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
return $ext;
}
function homepage() {
return true;
}
function navigation($missing) {
global $VERSION, $token;
?>