vacation mode but i will disable it just implemented but will be disabled

This commit is contained in:
Shadow
2014-03-12 08:40:43 +02:00
parent e50a8a905a
commit e641d9e9d4
10 changed files with 155 additions and 4 deletions
+45
View File
@@ -3616,6 +3616,51 @@ class MYSQL_DB {
$q = "DELETE from " . TB_PREFIX . "prisoners where id = '$id'";
mysql_query($q, $this->connection);
}
/*****************************************
Function to vacation mode - by advocaite
References:
*****************************************/
function setvacmode($uid,$days){
$days1 =60*60*24*$days;
$time =time()+$days1;
$q ="UPDATE ".TB_PREFIX."users SET vac_mode = '1' , vac_time=".$time." WHERE id=".$uid."";
$result =mysql_query($q,$this->connection);
}
function removevacationmode($uid){
$q ="UPDATE ".TB_PREFIX."users SET vac_mode = '0' , vac_time='0' WHERE id=".$uid."";
$result =mysql_query($q,$this->connection);
}
function getvacmodexy($wref){
$q = "SELECT id,oasistype,occupied FROM " . TB_PREFIX . "wdata where id = $wref";
$result = mysql_query($q, $this->connection);
$dbarray = mysql_fetch_array($result);
if($dbarray['occupied'] != 0 && $dbarray['oasistype'] == 0) {
$q1 = "SELECT owner FROM " . TB_PREFIX . "vdata where wref = ".$dbarray['id']."";
$result1 = mysql_query($q1, $this->connection);
$dbarray1 = mysql_fetch_array($result1);
if($dbarray1['owner'] != 0){
$q2 = "SELECT vac_mode,vac_time FROM " . TB_PREFIX . "users where id = ".$dbarray1['owner']."";
$result2 = mysql_query($q2, $this->connection);
$dbarray2 = mysql_fetch_array($result2);
if($dbarray2['vac_mode'] ==1){
return true;
}else{
return false;
}
}
} else {
return false;
}
}
/*****************************************
Function to vacation mode - by advocaite
References:
*****************************************/
/***************************
Function to get Hero Dead
+1 -1
View File
@@ -845,7 +845,7 @@ The construction plans are conquerable immediately when they appear to the serve
There will be a countdown in game, showing the exact time of the release, 5 days prior to the launch. ");
//planos
//Building Plans
define("PLAN","Ancient Construction Plan");
define("PLANVILLAGE","WW Buildingplan");
define("PLAN_DESC","With this ancient construction plan you will able to build World Wonder to level 50. to build further, your alliance must hold at least two plans.");
+39
View File
@@ -30,6 +30,14 @@ class Profile {
header("Location: banned.php");
}
break;
case "p4":
// Vacation mode - by advocaite and Shadow
if($session->access!=BANNED){
$this->setvactionmode($post);
}else{
header("Location: banned.php");
}
break;
}
}
if(isset($post['s'])) {
@@ -93,6 +101,37 @@ class Profile {
$database->gpack($database->RemoveXSS($session->uid),$database->RemoveXSS($post['custom_url']));
header("Location: spieler.php?uid=".$session->uid);
}
/*******************************************************
Function to vacation mode - by advocaite and Shadow
References:
********************************************************/
private function setvactionmode($post){
global $database,$session,$form;
$set =false;
if($post['vac'] && $post['vac_days'] >=2 && $post['vac_days'] <=14) {
$database->setvacmode($post['uid'],$post['vac_days']);
$set =true;
}
else {
echo "Minimum days is 2";die();exit();
}
if($set){
unset($_SESSION['wid']);
$database->activeModify(addslashes($session->username),1);
$database->UpdateOnline("logout") or die(mysql_error());
$session->Logout();
header("Location: login.php");
}else{
header("Location: spieler.php?s=5");
}
}
/*******************************************************
Function to vacation mode - by advocaite and Shadow
References:
********************************************************/
private function updateAccount($post) {
global $database,$session,$form;
+5
View File
@@ -148,6 +148,11 @@ class Units {
$id = $generator->getBaseID($coor['x'],$coor['y']);
if (!$database->getVillageState($id)){
$form->addError("error","Coordinates do not exist");
//check vaction mode- by advocaite
if($database->getvacmodexy($id)){
$form->addError("error","User is on vacation mode");
}
//END Vaction mode check
}
}
if (!empty($coor)) {
+6 -1
View File
@@ -27,9 +27,12 @@ if($checkexist){
$villageOwner = $database->getVillageField($getwref,'owner');
$userAccess = $database->getUserField($villageOwner,'access',0);
}
// Function vacation mode by Shadow
$userVacation = $database->getUserField($villageOwner,'vac_mode',0);
}
$maxcarry = $market->maxcarry;
$maxcarry *= $market->merchantAvail();
if(isset($_POST['ft'])=='check' && $allres!=0 && $allres <= $maxcarry && ($_POST['x']!="" && $_POST['y']!="" or $_POST['dname']!="") && $checkexist && $userAccess == 2){
if(isset($_POST['ft'])=='check' && $allres!=0 && $allres <= $maxcarry && ($_POST['x']!="" && $_POST['y']!="" or $_POST['dname']!="") && $checkexist && $userAccess == 2 && $userVacation == 0){
?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="ft" value="mk1">
@@ -215,6 +218,8 @@ if(isset($_POST['ft'])=='check'){
$error = '<span class="error"><b>You cannot send resources to the same village</b></span>';
}elseif($userAccess == '0' or $userAccess == '8' or $userAccess == '9'){
$error = '<span class="error"><b>Player is Banned. You cannot send resources to him.</b></span>';
}elseif($userVacation == '1') {
$error = '<span class="error"><b>Player is on vacation mode. You cannot send resources to him.</b></span>';
}elseif($_POST['r1']==0 && $_POST['r2']==0 && $_POST['r3']==0 && $_POST['r4']==0){
$error = '<span class="error"><b>Resources not selected.</b></span>';
}elseif(!$_POST['x'] && !$_POST['y'] && !$_POST['dname']){
+1
View File
@@ -3,6 +3,7 @@
| <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>
| <a href="spieler.php?s=5" <?php if(isset($_GET['s']) && $_GET['s'] == 5) { echo "class=\"selected\""; } ?>>Vacation</a>
<?php
if(GP_ENABLE) {
?>
+1 -1
View File
@@ -1 +1 @@
<?php
<?php################################################################################### -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- #### --------------------------------------------------------------------------- #### Filename special.tpl #### Developed by: Dzoki #### License: TravianX Project #### Copyright: TravianX (c) 2010-2011. All rights reserved. #### ###################################################################################?><table cellpadding="1" cellspacing="1" id="support_mh"> <thead> <tr> <th>Support and Multihunter</th> </tr> </thead> <tbody> <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> </tr> <tr> <td><b>Multihunter:</b><br>The Multihunters are responsible for the compliance with the <a href="#" target="_blank">game rules</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> </tr> </tbody> </table>
+49
View File
@@ -0,0 +1,49 @@
<h1>Player profile</h1>
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 01.09.2013 ##
## Filename vacation.php ##
## Developed by: Advocaite ##
## Fixed by: Shadow / Skype : cata7007 ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2013. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: http://github.com/Shadowss/TravianZ-by-Shadow/ ##
## ##
#################################################################################
include("menu.tpl"); ?>
<form action="spieler.php" method="POST">
<input type="hidden" name="ft" value="p4">
<input type="hidden" name="uid" value="<?php echo $session->uid; ?>" />
<table cellpadding="1" cellspacing="1" id="del_acc" class="account"><thead>
<tr>
<th colspan="2">Vacation Mode</th>
</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>
<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>
+4
View File
@@ -207,6 +207,10 @@ if($form->getError("activate") != "") {
<a href=\"activate.php?usr=".$form->getError("activate")."\">".VERIFY_EMAIL."</a>
</p>";
}
if($form->getError("vacation") != "") {
echo "<p class=\"error_box\">
<span class=\"error\">".$form->getError("vacation")."</span></p>";
}
?>
</div>
<div id="side_info" class="outgame">
+4 -1
View File
@@ -147,7 +147,10 @@ else if (isset($_GET['s'])) {
if($_GET['s'] == 4) {
include("Templates/Profile/graphic.tpl");
}
if($_GET['s'] > 4 or $session->sit == 1) {
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));
}
}