From 05bfde9063e970649e136227667679d5913b1b68 Mon Sep 17 00:00:00 2001 From: novgorodschi catalin Date: Thu, 21 May 2026 13:12:21 +0300 Subject: [PATCH] Remove some unused code and some fix Remove some unused code and some fix --- Admin/Mods/addTroops.php | 58 --- Admin/Mods/cp.php | 24 -- Admin/Mods/deletemedalbyweek.php | 22 - Admin/Mods/editUser.php | 27 -- Admin/Mods/gold.php | 25 -- Admin/Mods/gold_1.php | 24 -- Admin/Mods/index.php | 19 - Admin/Mods/medals.php | 33 -- Admin/Mods/renameVillage.php | 29 -- Admin/Mods/sendMessage.php | 27 -- Admin/Templates/config.tpl | 12 - Admin/admin.php | 13 +- GameEngine/Admin/database.php | 4 +- GameEngine/Automation.php | 692 ++++++++----------------------- GameEngine/Database.php | 60 +-- GameEngine/Session.php | 7 +- GameEngine/Technology.php | 4 +- GameEngine/Units.php | 11 +- GameEngine/Village.php | 7 +- Templates/Map/mapview.tpl | 28 +- Templates/Map/mapviewlarge.tpl | 29 +- Templates/a2b/attack.tpl | 2 +- 22 files changed, 256 insertions(+), 901 deletions(-) delete mode 100644 Admin/Mods/addTroops.php delete mode 100644 Admin/Mods/cp.php delete mode 100644 Admin/Mods/deletemedalbyweek.php delete mode 100644 Admin/Mods/editUser.php delete mode 100644 Admin/Mods/gold.php delete mode 100644 Admin/Mods/gold_1.php delete mode 100644 Admin/Mods/index.php delete mode 100644 Admin/Mods/medals.php delete mode 100644 Admin/Mods/renameVillage.php delete mode 100644 Admin/Mods/sendMessage.php diff --git a/Admin/Mods/addTroops.php b/Admin/Mods/addTroops.php deleted file mode 100644 index 558f3bf2..00000000 --- a/Admin/Mods/addTroops.php +++ /dev/null @@ -1,58 +0,0 @@ -getVillage($id); -$user = $database->getUserArray($village['owner'],1); -$coor = $database->getCoor($village['wref']); -$varray = $database->getProfileVillages($village['owner']); -$type = $database->getVillageType($village['wref']); -$fdata = $database->getResourceLevel($village['wref']); -$units = $database->getUnit($village['wref']); - -foreach ($_POST as $key => $value) { - $_POST[$key] = (int) $value; -} - -for($i = 1; $i <= 50; $i++) ${"u".$i} = $_POST['u'.$i]; - -if($user['tribe'] == 1){ - $q = "UPDATE ".TB_PREFIX."units SET u1 = $u1, u2 = $u2, u3 = $u3, u4 = $u4, u5 = $u5, u6 = $u6, u7 = $u7, u8 = $u8, u9 = $u9, u10 = $u10 WHERE vref = $id"; - mysqli_query($GLOBALS["link"], $q); -} else if($user['tribe'] == 2){ - $q = "UPDATE ".TB_PREFIX."units SET u11 = '$u11', u12 = '$u12', u13 = '$u13', u14 = '$u14', u15 = '$u15', u16 = '$u16', u17 = '$u17', u18 = '$u18', u19 = '$u19', u20 = '$u20' WHERE vref = $id"; - mysqli_query($GLOBALS["link"], $q); -} else if($user['tribe'] == 3){ - $q = "UPDATE ".TB_PREFIX."units SET u21 = '$u21', u22 = '$u22', u23 = '$u23', u24 = '$u24', u25 = '$u25', u26 = '$u26', u27 = '$u27', u28 = '$u28', u29 = '$u29', u30 = '$u30' WHERE vref = $id"; - mysqli_query($GLOBALS["link"], $q); -} else if($user['tribe'] == 4){ - $q = "UPDATE ".TB_PREFIX."units SET u31 = '$u31', u32 = '$u32', u33 = '$u33', u34 = '$u34', u35 = '$u35', u36 = '$u36', u37 = '$u37', u38 = '$u38', u39 = '$u39', u40 = '$u40' WHERE vref = $id"; - mysqli_query($GLOBALS["link"], $q); -} else if($user['tribe'] == 5){ - $q = "UPDATE ".TB_PREFIX."units SET u41 = '$u41', u42 = '$u42', u43 = '$u43', u44 = '$u44', u45 = '$u45', u46 = '$u46', u47 = '$u47', u48 = '$u48', u49 = '$u49', u50 = '$u50' WHERE vref = $id"; - mysqli_query($GLOBALS["link"], $q); -} - -mysqli_query($GLOBALS["link"], "Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed troop anmount in village $id ',".time().")"); - -$database->addStarvationData($village['wref']); - -header("Location: ../../../Admin/admin.php?p=addTroops&did=".$id."&d"); - -?> \ No newline at end of file diff --git a/Admin/Mods/cp.php b/Admin/Mods/cp.php deleted file mode 100644 index 163ee6a3..00000000 --- a/Admin/Mods/cp.php +++ /dev/null @@ -1,24 +0,0 @@ -getUserField($id,"username",0); -mysqli_query($GLOBALS["link"], "Insert into ".TB_PREFIX."admin_log values (0,$admid,'Added ".$_POST['cp']." Cultural Points to user $name ',".time().")"); - -header("Location: ../../../Admin/admin.php?p=player&uid=".$id."&cp=ok"); -?> \ No newline at end of file diff --git a/Admin/Mods/deletemedalbyweek.php b/Admin/Mods/deletemedalbyweek.php deleted file mode 100644 index 21ca8eeb..00000000 --- a/Admin/Mods/deletemedalbyweek.php +++ /dev/null @@ -1,22 +0,0 @@ - \ No newline at end of file diff --git a/Admin/Mods/editUser.php b/Admin/Mods/editUser.php deleted file mode 100644 index d2a0b5ad..00000000 --- a/Admin/Mods/editUser.php +++ /dev/null @@ -1,27 +0,0 @@ - $value) { - $_POST[$key] = $database->escape($value); -} - -$id = $_POST['id']; -$user = $database->getUserArray($id,1); -mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET email = '".$_POST['email']."', tribe = ".(int) $_POST['tribe'].", location = '".$_POST['location']."', desc1 = '".$_POST['desc1']."', desc2 = '".$_POST['desc2']."' WHERE id = ".(int) $_POST['id'].""); -mysqli_query($GLOBALS["link"], "Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed ".$user['username']."\'s profile',".time().")"); - - -header("Location: ../../../Admin/admin.php?p=player&uid=".$id.""); -?> \ No newline at end of file diff --git a/Admin/Mods/gold.php b/Admin/Mods/gold.php deleted file mode 100644 index 7127904c..00000000 --- a/Admin/Mods/gold.php +++ /dev/null @@ -1,25 +0,0 @@ -$gold gold to all users',".time().")"); - - -header("Location: ../../../Admin/admin.php?p=gold&g"); -?> \ No newline at end of file diff --git a/Admin/Mods/gold_1.php b/Admin/Mods/gold_1.php deleted file mode 100644 index 8225bd10..00000000 --- a/Admin/Mods/gold_1.php +++ /dev/null @@ -1,24 +0,0 @@ -getUserField($id,"username",0); -mysqli_query($GLOBALS["link"], "Insert into ".TB_PREFIX."admin_log values (0,$admid,'Added ".(int) $_POST['gold']." gold to user $name ',".time().")"); - -header("Location: ../../../Admin/admin.php?p=player&uid=".$id."&g=ok"); -?> \ No newline at end of file diff --git a/Admin/Mods/index.php b/Admin/Mods/index.php deleted file mode 100644 index 98297c7a..00000000 --- a/Admin/Mods/index.php +++ /dev/null @@ -1,19 +0,0 @@ - -
-
-

404 - File not found

- Not Found
-

We looked 404 times already but can't find anything, Not even an X marking the spot.

-

This system is not complete yet. So the page probably does not exist.


-
-
\ No newline at end of file diff --git a/Admin/Mods/medals.php b/Admin/Mods/medals.php deleted file mode 100644 index 9e56b05e..00000000 --- a/Admin/Mods/medals.php +++ /dev/null @@ -1,33 +0,0 @@ -$name ',".time().")"); - - -$deleteweek = (int) $_POST['medalweek']; -mysqli_query($GLOBALS["link"], "DELETE FROM ".TB_PREFIX."medal WHERE week = ".$deleteweek.""); - -header("Location: ../../../Admin/admin.php?p=player&uid=".$uid.""); -?> \ No newline at end of file diff --git a/Admin/Mods/renameVillage.php b/Admin/Mods/renameVillage.php deleted file mode 100644 index d078ef2c..00000000 --- a/Admin/Mods/renameVillage.php +++ /dev/null @@ -1,29 +0,0 @@ - $value) { - $_POST[$key] = $database->escape($value); -} - -$did = (int) $_POST['did']; -$name = $_POST['villagename']; -$sql = "UPDATE ".TB_PREFIX."vdata SET name = '$name' WHERE wref = $did"; - -mysqli_query($GLOBALS["link"], $sql); - -header("Location: ../../../Admin/admin.php?p=village&did=".$did."&name=".$origname.""); -?> \ No newline at end of file diff --git a/Admin/Mods/sendMessage.php b/Admin/Mods/sendMessage.php deleted file mode 100644 index 72ee7e08..00000000 --- a/Admin/Mods/sendMessage.php +++ /dev/null @@ -1,27 +0,0 @@ - $value) { - $_POST[$key] = $database->escape($value); -} - -$uid = (int) $_POST['uid']; -$topic = $_POST['topic']; -$message = $_POST['message']; -$time = time(); - -$query = "INSERT INTO ".TB_PREFIX."mdata SET target = $uid, owner = 1, topic = '$topic', message = '$message', viewed = 0, archived = 0, send = 0, time = $time, deltarget = 0, delowner = 0, alliance = 0, player = 0, coor = 0, report = 0"; -mysqli_query($GLOBALS["link"], $query) OR DIE (mysqli_errno($GLOBALS["link"])); - -header("Location: ../../../Admin/admin.php?p=Newmessage&uid=".$uid."&msg=ok"); -?> \ No newline at end of file diff --git a/Admin/Templates/config.tpl b/Admin/Templates/config.tpl index 7e505938..140784dd 100644 --- a/Admin/Templates/config.tpl +++ b/Admin/Templates/config.tpl @@ -392,18 +392,6 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); ? Enabled"; } elseif(!NEWSBOX3){ echo "Disabled"; } ?> - - diff --git a/Admin/admin.php b/Admin/admin.php index cbc5032a..4a24da68 100644 --- a/Admin/admin.php +++ b/Admin/admin.php @@ -6,14 +6,14 @@ ## --------------------------------------------------------------------------- ## ## ## ## Project: TravianZ ## -## Version: 05.03.2014 ## +## Version: 05.03.2026 ## ## Filename: Admin/admin.php ## ## Developed by: Dzoki ## -## Edited by: Shadow and ronix ## -## License: Creative Commons BY-NC-SA 3.0 ## -## Copyright: TravianZ (c) 2014 - All rights reserved ## -## URLs: http://travian.shadowss.ro ## -## Source code: https://github.com/Shadowss/TravianZ ## +## Refactored by: Shadow ## +## License: TravianZ Project ## +## Copyright: TravianZ (c) 2010-2026. All rights reserved. ## +## URLs: https://travianz.org ## +## https://github.com/Shadowss/TravianZ ## ## ## ################################################################################# @@ -507,7 +507,6 @@ if (!empty($_GET['p'])) {
  • Server Homepage
  • Control Panel Home
  • Return to the server
  • -
  • Logout
  • Server Info