diff --git a/Admin/admin.php b/Admin/admin.php index ccdf5ee4..88a8d44c 100644 --- a/Admin/admin.php +++ b/Admin/admin.php @@ -276,30 +276,41 @@ if (!empty($_GET['p'])) { } break; - case 'village': - if (!empty($_GET['did'])) { - $village = $database->getVillage($_GET['did']); - $user = $database->getUserArray($village['owner'],1); - $subpage = 'Edit Village ('.$village['name'].' » '.$user['username'].')'; - } else { - $subpage = 'Edit Village (no village)'; - } - break; + case 'village': + if (!empty($_GET['did'])) { + $did = (int)$_GET['did']; + $village = $database->getVillage($did); + if ($village) { + $user = $database->getUserArray($village['owner'], 1); + $subpage = 'Edit Village ('.$village['name'].' » '.($user['username'] ?? '?').')'; + } else { + $subpage = 'Edit Village (ID '.$did.' not found)'; + $village = null; // important, ca să nu crape template-ul mai jos + } + } else { + $subpage = 'Edit Village (no village)'; + } + break; - case 'editResources': - if (!empty($_GET['did'])) { - $village = $database->getVillage($_GET['did']); - $user = $database->getUserArray($village['owner'],1); - $subpage = 'Edit Resources ('.$village['name'].' » '.$user['username'].')'; - } else { - $subpage = 'Edit Resources (no village)'; - } - break; + case 'editResources': + if (!empty($_GET['did'])) { + $village = $database->getVillage($_GET['did']); + if ($village) { + $user = $database->getUserArray($village['owner'], 1); + $subpage = 'Edit Troops ('.$village['name'].' » '.$user['username'].')'; + } else { + $subpage = 'Edit Resources (ID '.$did.' not found)'; + $village = null; + } + } else { + $subpage = 'Edit Resources (no village)'; + } + break; case 'addTroops': if (!empty($_GET['did'])) { $village = $database->getVillage($_GET['did']); - $user = $database->getUserArray($village['owner'],1); + $user = $database->getUserArray($village['owner'], 1); $subpage = 'Edit Troops ('.$village['name'].' » '.$user['username'].')'; } else { $subpage = 'Edit Troops (no village)'; diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 4631ee65..c7594983 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -3021,11 +3021,13 @@ class MYSQLi_DB implements IDbConnection { $q = "DELETE from " . TB_PREFIX . "forum_post where id = '$id'"; return mysqli_query($this->dblink,$q); } - + function getAllianceName($id, $use_cache = true) { - if (!$id) return '-'; - $alliance = $this->getAlliance($id, $use_cache); - return $alliance['tag'] ?? '-'; + $alliance = $this->getAlliance($id, $use_cache); + if (!is_array($alliance) || !isset($alliance['tag'])) { + return null; + } + return $alliance['tag']; } // no need to cache this method diff --git a/Templates/Build/27.tpl b/Templates/Build/27.tpl index d259f584..7be88d38 100644 --- a/Templates/Build/27.tpl +++ b/Templates/Build/27.tpl @@ -1,25 +1,36 @@ - -
- 


- | '.NO_ARTEFACTS.' | '; + echo '|||||
| '.NO_ARTEFACTS.' | |||||
![]() |
- '.$artifact['name'] . ' '.$artifact['effect'].' '.TREASURY.' 10, '.EFFECT.' '.ACCOUNT.'
+ '.$artifact['name'] . ' '.$artifact['effect'].''.TREASURY.' 10, '.EFFECT.' '.VILLAGE.'
|
- '.$database->getUserField($artifact['owner'], "username", 0).' | -'.$database->getAllianceName($database->getUserField($artifact['owner'], "alliance", 0)).' | +'.$ownerName.' | +'.($aid ? ''.$allianceName.'' : '-').' |
- | '.NO_ARTEFACTS.' | '; + echo '|||||
| '.NO_ARTEFACTS.' | |||||
![]() |
'.$artifact['name'] . ' '.$artifact['effect'].' '.TREASURY.' 20, '.EFFECT.' '.ACCOUNT.'
|
- '.$database->getUserField($artifact['owner'], "username", 0).' | -'.$database->getAllianceName($database->getUserField($artifact['owner'], "alliance", 0)).' | +'.$ownerName.' | +'.($aid ? ''.$allianceName.'' : '-').' |
| + | |||
|---|---|---|---|
| - - + | |||
| -getUserField($artifact['owner'], "username", 0)) != "[?]"){?> +getUserField($artifact['owner'] ?? 0, "username", 0) ?? "[?]"; +if($artifactOwnerUsername != "[?]" && !empty($artifact['owner'])){ ?> - + [?] | @@ -39,9 +41,11 @@ $artifactInfo = Artifacts::getArtifactInfo($artifact);|||
| -checkVilExist($artifact['vref'])){?> -getVillageField($artifact['vref'], "name");?> - +checkVilExist($artifact['vref'])){ + $villageName = $database->getVillageField($artifact['vref'], "name") ?? '[?]'; +?> + + [?] | @@ -49,42 +53,46 @@ $artifactInfo = Artifacts::getArtifactInfo($artifact);|||
| -getUserField($artifact['owner'], "alliance", 0)) > 0){ ?> -getAllianceName($alliance); ?> - +getUserField($artifact['owner'] ?? 0, "alliance", 0) ?? 0); +if($alliance > 0){ + $allianceName = $database->getAllianceName($alliance) ?? '-'; +?> + + - | |||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| -getUserField($owner['uid'], "username", 0)) != "[?]"){?> - - + + + [?] | -checkVilExist($owner['vref'])){?> -getVillageField($owner['vref'], "name");?> - + + + [?] | -+ | |
| diff --git a/Templates/Profile/account.tpl b/Templates/Profile/account.tpl index 795f7fb8..4c5fadcb 100644 --- a/Templates/Profile/account.tpl +++ b/Templates/Profile/account.tpl @@ -9,7 +9,7 @@ ## Refactored by Shadow ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2026. All rights reserved. ## -## URLs: http://travian.shadowss.ro ## +## URLs: http://travianz.org ## ## Source code: http://github.com/Shadowss/TravianZ/ ## ## ## ################################################################################# diff --git a/Templates/Profile/graphic.tpl b/Templates/Profile/graphic.tpl index 2507a907..fa951b12 100644 --- a/Templates/Profile/graphic.tpl +++ b/Templates/Profile/graphic.tpl @@ -9,7 +9,7 @@ ## Refactored by Shadow ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2026. All rights reserved. ## -## URLs: http://travian.shadowss.ro ## +## URLs: http://travianz.org ## ## Source code: http://github.com/Shadowss/TravianZ/ ## ## ## ################################################################################# diff --git a/Templates/Profile/medal.php b/Templates/Profile/medal.php index ccf8deea..6a11852a 100644 --- a/Templates/Profile/medal.php +++ b/Templates/Profile/medal.php @@ -11,7 +11,7 @@ ## Fixed by: Shadow / Skype : cata7007 ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2026. All rights reserved. ## -## URLs: http://travian.shadowss.ro ## +## URLs: http://travianz.org ## ## Source code: http://github.com/Shadowss/TravianZ-by-Shadow/ ## ## ## ################################################################################# diff --git a/Templates/Profile/menu.tpl b/Templates/Profile/menu.tpl index 92482b2b..302e2247 100644 --- a/Templates/Profile/menu.tpl +++ b/Templates/Profile/menu.tpl @@ -9,7 +9,7 @@ ## Refactored by Shadow ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2026. All rights reserved. ## -## URLs: http://travian.shadowss.ro ## +## URLs: http://travianz.org ## ## Source code: http://github.com/Shadowss/TravianZ/ ## ## ## ################################################################################# diff --git a/Templates/Profile/menu2.tpl b/Templates/Profile/menu2.tpl index da408ac2..ecca4811 100644 --- a/Templates/Profile/menu2.tpl +++ b/Templates/Profile/menu2.tpl @@ -9,7 +9,7 @@ ## Refactored by Shadow ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2026. All rights reserved. ## -## URLs: http://travian.shadowss.ro ## +## URLs: http://travianz.org ## ## Source code: http://github.com/Shadowss/TravianZ/ ## ## ## ################################################################################# diff --git a/Templates/Profile/notfound.tpl b/Templates/Profile/notfound.tpl index a026efc2..4511805c 100644 --- a/Templates/Profile/notfound.tpl +++ b/Templates/Profile/notfound.tpl @@ -9,7 +9,7 @@ ## Refactored by Shadow ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2026. All rights reserved. ## -## URLs: http://travian.shadowss.ro ## +## URLs: http://travianz.org ## ## Source code: http://github.com/Shadowss/TravianZ/ ## ## ## ################################################################################# diff --git a/Templates/Profile/overview.tpl b/Templates/Profile/overview.tpl index 63ed2e40..52488c46 100644 --- a/Templates/Profile/overview.tpl +++ b/Templates/Profile/overview.tpl @@ -9,7 +9,7 @@ ## Refactored by Shadow ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2026. All rights reserved. ## -## URLs: http://travian.shadowss.ro ## +## URLs: http://travianz.org ## ## Source code: http://github.com/Shadowss/TravianZ/ ## ## ## ################################################################################# diff --git a/Templates/Profile/preference.tpl b/Templates/Profile/preference.tpl index 204e4ec2..9ad29d42 100644 --- a/Templates/Profile/preference.tpl +++ b/Templates/Profile/preference.tpl @@ -9,7 +9,7 @@ ## Refactored by Shadow ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2026. All rights reserved. ## -## URLs: http://travian.shadowss.ro ## +## URLs: http://travianz.org ## ## Source code: http://github.com/Shadowss/TravianZ/ ## ## ## ################################################################################# @@ -176,7 +176,7 @@ while ($data = mysqli_fetch_assoc($query)) { // ========================= // USER SETTINGS SAVE // ========================= -if (isset($_POST['v1']) || isset($_POST['v2']) || isset($_POST['timezone'])) { +if (isset($_POST['v1']) || isset($_POST['v2']) || isset($_POST['timezone']) || isset($_POST['lang'])) { $v1 = isset($_POST['v1']) ? 1 : 0; $v2 = isset($_POST['v2']) ? 1 : 0; @@ -189,6 +189,24 @@ if (isset($_POST['v1']) || isset($_POST['v2']) || isset($_POST['timezone'])) { $timezone = isset($_POST['timezone']) ? (int)$_POST['timezone'] : 1; $tformat = isset($_POST['tformat']) ? (int)$_POST['tformat'] : 0; +// ========================= +// LANGUAGE +// ========================= + +$lang = LANG; + +if(isset($_POST['lang'])) +{ + $allowedLangs = ['en','ro','de','fr','es','it','ru','tr']; + + $selectedLang = strtolower(trim($_POST['lang'])); + + if(in_array($selectedLang, $allowedLangs)) + { + $lang = $selectedLang; + } +} + // update user preferences $database->query(" UPDATE " . TB_PREFIX . "users SET @@ -200,10 +218,14 @@ if (isset($_POST['v1']) || isset($_POST['v2']) || isset($_POST['timezone'])) { v5=$v5, v6=$v6, timezone=$timezone, - tformat=$tformat + tformat=$tformat, + lang='$lang' WHERE id=" . (int)$session->uid . " "); + // schimbare instant în sesiune + $_SESSION['lang'] = $lang; + header("Location: spieler.php?s=2"); exit; } @@ -467,7 +489,49 @@ if (isset($_POST['v1']) || isset($_POST['v2']) || isset($_POST['timezone'])) { | |||
| Language settings | +|
|---|---|
| Game language | ++ + | +