Skip to content

Commit

Permalink
Don't encode binary files
Browse files Browse the repository at this point in the history
  • Loading branch information
vrana committed Sep 7, 2012
1 parent 5d25786 commit 85d985a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions adminer/file.inc.php
Expand Up @@ -3,21 +3,21 @@


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('../adminer/static/favicon.ico', 'base64_encode');"); echo 'compile_file("../adminer/static/favicon.ico", "add_apo_slashes");';
} elseif ($_GET["file"] == "default.css") { } elseif ($_GET["file"] == "default.css") {
header("Content-Type: text/css; charset=utf-8"); header("Content-Type: text/css; charset=utf-8");
?>compile_file('../adminer/static/default.css', 'minify_css');<?php ?>compile_file("../adminer/static/default.css", "minify_css");<?php
} elseif ($_GET["file"] == "functions.js") { } elseif ($_GET["file"] == "functions.js") {
header("Content-Type: text/javascript; charset=utf-8"); header("Content-Type: text/javascript; charset=utf-8");
?>compile_file('../adminer/static/functions.js', 'jsShrink');compile_file('static/editing.js', 'jsShrink');<?php ?>compile_file("../adminer/static/functions.js", "jsShrink");compile_file("static/editing.js", "jsShrink");<?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('../adminer/static/plus.gif', 'base64_encode');"); break; case "plus.gif": echo 'compile_file("../adminer/static/plus.gif", "add_apo_slashes");'; break;
case "cross.gif": echo base64_decode("compile_file('../adminer/static/cross.gif', 'base64_encode');"); break; case "cross.gif": echo 'compile_file("../adminer/static/cross.gif", "add_apo_slashes");'; break;
case "up.gif": echo base64_decode("compile_file('../adminer/static/up.gif', 'base64_encode');"); break; case "up.gif": echo 'compile_file("../adminer/static/up.gif", "add_apo_slashes");'; break;
case "down.gif": echo base64_decode("compile_file('../adminer/static/down.gif', 'base64_encode');"); break; case "down.gif": echo 'compile_file("../adminer/static/down.gif", "add_apo_slashes");'; break;
case "arrow.gif": echo base64_decode("compile_file('../adminer/static/arrow.gif', 'base64_encode');"); break; case "arrow.gif": echo 'compile_file("../adminer/static/arrow.gif", "add_apo_slashes");'; break;
} }
} }
exit; exit;
2 changes: 1 addition & 1 deletion compile.php
Expand Up @@ -328,7 +328,7 @@ function compile_file($match) {
$file = str_replace('<?php echo $LANG; ?>', $_SESSION["lang"], $file); $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="static/editing.js"></script>' . "\n", "", $file);
$file = preg_replace_callback("~compile_file\\('([^']+)', '([^']+)'\\);~", 'compile_file', $file); // integrate static files $file = preg_replace_callback('~compile_file\\("([^"]+)", "([^"]+)"\\);~', 'compile_file', $file); // integrate static files
$replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&amp;version=' . $VERSION; $replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&amp;version=' . $VERSION;
$file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file); $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('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);
Expand Down
2 changes: 1 addition & 1 deletion todo.txt
Expand Up @@ -13,7 +13,7 @@ Selectable <option>(on update)<option>CURRENT_TIMESTAMP for timestamp - https://
? Filter by value in row under <thead> in select ? Filter by value in row under <thead> in select
? Column and table names auto-completition in SQL textarea - http://blog.quplo.com/2010/06/css-code-completion-in-your-browser/ ? Column and table names auto-completition in SQL textarea - http://blog.quplo.com/2010/06/css-code-completion-in-your-browser/
? Aliasing of built-in functions can save 7 KB, function minification can save 7 KB, substitution of repetitive $a["a"] can save 4 KB, substitution of $_GET and friends can save 2 KB, aliasing of $connection->query can save 24 B, JS Closure compiler can save 2 KB, not enclosing HTML attribute values can save 1.2 KB, replacing \\n by \n can save .3 KB ? Aliasing of built-in functions can save 7 KB, function minification can save 7 KB, substitution of repetitive $a["a"] can save 4 KB, substitution of $_GET and friends can save 2 KB, aliasing of $connection->query can save 24 B, JS Closure compiler can save 2 KB, not enclosing HTML attribute values can save 1.2 KB, replacing \\n by \n can save .3 KB
? Branch binary_compile: LZW compression of translations can save 30 KB, LZW compression of all texts can save 11 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB ? Branch binary_compile: LZW compression of all texts can save 11 KB, using chars 127-255 in minification can save 1 KB


Editor: Editor:
Three-state checkbox for boolean searches Three-state checkbox for boolean searches
Expand Down

0 comments on commit 85d985a

Please sign in to comment.