]> git.joonet.de Git - adminer.git/commitdiff
Choose language through option-list
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 3 Oct 2008 13:15:58 +0000 (13:15 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 3 Oct 2008 13:15:58 +0000 (13:15 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@517 7c3ca157-0c34-0410-bff1-cbf682f78f5c

auth.inc.php
functions.inc.php
lang.inc.php

index eeb847e5895ea13c60c09bc69c8b44c38a8860d0..e0f3da420fd39579acf873ddde2e2b2e2163630f 100644 (file)
@@ -49,16 +49,7 @@ function auth_error() {
        </table>
        <p>
 <?php
-       $process = $_POST; // expired session
-       while (list($key, $val) = each($process)) {
-               if (is_array($val)) {
-                       foreach ($val as $k => $v) {
-                               $process[$key . "[$k]"] = $v;
-                       }
-               } elseif (!in_array($key, $ignore)) {
-                       echo '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($val) . '" />';
-               }
-       }
+       hidden_fields($_POST, $ignore); // expired session
        foreach ($_FILES as $key => $val) {
                echo '<input type="hidden" name="files[' . htmlspecialchars($key) . ']" value="' . ($val["error"] ? $val["error"] : base64_encode(file_get_contents($val["tmp_name"]))) . '" />';
        }
index 1a47daecf74aa739415ea022f21db98dc587784b..061d49f1141e4e2a31364d08e28a0003c7958805 100644 (file)
@@ -340,3 +340,15 @@ function table_comment(&$row) {
                $row["Comment"] = preg_replace('~(?:(.+); )?InnoDB free: .*~', '\\1', $row["Comment"]);
        }
 }
+
+function hidden_fields($process, $ignore) {
+       while (list($key, $val) = each($process)) {
+               if (is_array($val)) {
+                       foreach ($val as $k => $v) {
+                               $process[$key . "[$k]"] = $v;
+                       }
+               } elseif (!in_array($key, $ignore)) {
+                       echo '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($val) . '" />';
+               }
+       }
+}
index 017f383f5144c6604f4e7d13d8d07deb64c3d432..a6e6f57bfdbbd4c6fdb3a4b184e010001ff64f4c 100644 (file)
@@ -29,13 +29,14 @@ function lang($idf, $number = null) {
 }
 
 function switch_lang() {
-       global $langs;
-       echo "<p id='lang'>" . lang('Language') . ":";
-       $base = remove_from_uri("lang");
+       global $LANG, $langs;
+       echo "<form action=''>\n<div id='lang'>";
+       hidden_fields($_GET, array('lang'));
+       echo lang('Language') . ": <select name='lang' onchange='this.form.submit();'>";
        foreach ($langs as $lang => $val) {
-               echo ' <a href="' . htmlspecialchars($base . (strpos($base, "?") !== false ? "&" : "?")) . "lang=$lang\" title='$val'>$lang</a>";
+               echo "<option value='$lang'" . ($LANG == $lang ? " selected='selected'" : "") . ">$val</option>";
        }
-       echo "</p>\n";
+       echo "</select>\n<noscript><div style='display: inline;'><input type='submit' value='" . lang('Use') . "' /></div></noscript>\n</div>\n</form>\n";
 }
 
 if (isset($_GET["lang"])) {