1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-13 01:54:00 +02:00

Breadcrumbs

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@262 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2007-07-26 10:45:49 +00:00
parent 7138eb2842
commit b4df61d5b3
13 changed files with 33 additions and 18 deletions

View File

@@ -189,7 +189,7 @@ if (extension_loaded("mysqli")) {
$mysql = new Min_PDO_MySQL;
} else {
page_header(lang('No MySQL extension'));
page_header(lang('No MySQL extension'), null);
echo "<p class='error'>" . lang('None of supported PHP extensions (%s) are available.', 'mysqli, mysql, pdo') . "</p>\n";
page_footer("auth");
exit;

View File

@@ -37,7 +37,7 @@ function auth_error() {
$_POST["token"] = token();
}
unset($_SESSION["usernames"][$_GET["server"]]);
page_header(lang('Login'));
page_header(lang('Login'), null);
if (isset($username)) {
echo "<p class='error'>" . lang('Invalid credentials.') . "</p>\n";
} elseif (isset($_POST["server"])) {

View File

@@ -3,7 +3,7 @@ if (!(strlen($_GET["db"]) ? $mysql->select_db($_GET["db"]) : isset($_GET["sql"])
if (strlen($_GET["db"])) {
unset($_SESSION["databases"][$_GET["server"]]);
}
page_header(lang('Select database'));
page_header(lang('Select database'), (strlen($_GET["db"]) ? false : null));
if (strlen($_GET["db"])) {
echo "<p class='error'>" . lang('Invalid database.') . "</p>\n";
} else {

View File

@@ -54,7 +54,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
}
$error = $mysql->error;
}
page_header(strlen($_GET["create"]) ? lang('Alter table') . ': ' . htmlspecialchars($_GET["create"]) : lang('Create table'));
page_header(strlen($_GET["create"]) ? lang('Alter table') : lang('Create table'), array("table" => $_GET["create"]), $_GET["create"]);
$engines = array();
$result = $mysql->query("SHOW ENGINES");

View File

@@ -9,7 +9,7 @@ if ($_POST && !$error) {
$error = $mysql->error;
}
page_header(strlen($_GET["createv"]) ? lang('Alter view') . ": " . htmlspecialchars($_GET["createv"]) : lang('Create view'));
page_header(strlen($_GET["createv"]) ? lang('Alter view') : lang('Create view'), array("view" => $_GET["createv"]), $_GET["createv"]);
if ($_POST) {
$row = $_POST;

View File

@@ -29,7 +29,7 @@ if ($_POST && !$error) {
$error = $mysql->error;
}
page_header(strlen($_GET["db"]) ? lang('Alter database') . ": " . htmlspecialchars($_GET["db"]) : lang('Create database'));
page_header(strlen($_GET["db"]) ? lang('Alter database') : lang('Create database'), array(), $_GET["db"]);
$collations = collations();
if ($_POST) {

View File

@@ -1,6 +1,6 @@
<?php
function page_header($title) {
global $LANG;
function page_header($title, $breadcrumb = array(), $title2 = "") {
global $SELF, $LANG;
header("Content-Type: text/html; charset=utf-8");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -9,7 +9,7 @@ function page_header($title) {
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta name="robots" content="noindex" />
<title><?php echo lang('phpMinAdmin') . " - $title"; ?></title>
<title><?php echo lang('phpMinAdmin') . " - $title" . (strlen($title2) ? ": " . htmlspecialchars($title2) : ""); ?></title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="default.css" />
<?php if ($_COOKIE["highlight"] == "jush") { ?>
@@ -23,7 +23,22 @@ function page_header($title) {
<div id="content">
<?php
echo "<h2>$title</h2>\n";
if (isset($breadcrumb)) {
$link = substr(preg_replace('~db=[^&]*&~', '', $SELF), 0, -1);
echo '<p><a href="' . (strlen($link) ? htmlspecialchars($link) : ".") . '">' . (isset($_GET["server"]) ? htmlspecialchars($_GET["server"]) : lang('Server')) . '</a> &gt; ';
if (is_array($breadcrumb)) {
if (strlen($_GET["db"])) {
echo '<a href="' . substr($SELF, 0, -1) . '">' . htmlspecialchars($_GET["db"]) . '</a> &gt; ';
}
foreach ($breadcrumb as $key => $val) {
if (strlen($val)) {
echo '<a href="' . htmlspecialchars($SELF) . "$key=" . urlencode($val) . '">' . htmlspecialchars($val) . '</a> &gt; ';
}
}
}
echo "$title</p>\n";
}
echo "<h2>$title" . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . "</h2>\n";
if ($_SESSION["message"]) {
echo "<p class='message'>$_SESSION[message]</p>\n";
$_SESSION["message"] = "";
@@ -39,7 +54,7 @@ function page_footer($missing = false) {
</div>
<div id="menu">
<h1><a href="<?php echo ($missing == "auth" ? "http://phpminadmin.sourceforge.net" : (strlen($SELF) > 1 ? htmlspecialchars(substr($SELF, 0, -1)) : ".")); ?>"><?php echo lang('phpMinAdmin'); ?></a></h1>
<h1><a href="http://phpminadmin.sourceforge.net"><?php echo lang('phpMinAdmin'); ?></a></h1>
<?php switch_lang(); ?>
<?php if ($missing != "auth") { ?>
<p>

View File

@@ -41,7 +41,7 @@ if ($_POST && !$error) {
}
$error = $mysql->error;
}
page_header((isset($_GET["default"]) ? lang('Default values') : ($_GET["where"] ? lang('Edit') : lang('Insert'))) . ": " . htmlspecialchars($_GET["edit"]));
page_header((isset($_GET["default"]) ? lang('Default values') : ($_GET["where"] ? lang('Edit') : lang('Insert'))) . ": " . htmlspecialchars($_GET["edit"]), array((isset($_GET["default"]) ? "table" : "select") => $_GET["edit"]));
if ($_POST) {
echo "<p class='error'>" . lang('Error during saving') . ": " . htmlspecialchars($error) . "</p>\n";

View File

@@ -25,7 +25,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["change"] && !$_POST["change-
$error = $mysql->error;
}
page_header(lang('Foreign key') . ": " . htmlspecialchars($_GET["foreign"]));
page_header(lang('Foreign key'), array("table" => $_GET["foreign"]), $_GET["foreign"]);
$tables = array();
$result = $mysql->query("SHOW TABLE STATUS");

View File

@@ -79,11 +79,11 @@ if (isset($_GET["dump"])) {
include "./processlist.inc.php";
} else {
$TOKENS = array();
page_header(htmlspecialchars(lang('Database') . ": " . $_GET["db"]));
page_header(lang('Database') . ": " . htmlspecialchars($_GET["db"]), false);
echo '<p><a href="' . htmlspecialchars($SELF) . 'database=">' . lang('Alter database') . "</a></p>\n";
echo '<p><a href="' . htmlspecialchars($SELF) . 'schema=">' . lang('Database schema') . "</a></p>\n";
if ($mysql->server_info >= 5) {
echo '<p><a href="' . htmlspecialchars($SELF) . 'procedure=">' . lang('Create view') . "</a></p>\n";
echo '<p><a href="' . htmlspecialchars($SELF) . 'createv=">' . lang('Create view') . "</a></p>\n";
echo "<h3>" . lang('Routines') . "</h3>\n";
$result = $mysql->query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '" . $mysql->escape_string($_GET["db"]) . "'");
if ($result->num_rows) {

View File

@@ -38,7 +38,7 @@ if ($_POST && !$error && !$_POST["add"]) {
}
$error = $mysql->error;
}
page_header(lang('Indexes') . ': ' . htmlspecialchars($_GET["indexes"]));
page_header(lang('Indexes'), array("table" => $_GET["indexes"]), $_GET["indexes"]);
$fields = array_keys(fields($_GET["indexes"]));
if ($_POST) {

View File

@@ -1,5 +1,5 @@
<?php
page_header(lang('Database schema') . ": " . htmlspecialchars($_GET["db"]));
page_header(lang('Database schema'), array(), $_GET["db"]);
$schema = array();
$result = $mysql->query("SHOW TABLE STATUS");

View File

@@ -16,7 +16,7 @@ if ($_POST && !$error) {
$error = $mysql->error;
}
page_header(strlen($_GET["name"]) ? lang('Alter trigger') . ": " . htmlspecialchars($_GET["name"]) : lang('Create trigger'));
page_header(strlen($_GET["name"]) ? lang('Alter trigger') . ": " . htmlspecialchars($_GET["name"]) : lang('Create trigger'), array("table" => $_GET["trigger"]));
if ($_POST) {
$row = $_POST;