diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index 35eccc01..207b7ff0 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -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 diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php index 196b8f24..33d79b92 100644 --- a/GameEngine/Lang/en.php +++ b/GameEngine/Lang/en.php @@ -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."); diff --git a/GameEngine/Profile.php b/GameEngine/Profile.php index fede6cd1..24f55f20 100644 --- a/GameEngine/Profile.php +++ b/GameEngine/Profile.php @@ -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; diff --git a/GameEngine/Units.php b/GameEngine/Units.php index bf80043d..e9f68920 100644 --- a/GameEngine/Units.php +++ b/GameEngine/Units.php @@ -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)) { diff --git a/Templates/Build/17.tpl b/Templates/Build/17.tpl index dabb586a..a360dffb 100644 --- a/Templates/Build/17.tpl +++ b/Templates/Build/17.tpl @@ -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){ ?>
diff --git a/login.php b/login.php index 9022ac39..466d7d68 100644 --- a/login.php +++ b/login.php @@ -207,6 +207,10 @@ if($form->getError("activate") != "") { getError("activate")."\">".VERIFY_EMAIL." "; } +if($form->getError("vacation") != "") { +echo "+".$form->getError("vacation")."
"; +} ?>