Choose language through option-list

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@517 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2008-10-03 13:15:58 +00:00
parent 3920ebbe37
commit 5d7071a539
3 changed files with 19 additions and 15 deletions

View 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"]))) . '" />';
}

View 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) . '" />';
}
}
}

View 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"])) {