forked from amah/kummerkasten-php
Hinweis, dass wir Nachrichten weiterleiten können #2
2 changed files with 19 additions and 2 deletions
better errors on unknown languages
commit
59ce5d0419
|
|
@ -212,6 +212,12 @@ p {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.infobox.warn {
|
||||
border-color: var(--tertiary);
|
||||
font-weight: bold;
|
||||
background-color: var(--light-yellow);
|
||||
}
|
||||
|
||||
form > * {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
|
|
|||
15
index.php
15
index.php
|
|
@ -3,8 +3,14 @@
|
|||
<?php
|
||||
$lang = $_GET["lang"] ?? ($lang = "de");
|
||||
if ($lang !== "de" && $lang !== "en") {
|
||||
http_response_code(404);
|
||||
die("Error: Language not found!");
|
||||
http_response_code(302);
|
||||
$url = "?" . http_build_query(["lang" => "en", "redirect_lang" => $lang]);
|
||||
header("Location: $url");
|
||||
|
||||
echo "<p>The language <code>" . htmlspecialchars($lang) . "</code> is not currently supported.</p>";
|
||||
echo "<p>You should have been redirected to the english version of this page. If not, click <a href=\"$url\">here</a></p>";
|
||||
|
||||
die();
|
||||
}
|
||||
$text = json_decode(file_get_contents("languages/$lang.json"), true);
|
||||
$title = $text["title"];
|
||||
|
|
@ -61,6 +67,11 @@ if (isset($_POST["submit"])) {
|
|||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<?php if (isset($_GET["redirect_lang"])) { ?>
|
||||
<div class="infobox warn">
|
||||
<p> The language <code><?php echo htmlspecialchars($_GET["redirect_lang"]); ?></code> is not supported. You have been redirected to the english language suggestion box. </p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div id="about" class="infobox"><?php echo $about; ?></div>
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"] .
|
||||
"?" .
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue