mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-29 00:54:31 +00:00
+104
-88
@@ -32,104 +32,120 @@ class Process {
|
||||
}
|
||||
|
||||
private function constForm() {
|
||||
$myFile = "../GameEngine/config.php";
|
||||
$fh = @fopen($myFile, 'w') or die("<br/><br/><br/>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("<br/><br/><br/>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("<br/><br/><br/>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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user