<?php } ?>
<body class="<?php echo lang('ltr'); ?> nojs">
+<?php
+ $filename = get_temp_dir() . "/adminer.version";
+ if (!$_COOKIE["adminer_version"] && file_exists($filename) && filemtime($filename) + 86400 > time()) { // 86400 - 1 day in seconds
+ $_COOKIE["adminer_version"] = file_get_contents($filename); // doesn't need to send to the browser
+ }
+ ?>
<script<?php echo nonce(); ?>>
-mixin(document.body, {onkeydown: bodyKeydown, onclick: bodyClick<?php echo (isset($_COOKIE["adminer_version"]) ? "" : ", onload: partial(verifyVersion, '$VERSION')"); ?>});
+mixin(document.body, {onkeydown: bodyKeydown, onclick: bodyClick<?php
+ echo (isset($_COOKIE["adminer_version"]) ? "" : ", onload: partial(verifyVersion, '$VERSION', '" . js_escape(ME) . "', '" . get_token() . "')"); // $token may be empty in auth.inc.php
+ ?>});
document.body.className = document.body.className.replace(/ nojs/, ' js');
var offlineMessage = '<?php echo js_escape(lang('You are offline.')); ?>';
</script>
} elseif ($_GET["script"] == "kill") {
$connection->query("KILL " . number($_POST["kill"]));
+} elseif ($_GET["script"] == "version") {
+ $fp = file_open_lock(get_temp_dir() . "/adminer.version");
+ if ($fp) {
+ file_write_unlock($fp, $_POST["version"]);
+ }
+
} else { // connect
foreach (count_tables($adminer->databases()) as $db => $val) {
json_row("tables-$db", $val);
/** Verify current Adminer version
* @param string
+* @param string own URL base
+* @param string
*/
-function verifyVersion(current) {
+function verifyVersion(current, url, token) {
cookie('adminer_version=0', 1);
var iframe = document.createElement('iframe');
iframe.src = 'https://www.adminer.org/version/?current=' + current;
var match = /version=(.+)/.exec(event.data);
if (match) {
cookie('adminer_version=' + match[1], 1);
+ ajax(url + 'script=version', function () {
+ }, 'version=' + match[1] + '&token=' + token);
}
}
}, false);
Display newlines in column comments (bug #573)
Support current_timestamp() as default of time fields (bug #572)
Hide window.opener from pages opened in a new window (bug #561)
+Store current Adminer version server-side to avoid excessive requests
Adminer: Fix Search data in tables (regression from 4.4.0)
CSP: Allow any styles, images, media and fonts, disallow base-uri
MySQL: Support geometry in MySQL 8 (bug #574)