]> git.joonet.de Git - adminer.git/commitdiff
Immunity against CRLF
authorJakub Vrana <jakub@vrana.cz>
Sat, 16 Oct 2010 20:36:01 +0000 (22:36 +0200)
committerJakub Vrana <jakub@vrana.cz>
Sat, 16 Oct 2010 20:36:01 +0000 (22:36 +0200)
compile.php
lang.php

index d888495364986cb0e2cbc4f4478298f83b047ee9..a9cc4e4b82b6b722a0ef2c2b882e04c4694921da 100644 (file)
@@ -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);
index 0510518e90e229db69bd915664bb4b8891f73e40..e2b0ff851035e6b422a9a8c759df8d2a6850871e 100644 (file)
--- 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) {