Fix single language generation

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@639 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-06-01 16:05:51 +00:00
parent ab38ea5b1e
commit bc984b9972
3 changed files with 10 additions and 4 deletions

View file

@ -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, "<?php") <= 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;
}
}

View file

@ -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

View file

@ -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);