Include JUSH in the compiled version
This commit is contained in:
parent
f41ffd9ee1
commit
2c8d81c1ae
|
@ -12,10 +12,10 @@ if ($_GET["file"] == "favicon.ico") {
|
|||
echo lzw_decompress(compile_file('../adminer/static/favicon.ico', 'lzw_compress'));
|
||||
} elseif ($_GET["file"] == "default.css") {
|
||||
header("Content-Type: text/css; charset=utf-8");
|
||||
echo lzw_decompress(compile_file('../adminer/static/default.css', 'minify_css'));
|
||||
echo lzw_decompress(compile_file('../adminer/static/default.css;../externals/jush/jush.css', 'minify_css'));
|
||||
} elseif ($_GET["file"] == "functions.js") {
|
||||
header("Content-Type: text/javascript; charset=utf-8");
|
||||
echo lzw_decompress(compile_file('../adminer/static/functions.js;static/editing.js', 'minify_js'));
|
||||
echo lzw_decompress(compile_file('../adminer/static/functions.js;static/editing.js;../externals/jush/modules/jush.js;../externals/jush/modules/jush-sql.js;../externals/jush/modules/jush-pgsql.js;../externals/jush/modules/jush-sqlite.js;../externals/jush/modules/jush-mssql.js;../externals/jush/modules/jush-oracle.js;../externals/jush/modules/jush-simpledb.js', 'minify_js'));
|
||||
} else {
|
||||
header("Content-Type: image/gif");
|
||||
switch ($_GET["file"]) {
|
||||
|
|
|
@ -19,8 +19,11 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
|||
<meta name="robots" content="noindex">
|
||||
<title><?php echo $title_page; ?></title>
|
||||
<link rel="stylesheet" type="text/css" href="../adminer/static/default.css">
|
||||
<link rel="stylesheet" type="text/css" href="../externals/jush/jush.css">
|
||||
<script type="text/javascript" src="../adminer/static/functions.js"></script>
|
||||
<script type="text/javascript" src="static/editing.js"></script>
|
||||
<script type="text/javascript" src="../externals/jush/modules/jush.js"></script>
|
||||
<script type="text/javascript" src="../externals/jush/modules/jush-<?php echo $jush; ?>.js"></script>
|
||||
<?php if ($adminer->head()) { ?>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico">
|
||||
<link rel="apple-touch-icon" href="../adminer/static/favicon.ico">
|
||||
|
|
|
@ -1,56 +1,35 @@
|
|||
// Adminer specific functions
|
||||
|
||||
var jushRoot = '../externals/jush/'; // global variable to allow simple customization
|
||||
|
||||
/** Load syntax highlighting
|
||||
* @param string first three characters of database system version
|
||||
*/
|
||||
function bodyLoad(version) {
|
||||
if (jushRoot) {
|
||||
// copy of jush.style to load JS and CSS at once
|
||||
var link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.type = 'text/css';
|
||||
link.href = jushRoot + 'jush.css';
|
||||
document.getElementsByTagName('head')[0].appendChild(link);
|
||||
|
||||
var script = document.createElement('script');
|
||||
script.src = jushRoot + 'jush.js';
|
||||
script.onload = function () {
|
||||
if (window.jush) { // IE runs in case of an error too
|
||||
jush.create_links = ' target="_blank" rel="noreferrer"';
|
||||
for (var key in jush.urls) {
|
||||
var obj = jush.urls;
|
||||
if (typeof obj[key] != 'string') {
|
||||
obj = obj[key];
|
||||
key = 0;
|
||||
}
|
||||
obj[key] = obj[key]
|
||||
.replace(/\/doc\/mysql/, '/doc/refman/' + version) // MySQL
|
||||
.replace(/\/docs\/current/, '/docs/' + version) // PostgreSQL
|
||||
;
|
||||
}
|
||||
if (window.jushLinks) {
|
||||
jush.custom_links = jushLinks;
|
||||
}
|
||||
jush.highlight_tag('code', 0);
|
||||
var tags = document.getElementsByTagName('textarea');
|
||||
for (var i = 0; i < tags.length; i++) {
|
||||
if (/(^|\s)jush-/.test(tags[i].className)) {
|
||||
var pre = jush.textarea(tags[i]);
|
||||
if (pre) {
|
||||
setupSubmitHighlightInput(pre);
|
||||
}
|
||||
}
|
||||
if (window.jush) {
|
||||
jush.create_links = ' target="_blank" rel="noreferrer"';
|
||||
for (var key in jush.urls) {
|
||||
var obj = jush.urls;
|
||||
if (typeof obj[key] != 'string') {
|
||||
obj = obj[key];
|
||||
key = 0;
|
||||
}
|
||||
obj[key] = obj[key]
|
||||
.replace(/\/doc\/mysql/, '/doc/refman/' + version) // MySQL
|
||||
.replace(/\/docs\/current/, '/docs/' + version) // PostgreSQL
|
||||
;
|
||||
}
|
||||
if (window.jushLinks) {
|
||||
jush.custom_links = jushLinks;
|
||||
}
|
||||
jush.highlight_tag('code', 0);
|
||||
var tags = document.getElementsByTagName('textarea');
|
||||
for (var i = 0; i < tags.length; i++) {
|
||||
if (/(^|\s)jush-/.test(tags[i].className)) {
|
||||
var pre = jush.textarea(tags[i]);
|
||||
if (pre) {
|
||||
setupSubmitHighlightInput(pre);
|
||||
}
|
||||
}
|
||||
};
|
||||
script.onreadystatechange = function () {
|
||||
if (/^(loaded|complete)$/.test(script.readyState)) {
|
||||
script.onload();
|
||||
}
|
||||
};
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ Don't append newlines to uploaded files, bug since Adminer 3.7.0
|
|||
Don't display SQL edit form on Ctrl+click on the select query, introduced in Adminer 3.6.4
|
||||
Use MD5 for editing long keys only in supported drivers, bug since Adminer 3.6.4
|
||||
Don't execute external JavaScript when verifying version
|
||||
Include JUSH in the compiled version
|
||||
Protect CSRF token against BREACH
|
||||
SQLite: Allow editing primary key
|
||||
SQLite: Allow editing foreign keys
|
||||
|
|
13
compile.php
13
compile.php
|
@ -278,7 +278,6 @@ function minify_css($file) {
|
|||
}
|
||||
|
||||
function minify_js($file) {
|
||||
$file = str_replace("'../externals/jush/'", "location.protocol + '//www.adminer.org/static/jush/2.0.0/'", $file);
|
||||
if (function_exists('jsShrink')) {
|
||||
$file = jsShrink($file);
|
||||
}
|
||||
|
@ -363,7 +362,7 @@ if ($driver) {
|
|||
$file = preg_replace_callback('~\\b(include|require) "([^"]*)";~', 'put_file', $file);
|
||||
$file = str_replace('include "../adminer/include/coverage.inc.php";', '', $file);
|
||||
if ($driver) {
|
||||
$file = preg_replace('(include "../adminer/drivers/(?!' . preg_quote($driver) . ').*\\s*)', '', $file);
|
||||
$file = preg_replace('(include "../adminer/drivers/(?!' . preg_quote($driver) . '\.).*\\s*)', '', $file);
|
||||
}
|
||||
$file = preg_replace_callback('~\\b(include|require) "([^"]*)";~', 'put_file', $file); // bootstrap.inc.php
|
||||
if ($driver) {
|
||||
|
@ -375,6 +374,11 @@ if ($driver) {
|
|||
if (count($drivers) == 1) {
|
||||
$file = str_replace('<?php echo html_select("driver", $drivers, DRIVER); ?>', "<input type='hidden' name='driver' value='" . ($driver == "mysql" ? "server" : $driver) . "'>" . reset($drivers), $file);
|
||||
}
|
||||
$file = preg_replace('(;../externals/jush/modules/jush-(?!' . preg_quote($driver == "mysql" ? "sql" : $driver) . '\.)[^.]+.js)', '', $file);
|
||||
}
|
||||
if ($project == "editor") {
|
||||
$file = preg_replace('~;../externals/jush/jush.css~', '', $file);
|
||||
$file = preg_replace('~;../externals/jush/modules/jush[^.]*.js~', '', $file);
|
||||
}
|
||||
$file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file);
|
||||
$file = preg_replace_callback('~\\b(include|require) "([^"]*\\$LANG.inc.php)";~', 'put_file_lang', $file);
|
||||
|
@ -386,8 +390,11 @@ if ($_SESSION["lang"]) {
|
|||
$file = str_replace('<?php echo $LANG; ?>', $_SESSION["lang"], $file);
|
||||
}
|
||||
$file = str_replace('<script type="text/javascript" src="static/editing.js"></script>' . "\n", "", $file);
|
||||
$file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush.js"></script>' . "\n", "", $file);
|
||||
$file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush-<?php echo $jush; ?>.js"></script>' . "\n", "", $file);
|
||||
$file = str_replace('<link rel="stylesheet" type="text/css" href="../externals/jush/jush.css">' . "\n", "", $file);
|
||||
$file = preg_replace_callback("~compile_file\\('([^']+)'(?:, '([^']*)')?\\)~", 'compile_file', $file); // integrate static files
|
||||
$replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&version=' . $VERSION;
|
||||
$replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&version=' . $VERSION . ($driver ? '&driver=' . $driver : '');
|
||||
$file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
|
||||
$file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);
|
||||
$file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file);
|
||||
|
|
2
externals/JsShrink
vendored
2
externals/JsShrink
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 2298c30f3f1fc35596b18044b5bff2fa4fb513fd
|
||||
Subproject commit 17cbfacae67dede6d94d94ce92214c8ca31d858e
|
2
externals/jush
vendored
2
externals/jush
vendored
|
@ -1 +1 @@
|
|||
Subproject commit a68f53b5f66a3bb4dd512f7f4b79a99ecc8fba9a
|
||||
Subproject commit 6185c4979c7644b69acd9968ab5ea2d67ee7760b
|
Loading…
Reference in a new issue