From 312507fe9ff2f0f6bfaf00a047bb360812ab15d5 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Tue, 7 Nov 2017 12:30:32 +0100 Subject: [PATCH] feat: MySQL port into installation options Closes #279 --- .gitignore | 5 +- Admin/Templates/config.tpl | 4 + GameEngine/Admin/Mods/editAdminInfo.php | 1 + GameEngine/Admin/Mods/editExtraSet.php | 1 + GameEngine/Admin/Mods/editLogSet.php | 1 + GameEngine/Admin/Mods/editNewsboxSet.php | 1 + GameEngine/Admin/Mods/editPlusSet.php | 1 + GameEngine/Admin/Mods/editServerSet.php | 1 + GameEngine/Database.php | 2 +- GameEngine/Technology.php | 22 +++ install/data/constant_format.tpl | 8 +- install/process.php | 192 ++++++++++++----------- install/templates/config.tpl | 32 ++-- install/templates/end.tpl | 6 +- 14 files changed, 168 insertions(+), 109 deletions(-) diff --git a/.gitignore b/.gitignore index a93799b4..a109df14 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,7 @@ GameEngine/Notes/* .settings # PHPStorm -.idea \ No newline at end of file +.idea + +# additional constant_format.tpl file, copied over from the installation folder +GameEngine/Admin/Mods/constant_format.tpl \ No newline at end of file diff --git a/Admin/Templates/config.tpl b/Admin/Templates/config.tpl index d3e7bb00..d29c28a6 100644 --- a/Admin/Templates/config.tpl +++ b/Admin/Templates/config.tpl @@ -325,6 +325,10 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); Hostname + + Port + + DB Username diff --git a/GameEngine/Admin/Mods/editAdminInfo.php b/GameEngine/Admin/Mods/editAdminInfo.php index 7180b8cc..8e66d6b2 100755 --- a/GameEngine/Admin/Mods/editAdminInfo.php +++ b/GameEngine/Admin/Mods/editAdminInfo.php @@ -89,6 +89,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%BOX2%'", $NEWSBOX2, $text); $text = preg_replace("'%BOX3%'", $NEWSBOX3, $text); $text = preg_replace("'%SSERVER%'", SQL_SERVER, $text); + $text = str_replace("%SPORT%", SQL_PORT, $text); $text = preg_replace("'%SUSER%'", SQL_USER, $text); $text = preg_replace("'%SPASS%'", SQL_PASS, $text); $text = preg_replace("'%SDB%'", SQL_DB, $text); diff --git a/GameEngine/Admin/Mods/editExtraSet.php b/GameEngine/Admin/Mods/editExtraSet.php index c9c52aba..7183a27a 100755 --- a/GameEngine/Admin/Mods/editExtraSet.php +++ b/GameEngine/Admin/Mods/editExtraSet.php @@ -86,6 +86,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%BOX2%'", (NEWSBOX2 ? 'true' : 'false'), $text); $text = preg_replace("'%BOX3%'", (NEWSBOX3 ? 'true' : 'false'), $text); $text = preg_replace("'%SSERVER%'", SQL_SERVER, $text); + $text = str_replace("%SPORT%", SQL_PORT, $text); $text = preg_replace("'%SUSER%'", SQL_USER, $text); $text = preg_replace("'%SPASS%'", SQL_PASS, $text); $text = preg_replace("'%SDB%'", SQL_DB, $text); diff --git a/GameEngine/Admin/Mods/editLogSet.php b/GameEngine/Admin/Mods/editLogSet.php index da8bc74f..35137df3 100755 --- a/GameEngine/Admin/Mods/editLogSet.php +++ b/GameEngine/Admin/Mods/editLogSet.php @@ -86,6 +86,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%BOX2%'", $NEWSBOX2, $text); $text = preg_replace("'%BOX3%'", $NEWSBOX3, $text); $text = preg_replace("'%SSERVER%'", SQL_SERVER, $text); + $text = str_replace("%SPORT%", SQL_PORT, $text); $text = preg_replace("'%SUSER%'", SQL_USER, $text); $text = preg_replace("'%SPASS%'", SQL_PASS, $text); $text = preg_replace("'%SDB%'", SQL_DB, $text); diff --git a/GameEngine/Admin/Mods/editNewsboxSet.php b/GameEngine/Admin/Mods/editNewsboxSet.php index ca895b95..eba2c130 100755 --- a/GameEngine/Admin/Mods/editNewsboxSet.php +++ b/GameEngine/Admin/Mods/editNewsboxSet.php @@ -93,6 +93,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%BOX3%'", $_POST['box3'], $text); //end update $text = preg_replace("'%SSERVER%'", SQL_SERVER, $text); + $text = str_replace("%SPORT%", SQL_PORT, $text); $text = preg_replace("'%SUSER%'", SQL_USER, $text); $text = preg_replace("'%SPASS%'", SQL_PASS, $text); $text = preg_replace("'%SDB%'", SQL_DB, $text); diff --git a/GameEngine/Admin/Mods/editPlusSet.php b/GameEngine/Admin/Mods/editPlusSet.php index c1438ed8..798646d0 100644 --- a/GameEngine/Admin/Mods/editPlusSet.php +++ b/GameEngine/Admin/Mods/editPlusSet.php @@ -70,6 +70,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%BOX2%'", (NEWSBOX2 ? 'true' : 'false'), $text); $text = preg_replace("'%BOX3%'", (NEWSBOX3 ? 'true' : 'false'), $text); $text = preg_replace("'%SSERVER%'", SQL_SERVER, $text); + $text = str_replace("%SPORT%", SQL_PORT, $text); $text = preg_replace("'%SUSER%'", SQL_USER, $text); $text = preg_replace("'%SPASS%'", SQL_PASS, $text); $text = preg_replace("'%SDB%'", SQL_DB, $text); diff --git a/GameEngine/Admin/Mods/editServerSet.php b/GameEngine/Admin/Mods/editServerSet.php index f064a3e0..f20ebb1d 100755 --- a/GameEngine/Admin/Mods/editServerSet.php +++ b/GameEngine/Admin/Mods/editServerSet.php @@ -81,6 +81,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%BOX2%'", $NEWSBOX2, $text); $text = preg_replace("'%BOX3%'", $NEWSBOX3, $text); $text = preg_replace("'%SSERVER%'", SQL_SERVER, $text); + $text = str_replace("%SPORT%", SQL_PORT, $text); $text = preg_replace("'%SUSER%'", SQL_USER, $text); $text = preg_replace("'%SPASS%'", SQL_PASS, $text); $text = preg_replace("'%SDB%'", SQL_DB, $text); diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 25f5000d..6f85e475 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -5350,7 +5350,7 @@ References: // database is not needed if we're displaying static pages $req_file = basename($_SERVER['PHP_SELF']); if (!in_array($req_file, ['tutorial.php', 'anleitung.php'])) { - $database = new MYSQLi_DB(SQL_SERVER, SQL_USER, SQL_PASS, SQL_DB); + $database = new MYSQLi_DB(SQL_SERVER, SQL_USER, SQL_PASS, SQL_DB, SQL_PORT); $link = $database->return_link(); $GLOBALS['db'] = $database; $GLOBALS['link'] = $database->return_link(); diff --git a/GameEngine/Technology.php b/GameEngine/Technology.php index 3f3d82a2..99f4dc07 100755 --- a/GameEngine/Technology.php +++ b/GameEngine/Technology.php @@ -10,6 +10,28 @@ ## ## ################################################################################# +global $autoprefix; + +// even with autoloader created, we can't use it here yet, as it's not been created +// ... so, let's see where it is and include it +$autoloader_found = false; +// go max 5 levels up - we don't have folders that go deeper than that +for ($i = 0; $i < 5; $i++) { + $autoprefix = str_repeat('../', $i); + if (file_exists($autoprefix.'autoloader.php')) { + $autoloader_found = true; + include_once $autoprefix.'autoloader.php'; + break; + } +} + +if (!$autoloader_found) { + die('Could not find autoloading class.'); +} + +// this is needed for installation, since the lang file would not be included yet +include_once($autoprefix."GameEngine/lang/en.php"); + class Technology { public $unarray = array(1=>U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33,U34,U35,U36,U37,U38,U39,U40,U41,U42,U43,U44,U45,U46,U47,U48,U49,U50,U99,U0); diff --git a/install/data/constant_format.tpl b/install/data/constant_format.tpl index 693fe078..4cef5752 100644 --- a/install/data/constant_format.tpl +++ b/install/data/constant_format.tpl @@ -54,7 +54,7 @@ define("SPEED", "%SPEED%"); define("WORLD_MAX", "%MAX%"); // ***** Graphic Pack -// True = enabled, false = disabled +// true = enabled, false = disabled //!!!!!!!!!!!! DO NOT ENABLE !!!!!!!!!!!! define("GP_ENABLE",false); // Graphic pack location (default: gpack/travian_default/) @@ -213,11 +213,15 @@ define("NEWSBOX3",%BOX3%); ////////////////////////////////// // ***** SQL Hostname -// example. sql106.000space.com / localhost +// example: sql106.000space.com / localhost // If you host server on own PC than this value is: localhost // If you use online hosting, value must be written in host cpanel define("SQL_SERVER", "%SSERVER%"); +// ***** SQL Port +// default: 3306 +define("SQL_PORT", %SPORT%); + // ***** Database Username define("SQL_USER", "%SUSER%"); diff --git a/install/process.php b/install/process.php index 68f4938e..e203f9c8 100755 --- a/install/process.php +++ b/install/process.php @@ -32,104 +32,120 @@ class Process { } private function constForm() { - $myFile = "../GameEngine/config.php"; - $fh = @fopen($myFile, 'w') or die("


Can't create or update file: GameEngine\config.php"); + $configFile = "../GameEngine/config.php"; + $configTemplateFile = "../GameEngine/Admin/Mods/constant_format.tpl"; + + $gameConfig = @fopen($configFile, 'w') or die("


Can't create or update file: GameEngine\config.php"); + + // copy the contents of the config template file into a new location, used when editing + // game configuration from the in-game Admin (since the install folder would be deleted at that point) + $templateFile = @fopen($configTemplateFile, 'w') or die("


Can't create or update file: GameEngine\Admin\Mods\constant_format.tpl"); + fclose($templateFile); + $text = file_get_contents("data/constant_format.tpl"); - $text = preg_replace("'%SERVERNAME%'", $_POST['servername'], $text); - $text = preg_replace("'%SSTARTDATE%'", $_POST['start_date'], $text); - $text = preg_replace("'%SSTARTTIME%'", $_POST['start_time'], $text); + + // make template copy + file_put_contents($configTemplateFile, $text); + + // continue with text replacements + $findReplace = []; + + $findReplace["%SERVERNAME%"] = $_POST['servername']; + $findReplace["%SSTARTDATE%"] = $_POST['start_date']; + $findReplace["%SSTARTTIME%"] = $_POST['start_time']; $tz = explode(",",$_POST['tzone']); - $text = preg_replace("'%STIMEZONE%'", $tz[1], $text); - $text = preg_replace("'%LANG%'", $_POST['lang'], $text); - $text = preg_replace("'%SPEED%'", $_POST['speed'], $text); - $text = preg_replace("'%INCSPEED%'", $_POST['incspeed'], $text); - $text = preg_replace("'%EVASIONSPEED%'", $_POST['evasionspeed'], $text); - $text = preg_replace("'%TRADERCAP%'", $_POST['tradercap'], $text); - $text = preg_replace("'%CRANNYCAP%'", $_POST['crannycap'], $text); - $text = preg_replace("'%TRAPPERCAP%'", $_POST['trappercap'], $text); - $text = preg_replace("'%STORAGE_MULTIPLIER%'", $_POST['storage_multiplier'], $text); - //$text = preg_replace("'%UTRACK%'", $_POST['trackusers'], $text); - //$text = preg_replace("'%UTOUT%'", $_POST['timeout'], $text); - //$text = preg_replace("'%AUTOD%'", $_POST['autodel'], $text); - //$text = preg_replace("'%AUTODT%'", $_POST['autodeltime'], $text); - $text = preg_replace("'%MAX%'", $_POST['wmax'], $text); - //$text = preg_replace("'%GP%'", $_POST['gpack'], $text); - $text = preg_replace("'%SSERVER%'", $_POST['sserver'], $text); - $text = preg_replace("'%SUSER%'", $_POST['suser'], $text); - $text = preg_replace("'%SPASS%'", $_POST['spass'], $text); - $text = preg_replace("'%SDB%'", $_POST['sdb'], $text); - $text = preg_replace("'%PREFIX%'", $_POST['prefix'], $text); - $text = preg_replace("'%CONNECTT%'", $_POST['connectt'], $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); - $text = preg_replace("'%ARAIDS%'", ($_POST['admin_raidable'] == 'True' ? 'true' : 'false'), $text); - //$text = preg_replace("'%SUBDOM%'", $_POST['subdom'], $text); - $text = preg_replace("'%LOGBUILD%'", $_POST['log_build'], $text); - $text = preg_replace("'%LOGTECH%'", $_POST['log_tech'], $text); - $text = preg_replace("'%LOGLOGIN%'", $_POST['log_login'], $text); - $text = preg_replace("'%LOGGOLDFIN%'", $_POST['log_gold_fin'], $text); - $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("'%MINUSERLENGTH%'", $_POST['userlength'], $text); - //$text = preg_replace("'%MINPASSLENGTH%'", $_POST['passlength'], $text); - //$text = preg_replace("'%SPECIALCHARS%'", $_POST['specialchars'], $text); - $text = preg_replace("'%ACTIVATE%'", $_POST['activate'], $text); - $text = preg_replace("'%ARANK%'", $_POST['admin_rank'], $text); - $text = preg_replace("'%QUEST%'", $_POST['quest'], $text); - $text = preg_replace("'%QTYPE%'", $_POST['qtype'], $text); - $text = preg_replace("'%BEGINNER%'", $_POST['beginner'], $text); - $text = preg_replace("'%STARTTIME%'", time(), $text); - $text = preg_replace("'%DOMAIN%'", $_POST['domain'], $text); - $text = preg_replace("'%HOMEPAGE%'", $_POST['homepage'], $text); - $text = preg_replace("'%SERVER%'", $_POST['server'], $text); - $text = preg_replace("'%LIMIT_MAILBOX%'", $_POST['limit_mailbox'], $text); - $text = preg_replace("'%MAX_MAILS%'", $_POST['max_mails'], $text); - $text = preg_replace("'%DEMOLISH%'", $_POST['demolish'], $text); - $text = preg_replace("'%BOX1%'", $_POST['box1'], $text); - $text = preg_replace("'%BOX2%'", $_POST['box2'], $text); - $text = preg_replace("'%BOX3%'", $_POST['box3'], $text); - $text = preg_replace("'%VILLAGE_EXPAND%'", $_POST['village_expand'], $text); - $text = preg_replace("'%ERRORREPORT%'", $_POST['error'], $text); - $text = preg_replace("'%ERROR%'", $_POST['error'], $text); - //$text = preg_replace("'%GP_LOCATE%'", $_POST['gp_locate'], $text); - $text = preg_replace("'%PLUS_TIME%'", $_POST['plus_time'], $text); - $text = preg_replace("'%PLUS_PRODUCTION%'", $_POST['plus_production'], $text); - $text = preg_replace("'%PAYPAL_EMAIL%'", $_POST['paypal-email'], $text); - $text = preg_replace("'%PAYPAL_CURRENCY%'", $_POST['paypal-currency'], $text); - $text = preg_replace("'%PLUS_PACKAGE_A_GOLD%'", $_POST['plus-a-gold'], $text); - $text = preg_replace("'%PLUS_PACKAGE_A_PRICE%'", $_POST['plus-a-price'], $text); - $text = preg_replace("'%PLUS_PACKAGE_B_GOLD%'", $_POST['plus-b-gold'], $text); - $text = preg_replace("'%PLUS_PACKAGE_B_PRICE%'", $_POST['plus-b-price'], $text); - $text = preg_replace("'%PLUS_PACKAGE_C_GOLD%'", $_POST['plus-c-gold'], $text); - $text = preg_replace("'%PLUS_PACKAGE_C_PRICE%'", $_POST['plus-c-price'], $text); - $text = preg_replace("'%PLUS_PACKAGE_D_GOLD%'", $_POST['plus-d-gold'], $text); - $text = preg_replace("'%PLUS_PACKAGE_D_PRICE%'", $_POST['plus-d-price'], $text); - $text = preg_replace("'%PLUS_PACKAGE_E_GOLD%'", $_POST['plus-e-gold'], $text); - $text = preg_replace("'%PLUS_PACKAGE_E_PRICE%'", $_POST['plus-e-price'], $text); - $text = preg_replace("'%MEDALINTERVAL%'", $_POST['medalinterval'], $text); - $text = preg_replace("'%GREAT_WKS%'", $_POST['great_wks'], $text); - $text = preg_replace("'%TS_THRESHOLD%'", $_POST['ts_threshold'], $text); - $text = preg_replace("'%WW%'", $_POST['ww'], $text); - $text = preg_replace("'%SHOW_NATARS%'", $_POST['show_natars'], $text); - $text = preg_replace("'%NATARS_UNITS%'", $_POST['natars_units'], $text); - $text = preg_replace("'%NATURE_REGTIME%'", $_POST['nature_regtime'], $text); - $text = preg_replace("'%T4_COMING%'", $_POST['t4_coming'], $text); - $text = preg_replace("'%REG_OPEN%'", $_POST['reg_open'], $text); - $text = preg_replace("'%PEACE%'", $_POST['peace'], $text); + $findReplace["%STIMEZONE%"] = $tz[1]; + $findReplace["%LANG%"] = $_POST['lang']; + $findReplace["%SPEED%"] = $_POST['speed']; + $findReplace["%INCSPEED%"] = $_POST['incspeed']; + $findReplace["%EVASIONSPEED%"] = $_POST['evasionspeed']; + $findReplace["%TRADERCAP%"] = $_POST['tradercap']; + $findReplace["%CRANNYCAP%"] = $_POST['crannycap']; + $findReplace["%TRAPPERCAP%"] = $_POST['trappercap']; + $findReplace["%STORAGE_MULTIPLIER%"] = $_POST['storage_multiplier']; + //$findReplace["%UTRACK%"] = $_POST['trackusers']; + //$findReplace["%UTOUT%"] = $_POST['timeout']; + //$findReplace["%AUTOD%"] = $_POST['autodel']; + //$findReplace["%AUTODT%"] = $_POST['autodeltime']; + $findReplace["%MAX%"] = $_POST['wmax']; + //$findReplace["%GP%"] = $_POST['gpack']; + $findReplace["%SSERVER%"] = $_POST['sserver']; + $findReplace["%SPORT%"] = $_POST['sport']; + $findReplace["%SUSER%"] = $_POST['suser']; + $findReplace["%SPASS%"] = $_POST['spass']; + $findReplace["%SDB%"] = $_POST['sdb']; + $findReplace["%PREFIX%"] = $_POST['prefix']; + $findReplace["%CONNECTT%"] = $_POST['connectt']; + $findReplace["%AEMAIL%"] = $_POST['aemail']; + $findReplace["%ANAME%"] = $_POST['aname']; + $findReplace["%ASUPPMSGS%"] = ($_POST['admin_support_msgs'] == 'true' ? 'true' : 'false'); + $findReplace["%ARAIDS%"] = ($_POST['admin_raidable'] == 'true' ? 'true' : 'false'); + //$findReplace["%SUBDOM%"] = $_POST['subdom']; + $findReplace["%LOGBUILD%"] = $_POST['log_build']; + $findReplace["%LOGTECH%"] = $_POST['log_tech']; + $findReplace["%LOGLOGIN%"] = $_POST['log_login']; + $findReplace["%LOGGOLDFIN%"] = $_POST['log_gold_fin']; + $findReplace["%LOGADMIN%"] = $_POST['log_admin']; + $findReplace["%LOGWAR%"] = $_POST['log_war']; + $findReplace["%LOGMARKET%"] = $_POST['log_market']; + $findReplace["%LOGILLEGAL%"] = $_POST['log_illegal']; + //$findReplace["%MINUSERLENGTH%"] = $_POST['userlength']; + //$findReplace["%MINPASSLENGTH%"] = $_POST['passlength']; + //$findReplace["%SPECIALCHARS%"] = $_POST['specialchars']; + $findReplace["%ACTIVATE%"] = $_POST['activate']; + $findReplace["%ARANK%"] = $_POST['admin_rank']; + $findReplace["%QUEST%"] = $_POST['quest']; + $findReplace["%QTYPE%"] = $_POST['qtype']; + $findReplace["%BEGINNER%"] = $_POST['beginner']; + $findReplace["%STARTTIME%"] = time(); + $findReplace["%DOMAIN%"] = $_POST['domain']; + $findReplace["%HOMEPAGE%"] = $_POST['homepage']; + $findReplace["%SERVER%"] = $_POST['server']; + $findReplace["%LIMIT_MAILBOX%"] = $_POST['limit_mailbox']; + $findReplace["%MAX_MAILS%"] = $_POST['max_mails']; + $findReplace["%DEMOLISH%"] = $_POST['demolish']; + $findReplace["%BOX1%"] = $_POST['box1']; + $findReplace["%BOX2%"] = $_POST['box2']; + $findReplace["%BOX3%"] = $_POST['box3']; + $findReplace["%VILLAGE_EXPAND%"] = $_POST['village_expand']; + $findReplace["%ERRORREPORT%"] = $_POST['error']; + $findReplace["%ERROR%"] = $_POST['error']; + //$findReplace["%GP_LOCATE%"] = $_POST['gp_locate']; + $findReplace["%PLUS_TIME%"] = $_POST['plus_time']; + $findReplace["%PLUS_PRODUCTION%"] = $_POST['plus_production']; + $findReplace["%PAYPAL_EMAIL%"] = $_POST['paypal-email']; + $findReplace["%PAYPAL_CURRENCY%"] = $_POST['paypal-currency']; + $findReplace["%PLUS_PACKAGE_A_GOLD%"] = $_POST['plus-a-gold']; + $findReplace["%PLUS_PACKAGE_A_PRICE%"] = $_POST['plus-a-price']; + $findReplace["%PLUS_PACKAGE_B_GOLD%"] = $_POST['plus-b-gold']; + $findReplace["%PLUS_PACKAGE_B_PRICE%"] = $_POST['plus-b-price']; + $findReplace["%PLUS_PACKAGE_C_GOLD%"] = $_POST['plus-c-gold']; + $findReplace["%PLUS_PACKAGE_C_PRICE%"] = $_POST['plus-c-price']; + $findReplace["%PLUS_PACKAGE_D_GOLD%"] = $_POST['plus-d-gold']; + $findReplace["%PLUS_PACKAGE_D_PRICE%"] = $_POST['plus-d-price']; + $findReplace["%PLUS_PACKAGE_E_GOLD%"] = $_POST['plus-e-gold']; + $findReplace["%PLUS_PACKAGE_E_PRICE%"] = $_POST['plus-e-price']; + $findReplace["%MEDALINTERVAL%"] = $_POST['medalinterval']; + $findReplace["%GREAT_WKS%"] = $_POST['great_wks']; + $findReplace["%TS_THRESHOLD%"] = $_POST['ts_threshold']; + $findReplace["%WW%"] = $_POST['ww']; + $findReplace["%SHOW_NATARS%"] = $_POST['show_natars']; + $findReplace["%NATARS_UNITS%"] = $_POST['natars_units']; + $findReplace["%NATURE_REGTIME%"] = $_POST['nature_regtime']; + $findReplace["%T4_COMING%"] = $_POST['t4_coming']; + $findReplace["%REG_OPEN%"] = $_POST['reg_open']; + $findReplace["%PEACE%"] = $_POST['peace']; - fwrite($fh, $text); + fwrite($gameConfig, str_replace(array_keys($findReplace), array_values($findReplace), $text)); - if(file_exists("../GameEngine/config.php")) { + if (file_exists($configFile) && file_exists($configTemplateFile)) { header("Location: index.php?s=2"); } else { header("Location: index.php?s=1&c=1"); } - fclose($fh); + fclose($gameConfig); } /** diff --git a/install/templates/config.tpl b/install/templates/config.tpl index ea474f0f..efb6a541 100644 --- a/install/templates/config.tpl +++ b/install/templates/config.tpl @@ -118,8 +118,8 @@ echo "
Error creating constant.php Register Open: @@ -202,8 +202,8 @@ echo "
Error creating constant.php Great Workshop: @@ -211,8 +211,8 @@ echo "
Error creating constant.php ww: @@ -220,8 +220,8 @@ echo "
Error creating constant.php Show Natars in Statistics: @@ -255,8 +255,8 @@ echo "
Error creating constant.php Show admin in stats: @@ -264,8 +264,8 @@ echo "
Error creating constant.php Include Support Messages in Admin Mailbox: @@ -273,8 +273,8 @@ echo "
Error creating constant.php Allow Administrative Accounts to be Raided and Attacked: @@ -287,6 +287,10 @@ echo "
Error creating constant.php Hostname: + + Port: + + Username: diff --git a/install/templates/end.tpl b/install/templates/end.tpl index c24b52a8..56a848a5 100755 --- a/install/templates/end.tpl +++ b/install/templates/end.tpl @@ -49,9 +49,9 @@ touch('../var/installed');
- - - + + +