From 8c3ab3e5ebfa43e1b4932d33740a56484d259094 Mon Sep 17 00:00:00 2001 From: novgorodschi catalin Date: Mon, 25 May 2026 12:37:33 +0300 Subject: [PATCH] Fix some bugs + added (coded delAli) Fix some bugs + added (coded delAli) --- Admin/Templates/alliance.tpl | 189 +++++++++--------- Admin/Templates/artifact.tpl | 101 +++++----- Admin/Templates/delAli.tpl | 54 +++++ Admin/Templates/editPassword.tpl | 4 +- Admin/Templates/editProtection.tpl | 2 +- Admin/Templates/editSitter.tpl | 2 +- Admin/Templates/editUser.tpl | 21 +- Admin/Templates/editVillage.tpl | 306 +++++++++++------------------ Admin/Templates/search2.tpl | 8 +- Admin/Templates/troopUpgrades.tpl | 16 +- Admin/Templates/troops.tpl | 5 +- Admin/Templates/village.tpl | 52 ++--- GameEngine/Admin/Mods/delAli.php | 91 +++++++++ GameEngine/Admin/Mods/editAli.php | 106 ++++++---- 14 files changed, 532 insertions(+), 425 deletions(-) create mode 100644 Admin/Templates/delAli.tpl create mode 100644 GameEngine/Admin/Mods/delAli.php diff --git a/Admin/Templates/alliance.tpl b/Admin/Templates/alliance.tpl index 7f5e1640..e875c3d8 100644 --- a/Admin/Templates/alliance.tpl +++ b/Admin/Templates/alliance.tpl @@ -108,64 +108,58 @@ if($_GET['aid']) { -
- -
-
-

📋 Alliance Details

-
- - - - - - -
Tag
Name
Rank#
Points
Capacity - =$maxMembers?'full':'ok'; ?> - -
+ +
+

📋 Alliance Details

+
+ + + + + + +
Tag
Name
Rank#
Points
Capacity + =$maxMembers?'full':'ok'; ?> + +
-
- 🛡️ Alliance Positions -
- '.htmlspecialchars($player['username']).' '.htmlspecialchars($row['rank']).'
'.implode(' • ', $perms).'
'; - } - ?> -
-
- - -
-
- -
-

📢 Alliance Notice

-
+
+ 🛡 Alliance Positions +
+ '.htmlspecialchars($player['username']).' '.htmlspecialchars($row['rank']).'
'.implode(' • ', $perms).'
'; + } + ?>
- -
-
-

📖 Alliance Description

-
-
+
+
+ + +
+

📖 Alliance Description

+
+
+ + +
+

📢 Alliance Notice

+
+
@@ -200,54 +194,51 @@ if($_GET['aid']) {
- diff --git a/Admin/Templates/artifact.tpl b/Admin/Templates/artifact.tpl index 21bd80f7..b724f01c 100644 --- a/Admin/Templates/artifact.tpl +++ b/Admin/Templates/artifact.tpl @@ -23,51 +23,58 @@ include_once("../GameEngine/Artifacts.php"); $artifact = reset($database->getOwnArtefactInfo($_GET['did'])); $artifactOfTheFool = !empty($artifact) && $artifact['type'] == 8; -$artifactInfo = Artifacts::getArtifactInfo($artifact); +$artifactInfo = $artifact ? Artifacts::getArtifactInfo($artifact) : null; ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Artifact
NameBonusArea of effectTime of conquerTime of activationNext activation
- Return to Natars
'; - ?> - \ No newline at end of file + + +
+ +
+ + + + + + + + + + + + Next activation'; ?> + + + + + + + + + + + + '.$artifactInfo['nextEffect'].''; ?> + + +
NameBonusArea of effectTime of conquerTime of activation
+ + + + + +
\ No newline at end of file diff --git a/Admin/Templates/delAli.tpl b/Admin/Templates/delAli.tpl new file mode 100644 index 00000000..75877a5c --- /dev/null +++ b/Admin/Templates/delAli.tpl @@ -0,0 +1,54 @@ +getAlliance($aid); +if(!$alidata){ echo "
Alliance not found
"; return; } +$members = $database->getAllMember($aid); +?> + + +
+
+

🗑 Delete Alliance

+
+

Are you sure you want to permanently delete?:

+

[]

+

Members: | Points: getVSumField(array_column($members,'id'),'pop')[0]['Total']?? 0);?>

+ +
⚠ All members will be removed from the alliance, permissions, diplomacy, logs and the alliance forum will be deleted. The action is irreversible!
+ +
+ + + + Cancel +
+
+
+
\ No newline at end of file diff --git a/Admin/Templates/editPassword.tpl b/Admin/Templates/editPassword.tpl index 88348217..79648321 100644 --- a/Admin/Templates/editPassword.tpl +++ b/Admin/Templates/editPassword.tpl @@ -82,7 +82,7 @@ function genPw(){
⚠️ -
Atenție: Parola se schimbă instant. Jucătorul va fi delogat. Nu se trimite email automat.
+
WARNING: The password is changed instantly. The player will be logged out. No automatic email is sent.
@@ -91,7 +91,7 @@ function genPw(){
- +
diff --git a/Admin/Templates/editProtection.tpl b/Admin/Templates/editProtection.tpl index b806e505..f1c4e68e 100644 --- a/Admin/Templates/editProtection.tpl +++ b/Admin/Templates/editProtection.tpl @@ -98,7 +98,7 @@ function setDays(d){ document.getElementById('protect').value = d; } -
💡 Pune 0 ca să scoți protecția. Protecția se adaugă de la momentul salvării.
+
💡 Set to 0 to remove protection. Protection is added from the time of saving.
diff --git a/Admin/Templates/editSitter.tpl b/Admin/Templates/editSitter.tpl index 9a6d0f58..a43e5693 100644 --- a/Admin/Templates/editSitter.tpl +++ b/Admin/Templates/editSitter.tpl @@ -76,7 +76,7 @@ function clearSitter(n){ document.getElementById('sit'+n).value = '0'; }

⚙️ Sitter Settings

-
💡 Folosește UID-ul jucătorului. Pune 0 ca să ștergi sitter-ul. Găsești UID-ul din Search.
+
💡 Use the player's UID. Enter 0 to delete the sitter. You can find the UID in Search.
diff --git a/Admin/Templates/editUser.tpl b/Admin/Templates/editUser.tpl index 469410fc..196ff024 100644 --- a/Admin/Templates/editUser.tpl +++ b/Admin/Templates/editUser.tpl @@ -25,20 +25,19 @@ if(isset($id) && $id > 0) { $uid = $id; ?> - Show Instructions -
- - - - - - - - - - - - - - procResType($fdata['f'.$i.'t']); +
+
Modify Buildings
+
+
Modify Buildings
IDGIDNameLevel
+ + + procResType($gid); + echo ' + + + + + '; + } + ?> + +
IDGIDNameLevel
'.$i.''.$bu.'
+
+
+ +
+
+ - echo ' - - '.$i.' - - '.$bu.' - - '; - } - ?> - - +
+
Current Layout Preview
+
+ + +
+
Resource Fields
+
+
+ '; } ?> +
+
+
-

-
+ +
+
Village Center
+ +
+
+ 0?'':''; } + echo $fdata['f39t']>0?'':''; + if($WW==40){$l=$fdata['f99'];$c='g40';if($l>19)$c='g40_1';if($l>39)$c='g40_2';if($l>59)$c='g40_3';if($l>79)$c='g40_4';if($l>99)$c='g40_5';echo '';} ?> +
0)echo'
'.$lv.'
'; } if($fdata['f39t']>0)echo'
'.$fdata['f39'].'
'; if($wall>0)echo'
'.$fdata['f40'].'
'; if($WW>0)echo'
'.$fdata['f99'].'
'; ?>
+
+
+
-
-
-
- "; - } - ?> -
-
-
-
+
+
-

- -
-

-
- 0) echo ""; - elseif($gid == 0) echo ""; - } - - $rp = 16; - $rplevel = $fdata['f'.$rp]; - - if($rplevel > 0) echo ""; - elseif($rplevel == 0) echo ""; - - $resourcearray = $database->getResourceLevel($village['wref']); - if($resourcearray['f99t'] == 40) { - if($resourcearray['f99'] >= 0 && $resourcearray['f99'] <= 19) { - echo 'Worldwonder'; - } - elseif($resourcearray['f99'] >= 20 && $resourcearray['f99'] <= 39) { - echo 'Worldwonder'; - } - elseif($resourcearray['f99'] >= 40 && $resourcearray['f99'] <= 59) { - echo 'Worldwonder'; - } - elseif($resourcearray['f99'] >= 60 && $resourcearray['f99'] <= 79) { - echo 'Worldwonder'; - } - elseif($resourcearray['f99'] >= 80 && $resourcearray['f99'] <= 99) { - echo 'Worldwonder'; - } - elseif($resourcearray['f99'] == 100) { - echo 'Worldwonder'; - } - } - ?> -
- 0) echo "
$level
"; - } - if($rplevel > 0) echo "
".$fdata['f39']."
"; - if($wallLevel > 0) echo "
".$fdata['f40']."
"; - if($WWLevel > 0) echo "
".$fdata['f99']."
"; - ?> -
-
-
- \ No newline at end of file + + \ No newline at end of file diff --git a/Admin/Templates/search2.tpl b/Admin/Templates/search2.tpl index 4d0c8802..afc88d4c 100644 --- a/Admin/Templates/search2.tpl +++ b/Admin/Templates/search2.tpl @@ -28,20 +28,18 @@ $totalpop = 0; foreach($varray as $vil) $totalpop += $vil['pop']; ?>
diff --git a/Admin/Templates/troopUpgrades.tpl b/Admin/Templates/troopUpgrades.tpl index 3950a1de..1f43c9a2 100644 --- a/Admin/Templates/troopUpgrades.tpl +++ b/Admin/Templates/troopUpgrades.tpl @@ -23,15 +23,15 @@ $tribe = (int)$user['tribe']; $img = $tribe==1 ? "" : $tribe-1; ?> diff --git a/Admin/Templates/troops.tpl b/Admin/Templates/troops.tpl index 49808c47..ab510f15 100644 --- a/Admin/Templates/troops.tpl +++ b/Admin/Templates/troops.tpl @@ -26,7 +26,7 @@ $heroCount = $hero ? 1 : 0; ?>
diff --git a/Admin/Templates/village.tpl b/Admin/Templates/village.tpl index 1b213901..2d2da5f4 100644 --- a/Admin/Templates/village.tpl +++ b/Admin/Templates/village.tpl @@ -112,21 +112,20 @@ if(isset($id)){
-
-
-
-
Village Information
- - - - + +
+
Village Information
+
Owner - - - - - - -
+ + +
Owner +
+ + + + +
+
Name
@@ -141,16 +140,17 @@ if(isset($id)){
Field'.($i!=3?' | ':''); } ?>
-
-
Resources
- - - - - - -
ResAmtCapProd
Wood
Clay
Iron
Crop
-
+ +
+
Resources
+ + + + + + +
ResAmtCapProd
Wood
Clay
Iron
Crop
+
@@ -186,7 +186,7 @@ if(isset($id)){
- +

Village Center -

diff --git a/GameEngine/Admin/Mods/delAli.php b/GameEngine/Admin/Mods/delAli.php new file mode 100644 index 00000000..277f467a --- /dev/null +++ b/GameEngine/Admin/Mods/delAli.php @@ -0,0 +1,91 @@ +getUserArray($admid, 1); +if (!$admin || (int)$admin['access'] !== 9) { + die('

Access Denied: You are not Admin!

'); +} + +// --------------------------------------------------------------------------- +// 1. Scoate toți membrii +// --------------------------------------------------------------------------- +$database->query("UPDATE " . TB_PREFIX . "users SET alliance = 0 WHERE alliance = $aid"); + +// --------------------------------------------------------------------------- +// 2. Șterge structura alianței +// --------------------------------------------------------------------------- +$database->query("DELETE FROM " . TB_PREFIX . "alidata WHERE id = $aid"); +$database->query("DELETE FROM " . TB_PREFIX . "ali_permission WHERE alliance = $aid"); +$database->query("DELETE FROM " . TB_PREFIX . "ali_invite WHERE alliance = $aid"); +$database->query("DELETE FROM " . TB_PREFIX . "ali_log WHERE aid = $aid"); + +// --------------------------------------------------------------------------- +// 3. Șterge diplomația +// --------------------------------------------------------------------------- +$database->query("DELETE FROM " . TB_PREFIX . "diplomacy WHERE alli1 = $aid OR alli2 = $aid"); + +// --------------------------------------------------------------------------- +// 4. Șterge forumul +// --------------------------------------------------------------------------- +$database->query("DELETE FROM " . TB_PREFIX . "forum_cat WHERE alliance = $aid"); +$database->query("DELETE FROM " . TB_PREFIX . "forum_topic WHERE alliance = $aid"); +$database->query("DELETE FROM " . TB_PREFIX . "forum_post WHERE alliance = $aid"); + +// --------------------------------------------------------------------------- +// Log admin - aceeași structură ca editUser +// --------------------------------------------------------------------------- +$time = time(); +$logText = "Deleted alliance ID $aid"; +$logEsc = $database->escape($logText); + +$database->query( + "INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " . + "VALUES (0, '$admid', '$logEsc', $time)" +); + +header("Location: ../../../Admin/admin.php?p=search&delali=1"); +exit; +?> \ No newline at end of file diff --git a/GameEngine/Admin/Mods/editAli.php b/GameEngine/Admin/Mods/editAli.php index 55800621..c7f5357f 100644 --- a/GameEngine/Admin/Mods/editAli.php +++ b/GameEngine/Admin/Mods/editAli.php @@ -1,53 +1,91 @@ isAdmin()){ - header("Location: ../../../Admin/admin.php"); +// --------------------------------------------------------------------------- +// Input +// --------------------------------------------------------------------------- +$admid = (int)($_POST['admid'] ?? 0); +$aid = (int)($_POST['aid'] ?? 0); + +if ($aid <= 0 || $admid <= 0) { + header("Location: ../../../Admin/admin.php?p=alliance&aid=$aid&e=bad"); exit; } -$aid = (int)($_POST['aid'] ?? 0); -$admid = (int)($_POST['admid'] ?? 0); - -// verificare sesiune -if($admid != $session->uid || $aid <= 0){ - die("Access denied"); +// --------------------------------------------------------------------------- +// Verificare admin - la fel ca editUser +// --------------------------------------------------------------------------- +$admin = $database->getUserArray($admid, 1); +if (!$admin || (int)$admin['access'] !== 9) { + die('

Access Denied: You are not Admin!

'); } -$tag = $database->escape(substr(trim($_POST['tag']), 0, 8)); -$name = $database->escape(substr(trim($_POST['name']), 0, 25)); -$leader = (int)$_POST['leader']; -$max = (int)$_POST['max']; -if($max < 3) $max = 3; -if($max > 60) $max = 60; +// --------------------------------------------------------------------------- +// Câmpuri +// --------------------------------------------------------------------------- +$tag = $database->escape(substr(trim($_POST['tag'] ?? ''), 0, 8)); +$name = $database->escape(substr(trim($_POST['name'] ?? ''), 0, 25)); +$leader = (int)($_POST['leader'] ?? 0); +$max = (int)($_POST['max'] ?? 0); +$max = max(3, min(60, $max)); +$notice = $database->escape($_POST['notice'] ?? ''); +$desc = $database->escape($_POST['desc'] ?? ''); -$notice = $database->escape($_POST['notice']); -$desc = $database->escape($_POST['desc']); +// --------------------------------------------------------------------------- +// Update +// --------------------------------------------------------------------------- +$database->query( + "UPDATE " . TB_PREFIX . "alidata SET + tag = '$tag', + name = '$name', + leader = $leader, + `max` = $max, + notice = '$notice', + `desc` = '$desc' + WHERE id = $aid" +); -// update alidata -$database->query("UPDATE ".TB_PREFIX."alidata SET - tag = '$tag', - name = '$name', - leader = $leader, - `max` = $max, - notice = '$notice', - `desc` = '$desc' -WHERE id = $aid"); +// --------------------------------------------------------------------------- +// Log admin - aceeași structură ca editUser +// --------------------------------------------------------------------------- +$time = time(); +$logText = "Edited alliance $tag"; +$logEsc = $database->escape($logText); -// log admin -$database->query("INSERT INTO ".TB_PREFIX."admin_log (uid, action, time) VALUES ($admid, 'Edited alliance $aid ($tag)', ".time().")"); +$database->query( + "INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " . + "VALUES (0, '$admid', '$logEsc', $time)" +); -// redirect inapoi header("Location: ../../../Admin/admin.php?p=alliance&aid=$aid&edited=1"); exit; ?> \ No newline at end of file