mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-01 01:54:22 +00:00
fix: old version cannot save config data anymore
This commit is contained in:
@@ -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.<br />' .
|
||||
'Please download <strong>constant_format.tpl</strong> file and copy it into the <strong>GameEngine/Admin/Mods</strong> ' .
|
||||
'directory - otherwise saving configuration won\'t work.<br /><br />' .
|
||||
'The constant_format.tpl file can be downloaded at ' .
|
||||
'<strong>https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl</strong>');
|
||||
}
|
||||
|
||||
$myFile = "../../config.php";
|
||||
$fh = fopen($myFile, 'w') or die("<br/><br/><br/>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("<br/><br/><br/>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("<br/><br/><br/>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("<br/><br/><br/>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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user