mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-06 21:04:20 +00:00
l10n: full interface translation (FR/RO/IT/ZH) + EN fallback hardening (#186)
This commit is contained in:
+25
-15
@@ -39,6 +39,10 @@ class Profile {
|
||||
$this->updateProfile($post);
|
||||
break;
|
||||
|
||||
case "p2":
|
||||
$this->updatePreferences($post);
|
||||
break;
|
||||
|
||||
case "p3":
|
||||
$this->updateAccount($post);
|
||||
break;
|
||||
@@ -54,6 +58,27 @@ class Profile {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Preferences form (ft=p2): persist the per-user game language.
|
||||
* Writes the existing `lang` column (matches struct.sql + Session seeding).
|
||||
*/
|
||||
private function updatePreferences($post) {
|
||||
global $database, $session;
|
||||
|
||||
$allowed = ['en', 'fr', 'it', 'ro', 'zh'];
|
||||
if (!empty($post['lang'])) {
|
||||
$lang = strtolower(trim($post['lang']));
|
||||
if (in_array($lang, $allowed, true)) {
|
||||
$database->updateUserField($session->uid, "lang", $lang, 1);
|
||||
$_SESSION['lang'] = $lang;
|
||||
$session->userinfo['lang'] = $lang;
|
||||
}
|
||||
}
|
||||
|
||||
header("Location: spieler.php?s=2");
|
||||
exit;
|
||||
}
|
||||
|
||||
public function procSpecial($get) {
|
||||
if (isset($get['e'])) {
|
||||
switch ($get['e']) {
|
||||
@@ -219,21 +244,6 @@ class Profile {
|
||||
$form->addError("email", EMAIL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
// Language change
|
||||
if (!empty($post['sprache'])) {
|
||||
// whitelist – pune aici limbile pe care le ai în /lang/
|
||||
$allowed = ['en','fr','it','ro','zh'];
|
||||
$lang = strtolower(trim($post['sprache']));
|
||||
|
||||
if (in_array($lang, $allowed, true)) {
|
||||
$database->updateUserField($session->uid, "language", $lang, 1);
|
||||
|
||||
// update sesiunea ca să se vadă imediat, fără relog
|
||||
$_SESSION['lang'] = $lang;
|
||||
$session->userinfo['language'] = $lang;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete request cancel
|
||||
if (!empty($post['del_pw']) && !empty($post['del'])) {
|
||||
|
||||
Reference in New Issue
Block a user