diff --git a/adminer/index.php b/adminer/index.php index 04f28c8d..5e5a37e2 100644 --- a/adminer/index.php +++ b/adminer/index.php @@ -7,6 +7,32 @@ */ error_reporting(E_ALL & ~E_NOTICE); + +// used only in compiled file +if (isset($_GET["file"])) { + header("Expires: " . gmdate("D, d M Y H:i:s", time() + 365*24*60*60) . " GMT"); + if ($_GET["file"] == "favicon.ico") { + header("Content-Type: image/x-icon"); + echo base64_decode("compile_file('favicon.ico', 'base64_encode')"); + } elseif ($_GET["file"] == "default.css") { + header("Content-Type: text/css"); + ?>compile_file('default.css', 'minify_css')compile_file('functions.js', 'JSMin::minify') 1) { $_COOKIE["adminer_lang"] = $_SERVER["argv"][1]; // Adminer functions read language from cookie @@ -182,33 +190,10 @@ if ($_COOKIE["adminer_lang"]) { } else { $file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file); } +$file = preg_replace_callback("~compile_file\\('([^']+)', '([^']+)'\\)~", 'compile_file', $file); // integrate static files $replace = 'htmlspecialchars(preg_replace("~\\\\\\\\?.*~", "", $_SERVER["REQUEST_URI"])) . "?file=\\0&version=' . $VERSION; -$file = preg_replace('~default\\.css|functions\\.js|favicon\\.ico~', '', $file); -$file = preg_replace('~(plus|cross|up|down|arrow)\\.gif~', '" . ' . $replace, $file); -$file = str_replace('error_reporting(E_ALL & ~E_NOTICE);', 'error_reporting(E_ALL & ~E_NOTICE); -if (isset($_GET["file"])) { - header("Expires: " . gmdate("D, d M Y H:i:s", time() + 365*24*60*60) . " GMT"); - if ($_GET["file"] == "favicon.ico") { - header("Content-Type: image/x-icon"); - echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/adminer/favicon.ico")) . '"); - } elseif ($_GET["file"] == "default.css") { - header("Content-Type: text/css"); - ?>' . preg_replace('~\\s*([:;{},])\\s*~', '\\1', file_get_contents(dirname(__FILE__) . "/adminer/default.css")) . '' . JSMin::minify(file_get_contents(dirname(__FILE__) . "/adminer/functions.js")) . '', $file); +$file = preg_replace('~(?\n?|\\?>\n?<\\?php~", '', $file); $file = php_shrink($file);