From 7f3b4f2b8a6f071891a0a099dd6536e3ccd8c7e7 Mon Sep 17 00:00:00 2001
From: jakubvrana
Date: Fri, 29 May 2009 14:53:42 +0000
Subject: [PATCH] Version checker Always load the default style
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@617 7c3ca157-0c34-0410-bff1-cbf682f78f5c
---
_compile.php | 11 +++++++----
changes.txt | 3 ++-
connect.inc.php | 13 +++++++++++++
design.inc.php | 9 ++++++---
index.php | 1 +
lang/cs.inc.php | 2 ++
todo.txt | 3 ++-
version.inc.php | 2 ++
8 files changed, 35 insertions(+), 9 deletions(-)
create mode 100644 version.inc.php
diff --git a/_compile.php b/_compile.php
index 08ac0396..a408abdf 100644
--- a/_compile.php
+++ b/_compile.php
@@ -1,4 +1,6 @@
', $file);
-$file = preg_replace('~default\\.css|arrow\\.gif~', '" . preg_replace("~\\\\\\\\?.*~", "", $_SERVER["REQUEST_URI"]) . "?file=\\0', $file);
+$replace = 'preg_replace("~\\\\\\\\?.*~", "", $_SERVER["REQUEST_URI"]) . "?file=\\0&version=' . $VERSION;
+$file = preg_replace('~default\\.css|favicon\\.ico|(up|down|plus|minus)\\.gif~', '', $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")) . '' . preg_replace('~\\s*([:;{},])\\s*~', '\\1', file_get_contents("default.css")) . 'select_db($_GET["db"]) : isset($_GET["sql"]) |
echo '' . lang('Privileges') . "
\n";
echo '' . lang('Process list') . "
\n";
echo "" . lang('MySQL version: %s through PHP extension %s', "server_info < 4.1 ? " class='binary'" : "") . ">$dbh->server_info", "$dbh->extension") . "
\n";
+ echo "" . lang('phpMinAdmin version: %s', "$VERSION") . ", " . lang('current version') . "" . (version_compare($VERSION, $_COOKIE["phpMinAdmin_version"]) < 0 ? ": " . htmlspecialchars($_COOKIE["phpMinAdmin_version"]) . "" : "") . "
\n";
+ if (!isset($_COOKIE["phpMinAdmin_version"])) {
+ ?>
+
+" . lang('Logged as: %s', "" . htmlspecialchars($dbh->result($dbh->query("SELECT USER()"))) . "") . "
\n";
}
page_footer("db");
diff --git a/design.inc.php b/design.inc.php
index 3ece5026..0f6454b5 100644
--- a/design.inc.php
+++ b/design.inc.php
@@ -1,6 +1,6 @@
@@ -9,9 +9,12 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
-
+
-" />
+
+
+
+
diff --git a/index.php b/index.php
index 16deeb83..76f2795f 100644
--- a/index.php
+++ b/index.php
@@ -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";
diff --git a/lang/cs.inc.php b/lang/cs.inc.php
index 81615166..1016c064 100644
--- a/lang/cs.inc.php
+++ b/lang/cs.inc.php
@@ -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',
);
diff --git a/todo.txt b/todo.txt
index 5adde629..86ede040 100644
--- a/todo.txt
+++ b/todo.txt
@@ -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
diff --git a/version.inc.php b/version.inc.php
new file mode 100644
index 00000000..5d1cd816
--- /dev/null
+++ b/version.inc.php
@@ -0,0 +1,2 @@
+