diff --git a/adminer/file.inc.php b/adminer/file.inc.php index 332e58fa..53eafd36 100644 --- a/adminer/file.inc.php +++ b/adminer/file.inc.php @@ -3,21 +3,21 @@ 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 'compile_file("../adminer/static/favicon.ico", "add_apo_slashes");'; + echo "compile_file('../adminer/static/favicon.ico', 'add_quo_slashes');"; } elseif ($_GET["file"] == "default.css") { header("Content-Type: text/css; charset=utf-8"); - ?>compile_file("../adminer/static/default.css", "minify_css");compile_file('../adminer/static/default.css', 'minify_css');compile_file("../adminer/static/functions.js", "jsShrink");compile_file("static/editing.js", "jsShrink");compile_file('../adminer/static/functions.js', 'jsShrink');compile_file('static/editing.js', 'jsShrink'); "'", "\\\\" => "\\")); @@ -112,7 +116,8 @@ function put_file_lang($match) { $translation_ids[$lang_ids[$key]] = implode("\t", (array) $val); } } - $return .= "\n\t\tcase \"$lang\": \$compressed = '" . add_apo_slashes(lzw_compress(implode("\n", $translation_ids))) . "'; break;"; + $return .= ' + case "' . $lang . '": $compressed = "' . add_quo_slashes(lzw_compress(implode("\n", $translation_ids))) . '"; break;'; } $translations_version = crc32($return); return '$translations = &$_SESSION["translations"]; @@ -202,10 +207,10 @@ function php_shrink($input) { $token = array(0, $token); } if ($tokens[$i+2][0] === T_CLOSE_TAG && $tokens[$i+3][0] === T_INLINE_HTML && $tokens[$i+4][0] === T_OPEN_TAG - && strlen(addcslashes($tokens[$i+3][1], "'\\")) < strlen($tokens[$i+3][1]) + 3 + && strlen(add_apo_slashes($tokens[$i+3][1])) < strlen($tokens[$i+3][1]) + 3 ) { $tokens[$i+2] = array(T_ECHO, 'echo'); - $tokens[$i+3] = array(T_CONSTANT_ENCAPSED_STRING, "'" . addcslashes($tokens[$i+3][1], "'\\") . "'"); + $tokens[$i+3] = array(T_CONSTANT_ENCAPSED_STRING, "'" . add_apo_slashes($tokens[$i+3][1]) . "'"); $tokens[$i+4] = array(0, ';'); } if ($token[0] == T_COMMENT || $token[0] == T_WHITESPACE || ($token[0] == T_DOC_COMMENT && $doc_comment)) { @@ -328,8 +333,8 @@ foreach (array("adminer", "editor") as $project) { } } $file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file); - $file = str_replace("\r", "", $file); $file = preg_replace_callback('~\\b(include|require) "([^"]*\\$LANG.inc.php)";~', 'put_file_lang', $file); + $file = str_replace("\r", "", $file); if ($_SESSION["lang"]) { // single language version $file = preg_replace_callback("~(<\\?php\\s*echo )?lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])(;\\s*\\?>)?~s", 'remove_lang', $file); @@ -337,7 +342,7 @@ foreach (array("adminer", "editor") as $project) { $file = str_replace('', $_SESSION["lang"], $file); } $file = str_replace('' . "\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&version=' . $VERSION; $file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '', $file); $file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);