diff --git a/GameEngine/Account.php b/GameEngine/Account.php
index a1fee486..b730be41 100755
--- a/GameEngine/Account.php
+++ b/GameEngine/Account.php
@@ -75,6 +75,9 @@ class Account {
else if(USRNM_SPECIAL && preg_match("/[:,\\. \\n\\r\\t\\s\\<\\>]+/", $_POST['name'])) {
$form->addError("name",USRNM_CHAR);
}
+ else if(strtolower($_POST['name']) == 'natars') {
+ $form->addError("name",USRNM_TAKEN);
+ }
else if(User::exists($database,$_POST['name'])) {
$form->addError("name",USRNM_TAKEN);
}
@@ -103,7 +106,7 @@ class Account {
$form->addError("email",EMAIL_TAKEN);
}
}
- if(!isset($_POST['vid'])) {
+ if(!isset($_POST['vid']) || !in_array($_POST['vid'], [1, 2, 3])) {
$form->addError("tribe",TRIBE_EMPTY);
}
if(!isset($_POST['agb'])) {
@@ -154,14 +157,14 @@ class Account {
if(START_DATE < date('m/d/Y') or START_DATE == date('m/d/Y') && START_TIME <= date('H:i'))
{
global $database;
- $q = "SELECT act, username, password, email, tribe, kid FROM ".TB_PREFIX."activate where act = '".$database->escape($_POST['id'])."'";
+ $q = "SELECT act, username, password, email, tribe, location FROM ".TB_PREFIX."activate where act = '".$database->escape($_POST['id'])."'";
$result = mysqli_query($GLOBALS['link'],$q);
$dbarray = mysqli_fetch_array($result);
if($dbarray['act'] == $_POST['id']) {
$uid = $database->register($dbarray['username'],$dbarray['password'],$dbarray['email'],$dbarray['tribe'],"");
if($uid) {
$database->unreg($dbarray['username']);
- $this->generateBase($dbarray['kid'],$uid,$dbarray['username']);
+ $this->generateBase($dbarray['location'],$uid,$dbarray['username']);
header("Location: activate.php?e=2");
exit;
}
@@ -209,15 +212,22 @@ class Account {
$form->addError("pw",LOGIN_PASS_EMPTY);
}
else if(!$database->login($_POST['user'],$_POST['pw']) && !$database->sitterLogin($_POST['user'],$_POST['pw'])) {
- $form->addError("pw",LOGIN_PW_ERROR);
+ // try activation data if the user was not found
+ if (!$userData) {
+ $activateData = $database->getActivateField( $_POST['user'], 'act', 1 );
+
+ if ( $activateData != "" ) {
+ $form->addError( "activate", $_POST['user'] );
+ } else {
+ $form->addError("pw",LOGIN_PW_ERROR);
+ }
+ } else {
+ $form->addError("pw",LOGIN_PW_ERROR);
+ }
}
$userData = $database->getUserArray($_POST['user'], 0);
- if($userData["act"] != "") {
- $form->addError("activate",$_POST['user']);
- }
-
// Vacation mode by Shadow
if($userData["vac_mode"] == 1 && $userData["vac_time"] > time()) {
$form->addError("vacation","Vacation mode is still enabled");
diff --git a/GameEngine/Admin/Mods/editAdminInfo.php b/GameEngine/Admin/Mods/editAdminInfo.php
index 8e66d6b2..672ae9cf 100755
--- a/GameEngine/Admin/Mods/editAdminInfo.php
+++ b/GameEngine/Admin/Mods/editAdminInfo.php
@@ -14,9 +14,18 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
include_once("../../Database.php");
$id = (int) $_POST['id'];
+if (!file_exists('constant_format.tpl')) {
+ die(
+ 'You seem to be running a new version of TravianZ which was installed using an old installer.
' .
+ 'Please download
constant_format.tpl file and copy it into the
GameEngine/Admin/Mods ' .
+ 'directory - otherwise saving configuration won\'t work.
' .
+ 'The constant_format.tpl file can be downloaded at ' .
+ '
https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl');
+}
+
$myFile = "../../config.php";
$fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\config.php");
-
+
$ERRORREPORT=ERROR_REPORT;
$T4=(T4_COMING==false)? "false":"true";
$GP_ENABLE=(GP_ENABLE==false)? "false":"true";
@@ -39,7 +48,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$NEWSBOX2=(NEWSBOX2==false)? "false":"true";
$NEWSBOX3=(NEWSBOX3==false)? "false":"true";
$LIMIT_MAILBOX=(LIMIT_MAILBOX==false)? "false":"true";
-
+
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text);
$text = preg_replace("'%ERROR%'", $ERRORREPORT, $text);
@@ -60,7 +69,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%TRAPPERCAP%'", TRAPPER_CAPACITY, $text);
$text = preg_replace("'%VILLAGE_EXPAND%'", CP, $text);
$text = preg_replace("'%DEMOLISH%'", DEMOLISH_LEVEL_REQ, $text);
- $text = preg_replace("'%STORAGE_MULTIPLIER%'", STORAGE_MULTIPLIER, $text);
+ $text = preg_replace("'%STORAGE_MULTIPLIER%'", STORAGE_MULTIPLIER, $text);
$text = preg_replace("'%QUEST%'", $QUEST, $text);
$text = preg_replace("'%QTYPE%'", QTYPE, $text);
$text = preg_replace("'%BEGINNER%'", PROTECTION, $text);
@@ -84,7 +93,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%LOGADMIN%'", $LOG_ADMIN, $text);
$text = preg_replace("'%LOGWAR%'", $LOG_WAR, $text);
$text = preg_replace("'%LOGMARKET%'", $LOG_MARKET, $text);
- $text = preg_replace("'%LOGILLEGAL%'", $LOG_ILLEGAL, $text);
+ $text = preg_replace("'%LOGILLEGAL%'", $LOG_ILLEGAL, $text);
$text = preg_replace("'%BOX1%'", $NEWSBOX1, $text);
$text = preg_replace("'%BOX2%'", $NEWSBOX2, $text);
$text = preg_replace("'%BOX3%'", $NEWSBOX3, $text);
@@ -94,10 +103,10 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%SPASS%'", SQL_PASS, $text);
$text = preg_replace("'%SDB%'", SQL_DB, $text);
$text = preg_replace("'%PREFIX%'", TB_PREFIX, $text);
- $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text);
+ $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text);
$text = preg_replace("'%LIMIT_MAILBOX%'", $LIMIT_MAILBOX, $text);
$text = preg_replace("'%MAX_MAILS%'", MAX_MAIL, $text);
- $text = preg_replace("'%ARANK%'", $_POST['admin_rank'], $text);
+ $text = preg_replace("'%ARANK%'", $_POST['admin_rank'], $text);
$text = preg_replace("'%AEMAIL%'", $_POST['aemail'], $text);
$text = preg_replace("'%ANAME%'", $_POST['aname'], $text);
$text = preg_replace("'%ASUPPMSGS%'", ($_POST['admin_support_msgs'] == 'True' ? 'true' : 'false'), $text);
@@ -107,7 +116,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
$text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text);
$text = preg_replace("'%SERVER%'", SERVER, $text);
-
+
// PLUS settings need to be kept intact
$text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text);
$text = preg_replace("'%PLUS_PRODUCTION%'", PLUS_PRODUCTION, $text);
@@ -123,7 +132,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%PLUS_PACKAGE_D_GOLD%'", (defined('PLUS_PACKAGE_D_GOLD') ? PLUS_PACKAGE_D_GOLD : '1000'), $text);
$text = preg_replace("'%PLUS_PACKAGE_E_PRICE%'", (defined('PLUS_PACKAGE_E_PRICE') ? PLUS_PACKAGE_E_PRICE : '49,99'), $text);
$text = preg_replace("'%PLUS_PACKAGE_E_GOLD%'", (defined('PLUS_PACKAGE_E_GOLD') ? PLUS_PACKAGE_E_GOLD : '2000'), $text);
-
+
fwrite($fh, $text);
fclose($fh);
diff --git a/GameEngine/Admin/Mods/editExtraSet.php b/GameEngine/Admin/Mods/editExtraSet.php
index 7183a27a..7ad37818 100755
--- a/GameEngine/Admin/Mods/editExtraSet.php
+++ b/GameEngine/Admin/Mods/editExtraSet.php
@@ -14,9 +14,18 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
include_once("../../Database.php");
$id = (int) $_POST['id'];
+if (!file_exists('constant_format.tpl')) {
+ die(
+ 'You seem to be running a new version of TravianZ which was installed using an old installer.
' .
+ 'Please download
constant_format.tpl file and copy it into the
GameEngine/Admin/Mods ' .
+ 'directory - otherwise saving configuration won\'t work.
' .
+ 'The constant_format.tpl file can be downloaded at ' .
+ '
https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl');
+}
+
$myFile = "../../config.php";
$fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\config.php");
-
+
$ERRORREPORT=ERROR_REPORT;
$T4=(T4_COMING==false)? "false":"true";
$GP_ENABLE=(GP_ENABLE==false)? "false":"true";
@@ -38,7 +47,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true";
$SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true');
$ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true');
-
+
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", ERROR_REPORT, $text);
$text = preg_replace("'%ERROR%'", ERROR_REPORT, $text);
@@ -104,7 +113,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
$text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text);
$text = preg_replace("'%SERVER%'", SERVER, $text);
-
+
// PLUS settings need to be kept intact
$text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text);
$text = preg_replace("'%PLUS_PRODUCTION%'", PLUS_PRODUCTION, $text);
@@ -120,7 +129,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%PLUS_PACKAGE_D_GOLD%'", (defined('PLUS_PACKAGE_D_GOLD') ? PLUS_PACKAGE_D_GOLD : '1000'), $text);
$text = preg_replace("'%PLUS_PACKAGE_E_PRICE%'", (defined('PLUS_PACKAGE_E_PRICE') ? PLUS_PACKAGE_E_PRICE : '49,99'), $text);
$text = preg_replace("'%PLUS_PACKAGE_E_GOLD%'", (defined('PLUS_PACKAGE_E_GOLD') ? PLUS_PACKAGE_E_GOLD : '2000'), $text);
-
+
fwrite($fh, $text);
fclose($fh);
diff --git a/GameEngine/Admin/Mods/editLogSet.php b/GameEngine/Admin/Mods/editLogSet.php
index 35137df3..59b1ab1f 100755
--- a/GameEngine/Admin/Mods/editLogSet.php
+++ b/GameEngine/Admin/Mods/editLogSet.php
@@ -14,9 +14,18 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
include_once("../../Database.php");
$id = (int) $_POST['id'];
+if (!file_exists('constant_format.tpl')) {
+ die(
+ 'You seem to be running a new version of TravianZ which was installed using an old installer.
' .
+ 'Please download
constant_format.tpl file and copy it into the
GameEngine/Admin/Mods ' .
+ 'directory - otherwise saving configuration won\'t work.
' .
+ 'The constant_format.tpl file can be downloaded at ' .
+ '
https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl');
+}
+
$myFile = "../../config.php";
$fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\config.php");
-
+
$ERRORREPORT=ERROR_REPORT;
$T4=(T4_COMING==false)? "false":"true";
$GP_ENABLE=(GP_ENABLE==false)? "false":"true";
@@ -26,7 +35,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$AUTH_EMAIL=(AUTH_EMAIL==false)? "false":"true";
$GREAT_WKS=(GREAT_WKS==false)? "false":"true";
$REG_OPEN=(REG_OPEN==false)? "false":"true";
-
+
$NEWSBOX1=(NEWSBOX1==false)? "false":"true";
$NEWSBOX2=(NEWSBOX2==false)? "false":"true";
$NEWSBOX3=(NEWSBOX3==false)? "false":"true";
@@ -34,7 +43,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true";
$SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true');
$ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true');
-
+
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text);
$text = preg_replace("'%ERROR%'", $ERRORREPORT, $text);
@@ -55,7 +64,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%TRAPPERCAP%'", TRAPPER_CAPACITY, $text);
$text = preg_replace("'%VILLAGE_EXPAND%'", CP, $text);
$text = preg_replace("'%DEMOLISH%'", DEMOLISH_LEVEL_REQ, $text);
- $text = preg_replace("'%STORAGE_MULTIPLIER%'", STORAGE_MULTIPLIER, $text);
+ $text = preg_replace("'%STORAGE_MULTIPLIER%'", STORAGE_MULTIPLIER, $text);
$text = preg_replace("'%QUEST%'", $QUEST, $text);
$text = preg_replace("'%QTYPE%'", QTYPE, $text);
$text = preg_replace("'%BEGINNER%'", PROTECTION, $text);
@@ -80,7 +89,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%LOGADMIN%'", $_POST['log_admin'], $text);
$text = preg_replace("'%LOGWAR%'", $_POST['log_war'], $text);
$text = preg_replace("'%LOGMARKET%'", $_POST['log_market'], $text);
- $text = preg_replace("'%LOGILLEGAL%'", $_POST['log_illegal'], $text);
+ $text = preg_replace("'%LOGILLEGAL%'", $_POST['log_illegal'], $text);
//end update
$text = preg_replace("'%BOX1%'", $NEWSBOX1, $text);
$text = preg_replace("'%BOX2%'", $NEWSBOX2, $text);
@@ -91,10 +100,10 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%SPASS%'", SQL_PASS, $text);
$text = preg_replace("'%SDB%'", SQL_DB, $text);
$text = preg_replace("'%PREFIX%'", TB_PREFIX, $text);
- $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text);
+ $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text);
$text = preg_replace("'%LIMIT_MAILBOX%'", $LIMIT_MAILBOX, $text);
$text = preg_replace("'%MAX_MAILS%'", MAX_MAIL, $text);
- $text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text);
+ $text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text);
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ANAME%'", ADMIN_NAME, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
@@ -104,7 +113,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
$text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text);
$text = preg_replace("'%SERVER%'", SERVER, $text);
-
+
// PLUS settings need to be kept intact
$text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text);
$text = preg_replace("'%PLUS_PRODUCTION%'", PLUS_PRODUCTION, $text);
@@ -120,7 +129,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%PLUS_PACKAGE_D_GOLD%'", (defined('PLUS_PACKAGE_D_GOLD') ? PLUS_PACKAGE_D_GOLD : '1000'), $text);
$text = preg_replace("'%PLUS_PACKAGE_E_PRICE%'", (defined('PLUS_PACKAGE_E_PRICE') ? PLUS_PACKAGE_E_PRICE : '49,99'), $text);
$text = preg_replace("'%PLUS_PACKAGE_E_GOLD%'", (defined('PLUS_PACKAGE_E_GOLD') ? PLUS_PACKAGE_E_GOLD : '2000'), $text);
-
+
fwrite($fh, $text);
fclose($fh);
diff --git a/GameEngine/Admin/Mods/editNewsboxSet.php b/GameEngine/Admin/Mods/editNewsboxSet.php
index eba2c130..f1ec6e0e 100755
--- a/GameEngine/Admin/Mods/editNewsboxSet.php
+++ b/GameEngine/Admin/Mods/editNewsboxSet.php
@@ -14,9 +14,18 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
include_once("../../Database.php");
$id = (int) $_POST['id'];
+if (!file_exists('constant_format.tpl')) {
+ die(
+ 'You seem to be running a new version of TravianZ which was installed using an old installer.
' .
+ 'Please download
constant_format.tpl file and copy it into the
GameEngine/Admin/Mods ' .
+ 'directory - otherwise saving configuration won\'t work.
' .
+ 'The constant_format.tpl file can be downloaded at ' .
+ '
https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl');
+}
+
$myFile = "../../config.php";
$fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\config.php");
-
+
$ERRORREPORT=ERROR_REPORT;
$T4=(T4_COMING==false)? "false":"true";
$GP_ENABLE=(GP_ENABLE==false)? "false":"true";
@@ -35,13 +44,13 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$LOG_WAR=(LOG_WAR==false)? "false":"true";
$LOG_MARKET=(LOG_MARKET==false)? "false":"true";
$LOG_ILLEGAL=(LOG_ILLEGAL==false)? "false":"true";
-
+
$LIMIT_MAILBOX=(LIMIT_MAILBOX==false)? "false":"true";
$INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true";
$SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true');
$ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true');
-
+
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text);
$text = preg_replace("'%ERROR%'", $ERRORREPORT, $text);
@@ -62,7 +71,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%TRAPPERCAP%'", TRAPPER_CAPACITY, $text);
$text = preg_replace("'%VILLAGE_EXPAND%'", CP, $text);
$text = preg_replace("'%DEMOLISH%'", DEMOLISH_LEVEL_REQ, $text);
- $text = preg_replace("'%STORAGE_MULTIPLIER%'", STORAGE_MULTIPLIER, $text);
+ $text = preg_replace("'%STORAGE_MULTIPLIER%'", STORAGE_MULTIPLIER, $text);
$text = preg_replace("'%QUEST%'", $QUEST, $text);
$text = preg_replace("'%QTYPE%'", QTYPE, $text);
$text = preg_replace("'%BEGINNER%'", PROTECTION, $text);
@@ -86,7 +95,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%LOGADMIN%'", $LOG_ADMIN, $text);
$text = preg_replace("'%LOGWAR%'", $LOG_WAR, $text);
$text = preg_replace("'%LOGMARKET%'", $LOG_MARKET, $text);
- $text = preg_replace("'%LOGILLEGAL%'", $LOG_ILLEGAL, $text);
+ $text = preg_replace("'%LOGILLEGAL%'", $LOG_ILLEGAL, $text);
//update
$text = preg_replace("'%BOX1%'", $_POST['box1'], $text);
$text = preg_replace("'%BOX2%'", $_POST['box2'], $text);
@@ -98,10 +107,10 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%SPASS%'", SQL_PASS, $text);
$text = preg_replace("'%SDB%'", SQL_DB, $text);
$text = preg_replace("'%PREFIX%'", TB_PREFIX, $text);
- $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text);
+ $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text);
$text = preg_replace("'%LIMIT_MAILBOX%'", $LIMIT_MAILBOX, $text);
$text = preg_replace("'%MAX_MAILS%'", MAX_MAIL, $text);
- $text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text);
+ $text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text);
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ANAME%'", ADMIN_NAME, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
@@ -111,7 +120,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
$text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text);
$text = preg_replace("'%SERVER%'", SERVER, $text);
-
+
// PLUS settings need to be kept intact
$text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text);
$text = preg_replace("'%PLUS_PRODUCTION%'", PLUS_PRODUCTION, $text);
@@ -127,7 +136,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%PLUS_PACKAGE_D_GOLD%'", (defined('PLUS_PACKAGE_D_GOLD') ? PLUS_PACKAGE_D_GOLD : '1000'), $text);
$text = preg_replace("'%PLUS_PACKAGE_E_PRICE%'", (defined('PLUS_PACKAGE_E_PRICE') ? PLUS_PACKAGE_E_PRICE : '49,99'), $text);
$text = preg_replace("'%PLUS_PACKAGE_E_GOLD%'", (defined('PLUS_PACKAGE_E_GOLD') ? PLUS_PACKAGE_E_GOLD : '2000'), $text);
-
+
fwrite($fh, $text);
fclose($fh);
diff --git a/GameEngine/Admin/Mods/editPlusSet.php b/GameEngine/Admin/Mods/editPlusSet.php
index 798646d0..6f271bd4 100644
--- a/GameEngine/Admin/Mods/editPlusSet.php
+++ b/GameEngine/Admin/Mods/editPlusSet.php
@@ -15,11 +15,20 @@ include_once("../../Database.php");
include_once("../../config.php");
$id = (int) $_POST['id'];
+if (!file_exists('constant_format.tpl')) {
+ die(
+ 'You seem to be running a new version of TravianZ which was installed using an old installer.
' .
+ 'Please download
constant_format.tpl file and copy it into the
GameEngine/Admin/Mods ' .
+ 'directory - otherwise saving configuration won\'t work.
' .
+ 'The constant_format.tpl file can be downloaded at ' .
+ '
https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl');
+}
+
$myFile = "../../config.php";
$fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\config.php");
$text = file_get_contents("constant_format.tpl");
-
+
$SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true');
$ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true');
diff --git a/GameEngine/Admin/Mods/editServerSet.php b/GameEngine/Admin/Mods/editServerSet.php
index f20ebb1d..dc883216 100755
--- a/GameEngine/Admin/Mods/editServerSet.php
+++ b/GameEngine/Admin/Mods/editServerSet.php
@@ -14,9 +14,18 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
include_once("../../Database.php");
$id = (int) $_POST['id'];
+if (!file_exists('constant_format.tpl')) {
+ die(
+ 'You seem to be running a new version of TravianZ which was installed using an old installer.
' .
+ 'Please download
constant_format.tpl file and copy it into the
GameEngine/Admin/Mods ' .
+ 'directory - otherwise saving configuration won\'t work.
' .
+ 'The constant_format.tpl file can be downloaded at ' .
+ '
https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl');
+}
+
$myFile = "../../config.php";
$fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\config.php");
-
+
$T4=(T4_COMING==false)? "false":"true";
$LOG_BUILD=(LOG_BUILD==false)? "false":"true";
$LOG_TECH=(LOG_TECH==false)? "false":"true";
@@ -33,7 +42,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true";
$SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true');
$ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true');
-
+
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", $_POST['error'], $text);
$text = preg_replace("'%ERROR%'", $_POST['error'], $text);
@@ -54,7 +63,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%TRAPPERCAP%'", $_POST['trappercap'], $text);
$text = preg_replace("'%VILLAGE_EXPAND%'", $_POST['village_expand'], $text);
$text = preg_replace("'%DEMOLISH%'", $_POST['demolish'], $text);
- $text = preg_replace("'%STORAGE_MULTIPLIER%'", $_POST['storage_multiplier'], $text);
+ $text = preg_replace("'%STORAGE_MULTIPLIER%'", $_POST['storage_multiplier'], $text);
$text = preg_replace("'%QUEST%'", $_POST['quest'], $text);
$text = preg_replace("'%QTYPE%'", $_POST['qtype'], $text);
$text = preg_replace("'%BEGINNER%'", $_POST['beginner'], $text);
@@ -76,7 +85,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%LOGADMIN%'", $LOG_ADMIN, $text);
$text = preg_replace("'%LOGWAR%'", $LOG_WAR, $text);
$text = preg_replace("'%LOGMARKET%'", $LOG_MARKET, $text);
- $text = preg_replace("'%LOGILLEGAL%'", $LOG_ILLEGAL, $text);
+ $text = preg_replace("'%LOGILLEGAL%'", $LOG_ILLEGAL, $text);
$text = preg_replace("'%BOX1%'", $NEWSBOX1, $text);
$text = preg_replace("'%BOX2%'", $NEWSBOX2, $text);
$text = preg_replace("'%BOX3%'", $NEWSBOX3, $text);
@@ -86,10 +95,10 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%SPASS%'", SQL_PASS, $text);
$text = preg_replace("'%SDB%'", SQL_DB, $text);
$text = preg_replace("'%PREFIX%'", TB_PREFIX, $text);
- $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text);
+ $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text);
$text = preg_replace("'%LIMIT_MAILBOX%'", $LIMIT_MAILBOX, $text);
$text = preg_replace("'%MAX_MAILS%'", MAX_MAIL, $text);
- $text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text);
+ $text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text);
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
$text = preg_replace("'%ARAIDS%'", $ADMINS_RAIDABLE, $text);
@@ -99,7 +108,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
$text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text);
$text = preg_replace("'%SERVER%'", SERVER, $text);
-
+
// PLUS settings need to be kept intact
$text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text);
$text = preg_replace("'%PLUS_PRODUCTION%'", PLUS_PRODUCTION, $text);
@@ -115,7 +124,7 @@ $fh = fopen($myFile, 'w') or die("
Can't open file: GameEngine\con
$text = preg_replace("'%PLUS_PACKAGE_D_GOLD%'", (defined('PLUS_PACKAGE_D_GOLD') ? PLUS_PACKAGE_D_GOLD : '1000'), $text);
$text = preg_replace("'%PLUS_PACKAGE_E_PRICE%'", (defined('PLUS_PACKAGE_E_PRICE') ? PLUS_PACKAGE_E_PRICE : '49,99'), $text);
$text = preg_replace("'%PLUS_PACKAGE_E_GOLD%'", (defined('PLUS_PACKAGE_E_GOLD') ? PLUS_PACKAGE_E_GOLD : '2000'), $text);
-
+
fwrite($fh, $text);
fclose($fh);
diff --git a/GameEngine/Admin/Mods/natarbuildingplan.php b/GameEngine/Admin/Mods/natarbuildingplan.php
index 1928f904..f37b0726 100755
--- a/GameEngine/Admin/Mods/natarbuildingplan.php
+++ b/GameEngine/Admin/Mods/natarbuildingplan.php
@@ -27,7 +27,6 @@ include_once($autoprefix."GameEngine/Database.php");
$id = (int) $_POST['id'];
$amt = (int) $_POST['vill_amount'];
-$addUnitsWrefs = [];
for($i=1;$i<=$amt;$i++) {
@@ -41,7 +40,7 @@ $addUnitsWrefs = [];
mysqli_query($GLOBALS["link"], $q);
$pop = $automation->recountPop($wid);
$cp = $automation->recountPop($wid);
- $addUnitsWrefs[] = $wid;
+ $database->addUnits($wid);
$database->addTech($wid);
$database->addABTech($wid);
$speed = NATARS_UNITS;
@@ -51,8 +50,6 @@ $addUnitsWrefs = [];
$database->addArtefact($wid, 3, 11, 1, PLAN, $desc, '', 'type1.gif');
}
- $database->addUnits($addUnitsWrefs);
-
$myFile = "../../../Templates/text.tpl";
$fh = fopen($myFile, 'w') or die("
Can't open file: templates/text.tpl");
$text = file_get_contents("../../../Templates/text_format.tpl");
diff --git a/GameEngine/Admin/Mods/natarend.php b/GameEngine/Admin/Mods/natarend.php
index 68497aa4..a3fd058f 100755
--- a/GameEngine/Admin/Mods/natarend.php
+++ b/GameEngine/Admin/Mods/natarend.php
@@ -27,7 +27,6 @@ include_once($autoprefix."GameEngine/Database.php");
$id = (int) $_POST['id'];
$amt = (int) $_POST['vill_amount'];
-$addUnitsWrefs = [];
$addTechWrefs = [];
$addABTechWrefs = [];
@@ -44,17 +43,16 @@ for($i=1;$i<=$amt;$i++) {
mysqli_query($GLOBALS["link"], $q);
$pop = $automation->recountPop($wid);
$cp = $automation->recountPop($wid);
- $addUnitsWrefs[] = $wid;
$addTechWrefs[] = $wid;
$addABTechWrefs[] = $wid;
$speed = NATARS_UNITS;
//new with random amount of troops
+ $database->addUnits($wid);
$q = "UPDATE " . TB_PREFIX . "units SET u41 = " . (rand(50, 1200) * $speed) . ", u42 = " . (rand(100, 1400) * $speed) . ", u43 = " . (rand(200, 1600) * $speed) . ", u44 = " . (rand(10, 50) * $speed) . ", u45 = " . (rand(48, 1700) * $speed) . ", u46 = " . (rand(60, 1800) * $speed) . ", u47 = " . (rand(200, 1600) * $speed) . ", u48 = " . (rand(40, 200) * $speed) . " , u49 = " . (rand(4, 20) * $speed) . ", u50 = " . (rand(5, 25) * $speed) . " WHERE vref = '".$wid."'";
mysqli_query($GLOBALS["link"], $q);
}
-$database->addUnits($addUnitsWrefs);
$database->addTech($addTechWrefs);
$database->addABTech($addABTechWrefs);
diff --git a/GameEngine/Admin/database.php b/GameEngine/Admin/database.php
index c3a08562..43478246 100755
--- a/GameEngine/Admin/database.php
+++ b/GameEngine/Admin/database.php
@@ -181,7 +181,7 @@ class adm_DB {
$username = $database->getUserArray($uid,1);
$username = $username['username'];
$database->addVillage($wid,$uid,$username,'0');
- $database->addResourceFields($wid,$database->getVillageType($wid));
+ $database->addResourceFields($wid,$database->getVillageType($wid, false));
$database->addUnits($wid);
$database->addTech($wid);
$database->addABTech($wid);
@@ -364,6 +364,21 @@ class adm_DB {
$q = "UPDATE ".TB_PREFIX."wdata SET occupied = 0 where id = $wref";
mysqli_query($this->connection, $q);
+ // clear expansion slots, if this village is an expansion of any other village
+ $q = "
+ UPDATE
+ ".TB_PREFIX."vdata
+ SET
+ exp1 = IF(exp1 = $wref, 0, exp1),
+ exp2 = IF(exp2 = $wref, 0, exp2),
+ exp3 = IF(exp3 = $wref, 0, exp3)
+ WHERE
+ exp1 = $wref OR
+ exp2 = $wref OR
+ exp3 = $wref";
+
+ mysqli_query($this->connection, $q);
+
$getmovement = $database->getMovement(3,$wref,1);
foreach($getmovement as $movedata) {
$time = microtime(true);
diff --git a/GameEngine/Admin/function.php b/GameEngine/Admin/function.php
index 94f7164b..1efe9805 100755
--- a/GameEngine/Admin/function.php
+++ b/GameEngine/Admin/function.php
@@ -86,10 +86,10 @@ class funct {
if (!$killhero){
$killhero=$database->FindHeroInOasis($get['uid']);
}
- if ($killhero) {
- $database->KillMyHero($get['uid']);
- $error="&kc=1";
- }else $error="&e=1";
+
+ $database->KillMyHero($get['uid']);
+ $error="&kc=1";
+
header("Location: admin.php?p=player&uid=".$get['uid'].$error);
exit;
case "reviveHero":
diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php
index b2630e1b..51af2a72 100755
--- a/GameEngine/Automation.php
+++ b/GameEngine/Automation.php
@@ -654,11 +654,10 @@ class Automation {
if ($level != 1) {
$max -= ${'bid'.$indi['type']}[$level-1]['attri'] * STORAGE_MULTIPLIER;
- $max += ${'bid'.$indi['type']}[$level]['attri'] * STORAGE_MULTIPLIER;
- } else {
- $max = ${'bid'.$indi['type']}[$level]['attri'] * STORAGE_MULTIPLIER;
}
+ $max += ${'bid'.$indi['type']}[$level]['attri'] * STORAGE_MULTIPLIER;
+
$fieldsToSet[$fieldDbName] = $max;
}
@@ -1085,14 +1084,9 @@ class Automation {
$database->setMaxCropForVillage($data['to'], $buildarray[$tblevel]['attri']);
}
- // embassy level was changed
- if ($tbgid==18){
- $info_cat .= $database->checkEmbassiesAfterBattle($data['to'], false);
- }
-
// oasis cannot be destroyed
+ $pop=$this->recountPop($data['to'], false);
if ($isoasis == 0) {
- $pop=$this->recountPop($data['to'], false);
if($pop==0 && $can_destroy==1){
$village_destroyed = 1;
// this will ensure the right $info_cat text
@@ -1101,18 +1095,34 @@ class Automation {
}
if ($isSecondRow) {
- $info_cat .= "
| Information |
- ".$this->procResType($tbgid,$can_destroy,$isoasis)." destroyed. |
|---|
";
+ if ($tbid > 0 || ($tbid == 0 && strpos($info_cat, 'The village has') === false)) {
+ $info_cat .= "
| Information |
+ " . $this->procResType( $tbgid, $can_destroy, $isoasis ) . " destroyed.";
+ }
+
+ // embassy level was changed
+ if ($tbgid==18){
+ $info_cat .= $database->checkEmbassiesAfterBattle($data['to'], $bdo['f'.$catapultTarget], false);
+ }
+
+ $info_cat .= " |
|---|
";
} else {
$info_cat = "" . $catp_pic . ", " . $this->procResType( $tbgid, $can_destroy, $isoasis ) . " destroyed.";
+
+ // embassy level was changed
+ if ($tbgid==18){
+ $info_cat .= $database->checkEmbassiesAfterBattle($data['to'], $bdo['f'.$catapultTarget], false);
+ }
}
}
// building/field not damaged
elseif ($battlepart[4]==0)
{
if ($isSecondRow) {
- $info_cat .= "
| Information |
- ".$this->procResType($tbgid,$can_destroy,$isoasis)." was not damaged. |
|---|
";
+ if ($tbid > 0 || ($tbid == 0 && strpos($info_cat, 'The village has') === false)) {
+ $info_cat .= "
| Information |
+ " . $this->procResType( $tbgid, $can_destroy, $isoasis ) . " was not damaged. |
|---|
";
+ }
} else {
$info_cat = "" . $catp_pic . "," . $this->procResType( $tbgid, $can_destroy, $isoasis ) . " was not damaged.";
}
@@ -1162,11 +1172,6 @@ class Automation {
if ( $tbgid == 11 || $tbgid == 39 ) {
$database->setMaxCropForVillage( $data['to'], $buildarray[ $tblevel ]['attri'] );
}
-
- // embassy level was changed
- if ( $tbgid == 18 ) {
- $info_cat .= $database->checkEmbassiesAfterBattle( $data['to'], false );
- }
}
$fieldsToSet = ["f" . $tbid];
@@ -1192,9 +1197,21 @@ class Automation {
if ($isSecondRow) {
$info_cat .= "
| Information |
- ".$this->procResType($tbgid,$can_destroy,$isoasis).$info_cata." |
|---|
";
+

".$this->procResType($tbgid,$can_destroy,$isoasis).$info_cata;
+
+ // embassy level was changed
+ if ( $tbgid == 18 ) {
+ $info_cat .= $database->checkEmbassiesAfterBattle( $data['to'], $bdo['f'.$catapultTarget], false );
+ }
+
+ $info_cat .= "