diff --git a/Admin/Templates/config.tpl b/Admin/Templates/config.tpl index 6f8ba038..902cc983 100644 --- a/Admin/Templates/config.tpl +++ b/Admin/Templates/config.tpl @@ -117,6 +117,7 @@ $editIcon = ' ?Enabled" : "Disabled"; ?> + ?None"; ?> diff --git a/Admin/Templates/editServerSet.tpl b/Admin/Templates/editServerSet.tpl index 565926c0..f301aa13 100644 --- a/Admin/Templates/editServerSet.tpl +++ b/Admin/Templates/editServerSet.tpl @@ -458,6 +458,10 @@ function refresh(tz) { + + + ? + diff --git a/GameEngine/Admin/Mods/config_template.php b/GameEngine/Admin/Mods/config_template.php index d508ce95..72ba1301 100644 --- a/GameEngine/Admin/Mods/config_template.php +++ b/GameEngine/Admin/Mods/config_template.php @@ -352,6 +352,7 @@ if (!function_exists('tz_config_finalize')) { } $defaults = array( + 'PROTECTED_PLAYERS' => '', 'NATARS_WW_START_DELAY' => 10, 'USRNM_MIN_LENGTH' => 3, 'USRNM_MAX_LENGTH' => 15, diff --git a/GameEngine/Admin/Mods/editServerSet.php b/GameEngine/Admin/Mods/editServerSet.php index 6a4bd32a..d9d1849e 100755 --- a/GameEngine/Admin/Mods/editServerSet.php +++ b/GameEngine/Admin/Mods/editServerSet.php @@ -140,6 +140,10 @@ $text = admin_config_template_contents(array( tz_config_set($text, '%PWMIN%', $pMin); tz_config_set($text, '%SERVERNAME%', $_POST['servername'] ?? ''); + // Jucatori protejati impotriva atacurilor. Scoatem ghilimelele, ca sirul + // intra intre ghilimele in config.php. + tz_config_set($text, '%PROTECTEDPLAYERS%', + trim(str_replace('"', '', $_POST['protected_players'] ?? ''))); // Fusul orar se scrie intr-un fisier PHP (define("TIMEZONE","...")), deci // valoarea NU are voie sa ajunga acolo nefiltrata: pana acum $_POST['tzone'] // era inserat ca atare, ceea ce permitea scrierea de cod in config.php. diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php index e88c3728..46c54b26 100755 --- a/GameEngine/Lang/en.php +++ b/GameEngine/Lang/en.php @@ -4360,3 +4360,9 @@ tz_def('TZ_WW_NO_CAPITAL', 'The World Wonder village cannot become your capital. // BONUSURI DE ALIANTA - donatie peste necesarul ultimului nivel ////////////////////////////////////////////////////////////////////////////////////////////////////// tz_def('ALLYBONUS_MSG_OVERMAX', 'This is the final level: you can donate at most %s more resources.'); + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// JUCATORI PROTEJATI IMPOTRIVA ATACURILOR +////////////////////////////////////////////////////////////////////////////////////////////////////// +tz_def('ADM_PROTECTED_PLAYERS', 'Protected players'); +tz_def('ADM_PROTECTED_PLAYERS_TIP', 'Comma-separated player names that cannot be attacked or raided by anyone. Reinforcements are still allowed. Leave empty to disable.'); diff --git a/GameEngine/Lang/fr.php b/GameEngine/Lang/fr.php index 7bdab332..c3e27470 100644 --- a/GameEngine/Lang/fr.php +++ b/GameEngine/Lang/fr.php @@ -4303,3 +4303,9 @@ tz_def('TZ_WW_NO_CAPITAL', 'Le village de la Merveille du Monde ne peut pas deve // BONUSURI DE ALIANTA - donatie peste necesarul ultimului nivel ////////////////////////////////////////////////////////////////////////////////////////////////////// tz_def('ALLYBONUS_MSG_OVERMAX', 'Ceci est le dernier niveau : vous pouvez donner au maximum %s ressources supplementaires.'); + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// JUCATORI PROTEJATI IMPOTRIVA ATACURILOR +////////////////////////////////////////////////////////////////////////////////////////////////////// +tz_def('ADM_PROTECTED_PLAYERS', 'Joueurs proteges'); +tz_def('ADM_PROTECTED_PLAYERS_TIP', 'Noms de joueurs separes par des virgules qui ne peuvent etre ni attaques ni pilles. Les renforts restent autorises. Laisser vide pour desactiver.'); diff --git a/GameEngine/Lang/ro.php b/GameEngine/Lang/ro.php index 375e3588..35e264d7 100644 --- a/GameEngine/Lang/ro.php +++ b/GameEngine/Lang/ro.php @@ -4100,3 +4100,9 @@ tz_def('TZ_WW_NO_CAPITAL', 'Satul Minunii Lumii nu poate deveni capitala.'); // BONUSURI DE ALIANTA - donatie peste necesarul ultimului nivel ////////////////////////////////////////////////////////////////////////////////////////////////////// tz_def('ALLYBONUS_MSG_OVERMAX', 'Acesta e ultimul nivel: poti dona cel mult %s resurse.'); + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// JUCATORI PROTEJATI IMPOTRIVA ATACURILOR +////////////////////////////////////////////////////////////////////////////////////////////////////// +tz_def('ADM_PROTECTED_PLAYERS', 'Jucatori protejati'); +tz_def('ADM_PROTECTED_PLAYERS_TIP', 'Nume de jucatori separate prin virgula, care nu pot fi atacati sau jefuiti de nimeni. Intaririle raman permise. Lasa gol ca sa dezactivezi.'); diff --git a/GameEngine/Units.php b/GameEngine/Units.php index 85d30f57..3ab1a44f 100755 --- a/GameEngine/Units.php +++ b/GameEngine/Units.php @@ -230,6 +230,52 @@ class Units { * @param array $villageInfo Out: the resolved village/oasis row * @return string An error message, or "" if the target can be attacked */ + /** + * Jucatori protejati impotriva atacurilor. + * + * Lista vine din PROTECTED_PLAYERS (config.php), separata prin virgula: + * define("PROTECTED_PLAYERS", "Shadow,Multihunter"); + * + * Verificarea sta AICI fiindca e punctul unic prin care trec toate + * trimiterile de trupe ale jucatorilor - din a2b.php, din harta sau de + * oriunde altundeva. Nu e nevoie sa modificam fiecare pagina. + * + * Se blocheaza doar ATACUL si RAIDUL (c = 3 si 4). Intaririle (c = 2) trec, + * ca jucatorul protejat sa poata primi ajutor. + * + * @param int $ownerId proprietarul satului tinta + * @param mixed $missionType tipul misiunii din formular + * @return bool + */ + private function isProtectedTarget($ownerId, $missionType) { + global $database; + + if (!defined('PROTECTED_PLAYERS') || trim(PROTECTED_PLAYERS) === '') { + return false; + } + + // intaririle raman permise + if ((int) $missionType !== 3 && (int) $missionType !== 4) { + return false; + } + + $targetName = (string) $database->getUserField((int) $ownerId, 'username', 0); + + if ($targetName === '') { + return false; + } + + foreach (explode(',', PROTECTED_PLAYERS) as $protectedName) { + $protectedName = trim($protectedName); + + if ($protectedName !== '' && strcasecmp($protectedName, $targetName) === 0) { + return true; + } + } + + return false; + } + private function validateTargetPlayer($id, $isOasis, &$villageInfo) { global $database, $village; @@ -250,6 +296,10 @@ class Units { //check if the user' is on the vacation mode: if($database->getvacmodexy($id)) return "User is on vacation mode"; + // jucator protejat prin PROTECTED_PLAYERS + if($this->isProtectedTarget($villageOwner, isset($_POST['c']) ? $_POST['c'] : 0)) { + return "This player is protected from attacks."; + } //check if attacking same village that units are in if($id == $village->wid) return "You cant attack same village you are sending from."; diff --git a/install/data/constant_format.tpl b/install/data/constant_format.tpl index b9beb799..607befc0 100644 --- a/install/data/constant_format.tpl +++ b/install/data/constant_format.tpl @@ -3,7 +3,7 @@ ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## ## --------------------------------------------------------------------------- ## ## Filename config.php ## -## Version 10.0 Full Refactor & Security ## +## Version 11.0 Full Refactor & Security ## ## Developed by: Dzoki and Dixie Edited by Advocaite ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2013-2026. All rights reserved. ## @@ -144,31 +144,6 @@ define("SPEED", "%SPEED%"); // Defines world size. NOTICE: DO NOT EDIT!! define("WORLD_MAX", "%MAX%"); -// ***** Alliance Bonuses (T4 Port) -// Members donate resources, allowing the alliance to unlock four bonuses, each -// with five levels. The costs, durations, and limits below are based on -// Travian T4; upgrade times and donation limits are scaled by the server speed. -define("NEW_FUNCTIONS_ALLIANCE_BONUSES", %ALLIANCEBONUSES%); - -// Total resources required for each level (cumulative for that level). -define("ALLIANCE_BONUS_COSTS", "1200000,5600000,17100000,51200000,153600000"); - -// Upgrade duration in HOURS for each level (divided by the server speed). -define("ALLIANCE_BONUS_HOURS", "24,48,72,96,120"); - -// Daily donation limit per player, based on the highest bonus level unlocked -// by the alliance (index 0 = no bonuses unlocked). -define("ALLIANCE_BONUS_DAILY", "300000,300000,400000,550000,750000,1000000"); - -// Percentage granted by each level. Two sets: "small" bonuses (2% per level: -// Recruitment, Philosophy) and "large" bonuses (4% per level: Metallurgy, -// Commerce), exactly as in T4. -define("ALLIANCE_BONUS_PCT_SMALL", 2); -define("ALLIANCE_BONUS_PCT_LARGE", 4); - -// Gold cost to triple a donation. -define("ALLIANCE_BONUS_TRIPLE_GOLD", 3); - // ***** Graphical statistics (Travian Plus) // The game periodically records each player's rank, population, villages, and // army from the moment this feature is enabled. These snapshots are then used @@ -200,39 +175,11 @@ define("USRNM_MIN_LENGTH", %USRNMMIN%); define("USRNM_MAX_LENGTH", %USRNMMAX%); define("PW_MIN_LENGTH", %PWMIN%); -// ***** Tribe-specific World Wonder style -// When set to true, each tribe sees its own World Wonder, both on the village -// map and on the building page. Tribes without dedicated images on disk will -// continue to use the original image, regardless of this setting. -define("NEW_FUNCTION_WW_IMAGE", %WWIMAGE%); - -// ***** Graphic Pack -// -// SERVER_GP is the pack every player sees by default (chosen at install or in -// Admin -> Server Configuration). GP_ENABLE decides whether players may pick a -// different pack for themselves in Profile -> Graphic Pack. -// -// GP_LOCATE is the pack ACTUALLY used for the current request. It follows the -// same pattern as LANG above: the player's own choice wins when it is enabled -// and points at a real pack on disk, otherwise the server pack is used. A pack -// counts as real when the folder exists and contains travian.css, so a stale -// value in the database can never leave the game without stylesheets. -define("GP_ENABLE",%GP%); -define("SERVER_GP", "%GP_LOCATE%"); - -$__user_gp = ''; - -if (GP_ENABLE && isset($_SESSION['gpack']) && is_string($_SESSION['gpack'])) { - $__candidate = trim((string) $_SESSION['gpack']); - - // only local packs: "gpack//" with no traversal and no remote URL - if (preg_match('#^gpack/[A-Za-z0-9_\-]+/$#', $__candidate) - && is_file(__DIR__ . "/../" . $__candidate . "travian.css")) { - $__user_gp = $__candidate; - } -} - -define("GP_LOCATE", $__user_gp !== '' ? $__user_gp : SERVER_GP); +// ***** Activation Mail +// true = activation mail will be sent, users will have to finish registration +// by clicking on link recieved in mail. +// false = users can register with any mail. Not needed to be real one. +define("AUTH_EMAIL",%ACTIVATE%); // ***** Troop Speed // Values: 1 (normal), 3 (3x speed) etc... @@ -317,16 +264,102 @@ define("OASIS_CLAY_PRODUCTION",OASIS_CLAY_MULTIPLIER*SPEED); define("OASIS_IRON_PRODUCTION",OASIS_IRON_MULTIPLIER*SPEED); define("OASIS_CROP_PRODUCTION",OASIS_CROP_MULTIPLIER*SPEED); +// ***** Medal Interval check +define("MEDALINTERVAL",%MEDALINTERVAL%); +// ***** Great Workshop +define("GREAT_WKS",%GREAT_WKS%); +// ***** Tourn threshold +define("TS_THRESHOLD",%TS_THRESHOLD%); + +// ***** Register open/close +define("REG_OPEN",%REG_OPEN%); + +// ***** Peace system +// 0 = None +// 1 = Normal +// 2 = Christmas +// 3 = New Year +// 4 = Easter +define("PEACE",%PEACE%); + +// ***** Players protected from attacks +// Comma-separated list of names. Players listed here cannot be attacked or +// raided by anyone; reinforcements are still allowed. Leave empty to disable. +// Example: define("PROTECTED_PLAYERS", "Shadow,Multihunter"); +define("PROTECTED_PLAYERS", "%PROTECTEDPLAYERS%"); + +////////////////////////////////// +// ***** Alliance Bonuses *****// +////////////////////////////////// + +// Members donate resources, allowing the alliance to unlock four bonuses, each +// with five levels. The costs, durations, and limits below are based on +// Travian T4; upgrade times and donation limits are scaled by the server speed. +define("NEW_FUNCTIONS_ALLIANCE_BONUSES", %ALLIANCEBONUSES%); + +// Total resources required for each level (cumulative for that level). +define("ALLIANCE_BONUS_COSTS", "1200000,5600000,17100000,51200000,153600000"); + +// Upgrade duration in HOURS for each level (divided by the server speed). +define("ALLIANCE_BONUS_HOURS", "24,48,72,96,120"); + +// Daily donation limit per player, based on the highest bonus level unlocked +// by the alliance (index 0 = no bonuses unlocked). +define("ALLIANCE_BONUS_DAILY", "300000,300000,400000,550000,750000,1000000"); + +// Percentage granted by each level. Two sets: "small" bonuses (2% per level: +// Recruitment, Philosophy) and "large" bonuses (4% per level: Metallurgy, +// Commerce), exactly as in T4. +define("ALLIANCE_BONUS_PCT_SMALL", 2); +define("ALLIANCE_BONUS_PCT_LARGE", 4); + +// Gold cost to triple a donation. +define("ALLIANCE_BONUS_TRIPLE_GOLD", 3); + + +////////////////////////////////// +// ***** Graphic Pack *****// +////////////////////////////////// +// +// SERVER_GP is the pack every player sees by default (chosen at install or in +// Admin -> Server Configuration). GP_ENABLE decides whether players may pick a +// different pack for themselves in Profile -> Graphic Pack. +// +// GP_LOCATE is the pack ACTUALLY used for the current request. It follows the +// same pattern as LANG above: the player's own choice wins when it is enabled +// and points at a real pack on disk, otherwise the server pack is used. A pack +// counts as real when the folder exists and contains travian.css, so a stale +// value in the database can never leave the game without stylesheets. +define("GP_ENABLE",%GP%); +define("SERVER_GP", "%GP_LOCATE%"); + +$__user_gp = ''; + +if (GP_ENABLE && isset($_SESSION['gpack']) && is_string($_SESSION['gpack'])) { + $__candidate = trim((string) $_SESSION['gpack']); + + // only local packs: "gpack//" with no traversal and no remote URL + if (preg_match('#^gpack/[A-Za-z0-9_\-]+/$#', $__candidate) + && is_file(__DIR__ . "/../" . $__candidate . "travian.css")) { + $__user_gp = $__candidate; + } +} + +define("GP_LOCATE", $__user_gp !== '' ? $__user_gp : SERVER_GP); + +// ***** Tribe-specific World Wonder style +// When set to true, each tribe sees its own World Wonder, both on the village +// map and on the building page. Tribes without dedicated images on disk will +// continue to use the original image, regardless of this setting. +define("NEW_FUNCTION_WW_IMAGE", %WWIMAGE%); + // ***** Enable T4 is Coming screen define("T4_COMING",%T4_COMING%); -// ***** Activation Mail -// true = activation mail will be sent, users will have to finish registration -// by clicking on link recieved in mail. -// false = users can register with any mail. Not needed to be real one. -define("AUTH_EMAIL",%ACTIVATE%); +////////////////////////////////// +// ***** PLUS *****// +////////////////////////////////// -// ***** PLUS //Plus PayPal e-mail address define("PAYPAL_EMAIL","%PAYPAL_EMAIL%"); //Plus PayPal currency @@ -355,27 +388,11 @@ define("PLUS_PACKAGE_E_GOLD","%PLUS_PACKAGE_E_GOLD%"); define("PLUS_TIME",%PLUS_TIME%); //+25% production lenght define("PLUS_PRODUCTION",%PLUS_PRODUCTION%); -// ***** Medal Interval check -define("MEDALINTERVAL",%MEDALINTERVAL%); -// ***** Great Workshop -define("GREAT_WKS",%GREAT_WKS%); -// ***** Tourn threshold -define("TS_THRESHOLD",%TS_THRESHOLD%); - -// ***** Register open/close -define("REG_OPEN",%REG_OPEN%); - -// ***** Peace system -// 0 = None -// 1 = Normal -// 2 = Christmas -// 3 = New Year -// 4 = Easter -define("PEACE",%PEACE%); ////////////////////////////////// // **** LOG SETTINGS **** // ////////////////////////////////// +// // LOG BUILDING/UPGRADING define("LOG_BUILD",%LOGBUILD%); // LOG RESEARCHES @@ -393,8 +410,6 @@ define("LOG_MARKET",%LOGMARKET%); // LOG ILLEGAL ACTIONS define("LOG_ILLEGAL",%LOGILLEGAL%); - - ////////////////////////////////// // **** NEWSBOX SETTINGS **** // ////////////////////////////////// @@ -404,8 +419,6 @@ define("NEWSBOX1",%BOX1%); define("NEWSBOX2",%BOX2%); define("NEWSBOX3",%BOX3%); - - ////////////////////////////////// // **** SQL SETTINGS **** // ////////////////////////////////// @@ -438,8 +451,6 @@ define("TB_PREFIX", "%PREFIX%"); // default: 1 define("DB_TYPE", %CONNECTT%); - - //////////////////////////////////// // **** EXTRA SETTINGS **** // //////////////////////////////////// @@ -461,8 +472,6 @@ define("MAX_MAIL","%MAX_MAILS%"); // ***** Include administrator in statistics/rank define("INCLUDE_ADMIN", %ARANK%); - - //////////////////////////////////// // **** ADMIN SETTINGS **** // //////////////////////////////////// @@ -479,10 +488,10 @@ define("ADMIN_RECEIVE_SUPPORT_MESSAGES", %ASUPPMSGS%); // ***** Allow Admin accounts to be raided and attacked define("ADMIN_ALLOW_INCOMING_RAIDS", %ARAIDS%); - ///////////////////////////////////////////////// // **** NEW MECHANICS AND FUNCTIONS **** // ///////////////////////////////////////////////// + define("NEW_FUNCTIONS_OASIS", %NEW_FUNCTIONS_OASIS%); define("NEW_FUNCTIONS_ALLIANCE_INVITATION", %NEW_FUNCTIONS_ALLIANCE_INVITATION%); define("NEW_FUNCTIONS_EMBASSY_MECHANICS", %NEW_FUNCTIONS_EMBASSY_MECHANICS%); @@ -512,6 +521,7 @@ define("NEW_FUNCTION_REGISTRATION_GOLD_VALUE", %NEW_FUNCTION_REGISTRATION_GOLD_V ////////////////////////////////////////// // **** DO NOT EDIT SETTINGS **** // ////////////////////////////////////////// + define("AUTO_DEL_INACTIVE",false); // auto-delete inactive players; default = false define("UN_ACT_TIME", 3628800); // 6 weeks to consider a player inactive define("ALLOW_BURST",false); @@ -522,7 +532,10 @@ define("ALLOW_ALL_TRIBE",false); define("CFM_ADMIN_ACT",true); define("SERVER_WEB_ROOT",false); -// === IP ban === +//////////////////////////// +// **** IP BAN **** // +//////////////////////////// + // Master switch for IP-ban enforcement. define("BAN_IP_ENABLED",true); // Comma-separated list of trusted proxy IPs/CIDRs allowed to set the forwarded @@ -558,7 +571,7 @@ $requse = 0; ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## ## --------------------------------------------------------------------------- ## ## Filename config.php ## -## Version 10.0 Full Refactor & Security ## +## Version 11.0 Full Refactor & Security ## ## Developed by: Dzoki and Dixie Edited by Advocaite ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2013-2026. All rights reserved. ## diff --git a/install/process.php b/install/process.php index 5cb58cd2..08defede 100644 --- a/install/process.php +++ b/install/process.php @@ -109,6 +109,10 @@ class Process { // Minunea Lumii cu stil pe trib $findReplace["%WWIMAGE%"] = (isset($_POST['ww_image']) && $_POST['ww_image'] === 'false') ? 'false' : 'true'; + // Jucatori protejati impotriva atacurilor + $findReplace["%PROTECTEDPLAYERS%"] = isset($_POST['protected_players']) + ? trim(str_replace('"', '', $_POST['protected_players'])) : ''; + $findReplace["%GP%"] = (isset($_POST['gpack']) && $_POST['gpack'] === 'true') ? 'true' : 'false'; $findReplace["%SSERVER%"] = $_POST['sserver']; $findReplace["%SPORT%"] = $_POST['sport']; diff --git a/install/templates/accounts.tpl b/install/templates/accounts.tpl index 6494d18c..30a681ca 100644 --- a/install/templates/accounts.tpl +++ b/install/templates/accounts.tpl @@ -55,6 +55,10 @@ if(isset($_GET['err']) && $_GET['err'] == 2) { + + + +
diff --git a/install/templates/config.tpl b/install/templates/config.tpl index 14b2d37f..d7c1bd3c 100644 --- a/install/templates/config.tpl +++ b/install/templates/config.tpl @@ -334,6 +334,7 @@ foreach($mechs as $k => $l){
+