]> git.joonet.de Git - adminer.git/commitdiff
Fix single language generation
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Mon, 1 Jun 2009 16:05:51 +0000 (16:05 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Mon, 1 Jun 2009 16:05:51 +0000 (16:05 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@639 7c3ca157-0c34-0410-bff1-cbf682f78f5c

_compile.php
changes.txt
include/lang.inc.php

index b4e8b05be085c3920403bd403539c0118a37fe81..bc364cebcdce65b2c4530a803a21d09b5d0111c9 100644 (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;
                }
        }
index 3de79ae2129cece50d95a1b0090e45f5b34841dc..956719f63133954be0d39d1fb31ad651fdea7065 100644 (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
index 1e427a2de1a114962cb8cc388d672640175fdda0..36a58277b49d615d26b37a9586b660031cd49c77 100644 (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);