Skip to content

Commit

Permalink
Join editing.js in compilation
Browse files Browse the repository at this point in the history
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@815 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information
jakubvrana committed Jul 13, 2009
1 parent 5acd5a2 commit df03f4f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
19 changes: 8 additions & 11 deletions adminer/include/bootstrap.inc.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,24 +17,21 @@
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 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") { if ($_GET["file"] == "favicon.ico") {
header("Content-Type: image/x-icon"); header("Content-Type: image/x-icon");
echo base64_decode("compile_file('favicon.ico', 'base64_encode')"); echo base64_decode("compile_file('../adminer/favicon.ico', 'base64_encode');");
} elseif ($_GET["file"] == "default.css") { } elseif ($_GET["file"] == "default.css") {
header("Content-Type: text/css"); header("Content-Type: text/css");
?>compile_file('default.css', 'minify_css')<?php ?>compile_file('../adminer/default.css', 'minify_css');<?php
} elseif ($_GET["file"] == "functions.js") { } elseif ($_GET["file"] == "functions.js") {
header("Content-Type: text/javascript"); header("Content-Type: text/javascript");
?>compile_file('functions.js', 'JSMin::minify')<?php ?>compile_file('../adminer/functions.js', 'JSMin::minify');compile_file('editing.js', 'JSMin::minify');<?php
} elseif ($_GET["file"] == "editing.js") {
header("Content-Type: text/javascript");
?>compile_file('editing.js', 'JSMin::minify')<?php
} else { } else {
header("Content-Type: image/gif"); header("Content-Type: image/gif");
switch ($_GET["file"]) { switch ($_GET["file"]) {
case "plus.gif": echo base64_decode("compile_file('plus.gif', 'base64_encode')"); break; case "plus.gif": echo base64_decode("compile_file('../adminer/plus.gif', 'base64_encode');"); break;
case "cross.gif": echo base64_decode("compile_file('cross.gif', 'base64_encode')"); break; case "cross.gif": echo base64_decode("compile_file('../adminer/cross.gif', 'base64_encode');"); break;
case "up.gif": echo base64_decode("compile_file('up.gif', 'base64_encode')"); break; case "up.gif": echo base64_decode("compile_file('../adminer/up.gif', 'base64_encode');"); break;
case "down.gif": echo base64_decode("compile_file('down.gif', 'base64_encode')"); break; case "down.gif": echo base64_decode("compile_file('../adminer/down.gif', 'base64_encode');"); break;
case "arrow.gif": echo base64_decode("compile_file('arrow.gif', 'base64_encode')"); break; case "arrow.gif": echo base64_decode("compile_file('../adminer/arrow.gif', 'base64_encode');"); break;
} }
} }
exit; exit;
Expand Down
2 changes: 1 addition & 1 deletion adminer/include/design.inc.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {


<body onload="body_load();<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verify_version('$VERSION');"); ?>"> <body onload="body_load();<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verify_version('$VERSION');"); ?>">
<script type="text/javascript" src="../adminer/functions.js"></script> <script type="text/javascript" src="../adminer/functions.js"></script>
<script type="text/javascript" src="./editing.js<?php // "./" to distinguish from $_GET["file"] ?>"></script> <script type="text/javascript" src="editing.js"></script>


<div id="content"> <div id="content">
<?php <?php
Expand Down
8 changes: 5 additions & 3 deletions compile.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ function minify_css($file) {
} }


function compile_file($match) { function compile_file($match) {
return call_user_func($match[2], file_get_contents(dirname(__FILE__) . "/adminer/$match[1]")); global $project;
return call_user_func($match[2], file_get_contents(dirname(__FILE__) . "/$project/$match[1]"));
} }


error_reporting(4343); // errors and warnings error_reporting(4343); // errors and warnings
Expand Down Expand Up @@ -203,9 +204,10 @@ function compile_file($match) {
$file = str_replace("<?php switch_lang(); ?>\n", "", $file); $file = str_replace("<?php switch_lang(); ?>\n", "", $file);
$file = str_replace('<?php echo $LANG; ?>', $_COOKIE["adminer_lang"], $file); $file = str_replace('<?php echo $LANG; ?>', $_COOKIE["adminer_lang"], $file);
} }
$file = preg_replace_callback("~compile_file\\('([^']+)', '([^']+)'\\)~", 'compile_file', $file); // integrate static files $file = str_replace('<script type="text/javascript" src="editing.js"></script>' . "\n", "", $file);
$file = preg_replace_callback("~compile_file\\('([^']+)', '([^']+)'\\);~", 'compile_file', $file); // integrate static files
$replace = 'htmlspecialchars(preg_replace("~\\\\\\\\?.*~", "", $_SERVER["REQUEST_URI"])) . "?file=\\1&amp;version=' . $VERSION; $replace = 'htmlspecialchars(preg_replace("~\\\\\\\\?.*~", "", $_SERVER["REQUEST_URI"])) . "?file=\\1&amp;version=' . $VERSION;
$file = preg_replace('~(?:\\.\\./adminer/|\\./)(default\\.css|functions\\.js|editing\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file); $file = preg_replace('~(?:\\.\\./adminer/|\\./)(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
$file = preg_replace('~\\.\\./adminer/((plus|cross|up|down|arrow)\\.gif)~', '" . ' . $replace, $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/", "http://jush.sourceforge.net/", $file);
$file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file); $file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file);
Expand Down

0 comments on commit df03f4f

Please sign in to comment.