Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Switch language by POST

  • Loading branch information...
commit b7f1d56fe0086e7fdbcebfdb4e69e20045070474 1 parent 195a811
@vrana authored
Showing with 23 additions and 6 deletions.
  1. +7 −6 adminer/include/lang.inc.php
  2. +1 −0  changes.txt
  3. +15 −0 tests/0-login.html
View
13 adminer/include/lang.inc.php
@@ -70,17 +70,18 @@ function lang($idf, $number = null) {
}
function switch_lang() {
- global $LANG, $langs;
- echo "<form action=''>\n<div id='lang'>";
- hidden_fields($_GET, array('lang'));
+ global $LANG, $langs, $token;
+ echo "<form action='' method='post'>\n<div id='lang'>";
echo lang('Language') . ": " . html_select("lang", $langs, $LANG, "this.form.submit();");
echo " <input type='submit' value='" . lang('Use') . "' class='hidden'>\n";
+ echo "<input type='hidden' name='token' value='$token'>\n";
echo "</div>\n</form>\n";
}
-if (isset($_GET["lang"])) {
- $_COOKIE["adminer_lang"] = $_GET["lang"];
- $_SESSION["lang"] = $_GET["lang"]; // cookies may be disabled
+if (isset($_POST["lang"]) && $_SESSION["token"] == $_POST["token"]) { // $token and $error not yet available
+ cookie("adminer_lang", $_POST["lang"]);
+ $_SESSION["lang"] = $_POST["lang"]; // cookies may be disabled
+ redirect(remove_from_uri());
}
$LANG = "en";
View
1  changes.txt
@@ -5,6 +5,7 @@ Time out long running database list and select count
Use VALUES() in INSERT+UPDATE export
Style logout button as link
Ctrl+click and Shift+click on button opens form to a blank window
+Switch language by POST
selectQueryBuild() method (customization)
Serbian translation
View
15 tests/0-login.html
@@ -22,6 +22,21 @@
<td></td>
</tr>
<tr>
+ <td>click</td>
+ <td>name=lang</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>name=lang</td>
+ <td>label=English</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>css=option[value=&quot;en&quot;]</td>
+ <td></td>
+</tr>
+<tr>
<td>verifyTextPresent</td>
<td>Logged as</td>
<td></td>
Please sign in to comment.
Something went wrong with that request. Please try again.