mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-11 07:06:06 +00:00
Merge pull request #175 from Ferywir/feat/per-user-language
Add per-user language selection (closes #166)
This commit is contained in:
@@ -73,7 +73,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
|
||||
$text = preg_replace("'%STARTTIME%'", COMMENCE, $text);
|
||||
$text = preg_replace("'%SSTARTDATE%'", START_DATE, $text);
|
||||
$text = preg_replace("'%SSTARTTIME%'", START_TIME, $text);
|
||||
$text = preg_replace("'%LANG%'", LANG, $text);
|
||||
$text = preg_replace("'%LANG%'", (defined('SERVER_LANG') ? SERVER_LANG : LANG), $text);
|
||||
$text = preg_replace("'%SPEED%'", SPEED, $text);
|
||||
$text = preg_replace("'%MAX%'", WORLD_MAX, $text);
|
||||
$text = preg_replace("'%GP%'", $GP_ENABLE, $text);
|
||||
|
||||
@@ -72,7 +72,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
|
||||
$text = preg_replace("'%STARTTIME%'", COMMENCE, $text);
|
||||
$text = preg_replace("'%SSTARTDATE%'", START_DATE, $text);
|
||||
$text = preg_replace("'%SSTARTTIME%'", START_TIME, $text);
|
||||
$text = preg_replace("'%LANG%'", LANG, $text);
|
||||
$text = preg_replace("'%LANG%'", (defined('SERVER_LANG') ? SERVER_LANG : LANG), $text);
|
||||
$text = preg_replace("'%SPEED%'", SPEED, $text);
|
||||
$text = preg_replace("'%MAX%'", WORLD_MAX, $text);
|
||||
$text = preg_replace("'%GP%'", GP_ENABLE, $text);
|
||||
|
||||
@@ -68,7 +68,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
|
||||
$text = preg_replace("'%STARTTIME%'", COMMENCE, $text);
|
||||
$text = preg_replace("'%SSTARTDATE%'", START_DATE, $text);
|
||||
$text = preg_replace("'%SSTARTTIME%'", START_TIME, $text);
|
||||
$text = preg_replace("'%LANG%'", LANG, $text);
|
||||
$text = preg_replace("'%LANG%'", (defined('SERVER_LANG') ? SERVER_LANG : LANG), $text);
|
||||
$text = preg_replace("'%SPEED%'", SPEED, $text);
|
||||
$text = preg_replace("'%MAX%'", WORLD_MAX, $text);
|
||||
$text = preg_replace("'%GP%'", $GP_ENABLE, $text);
|
||||
|
||||
@@ -41,7 +41,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
|
||||
$text = preg_replace("'%STARTTIME%'", COMMENCE, $text);
|
||||
$text = preg_replace("'%SSTARTDATE%'", START_DATE, $text);
|
||||
$text = preg_replace("'%SSTARTTIME%'", START_TIME, $text);
|
||||
$text = preg_replace("'%LANG%'", LANG, $text);
|
||||
$text = preg_replace("'%LANG%'", (defined('SERVER_LANG') ? SERVER_LANG : LANG), $text);
|
||||
$text = preg_replace("'%SPEED%'", SPEED, $text);
|
||||
$text = preg_replace("'%MAX%'", WORLD_MAX, $text);
|
||||
$text = preg_replace("'%GP%'", GP_ENABLE, $text);
|
||||
|
||||
@@ -74,7 +74,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
|
||||
$text = preg_replace("'%STARTTIME%'", COMMENCE, $text);
|
||||
$text = preg_replace("'%SSTARTDATE%'", START_DATE, $text);
|
||||
$text = preg_replace("'%SSTARTTIME%'", START_TIME, $text);
|
||||
$text = preg_replace("'%LANG%'", LANG, $text);
|
||||
$text = preg_replace("'%LANG%'", (defined('SERVER_LANG') ? SERVER_LANG : LANG), $text);
|
||||
$text = preg_replace("'%SPEED%'", SPEED, $text);
|
||||
$text = preg_replace("'%MAX%'", WORLD_MAX, $text);
|
||||
$text = preg_replace("'%GP%'", $GP_ENABLE, $text);
|
||||
|
||||
@@ -56,7 +56,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
|
||||
$text = preg_replace("'%STARTTIME%'", COMMENCE, $text);
|
||||
$text = preg_replace("'%SSTARTDATE%'", START_DATE, $text);
|
||||
$text = preg_replace("'%SSTARTTIME%'", START_TIME, $text);
|
||||
$text = preg_replace("'%LANG%'", LANG, $text);
|
||||
$text = preg_replace("'%LANG%'", (defined('SERVER_LANG') ? SERVER_LANG : LANG), $text);
|
||||
$text = preg_replace("'%SPEED%'", SPEED, $text);
|
||||
$text = preg_replace("'%MAX%'", WORLD_MAX, $text);
|
||||
$text = preg_replace("'%GP%'", GP_ENABLE, $text);
|
||||
|
||||
@@ -369,6 +369,15 @@ function __construct() {
|
||||
}
|
||||
$this->userarray = $this->userinfo = $_SESSION[$cacheKeyUser]['data'];
|
||||
|
||||
// Per-user language (issue #166): seed the session language from the
|
||||
// player's saved preference (users.lang) the first time, e.g. right
|
||||
// after login. Once set, the profile "save preferences" page keeps it
|
||||
// up to date, so we don't overwrite it here (also avoids reverting to
|
||||
// a stale value from the 30s user cache above).
|
||||
if (empty($_SESSION['lang']) && !empty($this->userarray['lang'])) {
|
||||
$_SESSION['lang'] = $this->userarray['lang'];
|
||||
}
|
||||
|
||||
$this->username = $this->userarray['username'];
|
||||
$this->uid = $_SESSION['id_user'] = $this->userarray['id'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user