mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-03 11:04:24 +00:00
Code requirements for vacation
Code requirements for vacation Vacation function is fully functional
This commit is contained in:
+1
-18
@@ -81,7 +81,6 @@ class Account {
|
||||
else if(User::exists($database,$_POST['name'])) {
|
||||
$form->addError("name",USRNM_TAKEN);
|
||||
}
|
||||
|
||||
}
|
||||
if(!isset($_POST['pw']) || trim($_POST['pw']) == "") {
|
||||
$form->addError("pw",PW_EMPTY);
|
||||
@@ -116,8 +115,6 @@ class Account {
|
||||
$form->addError("invt",$_POST['invited']);
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $_POST;
|
||||
|
||||
|
||||
header("Location: anmelden.php");
|
||||
exit;
|
||||
}
|
||||
@@ -144,7 +141,6 @@ class Account {
|
||||
["", $_POST['invited']],
|
||||
1
|
||||
);
|
||||
|
||||
$this->generateBase($_POST['kid'], $uid, $_POST['name']);
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
@@ -155,7 +151,6 @@ class Account {
|
||||
|
||||
private function Activate() {
|
||||
global $database;
|
||||
|
||||
if(START_DATE < date('d.m.Y') or START_DATE == date('d.m.Y') && START_TIME <= date('H:i'))
|
||||
{
|
||||
$q = "SELECT act, username, password, email, tribe, location FROM ".TB_PREFIX."activate where act = '".$database->escape($_POST['id'])."'";
|
||||
@@ -185,7 +180,6 @@ class Account {
|
||||
|
||||
private function Unreg() {
|
||||
global $database;
|
||||
|
||||
$q = "SELECT password, username FROM ".TB_PREFIX."activate where id = ".(int) $_POST['id'];
|
||||
$result = mysqli_query($database->dblink,$q);
|
||||
$dbarray = mysqli_fetch_array($result);
|
||||
@@ -202,7 +196,6 @@ class Account {
|
||||
|
||||
private function Login() {
|
||||
global $database, $session, $form;
|
||||
|
||||
$user = $_POST['user'];
|
||||
if(!isset($_POST['user']) || empty($_POST['user'])){
|
||||
$form->addError("user", $user);
|
||||
@@ -222,15 +215,10 @@ class Account {
|
||||
}
|
||||
else $form->addError("pw", LOGIN_PW_ERROR);
|
||||
}
|
||||
|
||||
$userData = $database->getUserArray($_POST['user'], 0);
|
||||
|
||||
// Vacation mode by Shadow
|
||||
if($userData["vac_mode"] == 1 && $userData["vac_time"] > time()){
|
||||
$form->addError("vacation", "Vacation mode is still enabled");
|
||||
}
|
||||
|
||||
// Vacation mode by Shadow
|
||||
if($form->returnErrors() > 0){
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $_POST;
|
||||
@@ -238,9 +226,7 @@ class Account {
|
||||
header("Location: login.php");
|
||||
exit();
|
||||
}else{
|
||||
// Vacation mode by Shadow
|
||||
$database->removevacationmode($userData['id']);
|
||||
// Vacation mode by Shadow
|
||||
if($database->login($_POST['user'], $_POST['pw'])){
|
||||
$database->UpdateOnline("login", $_POST['user'], time(), $userData['id']);
|
||||
}else if($database->sitterLogin($_POST['user'], $_POST['pw'])){
|
||||
@@ -252,8 +238,7 @@ class Account {
|
||||
}
|
||||
|
||||
private function Logout() {
|
||||
global $session, $database;
|
||||
|
||||
global $session, $database;
|
||||
unset($_SESSION['wid']);
|
||||
$database->activeModify(addslashes($session->username),1);
|
||||
$database->UpdateOnline("logout") or die(mysqli_error($database->dblink));
|
||||
@@ -268,10 +253,8 @@ class Account {
|
||||
function generateBase($kid, $uid, $username) {
|
||||
global $database;
|
||||
$message = new Message();
|
||||
|
||||
if($kid == 0) $kid = rand(1,4);
|
||||
else $kid = $_POST['kid'];
|
||||
|
||||
$database->generateVillages([['wid' => 0, 'mode' => 0, 'type' => 3, 'kid' => $kid, 'capital' => 1, 'pop' => 2, 'name' => null, 'natar' => 0]], $uid, $username);
|
||||
$message->sendWelcome($uid, $username);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ class Alliance {
|
||||
|
||||
public function procAlliance($get) {
|
||||
global $session, $database;
|
||||
|
||||
if($session->alliance > 0) {
|
||||
$this->allianceArray = $database->getAlliance($session->alliance);
|
||||
// Permissions Array
|
||||
@@ -57,7 +56,6 @@ class Alliance {
|
||||
$this->inviteArray = $database->getInvitation($session->uid);
|
||||
$this->gotInvite = count($this->inviteArray) > 0;
|
||||
}
|
||||
|
||||
if(isset($get['a'])) {
|
||||
switch($get['a']) {
|
||||
case 2:
|
||||
@@ -86,7 +84,6 @@ class Alliance {
|
||||
|
||||
public function isForumAccessible($forumID){
|
||||
global $session;
|
||||
|
||||
//Loop through the shared forums and try to find the passed one
|
||||
foreach($session->sharedForums as $forums){
|
||||
foreach($forums as $forum){
|
||||
@@ -105,9 +102,7 @@ class Alliance {
|
||||
|
||||
public static function canAct($datas, $mode = 0){
|
||||
global $database, $session;
|
||||
|
||||
$hasSwitchedToAdmin = isset($datas['admin']) && !empty($datas['admin']) && $datas['admin'] == "switch_admin";
|
||||
|
||||
return (/*$database->CheckEditRes($datas['aid']) == 1 && */($datas['alliance'] > 0 && (($database->isAllianceOwner($session->uid) == $datas['alliance'] ||
|
||||
($datas['forum_perm'] == 1 && $session->alliance == $datas['alliance']))) ||
|
||||
($datas['owner'] == $session->uid && $session->access != ADMIN)) ||
|
||||
|
||||
+176
-1
@@ -8496,8 +8496,183 @@ References: User ID/Message ID, Mode
|
||||
return $dbarray2['vac_mode'] == 1;
|
||||
}
|
||||
}
|
||||
else return false;
|
||||
else
|
||||
return
|
||||
false;
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
Function to vacation mode remake by Shadow
|
||||
References: Shadow
|
||||
*****************************************/
|
||||
|
||||
function checkVacationRequirements($uid){
|
||||
$uid = (int)$uid;
|
||||
$time = time();
|
||||
$errors = [];
|
||||
|
||||
// 1. Troops moving OUT
|
||||
$q = "SELECT COUNT(*) as num
|
||||
FROM ".TB_PREFIX."movement m
|
||||
JOIN ".TB_PREFIX."vdata v ON v.wref = m.from
|
||||
WHERE v.owner=$uid
|
||||
AND m.proc=0
|
||||
AND m.endtime > $time
|
||||
AND m.sort_type = 3";
|
||||
|
||||
$res = mysqli_query($this->dblink,$q);
|
||||
if(!$res){ die("SQL ERROR (TROOPS_MOVING): ".mysqli_error($this->dblink)); }
|
||||
|
||||
$row = mysqli_fetch_assoc($res);
|
||||
if((int)$row['num'] > 0) $errors[] = "TROOPS_MOVING";
|
||||
|
||||
|
||||
// 2. Incoming troops
|
||||
$q = "SELECT COUNT(*) as num
|
||||
FROM ".TB_PREFIX."movement m
|
||||
JOIN ".TB_PREFIX."vdata v ON v.wref = m.to
|
||||
WHERE v.owner=$uid
|
||||
AND m.proc=0
|
||||
AND m.endtime > $time
|
||||
AND (m.sort_type = 3 OR m.sort_type = 4)";
|
||||
|
||||
$res = mysqli_query($this->dblink,$q);
|
||||
if(!$res){ die("SQL ERROR (INCOMING): ".mysqli_error($this->dblink)); }
|
||||
|
||||
$row = mysqli_fetch_assoc($res);
|
||||
if((int)$row['num'] > 0) $errors[] = "INCOMING_TROOPS";
|
||||
|
||||
|
||||
// 3. Reinforcements
|
||||
$q = "SELECT COUNT(*) as num
|
||||
FROM ".TB_PREFIX."enforcement e
|
||||
JOIN ".TB_PREFIX."vdata v ON v.wref = e.vref
|
||||
WHERE v.owner = $uid
|
||||
AND e.from != e.vref";
|
||||
|
||||
$res = mysqli_query($this->dblink,$q);
|
||||
if(!$res){ die("SQL ERROR (REINFORCEMENTS): ".mysqli_error($this->dblink)); }
|
||||
|
||||
$row = mysqli_fetch_assoc($res);
|
||||
if((int)$row['num'] > 0) $errors[] = "REINFORCEMENTS";
|
||||
|
||||
|
||||
// 4. Wonder of the World
|
||||
$q = "SELECT COUNT(*) as num
|
||||
FROM ".TB_PREFIX."fdata f
|
||||
JOIN ".TB_PREFIX."vdata v ON v.wref=f.vref
|
||||
WHERE v.owner=$uid AND f.f99t=40";
|
||||
|
||||
$res = mysqli_query($this->dblink,$q);
|
||||
if(!$res){ die("SQL ERROR (WW): ".mysqli_error($this->dblink)); }
|
||||
|
||||
$row = mysqli_fetch_assoc($res);
|
||||
if((int)$row['num'] > 0) $errors[] = "WW";
|
||||
|
||||
|
||||
// 5. Artefacts
|
||||
$q = "SELECT COUNT(*) as num
|
||||
FROM ".TB_PREFIX."artefacts
|
||||
WHERE owner=$uid";
|
||||
|
||||
$res = mysqli_query($this->dblink,$q);
|
||||
if(!$res){ die("SQL ERROR (ARTEFACTS): ".mysqli_error($this->dblink)); }
|
||||
|
||||
$row = mysqli_fetch_assoc($res);
|
||||
if((int)$row['num'] > 0) $errors[] = "ARTEFACTS";
|
||||
|
||||
|
||||
// 6. Beginner protection (FIXAT)
|
||||
$q = "SELECT protect
|
||||
FROM ".TB_PREFIX."users
|
||||
WHERE id=$uid";
|
||||
|
||||
$res = mysqli_query($this->dblink,$q);
|
||||
if(!$res){ die("SQL ERROR (PROTECTION): ".mysqli_error($this->dblink)); }
|
||||
|
||||
$row = mysqli_fetch_assoc($res);
|
||||
|
||||
$protect = (int)$row['protect'];
|
||||
|
||||
if($protect > 0 && $protect > $time){
|
||||
$errors[] = "PROTECTION";
|
||||
}
|
||||
|
||||
|
||||
// =========================
|
||||
// 7. PRISONERS (FIX FINAL)
|
||||
// =========================
|
||||
|
||||
// 7.1 Enemy troops trapped in your villages
|
||||
$q = "SELECT COUNT(*) as num
|
||||
FROM ".TB_PREFIX."prisoners p
|
||||
JOIN ".TB_PREFIX."vdata v ON v.wref = p.wref
|
||||
WHERE v.owner = $uid";
|
||||
|
||||
$res = mysqli_query($this->dblink,$q);
|
||||
if(!$res){
|
||||
die("SQL ERROR (PRISONERS_IN): ".mysqli_error($this->dblink));
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_assoc($res);
|
||||
$hasEnemyTrapped = (int)$row['num'];
|
||||
|
||||
|
||||
// 7.2 Your troops trapped in enemy villages
|
||||
$q = "SELECT COUNT(*) as num
|
||||
FROM ".TB_PREFIX."prisoners p
|
||||
JOIN ".TB_PREFIX."vdata v ON v.wref = p.from
|
||||
WHERE v.owner = $uid";
|
||||
|
||||
$res = mysqli_query($this->dblink,$q);
|
||||
if(!$res){
|
||||
die("SQL ERROR (PRISONERS_OUT): ".mysqli_error($this->dblink));
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_assoc($res);
|
||||
$hasOwnCaptured = (int)$row['num'];
|
||||
|
||||
|
||||
// FINAL RULE
|
||||
if($hasEnemyTrapped > 0){
|
||||
$errors[] = "PRISONERS_IN";
|
||||
}
|
||||
|
||||
if($hasOwnCaptured > 0){
|
||||
$errors[] = "PRISONERS_OUT";
|
||||
}
|
||||
|
||||
// 8. Marketplace
|
||||
$q = "SELECT COUNT(*) as num
|
||||
FROM ".TB_PREFIX."movement m
|
||||
JOIN ".TB_PREFIX."vdata v ON v.wref = m.from
|
||||
WHERE v.owner = $uid
|
||||
AND m.proc = 0
|
||||
AND m.endtime > $time
|
||||
AND m.sort_type = 0";
|
||||
|
||||
$res = mysqli_query($this->dblink,$q);
|
||||
if(!$res){ die("SQL ERROR (MARKET): ".mysqli_error($this->dblink)); }
|
||||
|
||||
$row = mysqli_fetch_assoc($res);
|
||||
if((int)$row['num'] > 0) $errors[] = "MARKET";
|
||||
|
||||
// 9. Account deletion
|
||||
$q = "SELECT timestamp
|
||||
FROM ".TB_PREFIX."deleting
|
||||
WHERE uid = $uid";
|
||||
|
||||
$res = mysqli_query($this->dblink,$q);
|
||||
if(!$res){ die("SQL ERROR (DELETING): ".mysqli_error($this->dblink)); }
|
||||
|
||||
$row = mysqli_fetch_assoc($res);
|
||||
|
||||
if(!empty($row['timestamp']) && $row['timestamp'] > $time){
|
||||
$errors[] = "ACCOUNT_DELETION";
|
||||
}
|
||||
|
||||
return empty($errors) ? true : $errors;
|
||||
}
|
||||
|
||||
// no need to cache this method
|
||||
function getHeroDeadReviveOrInTraining($id) {
|
||||
|
||||
+48
-16
@@ -79,23 +79,55 @@ class Profile {
|
||||
*/
|
||||
|
||||
private function setvactionmode($post){
|
||||
global $database, $session, $form;
|
||||
global $database, $session;
|
||||
|
||||
if(isset($post['vac']) && $post['vac'] && isset($post['vac_days']) && $post['vac_days'] >= 2 && $post['vac_days'] <= 14){
|
||||
unset($_SESSION['wid']);
|
||||
$database->setvacmode($session->uid, $post['vac_days']);
|
||||
$database->activeModify(addslashes($session->username), 1);
|
||||
$database->UpdateOnline("logout");
|
||||
$session->Logout();
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}else{
|
||||
$form->add("vac", VAC_MODE_WRONG_DAYS);
|
||||
header("Location: spieler.php?s=".$session->uid);
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
if(isset($post['vac']) && $post['vac'] && isset($post['vac_days']) && $post['vac_days'] >= 2 && $post['vac_days'] <= 14){
|
||||
|
||||
$check = $database->checkVacationRequirements($session->uid);
|
||||
|
||||
if($check !== true){
|
||||
|
||||
$messages = [
|
||||
"TROOPS_MOVING" => "There are no outgoing troops",
|
||||
"INCOMING_TROOPS" => "There are no incoming troops",
|
||||
"REINFORCEMENTS" => "You have reinforcements on your villages",
|
||||
"WW" => "You own a Wonder of the World",
|
||||
"ARTEFACTS" => "You own artefacts",
|
||||
"PROTECTION" => "You are still under beginner protection",
|
||||
"PRISONERS_IN" => "No units trapped in your traps",
|
||||
"PRISONERS_OUT" => "No units in enemy traps",
|
||||
"MARKET" => "Marketplace transport active",
|
||||
"ACCOUNT_DELETION" => "Account is scheduled for deletion"
|
||||
];
|
||||
|
||||
$output = "";
|
||||
|
||||
foreach($check as $err){
|
||||
$output .= ($messages[$err] ?? $err) . "<br>";
|
||||
}
|
||||
|
||||
$_SESSION['vac_error'] = $output;
|
||||
|
||||
header("Location: spieler.php?s=5");
|
||||
exit;
|
||||
}
|
||||
|
||||
// TOTUL OK → intră în vacanță
|
||||
unset($_SESSION['wid']);
|
||||
$database->setvacmode($session->uid, $post['vac_days']);
|
||||
$database->activeModify(addslashes($session->username), 1);
|
||||
$database->UpdateOnline("logout");
|
||||
$session->Logout();
|
||||
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
|
||||
} else {
|
||||
$_SESSION['vac_error'] = "Vacation days must be between 2 and 14";
|
||||
header("Location: spieler.php?s=5");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to vacation mode - by advocaite and Shadow
|
||||
|
||||
@@ -95,6 +95,13 @@ $database->updateUserField($session->uid,gpack,$_POST["custom_url"],1);
|
||||
<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>
|
||||
|
||||
+137
-59
@@ -1,8 +1,7 @@
|
||||
<?php if(NEW_FUNCTIONS_VACATION){
|
||||
?>
|
||||
<?php if(NEW_FUNCTIONS_VACATION){ ?>
|
||||
<h1>Player profile</h1>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
@@ -11,7 +10,7 @@
|
||||
## Version: 01.09.2013 ##
|
||||
## Filename vacation.php ##
|
||||
## Developed by: Advocaite ##
|
||||
## Fixed by: Shadow / Skype : cata7007 ##
|
||||
## Fixed & Remake:Shadow ##
|
||||
## License: TravianZ Project ##
|
||||
## Copyright: TravianZ (c) 2010-2013. All rights reserved. ##
|
||||
## URLs: http://travian.shadowss.ro ##
|
||||
@@ -20,69 +19,148 @@
|
||||
#################################################################################
|
||||
|
||||
include("menu.tpl"); ?>
|
||||
|
||||
<?php
|
||||
$tribe = (int)$session->tribe;
|
||||
$check = $database->checkVacationRequirements($session->uid);
|
||||
$errors = is_array($check) ? $check : [];
|
||||
$canActivate = empty($errors);
|
||||
function vac_ok($key, $errors){
|
||||
return !in_array($key, $errors);
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="spieler.php" method="POST">
|
||||
<input type="hidden" name="ft" value="p4">
|
||||
|
||||
<table cellpadding="1" cellspacing="1" id="del_acc" class="account"><thead>
|
||||
<tr>
|
||||
<th colspan="2">Vacation Mode</th>
|
||||
<div class="vacationBox">
|
||||
|
||||
</tr>
|
||||
</thead><tbody>
|
||||
<tr>
|
||||
<td class="note" colspan="2">If you plan on being away for an extended period of time and do not wish to set a sitter, you can set your account to Holiday Mode. During this time your account will stop produceing resource , CP , research , trops , etc , and stop receiving attacks , reinforcements, raid , essentially freezing your account. Remember, this just freezes your Travian, not time. If you are a member of Gold Club it will run out during this time and if you have automatic renewal selected, the automatic renewal feature will be cancelled while in Holiday Mode.Please Note you must set min of 2 days vaction mode and NO MORE THEN 14 days.</td>
|
||||
</tr><tr>
|
||||
|
||||
<center><h2>Vacation Mode</h2></center>
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<h4 class="round">General description</h4>
|
||||
Use vacation mode to protect your villages during you are away.<br/>
|
||||
During the vacation will be inactive next actions:<br/>
|
||||
<ul>
|
||||
<li>Send or receive troops</li>
|
||||
<li>Start new construction order</li>
|
||||
<li>Use market</li>
|
||||
<li>Train new troops</li>
|
||||
<li>Join to an alliance</li>
|
||||
<li>Delete account</li>
|
||||
</ul></div>
|
||||
<?php
|
||||
// 🔴 AICI AFIȘEZI ERORILE VACATION (IMPORTANT)
|
||||
if(isset($_SESSION['vac_error'])){
|
||||
echo "<div class='error' style='background:#900;color:#fff;padding:10px;margin-bottom:10px;'>"
|
||||
.nl2br($_SESSION['vac_error']).
|
||||
"</div>";
|
||||
|
||||
<h4 class="round">Conditions</h4>
|
||||
<ul>
|
||||
<li>No troops in movement</li>
|
||||
<li>No troops on way to other villages</li>
|
||||
<li>No troops send to reinforcements other villages</li>
|
||||
<li>No player have reinforcements on your villages</li>
|
||||
<li>Do not have Wonder World</li>
|
||||
<li>Do not have any artefacts</li>
|
||||
<li>You are no longer in player protections</li>
|
||||
<li>Do not have any troops in your traps</li>
|
||||
<li>Your account is not in deletion process.</li>
|
||||
</ul>
|
||||
unset($_SESSION['vac_error']);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="vacationDesc">
|
||||
If you plan on being away for an extended period of time and do not wish to set a sitter,
|
||||
you can activate <b>Vacation Mode</b>. During this time your account is essentially frozen.
|
||||
No resources, troops or research will progress and your villages cannot be attacked.
|
||||
Remember, this just freezes your Travian, not time.
|
||||
<br><br>
|
||||
Minimum vacation: <b>2 days</b><br>
|
||||
Maximum vacation: <b>14 days</b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="vacationGrid">
|
||||
|
||||
<div class="vacationColumn">
|
||||
<h4>Inactive during vacation</h4>
|
||||
<ul class="vacList">
|
||||
<li>Send or receive troops</li>
|
||||
<li>Start new construction order</li>
|
||||
<li>Use market</li>
|
||||
<li>Train new troops</li>
|
||||
<li>Join an alliance</li>
|
||||
<li>Delete account</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<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('REINFORCEMENTS',$errors) ? 'green':'red' ?>">
|
||||
No reinforcing troops sent/receive
|
||||
</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('ARTEFACTS',$errors) ? 'green':'red' ?>">
|
||||
No ownership of an artifact village
|
||||
</li>
|
||||
|
||||
<li style="color:<?= vac_ok('PROTECTION',$errors) ? 'green':'red' ?>">
|
||||
No beginner’s protection
|
||||
</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>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="vacationActivate">
|
||||
|
||||
<label>
|
||||
<input type="radio" name="vac" value="1">
|
||||
Activate Vacation Mode
|
||||
</label>
|
||||
|
||||
<input type="number" name="vac_days" value="2" min="2" max="14">
|
||||
|
||||
<span>days</span>
|
||||
|
||||
</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>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<th>Want to activate Vacation Mode?</th>
|
||||
<td class="del_selection">
|
||||
<label><input class="radio" type="radio" name="vac" value="1" /> Yes</label>
|
||||
<label><input class="text" type="text" name="vac_days" value="2" /></label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody></table>
|
||||
<?php
|
||||
// Added by Shadow - cata7007@gmail.com / Skype : cata7007
|
||||
if($form->getError("vac") != "") {
|
||||
echo "<span class=\"error\">".$form->getError("vac")."</span>";
|
||||
}
|
||||
?>
|
||||
<p class="btn"><input type="image" value="" name="s1" id="btn_save" class="dynamic_img" src="img/x.gif" alt="save" /></p>
|
||||
</form>
|
||||
<?php
|
||||
}else{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?uid=".$session->uid);
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const vacInput = document.querySelector('input[name="vac_days"]');
|
||||
|
||||
if (vacInput) {
|
||||
vacInput.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php }else{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?uid=".$session->uid);
|
||||
exit;
|
||||
} ?>
|
||||
@@ -9235,3 +9235,68 @@ input.accept{width:12px;height:12px;background-image:url(../../img/a/acc.gif);}
|
||||
width: auto;
|
||||
min-width: 500px;
|
||||
}
|
||||
|
||||
.vacationBox{
|
||||
background:#f5f5f5;
|
||||
border:1px solid #cfcfcf;
|
||||
padding:20px;
|
||||
border-radius:6px;
|
||||
}
|
||||
|
||||
.vacationBox h2{
|
||||
margin-top:0;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.vacationDesc{
|
||||
background:#fff;
|
||||
border:1px solid #ddd;
|
||||
padding:12px;
|
||||
margin-bottom:20px;
|
||||
font-size:13px;
|
||||
}
|
||||
|
||||
.vacationGrid{
|
||||
display:flex;
|
||||
gap:30px;
|
||||
margin-bottom:20px;
|
||||
}
|
||||
|
||||
.vacationColumn{
|
||||
flex:1;
|
||||
}
|
||||
|
||||
.vacationColumn h3{
|
||||
margin-bottom:8px;
|
||||
color:#444;
|
||||
}
|
||||
|
||||
.vacList{
|
||||
padding-left:18px;
|
||||
}
|
||||
|
||||
.vacList li{
|
||||
margin-bottom:5px;
|
||||
}
|
||||
|
||||
.vacationActivate{
|
||||
background:#fff;
|
||||
border:1px solid #ddd;
|
||||
padding:12px;
|
||||
margin-top:10px;
|
||||
}
|
||||
|
||||
.vacationActivate input[type=number]{
|
||||
width:60px;
|
||||
margin-left:10px;
|
||||
}
|
||||
|
||||
.vacationButton{
|
||||
text-align:center;
|
||||
margin-top:15px;
|
||||
}
|
||||
|
||||
.error{
|
||||
color:red;
|
||||
margin-top:10px;
|
||||
}
|
||||
|
||||
+50
-30
@@ -125,38 +125,58 @@ else $building->procBuild($_GET);
|
||||
<div id="content" class="player">
|
||||
<?php
|
||||
if(isset($_GET['uid'])) {
|
||||
if($_GET['uid'] >= 2) {
|
||||
$user = $database->getUserArray(preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['uid']),1);
|
||||
if(isset($user['id'])){
|
||||
include("Templates/Profile/overview.tpl");
|
||||
} else {
|
||||
include("Templates/Profile/notfound.tpl");
|
||||
}
|
||||
}
|
||||
else {
|
||||
include("Templates/Profile/special.tpl");
|
||||
}
|
||||
|
||||
if($_GET['uid'] >= 2) {
|
||||
|
||||
$user = $database->getUserArray(preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['uid']),1);
|
||||
|
||||
if(isset($user['id'])){
|
||||
|
||||
// 🔴 SHOW VACATION ERROR (IMPORTANT)
|
||||
if(isset($_SESSION['vac_error'])){
|
||||
echo "<div class='error'>".nl2br($_SESSION['vac_error'])."</div>";
|
||||
unset($_SESSION['vac_error']);
|
||||
}
|
||||
|
||||
include("Templates/Profile/overview.tpl");
|
||||
|
||||
} else {
|
||||
include("Templates/Profile/notfound.tpl");
|
||||
}
|
||||
|
||||
} else {
|
||||
include("Templates/Profile/special.tpl");
|
||||
}
|
||||
|
||||
}
|
||||
else if (isset($_GET['s'])) {
|
||||
if($_GET['s'] == 1) {
|
||||
include("Templates/Profile/profile.tpl");
|
||||
}
|
||||
if($_GET['s'] == 2) {
|
||||
include("Templates/Profile/preference.tpl");
|
||||
}
|
||||
if($_GET['s'] == 3) {
|
||||
include("Templates/Profile/account.tpl");
|
||||
}
|
||||
if($_GET['s'] == 4) {
|
||||
include("Templates/Profile/graphic.tpl");
|
||||
}
|
||||
if($_GET['s'] == 5) {
|
||||
include("Templates/Profile/vacation.tpl");
|
||||
}
|
||||
if($_GET['s'] > 5 or $session->sit == 1) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?uid=".preg_replace("/[^a-zA-Z0-9_-]/","",$session->uid));
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_GET['s'] == 1) {
|
||||
|
||||
include("Templates/Profile/profile.tpl");
|
||||
}
|
||||
|
||||
if($_GET['s'] == 2) {
|
||||
include("Templates/Profile/preference.tpl");
|
||||
}
|
||||
|
||||
if($_GET['s'] == 3) {
|
||||
include("Templates/Profile/account.tpl");
|
||||
}
|
||||
|
||||
if($_GET['s'] == 4) {
|
||||
include("Templates/Profile/graphic.tpl");
|
||||
}
|
||||
|
||||
if($_GET['s'] == 5) {
|
||||
|
||||
include("Templates/Profile/vacation.tpl");
|
||||
}
|
||||
|
||||
if($_GET['s'] > 5 or $session->sit == 1) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?uid=".preg_replace("/[^a-zA-Z0-9_-]/","",$session->uid));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user