The profile already had a language selector (Templates/Profile/preference.tpl)
that saved the choice into users.lang and $_SESSION['lang'], but the saved
preference was never used to actually load the language: every page loads
include("Lang/".LANG.".php") with the server-wide LANG constant, so changing
the language in the profile had no visible effect.
This wires it up:
- Introduce SERVER_LANG (the server default) and make LANG the EFFECTIVE
display language, resolved from the player's saved preference
($_SESSION['lang']) with a fallback to SERVER_LANG
(install/data/constant_format.tpl).
SECURITY: the value is sanitized to [a-z_] and the target Lang/<x>.php
file must exist, otherwise we fall back to the server default. This
prevents Local File Inclusion via include("Lang/".LANG.".php").
- Seed $_SESSION['lang'] from users.lang on login (GameEngine/Session.php,
PopulateVar), so the chosen language applies right after logging in.
- Keep the SERVER default intact when an admin saves settings: the admin
config regenerators and the "Server Settings"/config displays now use
SERVER_LANG (the server default) instead of the per-user LANG, so an
admin browsing in their own language can't accidentally overwrite the
server default (6 Admin/Mods/edit*.php + editServerSet.tpl + config.tpl).
Note: existing installs must also add SERVER_LANG + the LANG resolution to
their generated GameEngine/config.php (and the Admin/Mods/constant_format.tpl
copy) since config is generated at install time.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
TravianZ
TravianZ is an open-source browser strategy game inspired by classic Travian-like gameplay.
This repository currently targets modern local/server setups with PHP 8.x and MariaDB.
Project Status
- Version line:
v9(Incremental Refactor) - Stability: playable and actively maintained
- Migration note: this is not a drop-in upgrade over older
8.3.4deployments
If you are upgrading from an older installation, do a fresh install and migrate data carefully.
Quick Start (Docker)
git clone https://github.com/Shadowss/TravianZ.git
cd TravianZ
cp .env.example .env
docker compose up -d
Then open:
http://localhost:8080/install
Detailed container guide: DOCKER_README.md
System Requirements
Recommended:
- PHP
8.3+ - MariaDB
latest stable(or MySQL-compatible server) - Apache or Nginx with PHP support
- Linux server with enough CPU/RAM for your expected player count
Notes:
- The game is query-heavy by design (legacy architecture), so shared hosting can become a bottleneck quickly.
- For medium/large servers, prefer dedicated or well-sized VPS infrastructure.
Installation (Web Installer)
- Start services (Docker) or prepare your web+DB stack.
- Open
http://your-host/install. - Fill database settings:
- Host:
db(Docker) or your DB host - Port: usually
3306 - DB/User/Password from your environment
- Complete installer steps:
- DB structure
- World data
- Croppers build
- After success, access the game root.
Environment Configuration
Use .env (copy from .env.example) to manage deployment values.
Main keys:
MARIADB_ROOT_PASSWORDMARIADB_DATABASEMARIADB_USERMARIADB_PASSWORDDB_HOSTDB_PORT
Legacy compatibility keys (MYSQL_*) are still supported and can inherit MariaDB values.
Admin Panel
Admin entrypoint:
http://your-host/Admin/admin.php
Recent improvements include:
- Full incremental refactored GameEngine and Templates folder
- Added cache on Database.php and Automation.php and other important files
- Dynamic table prefix support in map tile queries
Performance Notes
For large worlds (for example 400x400), generation tasks can be expensive.
Recent optimizations include:
- world data generation tuning for bulk operations
- croppers generation batching and progress streaming
- safer DB/session handling during installer workflows
For production-like loads, monitor:
- DB CPU and slow queries
- PHP-FPM/Apache worker limits
- disk I/O during installer and reset operations
Troubleshooting
Common checks:
- If installer cannot connect to DB:
- verify
DB_HOST, port, user and password - in Docker, host should be
db, notlocalhost
- If permissions fail during install:
- ensure web user can write required runtime files/folders
- If pages show warnings after PHP upgrade:
- ensure latest code is deployed
- clear opcode/cache and retry
For container-specific troubleshooting, see DOCKER_README.md.
Development
Useful commands:
# Start stack
docker compose up -d
# Logs
docker compose logs -f web
# Validate PHP files
find . -name '*.php' -not -path './var/*' -print0 | xargs -0 -n1 php -l
Repository references:
- Change history: CHANGELOG.md
- Contribution guide: CONTRIBUTING.md
- Code of conduct: CODE_OF_CONDUCT.md
Community and Support
- Issues: https://github.com/Shadowss/TravianZ/issues
- Wiki: https://github.com/Shadowss/TravianZ/wiki
- Chat: https://gitter.im/TravianZ-V8/Lobby
Credits
Thanks to the original and current maintainers, contributors, testers, and the TravianZ community.
Special acknowledgement to all legacy authors and maintainers who kept this project alive through multiple iterations.
License
This project is licensed under the terms described in LICENSE.