Version checker

Always load the default style

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@617 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-05-29 14:53:42 +00:00
parent 67284b5799
commit 7f3b4f2b8a
8 changed files with 35 additions and 9 deletions

View file

@ -1,4 +1,6 @@
<?php
include "./version.inc.php";
function add_apo_slashes($s) {
return addcslashes($s, "\\'");
}
@ -167,17 +169,18 @@ if ($_COOKIE["lang"]) {
} else {
$file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file);
}
$file = preg_replace('~favicon\\.ico|(up|down|plus|minus)\\.gif~', '<?php echo preg_replace("~\\\\\\\\?.*~", "", $_SERVER["REQUEST_URI"]) . "?file=\\0"; ?>', $file);
$file = preg_replace('~default\\.css|arrow\\.gif~', '" . preg_replace("~\\\\\\\\?.*~", "", $_SERVER["REQUEST_URI"]) . "?file=\\0', $file);
$replace = 'preg_replace("~\\\\\\\\?.*~", "", $_SERVER["REQUEST_URI"]) . "?file=\\0&amp;version=' . $VERSION;
$file = preg_replace('~default\\.css|favicon\\.ico|(up|down|plus|minus)\\.gif~', '<?php echo ' . $replace . '"; ?>', $file);
$file = preg_replace('~arrow\\.gif~', '" . ' . $replace, $file);
$file = str_replace('error_reporting(E_ALL & ~E_NOTICE);', 'error_reporting(E_ALL & ~E_NOTICE);
if (isset($_GET["file"])) {
header("Expires: " . gmdate("D, d M Y H:i:s", filemtime(__FILE__) + 365*24*60*60) . " GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 365*24*60*60) . " GMT");
if ($_GET["file"] == "favicon.ico") {
header("Content-Type: image/x-icon");
echo base64_decode("' . base64_encode(file_get_contents("favicon.ico")) . '");
} elseif ($_GET["file"] == "default.css") {
header("Content-Type: text/css");
?>' . preg_replace('~\\s*([:;{},])\\s+~', '\\1', file_get_contents("default.css")) . '<?php
?>' . preg_replace('~\\s*([:;{},])\\s*~', '\\1', file_get_contents("default.css")) . '<?php
} else {
header("Content-Type: image/gif");
switch ($_GET["file"]) {

View file

@ -1,6 +1,7 @@
phpMinAdmin 1.10.2:
phpMinAdmin 1.11.0:
Connection through socket by server :/path/to/socket
Display execution time in SQL query
Version checker
phpMinAdmin 1.10.1:
Highlight odd and hover rows

View file

@ -12,6 +12,19 @@ if (!(strlen($_GET["db"]) ? $dbh->select_db($_GET["db"]) : isset($_GET["sql"]) |
echo '<p><a href="' . htmlspecialchars($SELF) . 'privileges=">' . lang('Privileges') . "</a></p>\n";
echo '<p><a href="' . htmlspecialchars($SELF) . 'processlist=">' . lang('Process list') . "</a></p>\n";
echo "<p>" . lang('MySQL version: %s through PHP extension %s', "<b" . ($dbh->server_info < 4.1 ? " class='binary'" : "") . ">$dbh->server_info</b>", "<b>$dbh->extension</b>") . "</p>\n";
echo "<p>" . lang('phpMinAdmin version: %s', "<b>$VERSION</b>") . ", <a href='http://phpminadmin.sourceforge.net/'>" . lang('current version') . "<span id='version'>" . (version_compare($VERSION, $_COOKIE["phpMinAdmin_version"]) < 0 ? ": <b>" . htmlspecialchars($_COOKIE["phpMinAdmin_version"]) . "</b>" : "") . "</span></a></p>\n";
if (!isset($_COOKIE["phpMinAdmin_version"])) {
?>
<script type="text/javascript">
onload = function () {
document.cookie = 'phpMinAdmin_version=0';
var script = document.createElement('script');
script.src = 'http://phpminadmin.sourceforge.net/version.php?version=<?php echo $VERSION; ?>';
document.body.appendChild(script);
};
</script>
<?php
}
echo "<p>" . lang('Logged as: %s', "<b>" . htmlspecialchars($dbh->result($dbh->query("SELECT USER()"))) . "</b>") . "</p>\n";
}
page_footer("db");

View file

@ -1,6 +1,6 @@
<?php
function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
global $SELF, $LANG;
global $SELF, $LANG, $VERSION;
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,9 +9,12 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
<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 . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . " - " . lang('phpMinAdmin') . " 1.10.2-dev"; ?></title>
<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . " - " . lang('phpMinAdmin') . " $VERSION"; ?></title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="<?php echo (file_exists("phpMinAdmin.css") ? "phpMinAdmin.css" : "default.css"); // Ondrej Valka, http://valka.info ?>" />
<link rel="stylesheet" type="text/css" href="default.css<?php // Ondrej Valka, http://valka.info ?>" />
<?php if (file_exists("phpMinAdmin.css")) { ?>
<link rel="stylesheet" type="text/css" href="phpMinAdmin.css" />
<?php } ?>
</head>
<body>

View file

@ -46,6 +46,7 @@ if (get_magic_quotes_gpc()) {
set_magic_quotes_runtime(false);
$SELF = preg_replace('~^[^?]*/([^?]*).*~', '\\1?', $_SERVER["REQUEST_URI"]) . (strlen($_GET["server"]) ? 'server=' . urlencode($_GET["server"]) . '&' : '') . (strlen($_GET["db"]) ? 'db=' . urlencode($_GET["db"]) . '&' : '');
include "./version.inc.php";
include "./functions.inc.php";
include "./lang.inc.php";
include "./lang/$LANG.inc.php";

View file

@ -217,4 +217,6 @@ $translations = array(
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Byl překročen maximální povolený počet polí. Zvyšte prosím %s a %s.',
'(anywhere)' => '(kdekoliv)',
'%.3f s' => '%.3f s',
'phpMinAdmin version: %s' => 'Verze phpMinAdmin: %s',
'current version' => 'aktuální verze',
);

View file

@ -7,7 +7,8 @@ Compress export and import
Create view and routine options
SQL queries history - utilize in edit link in .message and .error
Function to fix database encoding - http://php.vrana.cz/prevod-kodovani-mysql.php
? Execution time in sql.inc.php
Separate JavaScript - load after login form
? Save token also to cookie - for session expiration and login in other window
? Save uploaded files after error to session variable instead of hidden field
? Aliasing of built-in functions can save 7 KB, substitution of $_GET and friends can save 2 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB, JS shrink can save 1 KB
? AJAX editing - select page has all data to display edit form

2
version.inc.php Normal file
View file

@ -0,0 +1,2 @@
<?php
$VERSION = "1.11.0-dev";