Hinweis, dass wir Nachrichten weiterleiten können #2

Merged
ldr merged 3 commits from note_external_recipients into master 2025-04-09 20:08:56 +02:00
2 changed files with 19 additions and 2 deletions
Showing only changes of commit 59ce5d0419 - Show all commits

better errors on unknown languages

Daniel Mäckelmann 2025-03-27 18:39:03 +01:00
Signed by: dam
GPG key ID: 0683B8FCC71E90A4

View file

@ -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;

View file

@ -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"] .
"?" .