Diff of /adminer/include/design.inc.php [2df25b] .. [3f5b68]  Maximize  Restore

  Switch to side-by-side view

--- a/adminer/include/design.inc.php
+++ b/adminer/include/design.inc.php
@@ -1,8 +1,15 @@
 <?php
+/** Print HTML header
+* @param string used in title, breadcrumb and heading
+* @param string
+* @param mixed array("key" => "link=desc", "key2" => array("link", "desc")), null for nothing, false for driver only, true for driver and server
+* @param string used after colon in title and heading
+* @return null
+*/
 function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
-	global $LANG, $VERSION, $adminer, $connection;
+	global $LANG, $VERSION, $adminer, $connection, $drivers;
 	header("Content-Type: text/html; charset=utf-8");
-	header("X-Frame-Options: deny"); // ClickJacking protection in IE8, Safari 4, Chrome 2, NoScript plugin
+	header("X-Frame-Options: deny"); // ClickJacking protection in IE8, Safari 4, Chrome 2, Firefox NoScript plugin
 	$title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
 	?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
@@ -10,34 +17,41 @@
 <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 $title_all . ($_GET["server"] != "" && $_GET["server"] != "localhost" ? h(" - $_GET[server]") : "") . " - " . $adminer->name(); ?></title>
+<title><?php echo $title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name(); ?></title>
 <link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico">
 <link rel="stylesheet" type="text/css" href="../adminer/static/default.css<?php // Ondrej Valka, http://valka.info ?>">
 <?php if (file_exists("adminer.css")) { ?>
 <link rel="stylesheet" type="text/css" href="adminer.css">
 <?php } ?>
 
-<body onload="bodyLoad('<?php echo substr($connection->server_info, 0, 3); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>">
+<body onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>">
 <script type="text/javascript" src="../adminer/static/functions.js"></script>
 <script type="text/javascript" src="static/editing.js"></script>
 
 <div id="content">
 <?php
 	if (isset($breadcrumb)) {
+		$link = substr(preg_replace('~(username|db)=[^&]*&~', '', ME), 0, -1);
+		echo '<p id="breadcrumb"><a href="' . ($link ? h($link) : ".") . '">' . $drivers[DRIVER] . '</a> &raquo; ';
 		$link = substr(preg_replace('~db=[^&]*&~', '', ME), 0, -1);
-		echo '<p id="breadcrumb"><a href="' . ($link != "" ? h($link) : ".") . '">' . (isset($_GET["server"]) ? h($_GET["server"]) : lang('Server')) . '</a> &raquo; ';
-		if (is_array($breadcrumb)) {
-			if (DB != "") {
-				echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h(DB) . '</a> &raquo; ';
-			}
-			foreach ($breadcrumb as $key => $val) {
-				$desc = (is_array($val) ? $val[1] : $val);
-				if ($desc != "") {
-					echo '<a href="' . h(ME . "$key=") . urlencode(is_array($val) ? $val[0] : $val) . '">' . h($desc) . '</a> &raquo; ';
+		$server = (SERVER != "" ? h(SERVER) : lang('Server'));
+		if ($breadcrumb === false) {
+			echo "$server\n";
+		} else {
+			echo "<a href='" . ($link ? h($link) : ".") . "'>$server</a> &raquo; ";
+			if (is_array($breadcrumb)) {
+				if (DB != "") {
+					echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h(DB) . '</a> &raquo; ';
+				}
+				foreach ($breadcrumb as $key => $val) {
+					$desc = (is_array($val) ? $val[1] : $val);
+					if ($desc != "") {
+						echo '<a href="' . h(ME . "$key=") . urlencode(is_array($val) ? $val[0] : $val) . '">' . h($desc) . '</a> &raquo; ';
+					}
 				}
 			}
+			echo "$title\n";
 		}
-		echo "$title\n";
 	}
 	echo "<h2>$title_all</h2>\n";
 	restart_session();
@@ -45,10 +59,7 @@
 		echo "<div class='message'>" . implode("</div>\n<div class='message'>", $_SESSION["messages"]) . "</div>\n";
 		$_SESSION["messages"] = array();
 	}
-	if (!$_POST && !isset($_SESSION["passwords"])) { // used in auth
-		$_SESSION["passwords"] = array();
-	}
-	$databases = &$_SESSION["databases"][$_GET["server"]];
+	$databases = &get_session("databases");
 	if (DB != "" && $databases && !in_array(DB, $databases, true)) {
 		$databases = null;
 	}
@@ -57,7 +68,11 @@
 	}
 }
 
-function page_footer($missing = false) {
+/** Print HTML footer
+* @param string auth|db
+* @return null
+*/
+function page_footer($missing = "") {
 	global $adminer;
 	?>
 </div>
@@ -67,4 +82,8 @@
 <?php $adminer->navigation($missing); ?>
 </div>
 <?php
+	// don't wait for code after footer
+	session_write_close();
+	ob_flush();
+	flush();
 }

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks