From b3fc4c0ea298c7c2e025326184f868826a53a5c7 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Wed, 29 Jul 2009 15:01:47 +0000 Subject: [PATCH] Download externals from HTTPS git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@940 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- adminer/editing.js | 15 ++++----------- adminer/functions.js | 28 +++++++++++++++++++++++++--- changes.txt | 1 + compile.php | 2 +- released.js | 1 + todo.txt | 1 - 6 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 released.js diff --git a/adminer/editing.js b/adminer/editing.js index 589ecf8f..6da99a99 100644 --- a/adminer/editing.js +++ b/adminer/editing.js @@ -1,19 +1,12 @@ // Adminer specific functions function body_load() { - var script = document.createElement('script'); - script.src = '../externals/jush/jush.js'; - script.onload = function () { - jush.style('../externals/jush/jush.css'); + var jush_root = '../externals/jush/'; + load_script(jush_root + 'jush.js', function () { + jush.style(jush_root + 'jush.css'); jush.highlight_tag('pre'); jush.highlight_tag('code'); - } - script.onreadystatechange = function () { - if (script.readyState == 'loaded' || script.readyState == 'complete') { - script.onload(); - } - } - document.body.appendChild(script); + }); } diff --git a/adminer/functions.js b/adminer/functions.js index 9c2e62f0..fa80a9ef 100644 --- a/adminer/functions.js +++ b/adminer/functions.js @@ -6,11 +6,33 @@ function toggle(id) { return true; } +function load_script(src, onload) { + var script = document.createElement('script'); + script.src = src; + script.onload = onload; + script.onreadystatechange = function () { + if (script.readyState == 'loaded' || script.readyState == 'complete') { + onload(); + } + } + document.body.appendChild(script); +} + function verify_version(version) { document.cookie = 'adminer_version=0'; - var script = document.createElement('script'); - script.src = 'http://www.adminer.org/version.php?version=' + version; - document.body.appendChild(script); + load_script('https://adminer.svn.sourceforge.net/svnroot/adminer/released.js', function () { + document.cookie = 'adminer_version=' + released; + var re = /^([0-9]+)\.([0-9]+)\.([0-9]+)(.*)/; + var v1 = re.exec(version); + var v2 = re.exec(released); + if (v1 && v2 && (+v1[1] < +v2[1] + || (v1[1] == v2[1] && (+v1[2] < +v2[2] + || (v1[2] == v2[2] && (+v1[3] < +v2[3] + || (v1[3] == v2[3] && v1[4] + ))))))) { + document.getElementById('version').innerHTML = released; + } + }); } function form_check(el, name) { diff --git a/changes.txt b/changes.txt index d64680a3..a77d993e 100644 --- a/changes.txt +++ b/changes.txt @@ -15,6 +15,7 @@ Clear history (thanks to paranoiq) Remove Delete button from Edit page - use mass operation for it Faster multiple update, clone and delete Faster table list in navigation +Download version checker and syntax highlighting from HTTPS Use HTML Strict instead of XHTML Remove function minification for performance and customization Fix grant ALL PRIVILEGES with GRANT OPTION diff --git a/compile.php b/compile.php index 8c3f4628..7a370412 100644 --- a/compile.php +++ b/compile.php @@ -180,7 +180,7 @@ $file = preg_replace_callback("~compile_file\\('([^']+)', '([^']+)'\\);~", 'comp $replace = 'h(preg_replace("~\\\\\\\\?.*~", "", $_SERVER["REQUEST_URI"])) . "?file=\\1&version=' . $VERSION; $file = preg_replace('~\\.\\./adminer/(default\\.css|functions\\.js|favicon\\.ico)~', '', $file); $file = preg_replace('~\\.\\./adminer/((plus|cross|up|down|arrow)\\.gif)~', '" . ' . $replace, $file); -$file = str_replace("../externals/jush/", "http://jush.sourceforge.net/", $file); +$file = str_replace("../externals/jush/", "https://jush.svn.sourceforge.net/svnroot/jush/trunk/", $file); // mixed-content warning if Adminer runs on HTTPS and external files on HTTP $file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file); $file = php_shrink($file); diff --git a/released.js b/released.js new file mode 100644 index 00000000..ed09e0d3 --- /dev/null +++ b/released.js @@ -0,0 +1 @@ +var released = '1.11.1'; diff --git a/todo.txt b/todo.txt index 47d24660..3f4e1257 100644 --- a/todo.txt +++ b/todo.txt @@ -13,7 +13,6 @@ Edit default values directly in table creation Offer enum and set items in search - whisperer Use event $intervals + microseconds in relative date functions Table status cache - SHOW TABLE STATUS is slow with big InnoDB tables -Download external files (version checker and JUSH) from trusted HTTPS if Adminer runs in HTTPS (mixed-content warning) ? Ability to select external style - list downloaded by JavaScript ? Column and table names auto-completition in SQL textarea ? Save uploaded files after error to session variable instead of hidden field