1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-29 01:00:07 +02:00

Don't execute external JavaScript when verifying version

This commit is contained in:
Jakub Vrana
2013-12-19 09:29:16 -08:00
parent 372a0e22a7
commit 61cdde0797
3 changed files with 24 additions and 6 deletions

View File

@@ -30,12 +30,29 @@ function cookie(assign, days) {
}
/** Verify current Adminer version
* @param string
*/
function verifyVersion() {
function verifyVersion(current) {
cookie('adminer_version=0', 1);
var script = document.createElement('script');
script.src = location.protocol + '//www.adminer.org/version.php';
document.body.appendChild(script);
var iframe = document.createElement('iframe');
iframe.src = location.protocol + '//www.adminer.org/version/?current=' + current;
iframe.frameBorder = 0;
iframe.marginHeight = 0;
iframe.scrolling = 'no';
iframe.style.width = '7ex';
iframe.style.height = '1.25em';
if (window.postMessage && window.addEventListener) {
iframe.style.display = 'none';
addEventListener('message', function (event) {
if (event.origin == location.protocol + '//www.adminer.org') {
var match = /version=(.+)/.exec(event.data);
if (match) {
cookie('adminer_version=' + match[1], 1);
}
}
}, false);
}
document.getElementById('version').appendChild(iframe);
}
/** Get value of select