From bc984b99726acfe600978f72e7428dcff495e8b6 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Mon, 1 Jun 2009 16:05:51 +0000 Subject: [PATCH] Fix single language generation git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@639 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- _compile.php | 10 +++++++--- changes.txt | 1 + include/lang.inc.php | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/_compile.php b/_compile.php index b4e8b05b..bc364ceb 100644 --- a/_compile.php +++ b/_compile.php @@ -52,8 +52,12 @@ function put_file($match) { return "switch (\$LANG) {\n$return}\n"; } $return = file_get_contents(dirname(__FILE__) . "/$match[3]"); - if ($match[3] == "./include/lang.inc.php" && $_COOKIE["lang"] && (preg_match("~case '$_COOKIE[lang]': (.*) break;~", $return, $match2) || preg_match("~default: (.*)~", $return, $match2))) { - return "$match[1]\nfunction lang(\$ar, \$number) {\n\t$match2[1]\n\treturn sprintf(\$ar[\$pos], \$number);\n}\n$match[4]"; + if ($match[3] == "./include/lang.inc.php" && $_COOKIE["lang"]) { + if (preg_match('~\\s*(\\$pos = .*)~', $return, $match2)) { + return "$match[1]\nfunction lang(\$translation, \$number) {\n\t" . str_replace('$LANG', "'$_COOKIE[lang]'", $match2[1]) . "\n\treturn sprintf(\$translation[\$pos], \$number);\n}\n$match[4]"; + } else { + echo "lang() not found\n"; + } } $return = preg_replace("~\\?>\n?\$~", '', $return); if (substr_count($return, "") && !$match[4]) { @@ -191,7 +195,7 @@ if (isset($_GET["file"])) { case "arrow.gif": echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/arrow.gif")) . '"); break; case "up.gif": echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/up.gif")) . '"); break; case "down.gif": echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/down.gif")) . '"); break; - case "plus.gif": echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/add.gif")) . '"); break; + case "plus.gif": echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/plus.gif")) . '"); break; case "cross.gif": echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/cross.gif")) . '"); break; } } diff --git a/changes.txt b/changes.txt index 3de79ae2..956719f6 100644 --- a/changes.txt +++ b/changes.txt @@ -6,6 +6,7 @@ Relative date and time functions Version checker Separate JavaScript functions Always use the default style before the external one +Always try to use the syntax highlighter phpMinAdmin 1.10.1: Highlight odd and hover rows diff --git a/include/lang.inc.php b/include/lang.inc.php index 1e427a2d..36a58277 100644 --- a/include/lang.inc.php +++ b/include/lang.inc.php @@ -17,7 +17,8 @@ function lang($idf, $number = null) { global $LANG, $translations; $translation = $translations[$idf]; if (is_array($translation) && $translation) { - $translation = $translation[($number == 1 ? 0 : ((!$number || $number >= 5) && ereg('cs|sk|ru', $LANG) ? 2 : 1))]; + $pos = ($number == 1 ? 0 : ((!$number || $number >= 5) && ereg('cs|sk|ru', $LANG) ? 2 : 1)); + $translation = $translation[$pos]; } $args = func_get_args(); array_shift($args);