iopietro / Travianz-Legacy

Join our Discord Server: https://discordapp.com/invite/9fbJKP9 | New repo: https://github.com/iopietro/Travianz
GNU General Public License v3.0
160 stars 94 forks source link

Parse error after saving the settings in the Admin panel #540

Closed velhbxtyrj closed 6 years ago

velhbxtyrj commented 6 years ago

This is due to the configuration file: GameEngine/config.php Parse error: syntax error, unexpected '%' in /GameEngine/config.php on line 120

I have these records:

// ***** Natars Spawn Time
define("NATARS_SPAWN_TIME",10); 
define("NATARS_WW_SPAWN_TIME",20); 
define("NATARS_WW_BUILDING_PLAN_SPAWN_TIME",30); 

// ***** Oasis production
define("OASIS_WOOD_MULTIPLIER",40); 
define("OASIS_CLAY_MULTIPLIER",40); 
define("OASIS_IRON_MULTIPLIER",40); 
define("OASIS_CROP_MULTIPLIER",40); 
define("OASIS_WOOD_PRODUCTION",OASIS_WOOD_MULTIPLIER*SPEED);
define("OASIS_CLAY_PRODUCTION",OASIS_CLAY_MULTIPLIER*SPEED);
define("OASIS_IRON_PRODUCTION",OASIS_IRON_MULTIPLIER*SPEED);
define("OASIS_CROP_PRODUCTION",OASIS_CROP_MULTIPLIER*SPEED); 

After saving the settings, they are overwritten by:

// ***** Natars Spawn Time
define("NATARS_SPAWN_TIME",%NATARS_SPAWN_TIME%); 
define("NATARS_WW_SPAWN_TIME",%NATARS_WW_SPAWN_TIME%); 
define("NATARS_WW_BUILDING_PLAN_SPAWN_TIME",%NATARS_WW_BUILDING_PLAN_SPAWN_TIME%); 

// ***** Oasis production
define("OASIS_WOOD_MULTIPLIER",%OASIS_WOOD_MULTIPLIER%); 
define("OASIS_CLAY_MULTIPLIER",%OASIS_CLAY_MULTIPLIER%); 
define("OASIS_IRON_MULTIPLIER",%OASIS_IRON_MULTIPLIER%); 
define("OASIS_CROP_MULTIPLIER",%OASIS_CROP_MULTIPLIER%); 
define("OASIS_WOOD_PRODUCTION",OASIS_WOOD_MULTIPLIER*SPEED);
define("OASIS_CLAY_PRODUCTION",OASIS_CLAY_MULTIPLIER*SPEED);
define("OASIS_IRON_PRODUCTION",OASIS_IRON_MULTIPLIER*SPEED);
define("OASIS_CROP_PRODUCTION",OASIS_CROP_MULTIPLIER*SPEED); 
velhbxtyrj commented 6 years ago

I tried to fight this problem and I did not succeed (

iopietro commented 6 years ago

I think that is generated because of the new constants I added in the last updates, I'll look into it.

iopietro commented 6 years ago

Fixed in b58b762b12833d107b7282621e9bc6bfa42bd5ff.

velhbxtyrj commented 6 years ago

@iopietro We still have problems with this. The error does not occur if we edit and save the block: Edit Server Settings

Problems after saving all other blocks:

I looked at these files that correspond to the above and there they have information that relates to different blocks, and specifically they all have a file configuration: Edit Server Settings

https://github.com/Shadowss/TravianZ/blob/master/GameEngine/Admin/Mods/editServerSet.php https://github.com/Shadowss/TravianZ/blob/master/GameEngine/Admin/Mods/editPlusSet.php https://github.com/Shadowss/TravianZ/blob/master/GameEngine/Admin/Mods/editLogSet.php https://github.com/Shadowss/TravianZ/blob/master/GameEngine/Admin/Mods/editNewsboxSet.php https://github.com/Shadowss/TravianZ/blob/master/GameEngine/Admin/Mods/editExtraSet.php https://github.com/Shadowss/TravianZ/blob/master/GameEngine/Admin/Mods/editAdminInfo.php

If perform cleanup and leave in each file only the information that relates to this file, this will not cause any error? Or need to make changes to each file like you did in the previous fix?

iopietro commented 6 years ago

I think that I'll do the second thing you said.