From e4658f250faa87dc77112de77e277d4fd14a7fc2 Mon Sep 17 00:00:00 2001 From: Ferywir <65760459+Ferywir@users.noreply.github.com> Date: Tue, 23 Jun 2026 10:06:03 +0200 Subject: [PATCH] fix(admin): route alliance management pages [#139] (#260) The alliance/editAli/delAli pages are linked all over the admin panel (?p=alliance&aid=, ?p=editAli, ?p=delAli) but were never in admin_validated_page()'s whitelist, so admin.php fell back to search.tpl and the pages never showed. Add them to the whitelist plus switch cases for the breadcrumb (the templates resolve $aid/$alidata themselves from $_GET, like editSitter/editPassword). Co-authored-by: Claude Opus 4.8 --- Admin/admin.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Admin/admin.php b/Admin/admin.php index 1a55e669..694f93aa 100644 --- a/Admin/admin.php +++ b/Admin/admin.php @@ -91,6 +91,7 @@ function admin_validated_page(string $raw): string 'editWeek', 'userlogin', 'userillegallog', 'editHero', 'editAdditional', 'village', 'editResources', 'addTroops', 'addABTroops', 'editVillage', 'villagelog', 'techlog', 'msg', + 'alliance', 'editAli', 'delAli', ]; return in_array($raw, $whitelist, true) ? $raw : ''; @@ -503,6 +504,37 @@ if ($page !== '') { } break; + // ── Alliance-context pages (require a valid ?aid=) ─────────────────── + case 'alliance': + $aid = admin_input_id($_GET, 'aid'); + if ($aid !== null) { + $alidata = $database->getAlliance($aid); + $subpage = $alidata ? 'Alliance (' . e($alidata['tag']) . ')' : 'Alliance (ID ' . $aid . ' not found)'; + } else { + $subpage = 'Alliance'; + } + break; + + case 'editAli': + $aid = admin_input_id($_GET, 'aid'); + if ($aid !== null) { + $alidata = $database->getAlliance($aid); + $subpage = $alidata ? 'Edit Alliance (' . e($alidata['tag']) . ')' : 'Edit Alliance'; + } else { + $subpage = 'Edit Alliance'; + } + break; + + case 'delAli': + $aid = admin_input_id($_GET, 'aid'); + if ($aid !== null) { + $alidata = $database->getAlliance($aid); + $subpage = $alidata ? 'Delete Alliance (' . e($alidata['tag']) . ')' : 'Delete Alliance'; + } else { + $subpage = 'Delete Alliance'; + } + break; + case 'villagelog': $did = admin_input_id($_GET, 'did'); if ($did !== null) {