21 lines
668 B
PHP
21 lines
668 B
PHP
<?php
|
||
/**
|
||
* lang.php – Sprache wechseln (Klick auf eine Flagge): /lang.php?l=en&back=/pfad
|
||
* Speichert die Wahl in einem Cookie und leitet auf die Seite zurück, von der man kam.
|
||
*/
|
||
define('DESKHUB_NO_I18N', true);
|
||
require_once __DIR__ . '/includes/bootstrap.php';
|
||
|
||
$code = strtolower((string) ($_GET['l'] ?? ''));
|
||
if (isset(i18n_languages()[$code])) {
|
||
setcookie(I18N_COOKIE, $code, [
|
||
'expires' => time() + 365 * 86400,
|
||
'path' => '/',
|
||
'secure' => request_is_https(),
|
||
'httponly' => true,
|
||
'samesite' => 'Lax',
|
||
]);
|
||
}
|
||
header('Cache-Control: no-store');
|
||
redirect(i18n_safe_back((string) ($_GET['back'] ?? '/')));
|