From 53804a2c20f4cc32e20af1e8c07ac1ab38369a80 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sat, 16 Oct 2010 22:36:01 +0200 Subject: [PATCH] Immunity against CRLF --- compile.php | 1 + lang.php | 1 + 2 files changed, 2 insertions(+) diff --git a/compile.php b/compile.php index d8884953..a9cc4e4b 100644 --- a/compile.php +++ b/compile.php @@ -244,6 +244,7 @@ foreach (array("adminer", "editor") as $project) { } $file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $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); diff --git a/lang.php b/lang.php index 0510518e..e2b0ff85 100644 --- a/lang.php +++ b/lang.php @@ -27,6 +27,7 @@ foreach (array_merge( foreach (glob(dirname(__FILE__) . "/adminer/lang/" . ($_SESSION["lang"] ? $_SESSION["lang"] : "*") . ".inc.php") as $filename) { $messages = $messages_all; $file = file_get_contents($filename); + $file = str_replace("\r", "", $file); preg_match_all("~^(\\s*)(?:// )?(('(?:[^\\\\']+|\\\\.)*') => .*[^,\n]),?~m", $file, $matches, PREG_SET_ORDER); $s = ""; foreach ($matches as $match) {