Incremental Refactor Templates

Incremental Refactor Templates
This commit is contained in:
Catalin Novgorodschi
2026-05-06 13:16:54 +03:00
parent 544496c515
commit a02be51969
59 changed files with 7542 additions and 3364 deletions
+64 -13
View File
@@ -1,23 +1,74 @@
<?php if($session->alliance == $aid && $session->alliance > 0) {
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ (Refactor incremental) ##
## File: alli_menu.tpl ##
## Description: Alliance menu navigation ##
## Improvements: ##
## - Reduced duplication ##
## - Safer input handling ##
## - Cleaner structure ##
## - Added comments ##
#################################################################################
// Verifică dacă jucătorul este în alianța curentă
if ($session->alliance == $aid && $session->alliance > 0) {
// Preluăm parametrul "s" o singură dată (GET sau POST)
// Cast la int pentru siguranță
$s = 0;
if (isset($_GET['s'])) {
$s = (int)$_GET['s'];
} elseif (isset($_POST['s'])) {
$s = (int)$_POST['s'];
}
?>
<div id="textmenu">
<a href="allianz.php" <?php if(!isset($_GET['s']) && !isset($_POST['s'])) { echo "class=\"selected\""; } ?>>Overview</a>
| <a href="allianz.php?s=2" <?php if(isset($_GET['s']) && $_GET['s'] == 2) { echo "class=\"selected\""; } ?>>Forum</a>
| <a href="allianz.php?s=6" <?php if(isset($_GET['s']) && $_GET['s'] == 6) { echo "class=\"selected\""; } ?>>Chat</a>
| <a href="allianz.php?s=3" <?php if(isset($_GET['s']) && $_GET['s'] == 3) { echo "class=\"selected\""; } ?>>Attacks</a>
| <a href="allianz.php?s=4" <?php if(isset($_GET['s']) && $_GET['s'] == 4) { echo "class=\"selected\""; } ?>>News</a>
<!-- Overview -->
<a href="allianz.php" <?php if ($s === 0) { echo 'class="selected"'; } ?>>
Overview
</a>
| <!-- Forum -->
<a href="allianz.php?s=2" <?php if ($s === 2) { echo 'class="selected"'; } ?>>
Forum
</a>
| <!-- Chat -->
<a href="allianz.php?s=6" <?php if ($s === 6) { echo 'class="selected"'; } ?>>
Chat
</a>
| <!-- Attacks -->
<a href="allianz.php?s=3" <?php if ($s === 3) { echo 'class="selected"'; } ?>>
Attacks
</a>
| <!-- News -->
<a href="allianz.php?s=4" <?php if ($s === 4) { echo 'class="selected"'; } ?>>
News
</a>
<?php
if($session->sit == 0){
// Dacă NU este sitter are acces la Options
if ($session->sit == 0) {
?>
| <a href="allianz.php?s=5" <?php if(isset($_GET['s']) && $_GET['s'] == 5 || isset($_POST['s']) && $_POST['s']) { echo "class=\"selected\""; } ?>>Options</a>
| <!-- Options -->
<a href="allianz.php?s=5" <?php if ($s === 5) { echo 'class="selected"'; } ?>>
Options
</a>
<?php
}else{
} else {
?>
| <span class=none><b>Options</b></span>
<?php
}
| <!-- Options disabled for sitter -->
<span class="none"><b>Options</b></span>
<?php
}
?>
</div>
<?php
<?php
}
?>