Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Choose language through option-list

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@517 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
commit 5d7071a539d3dce780d3ff53a14b458be7c7d41a 1 parent 3920ebb
jakubvrana authored
Showing with 19 additions and 15 deletions.
  1. +1 −10 auth.inc.php
  2. +12 −0 functions.inc.php
  3. +6 −5 lang.inc.php
View
11 auth.inc.php
@@ -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"]))) . '" />';
}
View
12 functions.inc.php
@@ -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) . '" />';
+ }
+ }
+}
View
11 lang.inc.php
@@ -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"])) {
Please sign in to comment.
Something went wrong with that request. Please try again.