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)) {