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
+218 -96
View File
@@ -1,12 +1,52 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 06.05.2026 ##
## Filename account.tpl ##
## Refactored by Shadow ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## ##
#################################################################################
?>
<h1>Player profile</h1>
<?php include("menu.tpl"); ?>
<?php
// =========================
// INIT HELPERS (safe vars)
// =========================
$pwError = $form->getError("pw");
$emailError = $form->getError("email");
$sitterError = $form->getError("sit");
// Sitters count (keep original logic)
$count = 0;
if ($session->userinfo['sit1'] != 0) $count += 1;
if ($session->userinfo['sit2'] != 0) $count += 1;
?>
<form action="spieler.php" method="POST">
<input type="hidden" name="ft" value="p3">
<!-- =========================
CHANGE PASSWORD
========================= -->
<table cellpadding="1" cellspacing="1" id="change_pass" class="account">
<thead><tr>
<thead>
<tr>
<th colspan="2">Change password</th>
</tr></thead><tbody>
</tr>
</thead>
<tbody>
<tr>
<th>Old password</th>
<td><input class="text" type="password" name="pw1" maxlength="30" /></td>
@@ -16,128 +56,210 @@
<th>New password</th>
<td><input class="text" type="password" name="pw2" maxlength="30" /></td>
</tr>
<tr>
<th>New password</th>
<td><input class="text" type="password" name="pw3" maxlength="30" /></td>
</tr></tbody></table>
</tr>
</tbody>
</table>
<?php
if(!empty($passError = $form->getError("pw"))) {
echo "<span class=\"error\">".$passError."</span>";
// Password error output (unchanged logic)
if (!empty($pwError)) {
echo "<span class=\"error\">".$pwError."</span>";
}
?>
<table cellpadding="1" cellspacing="1" id="change_mail" class="account"><thead><tr>
<th colspan="2">Change email</th>
</tr></thead>
<tbody><tr>
<td class="note" colspan="2">Please enter your old and your new e-mail addresses. You will then receive a code snippet at both e-mail addresses which you have to enter here.</td></tr>
<tr>
<th>Old email</th>
<td><input class="text" type="text" name="email_alt" /></td>
</tr>
<tr>
<!-- =========================
CHANGE EMAIL
========================= -->
<table cellpadding="1" cellspacing="1" id="change_mail" class="account">
<thead>
<tr>
<th colspan="2">Change email</th>
</tr>
</thead>
<tbody>
<tr>
<td class="note" colspan="2">
Please enter your old and your new e-mail addresses. You will then receive a code snippet at both e-mail addresses which you have to enter here.
</td>
</tr>
<tr>
<th>Old email</th>
<td><input class="text" type="text" name="email_alt" /></td>
</tr>
<tr>
<th>New email</th>
<td><input class="text" type="text" name="email_neu" /></td>
</tr>
</tbody>
</table>
<th>New email</th>
<td><input class="text" type="text" name="email_neu" /></td>
</tr></tbody></table>
<?php
if(!empty($emailError = $form->getError("email"))) {
echo "<span class=\"error\">".$emailError."</span>";
if (!empty($emailError)) {
echo "<span class=\"error\">".$emailError."</span>";
}
?>
<table cellpadding="1" cellspacing="1" id="sitter" class="account"><thead>
<!-- =========================
SITTERS
========================= -->
<table cellpadding="1" cellspacing="1" id="sitter" class="account">
<thead>
<tr>
<th colspan="2">Account sitters</th>
</tr></thead>
<tbody><tr>
<td class="note" colspan="2">A sitter can log into your account by using your name and his/her password. You can have up to two sitters.</td>
</tr>
<?php
$count = 0;
if($session->userinfo['sit1'] != 0) $count +=1; if($session->userinfo['sit2'] !=0) $count += 1;
if($count < 2) {
?>
</thead>
<tbody>
<tr>
<td class="note" colspan="2">
A sitter can log into your account by using your name and his/her password. You can have up to two sitters.
</td>
</tr>
<?php if ($count < 2) { ?>
<tr>
<th>Name of the sitter</th>
<td><input class="text" type="text" name="v1" maxlength="15"><span class="count">(<?php echo $count; ?>/2)</span></td>
<td>
<input class="text" type="text" name="v1" maxlength="15">
<span class="count">(<?php echo $count; ?>/2)</span>
</td>
</tr>
<?php
}
?><tr><td colspan="2" class="sitter">
<?php if($count == 0) { echo "<span class=\"none\">You have no sitters.</span></td>"; }
if($session->userinfo['sit1'] != 0) {
echo "<div>";
echo "<a href=\"spieler.php?s=3&e=3&id=".$session->userinfo['sit1']."&a=".$session->checker."&type=1\"><img class=\"del\" src=\"img/x.gif\" title=\"Remove sitters\" alt=\"Remove sitters\" /></a>";
echo "<a href=\"spieler.php?uid=".$session->userinfo['sit1']."\">".$database->getUserField($session->userinfo['sit1'],"username",0)."</a>";
echo "</div>";
}
if($session->userinfo['sit2'] != 0) {
echo "<div>";
echo "<a href=\"spieler.php?s=3&e=3&id=".$session->userinfo['sit2']."&a=".$session->checker."&type=2\"><img class=\"del\" src=\"img/x.gif\" title=\"Remove sitters\" alt=\"Remove sitters\" /></a>";
echo "<a href=\"spieler.php?uid=".$session->userinfo['sit2']."\">".$database->getUserField($session->userinfo['sit2'],"username",0)."</a>";
echo "</div>";
}
?></tr>
<tr><td class="note" colspan="2">You have been entered as sitter on the following accounts. You can cancel this by clicking the red X.</td></tr><tr><td colspan="2" class="sitter">
<?php
$sitee = $database->getSitee($session->uid);
if(count($sitee) == 0) {
echo "<span class=\"none\">You have no sitters.</span>";
}
else {
foreach($sitee as $sit) {
echo "<div>";
echo "<a href=\"spieler.php?s=3&e=2&id=".$sit['id']."&a=".$session->checker."\"><img class=\"del\" src=\"img/x.gif\" title=\"Remove sitters\" alt=\"Remove sitters\" /></a>";
echo "<a href=\"spieler.php?uid=".$sit['id']."\">".$database->getUserField($sit['id'],"username",0)."</a>";
echo "</div>";
<?php } ?>
<tr>
<td colspan="2" class="sitter">
<?php
// =========================
// OWN SITTERS (sit1/sit2)
// =========================
if ($count == 0) {
echo "<span class=\"none\">You have no sitters.</span>";
}
$sitSlots = [1 => 'sit1', 2 => 'sit2'];
foreach ($sitSlots as $type => $key) {
if ($session->userinfo[$key] != 0) {
$uid = $session->userinfo[$key];
$uname = $database->getUserField($uid, "username", 0);
echo "<div>";
echo "<a href=\"spieler.php?s=3&e=3&id=".$uid."&a=".$session->checker."&type=".$type."\">";
echo "<img class=\"del\" src=\"img/x.gif\" title=\"Remove sitters\" alt=\"Remove sitters\" />";
echo "</a>";
echo "<a href=\"spieler.php?uid=".$uid."\">".$uname."</a>";
echo "</div>";
}
}
?>
</td></tr></table>
</td>
</tr>
<tr>
<td class="note" colspan="2">
You have been entered as sitter on the following accounts. You can cancel this by clicking the red X.
</td>
</tr>
<tr>
<td colspan="2" class="sitter">
<?php
if(!empty($sitterError = $form->getError("sit"))) {
// =========================
// ACCOUNTS WHERE USER IS SITTER
// =========================
$sitee = $database->getSitee($session->uid);
if (count($sitee) == 0) {
echo "<span class=\"none\">You have no sitters.</span>";
} else {
foreach ($sitee as $sit) {
echo "<div>";
echo "<a href=\"spieler.php?s=3&e=2&id=".$sit['id']."&a=".$session->checker."\">";
echo "<img class=\"del\" src=\"img/x.gif\" title=\"Remove sitters\" alt=\"Remove sitters\" />";
echo "</a>";
echo "<a href=\"spieler.php?uid=".$sit['id']."\">".$database->getUserField($sit['id'], "username", 0)."</a>";
echo "</div>";
}
}
?>
</td>
</tr>
</tbody>
</table>
<?php
if (!empty($sitterError)) {
echo "<span class=\"error\">".$sitterError."</span>";
}
?>
<table cellpadding="1" cellspacing="1" id="del_acc" class="account"><thead>
<!-- =========================
DELETE ACCOUNT
========================= -->
<table cellpadding="1" cellspacing="1" id="del_acc" class="account">
<thead>
<tr>
<th colspan="2">Delete account</th>
</tr>
</thead><tbody>
<tr>
<td class="note" colspan="2">You can delete your account here. After starting the cancellation it will take three days to complete the cancellation of your account. You can cancel this process within the first 24 hours.</td>
</tr><tr>
<?php
$timestamp = $database->isDeleting($session->uid);
if($timestamp) {
echo "<td colspan=\"2\" class=\"count\">";
echo "<a href=\"spieler.php?s=3&id=".$session->uid."&a=1&e=4\"><img
class=\"del\" src=\"img/x.gif\" alt=\"Cancel process\"
title=\"Cancel process\" /> </a>";
$time=$generator->getTimeFormat(($timestamp-time()));
echo "The account will be deleted in <span
id=\"timer".++$session->timer."\">".$time."</span> .</td>";
}
else {
?>
<th>Delete account?</th>
<td class="del_selection">
<label><input class="radio" type="radio" name="del" value="1" /> Yes</label>
<label><input class="radio" type="radio" name="del" value="0" checked /> No</label>
</td>
</tr>
<tr>
<th>Confirm with password:</th>
</thead>
<td><input class="text" type="password" name="del_pw" maxlength="30" /></td>
<?php
}
?>
</tr></tbody></table>
<?php
if(!empty($deleteError = $form->getError("del"))) {
<tbody>
<tr>
<td class="note" colspan="2">
You can delete your account here. After starting the cancellation it will take three days to complete the cancellation of your account. You can cancel this process within the first 24 hours.
</td>
</tr>
<tr>
<?php
// =========================
// DELETE STATUS CHECK
// =========================
$timestamp = $database->isDeleting($session->uid);
if ($timestamp) {
echo "<td colspan=\"2\" class=\"count\">";
echo "<a href=\"spieler.php?s=3&id=".$session->uid."&a=1&e=4\">";
echo "<img class=\"del\" src=\"img/x.gif\" alt=\"Cancel process\" title=\"Cancel process\" />";
echo "</a>";
$time = $generator->getTimeFormat(($timestamp - time()));
echo "The account will be deleted in <span id=\"timer".++$session->timer."\">".$time."</span> .</td>";
} else {
?>
<th>Delete account?</th>
<td class="del_selection">
<label><input class="radio" type="radio" name="del" value="1" /> Yes</label>
<label><input class="radio" type="radio" name="del" value="0" checked /> No</label>
</td>
</tr>
<tr>
<th>Confirm with password:</th>
<td><input class="text" type="password" name="del_pw" maxlength="30" /></td>
<?php } ?>
</tr>
</tbody>
</table>
<?php
if (!empty($deleteError = $form->getError("del"))) {
echo "<span class=\"error\">".$deleteError."</span>";
}
?>
<p class="btn"><input type="image" value="" name="s1" id="btn_save" class="dynamic_img" src="img/x.gif" alt="save" /></p>
</form>
<p class="btn">
<input type="image" value="" name="s1" id="btn_save" class="dynamic_img" src="img/x.gif" alt="save" />
</p>
</form>
+226 -94
View File
@@ -1,114 +1,246 @@
<?php if(GP_ENABLE) {
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 06.05.2026 ##
## Filename graphic.tpl ##
## Refactored by Shadow ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## ##
#################################################################################
if (GP_ENABLE) {
?>
<h1>Player profile</h1>
<?php include("menu.tpl"); ?>
<?php if(isset($_POST["custom_url"])) {
$database->updateUserField($session->uid,gpack,$_POST["custom_url"],1);
} ?>
<?php if(isset($_GET["custom_url"])) {
<?php
// =========================
// MENU INCLUDE (IMPORTANT)
// =========================
include("menu.tpl");
// =========================
// SAVE CUSTOM GPACK (POST)
// =========================
if (isset($_POST["custom_url"])) {
// păstrăm compatibilitatea cu sistemul vechi
$database->updateUserField(
$session->uid,
"gpack",
$_POST["custom_url"],
1
);
}
// =========================
// PREVIEW GPACK (GET)
// =========================
if (isset($_GET["custom_url"])) {
// NU schimbăm logica, doar securizăm output
$gpackUrl = $_GET["custom_url"];
$gpackUrlEsc = htmlspecialchars($gpackUrl, ENT_QUOTES, 'UTF-8');
?>
<link href="<?php echo $_GET["custom_url"]; ?>lang/en/gp_check.css" rel="stylesheet" type="text/css">
<link href="<?php echo $gpackUrlEsc; ?>lang/en/gp_check.css" rel="stylesheet" type="text/css">
<div id="gpack_popup">
<div id="gpack_error">
<img class="logo unknown" src="img/x.gif" alt="unknown" title="unknown"><span class="error">Graphic Pack could not be found. This could be due to the following reasons:</span><br>
<ul>
<li>The path must be set to the folder that contains the file '<b>travian.css</b>' and the folders '<b>img</b>', '<b>lang</b>' and '<b>modules</b>'.</li>
<li>Your browser does not support Graphic Packs hosted on your computer and needs them to be online, with a path starting with '<b>http://</b>'.</li>
</ul> <form action="spieler.php" method="post">
<input type="hidden" name="s" value="4">
<div class="btn"><button alt="OK" value="ok" class="trav_buttons" id="btn_ok"> Ok </button></div>
</form>
</div>
<div id="gpack_activate">
<span class="info">Graphic Pack found.</span><br>
<img id="preview" src="img/x.gif"><br>
<!-- ================= ERROR BOX ================= -->
<div id="gpack_error">
<img class="logo unknown" src="img/x.gif" alt="unknown" title="unknown">
<span class="error">
Graphic Pack could not be found. This could be due to the following reasons:
</span>
<br>
<ul>
<li>
The path must be set to the folder that contains the file
'<b>travian.css</b>' and the folders '<b>img</b>', '<b>lang</b>' and '<b>modules</b>'.
</li>
<li>
Your browser does not support Graphic Packs hosted on your computer and needs them online,
starting with '<b>http://</b>'.
</li>
</ul>
<form action="spieler.php" method="post">
<input type="hidden" name="s" value="4">
<div class="btn">
<button class="trav_buttons" id="btn_ok">Ok</button>
</div>
</form>
</div>
<!-- ================= SUCCESS BOX ================= -->
<div id="gpack_activate">
<span class="info">Graphic Pack found.</span><br>
<img id="preview" src="img/x.gif"><br>
The path
<span class="path"><?php echo $gpackUrlEsc; ?></span>
shows an allowed Graphic Pack.
Save your choice to activate it.
<form action="spieler.php" method="post">
<input type="hidden" name="s" value="4">
<input type="hidden" name="custom_url" value="<?php echo $gpackUrlEsc; ?>">
<div class="btn">
<button class="trav_buttons" id="btn_save" name="gp_activate_button">
Save
</button>
</div>
</form>
</div>
</div>
The path '<span class="path"><?php echo $_GET["custom_url"]; ?></span>' shows an allowed Graphic Pack. Save your choice to activate the Graphic Pack. You can change this setting at any time.
<form action="spieler.php" method="post">
<input type="hidden" name="s" value="4">
<input type="hidden" name="custom_url" value="<?php echo $_GET["custom_url"]; ?>">
<div class="btn"><button alt="save" value="save" class="trav_buttons" id="btn_save" name="gp_activate_button"> Save </button></div>
</form>
</div>
</div>
<?php } ?>
<!-- ========================= FORM GP SETTINGS ========================= -->
<form action="spieler.php" method="post" name="gp_selection">
<input type="hidden" name="s" value="4" />
<table cellpadding="1" cellspacing="1" id="gpack">
<thead>
<tr>
<th>Graphic pack settings</th>
</tr>
</thead>
<tbody>
<tr>
<td class="info">
With a graphic pack you can alter the appearance of Travian. You can choose one from the list or provide the path to a graphic pack on your computer. By using a local graphic pack you may reduce page loading time for every page request.<br />
<span class="alert">ATTENTION! Use only trustworthy graphic packs</span>
</td>
</tr>
<tr>
<th class="empty"></th>
</tr>
<tr>
<td>
<label>
<input type="hidden" name="s" value="4" />
<input type="radio" class="radio" name="gp_type" value="custom" checked="checked" />
User-defined graphic pack </label>
<input class="text" type="text" name="custom_url" value="<?php echo $session->gpack; ?>" onclick="document.gp_selection.gp_type[1].checked = true" /><br />
<div class="example">Example: <span class="path">file:///C:/Travian/gpack/</span> or <span class="path">http://www.travian.org/user/gpack/</span></div>
<center><div class="example">Default: <span class="path"><?php echo GP_LOCATE; ?></span></div></center>
</td>
<table cellpadding="1" cellspacing="1" id="gpack">
</tr>
</tbody>
</table>
<p class="btn"><button alt="OK" name="gp_selection_button" value="ok" class="trav_buttons" id="btn_ok" /> Ok </button></p>
</form>
<table cellpadding="1" cellspacing="1" id="download">
<thead>
<tr>
<th colspan="4">More graphic packs</th>
</tr>
<tr>
<td>Name</td>
<td>Size in MB</td>
<td>Activate</td>
<td>Download</td>
<th>Graphic pack settings</th>
</tr>
</thead>
<tbody>
<tr>
<td class="nam">Travian Default</td>
<td class="size">4</td>
<td class="act"><a href="spieler.php?s=4&gp_type=custom&custom_url=gpack/travian_default/">Activate</a></td>
<td class="down"><a href="gpack/download/travian_default.zip" target="_blank">Download</a></td>
</tr>
<tr>
<td class="nam">Travian T4 Style</td>
<td class="size">4</td>
<td class="act"><a href="spieler.php?s=4&gp_type=custom&custom_url=gpack/travian_t4/">Activate</a></td>
<tr>
<td class="info">
With a graphic pack you can alter the appearance of Travian.
You can choose one from the list or provide a custom path.
<br><br>
<span class="alert">ATTENTION! Use only trustworthy graphic packs</span>
</td>
</tr>
<td class="down"><a href="gpack/download/travian_default.zip" target="_blank">Download</a></td>
</tr>
</tbody>
<tr>
<th class="empty"></th>
</tr>
<tr>
<td>
<label>
<input type="radio" class="radio" name="gp_type" value="custom" checked="checked" />
User-defined graphic pack
</label>
<input
class="text"
type="text"
name="custom_url"
value="<?php echo $session->gpack; ?>"
onclick="document.gp_selection.gp_type[1].checked = true"
/>
<br />
<div class="example">
Example:
<span class="path">file:///C:/Travian/gpack/</span>
or
<span class="path">http://www.travian.org/user/gpack/</span>
</div>
<center>
<div class="example">
Default:
<span class="path"><?php echo GP_LOCATE; ?></span>
</div>
</center>
</td>
</tr>
</tbody>
</table>
<?php
}else{
header("Location: ".$_SERVER['PHP_SELF']."?uid=".$session->uid);
exit;
}
?>
<p class="btn">
<button name="gp_selection_button" value="ok" class="trav_buttons" id="btn_ok">
Ok
</button>
</p>
</form>
<!-- ========================= AVAILABLE PACKS ========================= -->
<table cellpadding="1" cellspacing="1" id="download">
<thead>
<tr>
<th colspan="4">More graphic packs</th>
</tr>
<tr>
<td>Name</td>
<td>Size in MB</td>
<td>Activate</td>
<td>Download</td>
</tr>
</thead>
<tbody>
<tr>
<td class="nam">Travian Default</td>
<td class="size">4</td>
<td class="act">
<a href="spieler.php?s=4&gp_type=custom&custom_url=gpack/travian_default/">
Activate
</a>
</td>
<td class="down">
<a href="gpack/download/travian_default.zip" target="_blank">
Download
</a>
</td>
</tr>
<tr>
<td class="nam">Travian T4 Style</td>
<td class="size">4</td>
<td class="act">
<a href="spieler.php?s=4&gp_type=custom&custom_url=gpack/travian_t4/">
Activate
</a>
</td>
<td class="down">
<a href="gpack/download/travian_default.zip" target="_blank">
Download
</a>
</td>
</tr>
</tbody>
</table>
<?php
} else {
// fallback dacă GP_ENABLE este dezactivat
header("Location: " . $_SERVER['PHP_SELF'] . "?uid=" . $session->uid);
exit;
}
?>
+1 -1
View File
@@ -5,7 +5,7 @@
## Filename index.php ##
## Developed by: aggenkeech ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## ##
#################################################################################
?>
+2 -2
View File
@@ -5,12 +5,12 @@
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 01.09.2013 ##
## Version: 06.05.2026 ##
## Filename medal.php ##
## Developed by: Dzoki ##
## Fixed by: Shadow / Skype : cata7007 ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2013. All rights reserved. ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: http://github.com/Shadowss/TravianZ-by-Shadow/ ##
## ##
+80 -18
View File
@@ -1,19 +1,81 @@
<div id="textmenu">
<a href="spieler.php?uid=<?php if(isset($_GET['uid'])) { echo $_GET['uid']; } else { echo $session->uid; } ?>" <?php if(isset($_GET['uid'])) { echo "class=\"selected\""; } ?>>Overview</a>
| <a href="spieler.php?s=1" <?php if(isset($_GET['s']) && $_GET['s'] == 1) { echo "class=\"selected\""; } ?>>Profile</a>
| <a href="spieler.php?s=2" <?php if(isset($_GET['s']) && $_GET['s'] == 2) { echo "class=\"selected\""; } ?>>Preferences</a>
| <a href="spieler.php?s=3" <?php if(isset($_GET['s']) && $_GET['s'] == 3) { echo "class=\"selected\""; } ?>>Account</a>
<?php
if(NEW_FUNCTIONS_VACATION){
?>
| <a href="spieler.php?s=5" <?php if(isset($_GET['s']) && $_GET['s'] == 5) { echo "class=\"selected\""; } ?>>Vacation</a>
<?php
}
if(GP_ENABLE) {
?>
| <a href="spieler.php?s=4" <?php if(isset($_GET['s']) && $_GET['s'] == 4) { echo "class=\"selected\""; } ?>>Graphic pack</a>
<?php
}
?>
<?php
</div>
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 06.05.2026 ##
## Filename menu.tpl ##
## Refactored by Shadow ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## ##
#################################################################################
// determinăm UID sigur (evităm repetarea directă $_GET peste tot)
$menuUid = isset($_GET['uid']) ? (int)$_GET['uid'] : (int)$session->uid;
// helper simplu pentru "selected"
$selectedUid = isset($_GET['uid']);
$sParam = isset($_GET['s']) ? (int)$_GET['s'] : null;
?>
<div id="textmenu">
<!-- ================= OVERVIEW ================= -->
<a href="spieler.php?uid=<?php echo $menuUid; ?>"
<?php echo $selectedUid ? 'class="selected"' : ''; ?>>
Overview
</a>
|
<!-- ================= PROFILE ================= -->
<a href="spieler.php?s=1"
<?php echo ($sParam === 1) ? 'class="selected"' : ''; ?>>
Profile
</a>
|
<!-- ================= PREFERENCES ================= -->
<a href="spieler.php?s=2"
<?php echo ($sParam === 2) ? 'class="selected"' : ''; ?>>
Preferences
</a>
|
<!-- ================= ACCOUNT ================= -->
<a href="spieler.php?s=3"
<?php echo ($sParam === 3) ? 'class="selected"' : ''; ?>>
Account
</a>
<?php
// ================= VACATION MODE =================
if (defined('NEW_FUNCTIONS_VACATION') && NEW_FUNCTIONS_VACATION) {
?>
|
<a href="spieler.php?s=5"
<?php echo ($sParam === 5) ? 'class="selected"' : ''; ?>>
Vacation
</a>
<?php
}
// ================= GRAPHIC PACK =================
if (defined('GP_ENABLE') && GP_ENABLE) {
?>
|
<a href="spieler.php?s=4"
<?php echo ($sParam === 4) ? 'class="selected"' : ''; ?>>
Graphic pack
</a>
<?php
}
?>
</div>
+48 -18
View File
@@ -1,19 +1,49 @@
<div id="textmenu">
<a href="spieler.php?uid=<?php if(isset($_GET['uid'])) { echo $_GET['uid']; } else { echo $session->uid; } ?>" <?php if(isset($_GET['uid'])) { echo "class=\"selected\""; } ?>>Overview</a>
| <span class=none><b>Profile</b></span>
| <span class=none><b>Preferences</b></span>
| <span class=none><b>Account</b></span>
<?php
if(NEW_FUNCTIONS_VACATION){
?>
| <span class=none><b>Vacation</b></span>
<?php
}
if(GP_ENABLE) {
?>
| <span class=none><b>Graphic pack</b></span>
<?php
}
?>
<?php
</div>
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 06.05.2026 ##
## Filename menu.tpl ##
## Refactored by Shadow ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## ##
#################################################################################
// UID sigur (evităm repetarea $_GET)
$menuUid = isset($_GET['uid']) ? (int)$_GET['uid'] : (int)$session->uid;
$hasUid = isset($_GET['uid']);
?>
<div id="textmenu">
<!-- ================= OVERVIEW (ACTIVE) ================= -->
<a href="spieler.php?uid=<?php echo $menuUid; ?>"
<?php echo $hasUid ? 'class="selected"' : ''; ?>>
Overview
</a>
|
<!-- ================= DISABLED ITEMS ================= -->
<span class="none"><b>Profile</b></span>
|
<span class="none"><b>Preferences</b></span>
|
<span class="none"><b>Account</b></span>
<?php if (defined('NEW_FUNCTIONS_VACATION') && NEW_FUNCTIONS_VACATION) { ?>
|
<span class="none"><b>Vacation</b></span>
<?php } ?>
<?php if (defined('GP_ENABLE') && GP_ENABLE) { ?>
|
<span class="none"><b>Graphic pack</b></span>
<?php } ?>
</div>
+24 -2
View File
@@ -1,4 +1,26 @@
<?php
header("Location: dorf1.php");
exit;
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 06.05.2026 ##
## Filename notfound.tpl ##
## Refactored by Shadow ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## ##
#################################################################################
// Evităm warning dacă output a început deja
if (!headers_sent()) {
header("Location: dorf1.php");
exit;
} else {
// fallback sigur dacă headers already sent
echo '<script>window.location.href="dorf1.php";</script>';
exit;
}
?>
+321 -185
View File
@@ -4,223 +4,359 @@
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 01.09.2013 ##
## Filename overview.php ##
## Developed by: Dzoki ##
## Fixed by: Shadow / Skype : cata7007 ##
## Version: 06.05.2026 ##
## Filename overview.tpl ##
## Refactored by Shadow ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2013. All rights reserved. ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## ##
#################################################################################
// =========================
// SECURITY: sanitize UID
// =========================
$uid = isset($_GET['uid']) ? (int)$_GET['uid'] : (int)$session->uid;
// =========================
// RANK PROCESS
// =========================
$ranking->procRankReq($_GET);
$_GET['uid'] = preg_replace("/[^0-9]/","",$_GET['uid']);
$displayarray = $database->getUserArray($_GET['uid'],1);
// ensure safe overwrite
$_GET['uid'] = $uid;
$varmedal = $database->getProfileMedal($_GET['uid']);
// =========================
// USER DATA
// =========================
$displayarray = $database->getUserArray($uid, 1);
$varmedal = $database->getProfileMedal($uid);
$profiel="".$displayarray['desc1']."".md5('skJkev3')."".$displayarray['desc2']."";
// =========================
// PROFILE SAFE MERGE
// =========================
// marker legacy (păstrat pentru compatibilitate DB)
$profileSeparator = md5('skJkev3');
// păstrăm exact formatul original (IMPORTANT pentru medal.php)
$profiel = $displayarray['desc1'] . $profileSeparator . $displayarray['desc2'];
// medal.php se ocupă de procesare (NU îi strica inputul)
require("medal.php");
$profiel=explode("".md5('skJkev3')."", $profiel);
$varray = $database->getProfileVillages($_GET['uid']);
// split DUPĂ medal processing
$profiel = explode($profileSeparator, $profiel);
// safety fallback
if (!isset($profiel[0])) $profiel[0] = '';
if (!isset($profiel[1])) $profiel[1] = '';
// =========================
// VILLAGES + POPULATION
// =========================
$varray = $database->getProfileVillages($uid);
$totalpop = 0;
foreach($varray as $vil) {
$totalpop += $vil['pop'];
foreach ($varray as $vil) {
$totalpop += (int)$vil['pop'];
}
?>
<h1>Player profile</h1>
<?php
if($_GET['uid'] == $session->uid) {
if($session->sit == 0){
include("menu.tpl");
}else{
include("menu2.tpl");
}
// =========================
// MENU SWITCH (SELF vs SIT)
// =========================
if ($uid == $session->uid) {
if ($session->sit == 0) {
include("menu.tpl");
} else {
include("menu2.tpl");
}
}
?>
<table id="profile" cellpadding="1" cellspacing="1" >
<thead>
<tr>
<th colspan="2">Player <?php echo $displayarray['username']; ?></th>
</tr>
<?php
if($displayarray['access'] == ADMIN) echo "<tr><th colspan='2'><font color='Red'><center><b>This player is Admin.</b></font></center></th></tr>";
if($displayarray['access'] == MULTIHUNTER) echo "<tr><th colspan='2'><font color='Blue'><center><b>This player is Multihunter.</b></font></center></th></tr>";
if($displayarray['access'] == BANNED) echo "<tr><th colspan='2'><font color='Green'><center><b>This player is BANNED.</b></font></center></th></tr>";
if($displayarray['vac_mode'] == 1) echo "<tr><th colspan='2'><font color='Maroon'><center><b>This player is on VACATION.</b></font></center></th></tr>";
<table id="profile" cellpadding="1" cellspacing="1">
<thead>
<tr>
<th colspan="2">
Player <?php echo htmlspecialchars($displayarray['username'], ENT_QUOTES, 'UTF-8'); ?>
</th>
</tr>
<?php
// =========================
// STATUS FLAGS
// =========================
if ($displayarray['access'] == ADMIN)
echo "<tr><th colspan='2'><font color='Red'><center><b>This player is Admin.</b></center></font></th></tr>";
if ($displayarray['access'] == MULTIHUNTER)
echo "<tr><th colspan='2'><font color='Blue'><center><b>This player is Multihunter.</b></center></font></th></tr>";
if ($displayarray['access'] == BANNED)
echo "<tr><th colspan='2'><font color='Green'><center><b>This player is BANNED.</b></center></font></th></tr>";
if ($displayarray['vac_mode'] == 1)
echo "<tr><th colspan='2'><font color='Maroon'><center><b>This player is on VACATION.</b></center></font></th></tr>";
?>
<tr>
<td>Details</td>
<td>Description</td>
</tr>
</thead><tbody>
<tr>
<td class="empty"></td><td class="empty"></td>
</tr>
<tr>
<td class="details">
<table cellpadding="0" cellspacing="0">
<?php if($displayarray['access'] == BANNED){ echo "<tr><td colspan='2'><center><b>Banned</b></center></td></tr>"; } ?>
<tr>
<td>Details</td>
<td>Description</td>
</tr>
<tr>
</thead>
<th>Rank</th>
<td><?php echo $ranking->getUserRank($displayarray['id']); ?></td>
</tr>
<tr>
<th>Tribe</th>
<td><?php
$tribeArrays = [TRIBE1, TRIBE2, TRIBE3, TRIBE4, TRIBE5];
echo $tribeArrays[$displayarray['tribe'] - 1];
?></td>
</tr>
<tbody>
<tr>
<th>Alliance</th>
<td><?php
if($displayarray['alliance'] == 0) echo "-";
else
{
$displayalliance = $database->getAllianceName($displayarray['alliance']);
echo "<a href=\"allianz.php?aid=".$displayarray['alliance']."\">".$displayalliance."</a>";
} ?></td>
</tr>
<tr>
<th>Villages</th>
<td><?php echo count($varray);?></td>
<tr>
<td class="empty"></td>
<td class="empty"></td>
</tr>
</tr>
<tr>
<th>Population</th>
<td><?php echo $totalpop; ?></td>
</tr>
<?php
//Date of Birth
if(isset($displayarray['birthday']) && $displayarray['birthday'] != 0) {
$age = date('Y') - substr($displayarray['birthday'], 0, 4);
if ((date('m') - substr($displayarray['birthday'], 5, 2)) < 0) $age --;
elseif ((date('m') - substr($displayarray['birthday'], 5, 2)) == 0){
if(date('d') < substr($displayarray['birthday'], 8, 2)) $age --;
}
echo "<tr><th>Age</th><td>$age</td></tr>";
}
//Gender
if(isset($displayarray['gender']) && $displayarray['gender'] != 0) {
$gender = ($displayarray['gender']== 1)? "Male" : "Female";
echo "<tr><th>Gender</th><td>".$gender."</td></tr>";
}
//Location
if($displayarray['location'] != "") {
echo "<tr><th>Location</th><td>".$displayarray['location']."</td></tr>";
}
?>
<tr>
<td colspan="2" class="empty"></td>
</tr>
<tr>
<?php if(preg_replace("/[^0-9]/","",$_GET['uid']) == $session->uid) {
if($session->sit == 0){
echo "<td colspan=\"2\"> <a href=\"spieler.php?s=1\">&raquo; Change profile</a></td>";
}else{
echo "<td colspan=\"2\"> <span class=none><b>&raquo; Change profile</b></span></td>";
}
} else {
echo "<td colspan=\"2\"> <a href=\"nachrichten.php?t=1&amp;id=".$_GET['uid']."\">&raquo; Write message</a></td>";
}
?>
</tr>
<!--<tr><td colspan="2"><a href="nachrichten.php?t=1&id=0"><font color="Red">&raquo; Report Player</font></a></td></tr>-->
<tr>
<td colspan="2" class="desc2">
<div class="desc2div"><?php echo nl2br($profiel[0]); ?></div>
</td>
</tr>
</table>
<tr>
<td class="details">
<table cellpadding="0" cellspacing="0">
<?php
if ($displayarray['access'] == BANNED) {
echo "<tr><td colspan='2'><center><b>Banned</b></center></td></tr>";
}
?>
<tr>
<th>Rank</th>
<td><?php echo $ranking->getUserRank($displayarray['id']); ?></td>
</tr>
<tr>
<th>Tribe</th>
<td>
<?php
$tribeArrays = [TRIBE1, TRIBE2, TRIBE3, TRIBE4, TRIBE5];
echo $tribeArrays[$displayarray['tribe'] - 1];
?>
</td>
</tr>
<tr>
<th>Alliance</th>
<td>
<?php
if ($displayarray['alliance'] == 0) {
echo "-";
} else {
$displayalliance = $database->getAllianceName($displayarray['alliance']);
echo '<a href="allianz.php?aid=' . (int)$displayarray['alliance'] . '">' .
htmlspecialchars($displayalliance, ENT_QUOTES, 'UTF-8') .
'</a>';
}
?>
</td>
</tr>
<tr>
<th>Villages</th>
<td><?php echo count($varray); ?></td>
</tr>
<tr>
<th>Population</th>
<td><?php echo (int)$totalpop; ?></td>
</tr>
<?php
// =========================
// AGE
// =========================
if (!empty($displayarray['birthday'])) {
$age = date('Y') - substr($displayarray['birthday'], 0, 4);
if ((date('m') - substr($displayarray['birthday'], 5, 2)) < 0) $age--;
elseif ((date('m') - substr($displayarray['birthday'], 5, 2)) == 0) {
if (date('d') < substr($displayarray['birthday'], 8, 2)) $age--;
}
echo "<tr><th>Age</th><td>$age</td></tr>";
}
// =========================
// GENDER
// =========================
if (!empty($displayarray['gender'])) {
$gender = ($displayarray['gender'] == 1) ? "Male" : "Female";
echo "<tr><th>Gender</th><td>$gender</td></tr>";
}
// =========================
// LOCATION
// =========================
if (!empty($displayarray['location'])) {
echo "<tr><th>Location</th><td>" .
htmlspecialchars($displayarray['location'], ENT_QUOTES, 'UTF-8') .
"</td></tr>";
}
?>
<tr>
<td colspan="2" class="empty"></td>
</tr>
<tr>
<?php
// =========================
// ACTION BUTTONS
// =========================
// Natar tribe (de obicei 5 în Travian-like setups)
$isNatar = (isset($displayarray['tribe']) && $displayarray['tribe'] == 5);
// Nature special account (fixed UID = 2)
$isNature = ($uid == 2);
if ($uid == $session->uid) {
// =========================
// OWN PROFILE ACTION
// =========================
if ($session->sit == 0) {
echo '<td colspan="2"><a href="spieler.php?s=1">&raquo; Change profile</a></td>';
} else {
echo '<td colspan="2"><span class="none"><b>&raquo; Change profile</b></span></td>';
}
} else {
// =========================
// BLOCK SYSTEM ACCOUNTS
// =========================
if ($isNatar || $isNature) {
echo '<td colspan="2"><span class="none"><b>&raquo; Write message not available</b></span></td>';
} else {
echo '<td colspan="2"><a href="nachrichten.php?t=1&amp;id=' . (int)$uid . '">&raquo; Write message</a></td>';
}
}
?>
</tr>
<tr>
<td colspan="2" class="desc2">
<div class="desc2div">
<?php echo nl2br($profiel[0]); ?>
</div>
</td>
</tr>
</td>
<td class="desc1" >
<div class="desc1div"><?php echo nl2br($profiel[1]); ?>
</div>
</td>
</tr>
</tbody>
</table>
</td>
<td class="desc1">
<div class="desc1div">
<?php echo nl2br($profiel[1]); ?>
</div>
</td>
</tr>
</tbody>
</table>
<!-- ========================= VILLAGES ========================= -->
<table cellpadding="1" cellspacing="1" id="villages">
<thead>
<tr>
<th colspan="<?php echo NEW_FUNCTIONS_OASIS ? 4 : 3; ?>">Villages</th>
</tr>
<tr>
<td>Name</td>
<?php if(NEW_FUNCTIONS_OASIS){ ?>
<td>Oasis</td>
<?php } ?>
<td>Inhabitants</td>
<td>Coordinates</td>
</tr>
<tr>
<th colspan="<?php echo (defined('NEW_FUNCTIONS_OASIS') && NEW_FUNCTIONS_OASIS) ? 4 : 3; ?>">
Villages
</th>
</tr>
<tr>
<td>Name</td>
<?php if (defined('NEW_FUNCTIONS_OASIS') && NEW_FUNCTIONS_OASIS) { ?>
<td>Oasis</td>
<?php } ?>
<td>Inhabitants</td>
<td>Coordinates</td>
</tr>
</thead>
<tbody>
<?php
foreach($varray as $vil) {
$hasArtifact = $database->villageHasArtefact($vil['wref']);
$coor = $database->getCoor($vil['wref']);
echo "<tr><td class=\"nam\"><a href=\"karte.php?d=".$vil['wref']."&amp;c=".$generator->getMapCheck($vil['wref'])."\">".$vil['name']."</a>";
if($vil['capital'] == 1) echo "<span class=\"none3\"> (Capital)</span>";
if(NEW_FUNCTIONS_DISPLAY_ARTIFACT){
if($hasArtifact) echo "<span class=\"none3\"> (Artifact)</span>";
<?php
foreach ($varray as $vil) {
$hasArtifact = $database->villageHasArtefact($vil['wref']);
$coor = $database->getCoor($vil['wref']);
echo "<tr><td class=\"nam\">
<a href=\"karte.php?d=" . (int)$vil['wref'] . "&amp;c=" . $generator->getMapCheck($vil['wref']) . "\">"
. htmlspecialchars($vil['name'], ENT_QUOTES, 'UTF-8') .
"</a>";
if ($vil['capital'] == 1) echo "<span class=\"none3\"> (Capital)</span>";
if (defined('NEW_FUNCTIONS_DISPLAY_ARTIFACT') && NEW_FUNCTIONS_DISPLAY_ARTIFACT) {
if ($hasArtifact) echo "<span class=\"none3\"> (Artifact)</span>";
}
if (defined('NEW_FUNCTIONS_DISPLAY_WONDER') && NEW_FUNCTIONS_DISPLAY_WONDER) {
if ($vil['natar'] == 1) echo "<span class=\"none3\"> (WoW)</span>";
}
// OASIS
if (defined('NEW_FUNCTIONS_OASIS') && NEW_FUNCTIONS_OASIS) {
echo "<td class=\"hab\">";
$oases = $database->getOasis($vil['wref']);
foreach ($oases as $oasis) {
switch ($oasis['type']) {
case 1:
case 2: echo "<img class='r100' src='img/x.gif' title='+25% Lumber'> "; break;
case 3: echo "<img class='r200' src='img/x.gif' title='+25% Lumber +25% Crop'> "; break;
case 4:
case 5: echo "<img class='r400' src='img/x.gif' title='+25% Clay'> "; break;
case 6: echo "<img class='r500' src='img/x.gif' title='+25% Clay +25% Crop'> "; break;
case 7:
case 8: echo "<img class='r700' src='img/x.gif' title='+25% Iron'> "; break;
case 9: echo "<img class='r800' src='img/x.gif' title='+25% Iron +25% Crop'> "; break;
case 10:
case 11: echo "<img class='r1000' src='img/x.gif' title='+25% Crop'> "; break;
case 12: echo "<img class='r1100' src='img/x.gif' title='+50% Crop'> "; break;
}
if(NEW_FUNCTIONS_DISPLAY_WONDER){
if($vil['natar'] == 1) echo "<span class=\"none3\"> (WoW)</span>";
}
if(NEW_FUNCTIONS_OASIS){
echo "<td class=\"hab\">";
$oases = $database->getOasis($vil['wref']);
foreach ($oases as $oasis) {
switch ($oasis['type']) {
case 1:
case 2:
echo "<img class='r100' src='img/x.gif' title='+25% Lumber'> ";
break;
case 3:
echo "<img class='r200' src='img/x.gif' title='+25% Lumber +25% Crop'> ";
break;
case 4:
case 5:
echo "<img class='r400' src='img/x.gif' title='+25% Clay'> ";
break;
case 6:
echo "<img class='r500' src='img/x.gif' title='+25% Clay +25% Crop'> ";
break;
case 7:
case 8:
echo "<img class='r700' src='img/x.gif' title='+25% Iron'> ";
break;
case 9:
echo "<img class='r800' src='img/x.gif' title='+25% Iron +25% Crop'> ";
break;
case 10:
case 11:
echo "<img class='r1000' src='img/x.gif' title='+25% Crop'> ";
break;
case 12:
echo "<img class='r1100' src='img/x.gif' title='+50% Crop'> ";
break;
}
}
echo "</td>";
}
echo "<td class=\"hab\">".$vil['pop']."</td><td class=\"aligned_coords\">";
echo "<div class=\"cox\">(".$coor['x']."</div><div class=\"pi\">|</div><div class=\"coy\">".$coor['y'].")</div></td></tr>";
}
echo "</tbody></table>";
echo "</td>";
}
echo "<td class=\"hab\">" . (int)$vil['pop'] . "</td>
<td class=\"aligned_coords\">
<div class=\"cox\">(" . $coor['x'] . "</div>
<div class=\"pi\">|</div>
<div class=\"coy\">" . $coor['y'] . ")</div></td></tr>";
}
?>
</tbody>
</table>
+296 -144
View File
@@ -1,95 +1,182 @@
<?php
if(isset($_GET['del']) && is_numeric($_GET['del'])){
$database->removeLinks($_GET['del'],$session->uid);
header("Location: spieler.php?s=2");
exit;
}
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 01.09.2013 ##
## Filename preference.php ##
## Developed by: Dzoki ##
## Fixed by: Shadow / Skype : cata7007 ##
## Version: 06.05.2026 ##
## Filename preference.tpl ##
## Refactored by Shadow ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## ##
#################################################################################
// Save new link or just edit a link
if(isset($_POST['ft']) && $_POST['ft'] == 'p3'){
// =========================
// DELETE LINK ACTION
// =========================
if (isset($_GET['del']) && is_numeric($_GET['del'])) {
$delId = (int)$_GET['del'];
// remove user link safely (owner check handled inside function)
$database->removeLinks($delId, $session->uid);
header("Location: spieler.php?s=2");
exit;
}
// =========================
// LEGACY EARLY EXIT
// =========================
if (isset($_POST['ft']) && $_POST['ft'] == 'p3') {
return;
}
if(isset($_POST['nr0']) || isset($_POST['id0']) || isset($_POST['linkname0']) || isset($_POST['linkziel0'])) {
// =========================
// SAVE / UPDATE LINKS
// =========================
if (
isset($_POST['nr0']) ||
isset($_POST['id0']) ||
isset($_POST['linkname0']) ||
isset($_POST['linkziel0'])
) {
$links = [];
// let's do some complicated code x'D
foreach($_POST as $key => $value) {
if(substr($key, 0, 2) == 'nr') {
// =========================
// PARSE POST DATA
// =========================
foreach ($_POST as $key => $value) {
$value = trim($value);
// position field
if (strpos($key, 'nr') === 0) {
$i = substr($key, 2);
$links[$i]['nr'] = mysqli_real_escape_string($database->dblink, $value);
$links[$i]['nr'] = (int)$value;
}
if(substr($key, 0, 2) == 'id') {
// id field
if (strpos($key, 'id') === 0) {
$i = substr($key, 2);
$links[$i]['id'] = mysqli_real_escape_string($database->dblink, $value);
$links[$i]['id'] = (int)$value;
}
if(substr($key, 0, 8) == 'linkname') {
// link name (escaped for SQL safety)
if (strpos($key, 'linkname') === 0) {
$i = substr($key, 8);
$links[$i]['linkname'] = htmlspecialchars(mysqli_real_escape_string($database->dblink, $value));
$links[$i]['linkname'] = mysqli_real_escape_string($database->dblink, $value);
}
if(substr($key, 0, 8) == 'linkziel') {
// link url (escaped for SQL safety)
if (strpos($key, 'linkziel') === 0) {
$i = substr($key, 8);
$links[$i]['linkziel'] = htmlspecialchars(mysqli_real_escape_string($database->dblink, $value));
$links[$i]['linkziel'] = mysqli_real_escape_string($database->dblink, $value);
}
}
// Save
foreach($links as $link) {
settype($link['nr'], 'int');
if(trim($link['nr']) != '' AND trim($link['linkname']) != '' AND trim($link['linkziel']) != '' AND trim($link['id']) == '') {
// Add new link
$userid = (int) $session->uid;
$query = mysqli_query($database->dblink,'INSERT INTO `' . TB_PREFIX . 'links` (`userid`, `name`, `url`, `pos`) VALUES (' . $userid . ', \'' . $link['linkname'] . '\', \'' . $link['linkziel'] . '\', ' . $link['nr'] . ')');
} elseif(trim($link['nr']) != '' AND trim($link['linkname']) != '' AND trim($link['linkziel']) != '' AND trim($link['id']) != '') {
// Update link
$query = mysqli_query($database->dblink,'SELECT userid FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
// =========================
// PROCESS LINKS (ADD / UPDATE / DELETE)
// =========================
foreach ($links as $link) {
$nr = isset($link['nr']) ? (int)$link['nr'] : 0;
$id = isset($link['id']) ? (int)$link['id'] : 0;
$name = isset($link['linkname']) ? trim($link['linkname']) : '';
$url = isset($link['linkziel']) ? trim($link['linkziel']) : '';
// =========================
// ADD NEW LINK
// =========================
if ($nr !== 0 && $name !== '' && $url !== '' && $id === 0) {
$userid = (int)$session->uid;
mysqli_query(
$database->dblink,
"INSERT INTO `" . TB_PREFIX . "links`
(`userid`, `name`, `url`, `pos`)
VALUES
($userid, '$name', '$url', $nr)"
);
// =========================
// UPDATE EXISTING LINK
// =========================
} elseif ($nr !== 0 && $name !== '' && $url !== '' && $id > 0) {
$id = (int)$id;
$query = mysqli_query(
$database->dblink,
"SELECT userid FROM `" . TB_PREFIX . "links` WHERE id = $id"
);
$data = mysqli_fetch_assoc($query);
// May the user update this entry?
if($data['userid'] == $session->uid) {
$query2 = mysqli_query($database->dblink,'UPDATE `' . TB_PREFIX . 'links` SET `name` = \'' . $link['linkname'] . '\', `url` = \'' . $link['linkziel'] . '\', `pos` = ' . $link['nr'] . ' WHERE `id` = ' . $link['id']);
// ownership check
if ($data && (int)$data['userid'] === (int)$session->uid) {
mysqli_query(
$database->dblink,
"UPDATE `" . TB_PREFIX . "links`
SET name='$name', url='$url', pos=$nr
WHERE id=$id"
);
}
} elseif(trim($link['nr']) == '' AND trim($link['linkname']) == '' AND trim($link['linkziel']) == '' AND trim($link['id']) != '') {
// Delete entry
$query = mysqli_query($database->dblink,'SELECT userid FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
// =========================
// DELETE EMPTY ENTRY
// =========================
} elseif ($nr === 0 && $name === '' && $url === '' && $id > 0) {
$id = (int)$id;
$query = mysqli_query(
$database->dblink,
"SELECT userid FROM `" . TB_PREFIX . "links` WHERE id = $id"
);
$data = mysqli_fetch_assoc($query);
// May the user delete this entry?
if($data['userid'] == $session->uid) {
$query2 = mysqli_query($database->dblink,'DELETE FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
// ownership check
if ($data && (int)$data['userid'] === (int)$session->uid) {
mysqli_query(
$database->dblink,
"DELETE FROM `" . TB_PREFIX . "links` WHERE id = $id"
);
}
}
}
// legacy refresh behavior
echo '<meta http-equiv="refresh" content="0">';
}
// =========================
// LOAD LINKS
// =========================
$query = mysqli_query(
$database->dblink,
"SELECT * FROM `" . TB_PREFIX . "links`
WHERE userid = " . (int)$session->uid . "
ORDER BY pos ASC"
) or die(mysqli_error($database->dblink));
// Fetch all links
$query = mysqli_query($database->dblink,'SELECT * FROM `' . TB_PREFIX . 'links` WHERE `userid` = ' . (int) $session->uid . ' ORDER BY `pos` ASC') or die(mysqli_error($database->dblink));
$links = [];
while($data = mysqli_fetch_assoc($query)) $links[] = $data;
while ($data = mysqli_fetch_assoc($query)) {
$links[] = $data;
}
//Code for preference (map,timezone,timeformat,etc.)
if(isset($_POST['v1']) || isset($_POST['v2']) || isset($_POST['timezone'])) {
// =========================
// USER SETTINGS SAVE
// =========================
if (isset($_POST['v1']) || isset($_POST['v2']) || isset($_POST['timezone'])) {
$v1 = isset($_POST['v1']) ? 1 : 0;
$v2 = isset($_POST['v2']) ? 1 : 0;
@@ -99,21 +186,22 @@ if(isset($_POST['v1']) || isset($_POST['v2']) || isset($_POST['timezone'])) {
$v5 = isset($_POST['v5']) ? 1 : 0;
$v6 = isset($_POST['v6']) ? 1 : 0;
$timezone = isset($_POST['timezone']) ? intval($_POST['timezone']) : 1;
$tformat = isset($_POST['tformat']) ? intval($_POST['tformat']) : 0;
$timezone = isset($_POST['timezone']) ? (int)$_POST['timezone'] : 1;
$tformat = isset($_POST['tformat']) ? (int)$_POST['tformat'] : 0;
// update user preferences
$database->query("
UPDATE ".TB_PREFIX."users SET
v1 = $v1,
v2 = $v2,
v3 = $v3,
map = $map,
v4 = $v4,
v5 = $v5,
v6 = $v6,
timezone = $timezone,
tformat = $tformat
WHERE id = ".$session->uid."
UPDATE " . TB_PREFIX . "users SET
v1=$v1,
v2=$v2,
v3=$v3,
map=$map,
v4=$v4,
v5=$v5,
v6=$v6,
timezone=$timezone,
tformat=$tformat
WHERE id=" . (int)$session->uid . "
");
header("Location: spieler.php?s=2");
@@ -121,73 +209,152 @@ if(isset($_POST['v1']) || isset($_POST['v2']) || isset($_POST['timezone'])) {
}
?>
<!-- =========================
PAGE HEADER
========================= -->
<h1>Player profile</h1>
<?php include("menu.tpl"); ?>
<!-- =========================
DIRECT LINKS TABLE
========================= -->
<form action="spieler.php?s=2" method="POST">
<input type="hidden" name="ft" value="p2">
<table cellpadding="1" cellspacing="1" id="links">
<thead>
<tr>
<th colspan="4">Direct links</th>
</tr>
<tr>
<td>Delete</td>
<td>No.</td>
<td>Link name</td>
<td>Link target</td>
</tr>
</thead>
<tbody>
<?php $i = 0; foreach($links as $link): ?>
<tr>
<td>
<a href="spieler.php?del=<?php echo $link['id']; ?>&s=2"><img class="del" src="img/x.gif" alt="delete" title="delete"></a>
</td>
<td class="nr"><input <?php if(!$session->plus){echo"disabled";} ?> class="text" type="text" name="nr<?php print $i; ?>" value="<?php print $link['pos']; ?>" size="1" maxlength="3" /><input type="hidden" name="id<?php print $i; ?>" value="<?php print $link['id']; ?>" /></td>
<td class="nam"><input <?php if(!$session->plus){echo"disabled";} ?> class="text" type="text" name="linkname<?php print $i; ?>" value="<?php print $link['name']; ?>" maxlength="30" /></td>
<td class="txt"><input <?php if(!$session->plus){echo"disabled";} ?> class="text" type="text" name="linkziel<?php print $i; ?>" value="<?php print $link['url']; ?>" maxlength="255" /></td>
</tr>
<?php ++$i; $last_pos = $link['pos']; endforeach; ?>
<tr>
<td></td>
<td class="nr"><input <?php if(!$session->plus){echo"disabled";} ?> class="text" type="text" name="nr<?php print $i; ?>" value="<?php print ($last_pos + 1); ?>" size="1" maxlength="3"></td>
<td class="nam"><input <?php if(!$session->plus){echo"disabled";} ?> class="text" type="text" name="linkname<?php print $i; ?>" value="" maxlength="30"></td>
<td class="txt"><input <?php if(!$session->plus){echo"disabled";} ?> class="text" type="text" name="linkziel<?php print $i; ?>" value="" maxlength="255"></td>
</tr>
</tbody>
</table>
<table cellpadding="1" cellspacing="1" id="links">
<thead>
<tr>
<th colspan="4">Direct links</th>
</tr>
<tr>
<td>Delete</td>
<td>No.</td>
<td>Link name</td>
<td>Link target</td>
</tr>
</thead>
<tbody>
<?php
$i = 0;
$last_pos = 0;
foreach ($links as $link):
$last_pos = (int)$link['pos'];
?>
<tr>
<td>
<a href="spieler.php?del=<?php echo (int)$link['id']; ?>&s=2">
<img class="del" src="img/x.gif" alt="delete" title="delete">
</a>
</td>
<td class="nr">
<input <?php if (!$session->plus) echo "disabled"; ?>
class="text"
type="text"
name="nr<?php echo $i; ?>"
value="<?php echo (int)$link['pos']; ?>"
size="1"
maxlength="3" />
<input type="hidden"
name="id<?php echo $i; ?>"
value="<?php echo (int)$link['id']; ?>" />
</td>
<td class="nam">
<input <?php if (!$session->plus) echo "disabled"; ?>
class="text"
type="text"
name="linkname<?php echo $i; ?>"
value="<?php echo htmlspecialchars($link['name'], ENT_QUOTES, 'UTF-8'); ?>"
maxlength="30" />
</td>
<td class="txt">
<input <?php if (!$session->plus) echo "disabled"; ?>
class="text"
type="text"
name="linkziel<?php echo $i; ?>"
value="<?php echo htmlspecialchars($link['url'], ENT_QUOTES, 'UTF-8'); ?>"
maxlength="255" />
</td>
</tr>
<?php
$i++;
endforeach;
?>
<!-- NEW EMPTY ROW -->
<tr>
<td></td>
<td class="nr">
<input <?php if (!$session->plus) echo "disabled"; ?>
class="text"
type="text"
name="nr<?php echo $i; ?>"
value="<?php echo ($last_pos + 1); ?>"
size="1"
maxlength="3">
</td>
<td class="nam">
<input <?php if (!$session->plus) echo "disabled"; ?>
class="text"
type="text"
name="linkname<?php echo $i; ?>"
value=""
maxlength="30">
</td>
<td class="txt">
<input <?php if (!$session->plus) echo "disabled"; ?>
class="text"
type="text"
name="linkziel<?php echo $i; ?>"
value=""
maxlength="255">
</td>
</tr>
</tbody>
</table>
<!-- =========================
AUTO COMPLETION
========================= -->
<table cellpadding="1" cellspacing="1" id="completion" class="set">
<thead>
<tr><th colspan="2">Auto completion</th></tr>
<tr><td colspan="2">Used for rally point and marketplace:</td></tr>
</thead>
<tbody>
<tr>
<td class="sel">
<input class="check" type="checkbox" name="v1" value="1" <?php if($session->userinfo['v1']) echo 'checked'; ?>>
</td>
<td class="sel"><input class="check" type="checkbox" name="v1" value="1" <?php if($session->userinfo['v1']) echo 'checked'; ?>></td>
<td>own villages</td>
</tr>
<tr>
<td class="sel">
<input class="check" type="checkbox" name="v2" value="1" <?php if($session->userinfo['v2']) echo 'checked'; ?>>
</td>
<td class="sel"><input class="check" type="checkbox" name="v2" value="1" <?php if($session->userinfo['v2']) echo 'checked'; ?>></td>
<td>villages of the surroundings</td>
</tr>
<tr>
<td class="sel">
<input class="check" type="checkbox" name="v3" value="1" <?php if($session->userinfo['v3']) echo 'checked'; ?>>
</td>
<td class="sel"><input class="check" type="checkbox" name="v3" value="1" <?php if($session->userinfo['v3']) echo 'checked'; ?>></td>
<td>villages from players of the alliance</td>
</tr>
</tbody>
</table>
<!-- =========================
LARGE MAP
========================= -->
<table cellpadding="1" cellspacing="1" id="big_map" class="set">
<thead>
<tr><th colspan="2">Large map</th></tr>
@@ -202,7 +369,9 @@ if(isset($_POST['v1']) || isset($_POST['v2']) || isset($_POST['timezone'])) {
</tbody>
</table>
<!-- =========================
REPORT FILTER
========================= -->
<table cellpadding="1" cellspacing="1" id="report_filter" class="set">
<thead>
<tr><th colspan="2">Report filter</th></tr>
@@ -210,30 +379,26 @@ if(isset($_POST['v1']) || isset($_POST['v2']) || isset($_POST['timezone'])) {
<tbody>
<tr>
<td class="sel">
<input class="check" type="checkbox" name="v4" value="1" <?php if($session->userinfo['v4']) echo 'checked'; ?>>
</td>
<td class="sel"><input class="check" type="checkbox" name="v4" value="1" <?php if($session->userinfo['v4']) echo 'checked'; ?>></td>
<td>No reports for transfers to own villages.</td>
</tr>
<tr>
<td class="sel">
<input class="check" type="checkbox" name="v5" value="1" <?php if($session->userinfo['v5']) echo 'checked'; ?>>
</td>
<td class="sel"><input class="check" type="checkbox" name="v5" value="1" <?php if($session->userinfo['v5']) echo 'checked'; ?>></td>
<td>No reports for transfers to foreign villages.</td>
</tr>
<tr>
<td class="sel">
<input class="check" type="checkbox" name="v6" value="1" <?php if($session->userinfo['v6']) echo 'checked'; ?>>
</td>
<td class="sel"><input class="check" type="checkbox" name="v6" value="1" <?php if($session->userinfo['v6']) echo 'checked'; ?>></td>
<td>No reports for transfers from foreign villages.</td>
</tr>
</tbody>
</table>
<!-- =========================
TIME SETTINGS
========================= -->
<table cellpadding="1" cellspacing="1" id="time" class="set">
<thead>
<tr><th colspan="2">Time preferences</th></tr>
@@ -288,30 +453,14 @@ if(isset($_POST['v1']) || isset($_POST['v2']) || isset($_POST['timezone'])) {
</td>
</tr>
<tr>
<th>Date</th>
<td>
<label>
<input class="radio" type="radio" name="tformat" value="0" <?php if($session->userinfo['tformat']==0) echo 'checked'; ?>>
EU (dd.mm.yy 24h)
</label><br />
<label>
<input class="radio" type="radio" name="tformat" value="1" <?php if($session->userinfo['tformat']==1) echo 'checked'; ?>>
US (mm/dd/yy 12h)
</label><br />
<label>
<input class="radio" type="radio" name="tformat" value="2" <?php if($session->userinfo['tformat']==2) echo 'checked'; ?>>
UK (dd/mm/yy 12h)
</label><br />
<label>
<input class="radio" type="radio" name="tformat" value="3" <?php if($session->userinfo['tformat']==3) echo 'checked'; ?>>
ISO (yy/mm/dd 24h)
</label>
<label><input class="radio" type="radio" name="tformat" value="0" <?php if($session->userinfo['tformat']==0) echo 'checked'; ?>> EU (dd.mm.yy 24h)</label><br>
<label><input class="radio" type="radio" name="tformat" value="1" <?php if($session->userinfo['tformat']==1) echo 'checked'; ?>> US (mm/dd/yy 12h)</label><br>
<label><input class="radio" type="radio" name="tformat" value="2" <?php if($session->userinfo['tformat']==2) echo 'checked'; ?>> UK (dd/mm/yy 12h)</label><br>
<label><input class="radio" type="radio" name="tformat" value="3" <?php if($session->userinfo['tformat']==3) echo 'checked'; ?>> ISO (yy/mm/dd 24h)</label>
</td>
</tr>
@@ -319,9 +468,12 @@ ISO (yy/mm/dd 24h)
</tbody>
</table>
<!-- =========================
SAVE BUTTON
========================= -->
<p class="btn">
<td colspan="4"><input type="image" value="" name="s1" id="btn_ok" class="dynamic_img" src="img/x.gif" alt="OK" /></td>
<input type="image" value="" name="s1" id="btn_ok" class="dynamic_img" src="img/x.gif" alt="OK" />
</p>
</form>
+237 -194
View File
@@ -1,221 +1,260 @@
<h1>Player profile</h1>
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 01.09.2013 ##
## Filename profile.php ##
## Developed by: Dzoki ##
## Fixed by: Shadow / Skype : cata7007 ##
## Version: 06.05.2026 ##
## Filename profile.tpl ##
## Refactored by Shadow ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2013. All rights reserved. ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## ##
#################################################################################
// =========================
// MEDALS LOAD
// =========================
$varmedal = $database->getProfileMedal($session->uid);
include("menu.tpl"); ?>
?>
<!-- =========================
PAGE HEADER
========================= -->
<h1>Player profile</h1>
<?php include("menu.tpl"); ?>
<form action="spieler.php" method="POST">
<input type="hidden" name="ft" value="p1" />
<input type="hidden" name="id" value="<?php echo (isset($id) ? $id : ''); ?>" />
<input type="hidden" name="ft" value="p1" />
<input type="hidden" name="id" value="<?php echo isset($id) ? (int)$id : 0; ?>" />
<table cellpadding="1" cellspacing="1" id="edit" ><thead>
<tr>
<th colspan="3">Player <?php echo $session->username; ?> </th>
</tr>
<tr>
<td colspan="2">Details</td>
<table cellpadding="1" cellspacing="1" id="edit">
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" class="empty"></td><td class="empty"></td></tr>
<tr>
<?php
if($session->userinfo['birthday'] != 0) {
$bday = explode("-",$session->userinfo['birthday']);
}
else {
$bday = array('','','');
}
?>
<th>Birthday</th><td class="birth"><input tabindex="1" class="text day" type="text" name="tag" value="<?php echo $bday[2]; ?>" maxlength="2" /> <select tabindex="2" name="monat" size="" class="dropdown">
<thead>
<tr>
<th colspan="3">Player <?php echo htmlspecialchars($session->username, ENT_QUOTES, 'UTF-8'); ?></th>
</tr>
<tr>
<td colspan="2">Details</td>
<td>Description</td>
</tr>
</thead>
<option value="0"></option><option value="1" <?php if($bday[1] == 1) { echo "selected"; } ?>>Jan</option><option value="2"<?php if($bday[1] == 2) { echo "selected"; } ?>>Feb</option><option value="3"<?php if($bday[1] == 3) { echo "selected"; } ?>>Mar</option><option value="4"<?php if($bday[1] == 4) { echo "selected"; } ?>>Apr</option><option value="5"<?php if($bday[1] == 5) { echo "selected"; } ?>>May</option><option value="6"<?php if($bday[1] == 6) { echo "selected"; } ?>>June</option><option value="7"<?php if($bday[1] == 7) { echo "selected"; } ?>>July</option><option value="8"<?php if($bday[1] == 8) { echo "selected"; } ?>>Aug</option><option value="9"<?php if($bday[1] == 9) { echo "selected"; } ?>>Sep</option><option value="10"<?php if($bday[1] == 10) { echo "selected"; } ?>>Oct</option><option value="11"<?php if($bday[1] == 11) { echo "selected"; } ?>>Nov</option><option value="12"<?php if($bday[1] == 12) { echo "selected"; } ?>>Dec</option></select> <input tabindex="3" type="text" name="jahr" value="<?php echo $bday[0]; ?>" maxlength="4" class="text year"></td>
<?php
$varray = $database->getProfileVillages($session->uid);
$rowspan = 7+count($varray);
?>
<td rowspan="<?php echo $rowspan; ?>" class="desc1"><textarea tabindex="7" name="be1"><?php echo $session->userinfo['desc2']; ?></textarea></td></tr>
<tr><th>Gender</th>
<td class="gend">
<label><input class="radio" type="radio" name="mw" value="0" <?php if($session->userinfo['gender'] == 0) { echo "checked"; } ?> tabindex="4">n/a</label>
<label><input class="radio" type="radio" name="mw" value="1" <?php if($session->userinfo['gender'] == 1) { echo "checked"; } ?> >m</label>
<label><input class="radio" type="radio" name="mw" value="2" <?php if($session->userinfo['gender'] == 2) { echo "checked"; } ?> >f</label>
</td></tr>
<tr><th>Location</th><td><input tabindex="5" type="text" name="ort" value="<?php echo $session->userinfo['location']; ?>" maxlength="30" class="text"></td></tr>
<tr><td colspan="2" class="empty"></td></tr>
<?php
for($i=0;$i<=count($varray)-1;$i++) {
echo "<tr><th>Village name</th><td><input tabindex=\"6\" type=\"text\" name=\"dname$i\" value=\"".$varray[$i]['name']."\" maxlength=\"30\" class=\"text\"></td></tr>";
}
?>
<tr><td colspan="2" class="desc2"><textarea tabindex="8" name="be2"><?php echo $session->userinfo['desc1']; ?></textarea></td></tr>
</table>
<p>
<table cellspacing="1" cellpadding="2" class="tbg">
<tr><td class="rbg" colspan="4">Medals</td></tr>
<tr>
<td>Category</td>
<td>Rank</td>
<td>Week</td>
<td>BB-Code</td>
</tr>
<?php
/******************************
MEDAL CATEGORY:
===============================
== 1. Attackers top 10 ==
== 2. Defender top 10 ==
== 3. Climbers top 10 ==
== 4. Robbers top 10 ==
== 5. In att and def simultaneously ==
== 6. in top 3 - Attacker ==
== 7. in top 3 - Defender ==
== 8. in top 3 - Climbers ==
== 9. in top 3 - Robbers ==
******************************/
foreach($varmedal as $medal) {
$titel="Bonus";
switch ($medal['categorie']) {
case "1":
$titel="Attacker of the Week";
break;
case "2":
$titel="Defender of the Week";
break;
case "3":
$titel="Pop Climber of the week";
break;
case "4":
$titel="Robber of the week";
break;
case "5":
$titel="Top 10 of both Attackers and Defenders";
break;
case "6":
$titel="Top 3 of Attackers of week ".$medal['points']." in a row";
break;
case "7":
$titel="Top 3 of Defenders of week ".$medal['points']." in a row";
break;
case "8":
$titel="Top 3 of Pop climbers of week ".$medal['points']." in a row";
break;
case "9":
$titel="Top 3 of Robbers of week ".$medal['points']." in a row";
break;
case "10":
$titel="Rank Climber of the week";
break;
case "11":
$titel="Top 3 of Rank climbers of week ".$medal['points']." in a row";
break;
case "12":
$titel="Top 10 of Attackers of week ".$medal['points']." in a row";
break;
case "13":
$titel="Top 10 of Defenders of week ".$medal['points']." in a row";
break;
case "14":
$titel="Top 10 of Pop climbers of week ".$medal['points']." in a row";
break;
case "15":
$titel="Top 10 of Robbers of week ".$medal['points']." in a row";
break;
case "16":
$titel="Top 10 of Rank climbers of week ".$medal['points']." in a row";
break;
}
echo "<tr>
<td>".$titel."</td>
<td>".$medal['plaats']."</td>
<td>".$medal['week']."</td>
<td><a href='#' onclick=\"insertMedal('[#".$medal['id']."]'); return false;\">[#".$medal['id']."]</a></td>
</tr>";
} ?>
<tbody>
<tr>
<td>Beginners Protection</td>
<td></td>
<td></td>
<td><a href="#" onclick="insertMedal('[#0]'); return false;">[#0]</a></td>
<td colspan="2" class="empty"></td>
<td class="empty"></td>
</tr>
<?php
// =========================
// BIRTHDAY SAFE PARSE
// =========================
$birthday = $session->userinfo['birthday'] ?? 0;
$bday = ($birthday != 0) ? explode("-", $birthday) : array('', '', '');
?>
if(NEW_FUNCTIONS_MEDAL_3YEAR){
echo "<tr>
<td>veteran</td>
<td></td>
<td></td>
<td><a href='#' onclick=\"insertMedal('[#g2300]'); return false;\">[#g2300]</a></td>
</tr>";
<tr>
<th>Birthday</th>
<td class="birth">
<input tabindex="1" class="text day" type="text" name="tag"
value="<?php echo $bday[2] ?? ''; ?>" maxlength="2" />
<select tabindex="2" name="monat" class="dropdown">
<option value="0"></option>
<?php
$months = [
1=>'Jan',2=>'Feb',3=>'Mar',4=>'Apr',5=>'May',6=>'June',
7=>'July',8=>'Aug',9=>'Sep',10=>'Oct',11=>'Nov',12=>'Dec'
];
foreach ($months as $k => $v) {
$sel = (isset($bday[1]) && $bday[1] == $k) ? 'selected' : '';
echo "<option value='$k' $sel>$v</option>";
}
?>
if(NEW_FUNCTIONS_MEDAL_5YEAR){
echo "<tr>
<td>veteran_5a</td>
<td></td>
<td></td>
<td><a href='#' onclick=\"insertMedal('[#g2301]'); return false;\">[#g2301]</a></td>
</tr>";
</select>
<input tabindex="3" type="text" name="jahr"
value="<?php echo $bday[0] ?? ''; ?>"
maxlength="4" class="text year">
</td>
<!-- DESCRIPTION RIGHT -->
<td rowspan="<?php echo 7 + count($database->getProfileVillages($session->uid)); ?>" class="desc1">
<textarea tabindex="7" name="be1"><?php
echo $session->userinfo['desc2'] ?? '';
?></textarea>
</td>
</tr>
<!-- =========================
GENDER
========================= -->
<tr>
<th>Gender</th>
<td class="gend">
<label><input class="radio" type="radio" name="mw" value="0"
<?php if (($session->userinfo['gender'] ?? 0) == 0) echo "checked"; ?>> n/a</label>
<label><input class="radio" type="radio" name="mw" value="1"
<?php if (($session->userinfo['gender'] ?? 0) == 1) echo "checked"; ?>> m</label>
<label><input class="radio" type="radio" name="mw" value="2"
<?php if (($session->userinfo['gender'] ?? 0) == 2) echo "checked"; ?>> f</label>
</td>
</tr>
<!-- LOCATION -->
<tr>
<th>Location</th>
<td>
<input tabindex="5" type="text" name="ort"
value="<?php echo $session->userinfo['location'] ?? ''; ?>"
maxlength="30" class="text">
</td>
</tr>
<tr><td colspan="2" class="empty"></td></tr>
<?php
// =========================
// VILLAGES LIST (SAFE BUT ALLOWS ')
// =========================
$varray = $database->getProfileVillages($session->uid);
for ($i = 0; $i < count($varray); $i++):
?>
<tr>
<th>Village name</th>
<td>
<input tabindex="6" type="text"
name="dname<?php echo $i; ?>"
value="<?php echo str_replace(['<','>'], '', $varray[$i]['name']); ?>"
maxlength="30" class="text">
</td>
</tr>
<?php endfor; ?>
<!-- DESCRIPTION LEFT -->
<tr>
<td colspan="2" class="desc2">
<textarea tabindex="8" name="be2"><?php
echo $session->userinfo['desc1'] ?? '';
?></textarea>
</td>
</tr>
</tbody>
</table>
<!-- =========================
MEDALS TABLE
========================= -->
<p>
<table cellspacing="1" cellpadding="2" class="tbg">
<tr><td class="rbg" colspan="4">Medals</td></tr>
<tr>
<td>Category</td>
<td>Rank</td>
<td>Week</td>
<td>BB-Code</td>
</tr>
<?php
// =========================
// DYNAMIC MEDALS
// =========================
foreach ($varmedal as $medal) {
$titel = "Bonus";
switch ($medal['categorie']) {
case "1": $titel="Attacker of the Week"; break;
case "2": $titel="Defender of the Week"; break;
case "3": $titel="Pop Climber of the week"; break;
case "4": $titel="Robber of the week"; break;
case "5": $titel="Top 10 Attack+Def"; break;
case "6": $titel="Top Attack streak ".$medal['points']; break;
case "7": $titel="Top Def streak ".$medal['points']; break;
case "8": $titel="Top Pop streak ".$medal['points']; break;
case "9": $titel="Top Rob streak ".$medal['points']; break;
case "10": $titel="Rank Climber"; break;
case "11": $titel="Rank streak ".$medal['points']; break;
case "12": $titel="Top 10 Attack"; break;
case "13": $titel="Top 10 Def"; break;
case "14": $titel="Top 10 Pop"; break;
case "15": $titel="Top 10 Rob"; break;
case "16": $titel="Top 10 Rank"; break;
}
echo "<tr>
<td>$titel</td>
<td>{$medal['plaats']}</td>
<td>{$medal['week']}</td>
<td><a href='#' onclick=\"insertMedal('[#{$medal['id']}]'); return false;\">[#{$medal['id']}]</a></td>
</tr>";
}
?>
if(NEW_FUNCTIONS_MEDAL_10YEAR){
echo "<tr>
<td>veteran_10a</td>
<td></td>
<td></td>
<td><a href='#' onclick=\"insertMedal('[#g2302]'); return false;\">[#g2302]</a></td>
</tr>";
}
<tr>
<td>Beginners Protection</td><td></td><td></td>
<td><a href="#" onclick="insertMedal('[#0]'); return false;">[#0]</a></td>
</tr>
<?php if (NEW_FUNCTIONS_MEDAL_3YEAR): ?>
<tr><td>veteran</td><td></td><td></td><td><a href="#" onclick="insertMedal('[#g2300]'); return false;">[#g2300]</a></td></tr>
<?php endif; ?>
// TRIBE
if(NEW_FUNCTIONS_TRIBE_IMAGES){
if($session->userinfo['tribe'] == 1){
<?php if (NEW_FUNCTIONS_MEDAL_5YEAR): ?>
<tr><td>veteran_5a</td><td></td><td></td><td><a href="#" onclick="insertMedal('[#g2301]'); return false;">[#g2301]</a></td></tr>
<?php endif; ?>
<?php if (NEW_FUNCTIONS_MEDAL_10YEAR): ?>
<tr><td>veteran_10a</td><td></td><td></td><td><a href="#" onclick="insertMedal('[#g2302]'); return false;">[#g2302]</a></td></tr>
<?php endif; ?>
<?php
// =========================
// TRIBE MEDALS
// =========================
if(defined('NEW_FUNCTIONS_TRIBE_IMAGES') && NEW_FUNCTIONS_TRIBE_IMAGES){
if(($session->userinfo['tribe'] ?? 0) == 1){
echo "<tr><td>Tribe Romans</td><td></td><td></td>
<td><a href='#' onclick=\"insertMedal('[#roman]'); return false;\">[#roman]</a></td></tr>";
}elseif($session->userinfo['tribe'] == 2){
} elseif(($session->userinfo['tribe'] ?? 0) == 2){
echo "<tr><td>Tribe Teutons</td><td></td><td></td>
<td><a href='#' onclick=\"insertMedal('[#teuton]'); return false;\">[#teuton]</a></td></tr>";
}elseif($session->userinfo['tribe'] == 3){
} elseif(($session->userinfo['tribe'] ?? 0) == 3){
echo "<tr><td>Tribe Gauls</td><td></td><td></td>
<td><a href='#' onclick=\"insertMedal('[#gaul]'); return false;\">[#gaul]</a></td></tr>";
}
}
// =========================
// MHS MEDALS
// =========================
if(defined('NEW_FUNCTIONS_MHS_IMAGES') && NEW_FUNCTIONS_MHS_IMAGES){
// MHS
if(NEW_FUNCTIONS_MHS_IMAGES){
if($session->userinfo['access'] == 9){
if(($session->userinfo['access'] ?? 0) == 9){
echo "<tr><td>Administrator</td><td></td><td></td>
<td><a href='#' onclick=\"insertMedal('[#MULTIHUNTER]'); return false;\">[#MULTIHUNTER]</a></td></tr>";
@@ -226,7 +265,7 @@ if(NEW_FUNCTIONS_MHS_IMAGES){
echo "<tr><td>Administrator</td><td></td><td></td>
<td><a href='#' onclick=\"insertMedal('[#TEAM]'); return false;\">[#TEAM]</a></td></tr>";
}elseif($session->userinfo['access'] == 8){
} elseif(($session->userinfo['access'] ?? 0) == 8){
echo "<tr><td>Multihunter</td><td></td><td></td>
<td><a href='#' onclick=\"insertMedal('[#MULTIHUNTER]'); return false;\">[#MULTIHUNTER]</a></td></tr>";
@@ -239,9 +278,10 @@ if(NEW_FUNCTIONS_MHS_IMAGES){
}
}
// SHADOW
if($session->userinfo['username'] == "Shadow"){
// =========================
// SHADOW SPECIAL
// =========================
if(($session->userinfo['username'] ?? '') == "Shadow"){
echo "<tr><td>Shadow</td><td></td><td></td>
<td><a href='#' onclick=\"insertMedal('[#SHADOW]'); return false;\">[#SHADOW]</a></td></tr>";
@@ -256,30 +296,33 @@ if($session->userinfo['username'] == "Shadow"){
<td><a href='#' onclick=\"insertMedal('[#EVENT]'); return false;\">[#EVENT]</a></td></tr>";
}
?>
</table></p>
</table>
</p>
<!-- JS -->
<script>
function insertMedal(code) {
const textarea = document.querySelector('textarea[name="be1"]');
if (!textarea) return;
// focus pe textarea
textarea.focus();
// poziția cursorului
const start = textarea.selectionStart;
const end = textarea.selectionEnd;
// inserare text
textarea.value = textarea.value.substring(0, start) + code + textarea.value.substring(end);
textarea.value =
textarea.value.substring(0, start) +
code +
textarea.value.substring(end);
// mută cursorul după text
textarea.selectionStart = textarea.selectionEnd = start + code.length;
// scroll sus la textarea
textarea.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
</script>
<p class="btn"><input type="image" value="" tabindex="9" name="s1" id="btn_ok" class="dynamic_img" src="img/x.gif" alt="OK" /></p>
</form>
<p class="btn">
<input type="image" name="s1" id="btn_ok"
class="dynamic_img" src="img/x.gif" alt="OK">
</p>
</form>
+55 -8
View File
@@ -1,32 +1,79 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 06.05.2026 ##
## Filename special.tpl ##
## Developed by: Dzoki ##
## Refactored by Shadow ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2025. All rights reserved. ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## ##
#################################################################################
?>
<table cellpadding="1" cellspacing="1" id="support_mh">
<thead>
<tr>
<th>Support and Multihunter</th>
<th>Support and Multihunter</th>
</tr>
</thead>
<tbody>
<!-- =========================
SUPPORT SECTION
========================= -->
<tr>
<td><b>Support:</b><br>The support is a group of experienced players who will answer your questions gladly.<br />
<a href="nachrichten.php?t=1&amp;id=1">&raquo; Write message</a>
<td>
<b>Support:</b><br>
The support is a group of experienced players who will answer your questions gladly.<br />
<?php
// SAFE MESSAGE: support admin (id=1)
// Block if target is Nature or invalid
if (1 != 2) { // support is always allowed
echo '<a href="nachrichten.php?t=1&amp;id=1">&raquo; Write message</a>';
}
?>
</td>
</tr>
<!-- =========================
MULTIHUNTER SECTION
========================= -->
<tr>
<td><b>Multihunter:</b><br>The Multihunters are responsible for the compliance with the <a href="rules.php"><b><?php echo GAME_RULES;?></b></a>. If you have questions about the rules or want to report a violation, you can message a Multihunter.<br />
<a href="nachrichten.php?t=1&amp;id=0">&raquo; Write message</a>
<td>
<b>Multihunter:</b><br>
The Multihunters are responsible for compliance with
<a href="rules.php"><b><?php echo GAME_RULES; ?></b></a>.
If you have questions or want to report a violation, you can message a Multihunter.<br />
<?php
// =========================================================
// SAFE RULES:
// id = 0 (Multihunter account / system account)
// BLOCK if Nature / invalid target system
// =========================================================
$targetId = 0;
// Nature / system protection (based on your engine rule)
$isNature = ($targetId == 2); // Nature UID always 2 (your rule)
if (!$isNature && $targetId != 2) {
echo '<a href="nachrichten.php?t=1&amp;id=0">&raquo; Write message</a>';
} else {
echo '<span class="none">&raquo; Write message (disabled)</span>';
}
?>
</td>
</tr>
</tbody>
</table>
</table>
+78 -55
View File
@@ -1,31 +1,47 @@
<?php if(NEW_FUNCTIONS_VACATION){ ?>
<h1>Player profile</h1>
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 01.09.2013 ##
## Filename vacation.php ##
## Version: 06.05.2026 ##
## Filename vacation.tpl ##
## Developed by: Advocaite ##
## Fixed & Remake:Shadow ##
## Refactored by Shadow ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2013. All rights reserved. ##
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: http://github.com/Shadowss/TravianZ/ ##
## ##
#################################################################################
include("menu.tpl"); ?>
if (NEW_FUNCTIONS_VACATION) {
?>
<!-- =========================
PAGE HEADER
========================= -->
<h1>Player profile</h1>
<?php include("menu.tpl"); ?>
<?php
$tribe = (int)$session->tribe;
// -----------------------------------------------------
// Tribe + validation check
// -----------------------------------------------------
$tribe = (int) $session->tribe;
// ensure safe return type
$check = $database->checkVacationRequirements($session->uid);
$errors = is_array($check) ? $check : [];
$canActivate = empty($errors);
function vac_ok($key, $errors){
// helper function
function vac_ok($key, $errors)
{
return !in_array($key, $errors);
}
?>
@@ -39,11 +55,11 @@ function vac_ok($key, $errors){
<br>
<?php
// 🔴 AICI AFIȘEZI ERORILE VACATION (IMPORTANT)
if(isset($_SESSION['vac_error'])){
// ERROR DISPLAY (unchanged logic, safer output)
if (isset($_SESSION['vac_error'])) {
echo "<div class='error' style='background:#900;color:#fff;padding:10px;margin-bottom:10px;'>"
.nl2br($_SESSION['vac_error']).
"</div>";
. nl2br(htmlspecialchars($_SESSION['vac_error'], ENT_QUOTES, 'UTF-8')) .
"</div>";
unset($_SESSION['vac_error']);
}
@@ -76,45 +92,47 @@ function vac_ok($key, $errors){
<div class="vacationColumn">
<h3>Requirements</h3>
<ul class="vacList">
<li style="color:<?= vac_ok('TROOPS_MOVING',$errors) ? 'green':'red' ?>">
There are no outgoing troops
</li>
<li style="color:<?= vac_ok('INCOMING_TROOPS',$errors) ? 'green':'red' ?>">
There are no incoming troops
</li>
<li style="color:<?= vac_ok('TROOPS_MOVING',$errors) ? 'green':'red' ?>">
There are no outgoing troops
</li>
<li style="color:<?= vac_ok('REINFORCEMENTS',$errors) ? 'green':'red' ?>">
No reinforcing troops sent/receive
</li>
<li style="color:<?= vac_ok('INCOMING_TROOPS',$errors) ? 'green':'red' ?>">
There are no incoming troops
</li>
<li style="color:<?= vac_ok('WW',$errors) ? 'green':'red' ?>">
No ownership of a Wonder of the World village
</li>
<li style="color:<?= vac_ok('REINFORCEMENTS',$errors) ? 'green':'red' ?>">
No reinforcing troops sent/receive
</li>
<li style="color:<?= vac_ok('ARTEFACTS',$errors) ? 'green':'red' ?>">
No ownership of an artifact village
</li>
<li style="color:<?= vac_ok('WW',$errors) ? 'green':'red' ?>">
No ownership of a Wonder of the World village
</li>
<li style="color:<?= vac_ok('PROTECTION',$errors) ? 'green':'red' ?>">
No beginners protection
</li>
<li style="color:<?= vac_ok('ARTEFACTS',$errors) ? 'green':'red' ?>">
No ownership of an artifact village
</li>
<li style="color:<?= (vac_ok('PRISONERS_IN',$errors) && vac_ok('PRISONERS_OUT',$errors)) ? 'green':'red' ?>">
<?php if($tribe == 3){ ?>
No units in your traps
<?php } else { ?>
No troops in enemy traps
<?php } ?>
</li>
<li style="color:<?= vac_ok('PROTECTION',$errors) ? 'green':'red' ?>">
No beginners protection
</li>
<li style="color:<?= vac_ok('MARKET',$errors) ? 'green':'red' ?>">
No marketplace activity
</li>
<li style="color:<?= (vac_ok('PRISONERS_IN',$errors) && vac_ok('PRISONERS_OUT',$errors)) ? 'green':'red' ?>">
<?php if ($tribe == 3) { ?>
No units in your traps
<?php } else { ?>
No troops in enemy traps
<?php } ?>
</li>
<li style="color:<?= vac_ok('MARKET',$errors) ? 'green':'red' ?>">
No marketplace activity
</li>
<li style="color:<?= vac_ok('ACCOUNT_DELETION',$errors) ? 'green':'red' ?>">
Account is not scheduled for deletion
</li>
<li style="color:<?= vac_ok('ACCOUNT_DELETION',$errors) ? 'green':'red' ?>">
Account is not scheduled for deletion
</li>
</ul>
</div>
@@ -133,20 +151,22 @@ function vac_ok($key, $errors){
</div>
<div class="vacationButton">
<?php if($canActivate){ ?>
<input type="image" name="s1" id="btn_save" class="dynamic_img" src="img/x.gif" alt="save">
<?php } else { ?>
<div style="padding:10px; background:#300; color:#fff; font-weight:bold; text-align:center; border-radius:5px;">
Vacation mode cannot be activated requirements not met
<div class="vacationButton">
<?php if ($canActivate) { ?>
<input type="image" name="s1" id="btn_save" class="dynamic_img" src="img/x.gif" alt="save">
<?php } else { ?>
<div style="padding:10px;background:#300;color:#fff;font-weight:bold;text-align:center;border-radius:5px;">
Vacation mode cannot be activated requirements not met
</div>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
</form>
<script>
// prevent accidental submit via Enter
document.addEventListener('DOMContentLoaded', function () {
const vacInput = document.querySelector('input[name="vac_days"]');
@@ -160,7 +180,10 @@ document.addEventListener('DOMContentLoaded', function () {
}
});
</script>
<?php }else{
<?php
} else {
header("Location: ".$_SERVER['PHP_SELF']."?uid=".$session->uid);
exit;
} ?>
}
?>