fix: fix even more PHP errors and warnings
This commit is contained in:
parent
077f97d5fc
commit
7debdba37c
28 changed files with 80 additions and 72 deletions
|
@ -81,16 +81,17 @@ function disableTicks() {
|
||||||
$statusMessage = "";
|
$statusMessage = "";
|
||||||
|
|
||||||
// Start / stop manager
|
// Start / stop manager
|
||||||
if ($_GET['c'] == 'sm') {
|
$command = $_GET['c'] ?? '';
|
||||||
|
if ($command == 'sm') {
|
||||||
startManager();
|
startManager();
|
||||||
} elseif ($_GET['c'] == 'km') {
|
} elseif ($command == 'km') {
|
||||||
killManager();
|
killManager();
|
||||||
} else {
|
} else {
|
||||||
$mRunning = __isManagerRunning();
|
$mRunning = __isManagerRunning();
|
||||||
$tActive = ($mRunning !== false) ? ticksActive() : false;
|
$tActive = ($mRunning !== false) ? ticksActive() : false;
|
||||||
|
|
||||||
// Run tick manually
|
// Run tick manually
|
||||||
if ($_GET['c'] == 'rt' && $_GET['g'] != '' && $_GET['t'] != '') {
|
if ($command == 'rt' && $_GET['g'] != '' && $_GET['t'] != '') {
|
||||||
$__runFromAdmin = true;
|
$__runFromAdmin = true;
|
||||||
$__adminParams = array($_GET['g'], $_GET['t']);
|
$__adminParams = array($_GET['g'], $_GET['t']);
|
||||||
__logAdmin("is running tick " . join("::", $__adminParams));
|
__logAdmin("is running tick " . join("::", $__adminParams));
|
||||||
|
@ -102,10 +103,10 @@ if ($_GET['c'] == 'sm') {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Enable / disable ticks
|
// Enable / disable ticks
|
||||||
if ($tActive === true && $_GET['c'] == 'dt') {
|
if ($tActive === true && $command == 'dt') {
|
||||||
disableTicks();
|
disableTicks();
|
||||||
$tActive = 'pending';
|
$tActive = 'pending';
|
||||||
} elseif ($mRunning !== false && $tActive === false && $_GET['c'] == 'et') {
|
} elseif ($mRunning !== false && $tActive === false && $command == 'et') {
|
||||||
enableTicks();
|
enableTicks();
|
||||||
$tActive = 'pending';
|
$tActive = 'pending';
|
||||||
}
|
}
|
||||||
|
@ -140,7 +141,7 @@ if (!class_exists('config')) {
|
||||||
if ($mRunning === false) {
|
if ($mRunning === false) {
|
||||||
?>
|
?>
|
||||||
<b>not running</b> - <a href="?c=sm">Start manager</a>
|
<b>not running</b> - <a href="?c=sm">Start manager</a>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
?> <b>running</b>, process ID #<?=$mRunning?> - <a href="?c=km">Kill manager</a><br/>
|
?> <b>running</b>, process ID #<?=$mRunning?> - <a href="?c=km">Kill manager</a><br/>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -72,7 +72,8 @@ class beta5_getUniverseOverview
|
||||||
return array(
|
return array(
|
||||||
$pc, $gr['points'], $gr['ranking'], $cr['points'], $cr['ranking'],
|
$pc, $gr['points'], $gr['ranking'], $cr['points'], $cr['ranking'],
|
||||||
$mr['points'], $mr['ranking'], $fr['points'], $fr['ranking'],
|
$mr['points'], $mr['ranking'], $fr['points'], $fr['ranking'],
|
||||||
$or['points'], $or['ranking'], $ir['points'], $ir['ranking']
|
$or['points'] ?? "", $or['ranking'] ?? "",
|
||||||
|
$ir['points'] ?? "", $ir['ranking'] ?? ""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ class beta5_alliance_getPrivileges {
|
||||||
);
|
);
|
||||||
|
|
||||||
$pi = $this->players->call('get', $p);
|
$pi = $this->players->call('get', $p);
|
||||||
if (is_null($pi['aid'])) {
|
if (!isset($pi['aid'])) {
|
||||||
return $nr;
|
return $nr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class beta5_fleet_getPower {
|
||||||
|
|
||||||
// Computes a fleet's power
|
// Computes a fleet's power
|
||||||
function run($pl, $g, $f, $c, $b) {
|
function run($pl, $g, $f, $c, $b) {
|
||||||
if (!is_array($this->ePower[$pl])) {
|
if (!isset($this->ePower[$pl])) {
|
||||||
$r = $this->rules->call('get', $pl);
|
$r = $this->rules->call('get', $pl);
|
||||||
$a = array('gaship','fighter','cruiser','bcruiser');
|
$a = array('gaship','fighter','cruiser','bcruiser');
|
||||||
$this->ePower[$pl] = array();
|
$this->ePower[$pl] = array();
|
||||||
|
|
|
@ -69,7 +69,7 @@ class beta5_forums_getStructure {
|
||||||
|
|
||||||
// Get alliance forums
|
// Get alliance forums
|
||||||
$ap = $this->alliance->call('getPrivileges', $player);
|
$ap = $this->alliance->call('getPrivileges', $player);
|
||||||
if ($ap['f_read'] || $ap['f_mod']) {
|
if (($ap['f_read'] ?? false) || ($ap['f_mod'] ?? false)) {
|
||||||
$rv['A#'.$pi['aid']] = array(
|
$rv['A#'.$pi['aid']] = array(
|
||||||
"id" => $pi['aid'],
|
"id" => $pi['aid'],
|
||||||
"type" => "A",
|
"type" => "A",
|
||||||
|
|
|
@ -55,7 +55,7 @@ class beta5_planet_library {
|
||||||
$r = dbFetchHash($q);
|
$r = dbFetchHash($q);
|
||||||
$r["rename"] = ($r['rename'] == 't') ? 1 : 0;
|
$r["rename"] = ($r['rename'] == 't') ? 1 : 0;
|
||||||
|
|
||||||
if (is_null($this->pOwner[$r['id']])) {
|
if (!isset($this->pOwner[$r['id']])) {
|
||||||
$this->pOwner[$r['id']] = $r['owner'];
|
$this->pOwner[$r['id']] = $r['owner'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class beta5_player_get {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($this->lib->mainClass->players[$id])) {
|
if (isset($this->lib->mainClass->players[$id])) {
|
||||||
if (!$quitOk && $this->lib->mainClass->players[$id]["quit"] == "1") {
|
if (!$quitOk && $this->lib->mainClass->players[$id]["quit"] == "1") {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ class beta5_player_get {
|
||||||
"vac" => ($a[10] == 't'),
|
"vac" => ($a[10] == 't'),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (is_null($this->lib->mainClass->pNames[$id])) {
|
if (!isset($this->lib->mainClass->pNames[$id])) {
|
||||||
$this->lib->mainClass->pNames[$id] = $pinf['name'];
|
$this->lib->mainClass->pNames[$id] = $pinf['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class beta5_player_isOnVacation {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->lib->game->params['novacation'] == 1) {
|
if ($this->lib->game->params['novacation'] ?? 0 == 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class beta5_rules_library {
|
class beta5_rules_library {
|
||||||
var $index = array(
|
public $index = array(
|
||||||
'change',
|
'change',
|
||||||
'get'
|
'get'
|
||||||
);
|
);
|
||||||
|
public $rules = [];
|
||||||
|
|
||||||
|
|
||||||
public function __construct($lib) {
|
public function __construct($lib) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ class beta5_rules_get {
|
||||||
// Loads rules for a player
|
// Loads rules for a player
|
||||||
function run($pid) {
|
function run($pid) {
|
||||||
$apid = is_null($pid) ? ' ' : $pid;
|
$apid = is_null($pid) ? ' ' : $pid;
|
||||||
if (is_array($this->lib->mainClass->rules[$apid])) {
|
if (isset($this->lib->mainClass->rules[$apid])) {
|
||||||
return $this->lib->mainClass->rules[$apid];
|
return $this->lib->mainClass->rules[$apid];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ class main_manual_search {
|
||||||
$required = $excluded = $normal = array();
|
$required = $excluded = $normal = array();
|
||||||
$tl = explode(' ', $text);
|
$tl = explode(' ', $text);
|
||||||
foreach ($tl as $word) {
|
foreach ($tl as $word) {
|
||||||
if ($word{0} == '+' || $word{0} == '-') {
|
if ($word[0] == '+' || $word[0] == '-') {
|
||||||
$qual = $word{0};
|
$qual = $word[0];
|
||||||
$word = substr($word, 1);
|
$word = substr($word, 1);
|
||||||
} else {
|
} else {
|
||||||
$qual = '';
|
$qual = '';
|
||||||
|
|
|
@ -21,28 +21,28 @@ class ajax {
|
||||||
|
|
||||||
// Get AJAX functions from handler
|
// Get AJAX functions from handler
|
||||||
$a1 = is_array($handler->ajax) ? $handler->ajax : array();
|
$a1 = is_array($handler->ajax) ? $handler->ajax : array();
|
||||||
if (is_array($a1['func'])) {
|
if (isset($a1['func'])) {
|
||||||
ajax::$fHandler = $a1['func'];
|
ajax::$fHandler = $a1['func'];
|
||||||
$ml = is_array($a1['method']) ? $a1['method'] : array();
|
$ml = is_array($a1['method'] ?? null) ? $a1['method'] : array();
|
||||||
foreach ($a1['func'] as $f) {
|
foreach ($a1['func'] as $f) {
|
||||||
$m = ($ml[$f] == "") ? ($handler->ajaxPOST ? "POST" : "GET") : $ml[$f];
|
$m = ($ml[$f] ?? "" == "") ? ($handler->ajaxPOST ?? false ? "POST" : "GET") : $ml[$f];
|
||||||
ajax::$method[$f] = $m;
|
ajax::$method[$f] = $m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get theme-specific AJAX functions
|
// Get theme-specific AJAX functions
|
||||||
$a2 = ajax::getTheme();
|
$a2 = ajax::getTheme();
|
||||||
if (is_array($a2['func'])) {
|
if (isset($a2['func'])) {
|
||||||
ajax::$fTheme = $a2['func'];
|
ajax::$fTheme = $a2['func'];
|
||||||
$ml = is_array($a2['method']) ? $a2['method'] : array();
|
$ml = is_array($a2['method'] ?? null) ? $a2['method'] : array();
|
||||||
foreach ($a2['func'] as $f) {
|
foreach ($a2['func'] as $f) {
|
||||||
$m = ($ml[$f] == "") ? ($handler->ajaxPOST ? "POST" : "GET") : $ml[$f];
|
$m = ($ml[$f] ?? "" == "") ? ($handler->ajaxPOST ?? false ? "POST" : "GET") : $ml[$f];
|
||||||
ajax::$method[$f] = $m;
|
ajax::$method[$f] = $m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create init string
|
// Create init string
|
||||||
ajax::$init = $a2['init'] . $a1['init'];
|
ajax::$init = ($a2['init'] ?? '') . ($a1['init'] ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -307,7 +307,7 @@ class db {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGameAccess($prefix) {
|
public function getGameAccess($prefix) {
|
||||||
if (is_null($this->accessors[$prefix])) {
|
if (!isset($this->accessors[$prefix])) {
|
||||||
$this->accessors[$prefix] = new db_accessor($this, $prefix);
|
$this->accessors[$prefix] = new db_accessor($this, $prefix);
|
||||||
}
|
}
|
||||||
return $this->accessors[$prefix];
|
return $this->accessors[$prefix];
|
||||||
|
|
|
@ -316,7 +316,7 @@ class display_engine {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tracking::$data['bat']) {
|
if (tracking::$data['bat'] ?? false) {
|
||||||
// User tried to log in after being kicked
|
// User tried to log in after being kicked
|
||||||
session::kill();
|
session::kill();
|
||||||
$this->displayKicked();
|
$this->displayKicked();
|
||||||
|
|
|
@ -54,7 +54,7 @@ class display_engine {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tracking::$data['bat']) {
|
if (isset(tracking::$data['bat'])) {
|
||||||
// User tried to log in after being kicked
|
// User tried to log in after being kicked
|
||||||
session::kill();
|
session::kill();
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ class game {
|
||||||
private $__status = null;
|
private $__status = null;
|
||||||
private $__firstTick = null;
|
private $__firstTick = null;
|
||||||
private $__lastTick = null;
|
private $__lastTick = null;
|
||||||
|
public $db = null;
|
||||||
|
|
||||||
function __construct($version, $name, $namespace, $public, $canJoin, $text) {
|
function __construct($version, $name, $namespace, $public, $canJoin, $text) {
|
||||||
$this->version = $version;
|
$this->version = $version;
|
||||||
|
@ -48,7 +49,7 @@ class game {
|
||||||
|
|
||||||
|
|
||||||
private function __loadActionObject() {
|
private function __loadActionObject() {
|
||||||
if ($this->actionObj) {
|
if (isset($this->actionObj)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class handler {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Get the list of supported engines
|
// Get the list of supported engines
|
||||||
if (is_array($handler->engines)) {
|
if (isset($handler->engines) && is_array($handler->engines)) {
|
||||||
$engines = $handler->engines;
|
$engines = $handler->engines;
|
||||||
} else {
|
} else {
|
||||||
$engines = array('page', 'css', 'js', 'rpc');
|
$engines = array('page', 'css', 'js', 'rpc');
|
||||||
|
|
|
@ -111,7 +111,7 @@ function handleInput() {
|
||||||
engine::$e->initSession();
|
engine::$e->initSession();
|
||||||
engine::$e->checkAuth();
|
engine::$e->checkAuth();
|
||||||
|
|
||||||
if (is_array($_SESSION) && is_array(config::$main['trace'])
|
if (isset($_SESSION) && is_array(config::$main['trace'])
|
||||||
&& in_array($_SESSION['userid'], config::$main['trace'])) {
|
&& in_array($_SESSION['userid'], config::$main['trace'])) {
|
||||||
|
|
||||||
$path = input::$path;
|
$path = input::$path;
|
||||||
|
|
|
@ -15,7 +15,7 @@ class prefs {
|
||||||
while ($r = dbFetchHash($qr)) {
|
while ($r = dbFetchHash($qr)) {
|
||||||
$v = $r['version'];
|
$v = $r['version'];
|
||||||
$i = $r['id'];
|
$i = $r['id'];
|
||||||
if (!is_array(prefs::$prefs[$v])) {
|
if (!isset(prefs::$prefs[$v])) {
|
||||||
prefs::$prefs[$v] = array();
|
prefs::$prefs[$v] = array();
|
||||||
}
|
}
|
||||||
prefs::$prefs[$v][$i] = $r['value'];
|
prefs::$prefs[$v][$i] = $r['value'];
|
||||||
|
@ -96,7 +96,7 @@ class prefs {
|
||||||
}
|
}
|
||||||
|
|
||||||
list($version, $name) = explode('/', $path);
|
list($version, $name) = explode('/', $path);
|
||||||
if (is_array(prefs::$prefs[$version])) {
|
if (isset(prefs::$prefs[$version])) {
|
||||||
$v = prefs::$prefs[$version][$name];
|
$v = prefs::$prefs[$version][$name];
|
||||||
} else {
|
} else {
|
||||||
$v = null;
|
$v = null;
|
||||||
|
|
|
@ -19,11 +19,11 @@ class tick_definition {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getName($lang) {
|
function getName($lang) {
|
||||||
return ($this->text[$lang] ? $this->text[$lang][0] : "");
|
return isset($this->text[$lang]) ? $this->text[$lang][0] : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDescription($lang) {
|
function getDescription($lang) {
|
||||||
return ($this->text[$lang] ? $this->text[$lang][1] : "");
|
return isset($this->text[$lang]) ? $this->text[$lang][1] : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPath() {
|
function getPath() {
|
||||||
|
|
|
@ -34,6 +34,7 @@ class tick_manager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
l::debug("cache dir : " . config::$main['cachedir']);
|
||||||
if (file_exists(config::$main['cachedir'] . "/stop_ticks")) {
|
if (file_exists(config::$main['cachedir'] . "/stop_ticks")) {
|
||||||
unlink(config::$main['cachedir'] . "/stop_ticks");
|
unlink(config::$main['cachedir'] . "/stop_ticks");
|
||||||
$this->ticksStopped = true;
|
$this->ticksStopped = true;
|
||||||
|
|
|
@ -121,7 +121,7 @@ class tracking {
|
||||||
tracking::$cName = config::getParam('trackname');
|
tracking::$cName = config::getParam('trackname');
|
||||||
|
|
||||||
list($trackId,$trackNew) = tracking::readId();
|
list($trackId,$trackNew) = tracking::readId();
|
||||||
if (handler::$h->noTracking && (is_null($trackId) || $trackNew)) {
|
if (handler::$h->noTracking ?? false && (is_null($trackId) || $trackNew)) {
|
||||||
tracking::$disabled = true;
|
tracking::$disabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ class page_handler {
|
||||||
public function getOverview() {
|
public function getOverview() {
|
||||||
$overview = $this->game->action('getOverview', $_SESSION[game::sessName()]['player'],
|
$overview = $this->game->action('getOverview', $_SESSION[game::sessName()]['player'],
|
||||||
getLanguage());
|
getLanguage());
|
||||||
$result = array($_SESSION[game::sessName()]['ov_complete'] ? "1" : "0");
|
$result = array($_SESSION[game::sessName()]['ov_complete'] ?? false ? "1" : "0");
|
||||||
|
|
||||||
// Protection level
|
// Protection level
|
||||||
array_push($result, $overview['protection']);
|
array_push($result, $overview['protection']);
|
||||||
|
@ -18,7 +18,7 @@ class page_handler {
|
||||||
// Communications overview
|
// Communications overview
|
||||||
$data = $overview['comms'];
|
$data = $overview['comms'];
|
||||||
array_push($result, count($data['folders']['CUS']) . "#" . count($data['forums']['general'])
|
array_push($result, count($data['folders']['CUS']) . "#" . count($data['forums']['general'])
|
||||||
. "#" . count($data['forums']['alliance']) . "#" . $data['forums']['allianceID']);
|
. "#" . count($data['forums']['alliance']) . "#" . ($data['forums']['allianceID'] ?? ''));
|
||||||
|
|
||||||
// Messages in default folders
|
// Messages in default folders
|
||||||
$dFld = array('IN', 'INT', 'OUT');
|
$dFld = array('IN', 'INT', 'OUT');
|
||||||
|
@ -75,7 +75,7 @@ class page_handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function switchOvMode() {
|
public function switchOvMode() {
|
||||||
$_SESSION[game::sessName()]['ov_complete'] = ! $_SESSION[game::sessName()]['ov_complete'];
|
$_SESSION[game::sessName()]['ov_complete'] = !( $_SESSION[game::sessName()]['ov_complete'] ?? false );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle($input) {
|
public function handle($input) {
|
||||||
|
|
|
@ -2,17 +2,20 @@
|
||||||
|
|
||||||
class page_handler
|
class page_handler
|
||||||
{
|
{
|
||||||
var $needsAuth = true;
|
private $mailError = null;
|
||||||
var $ajax = array();
|
private $passError = null;
|
||||||
|
|
||||||
function checkMail($a) {
|
public $needsAuth = true;
|
||||||
|
public $ajax = array();
|
||||||
|
|
||||||
|
private static function checkMail($a) {
|
||||||
return preg_match(
|
return preg_match(
|
||||||
'/^[A-Za-z0-9_\.\-\+]+@([A-Za-z0-9_\.\-\+]+)+\.[A-Za-z]{2,6}/',
|
'/^[A-Za-z0-9_\.\-\+]+@([A-Za-z0-9_\.\-\+]+)+\.[A-Za-z]{2,6}$/',
|
||||||
$a
|
$a
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkPassword($op, $np, $cp) {
|
private function checkPassword($op, $np, $cp) {
|
||||||
$q = dbQuery("SELECT password FROM account WHERE id=".$_SESSION['userid']);
|
$q = dbQuery("SELECT password FROM account WHERE id=".$_SESSION['userid']);
|
||||||
if (!$q) {
|
if (!$q) {
|
||||||
$this->passError = 1;
|
$this->passError = 1;
|
||||||
|
@ -44,8 +47,7 @@ class page_handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkFormData($input)
|
private function checkFormData($input) {
|
||||||
{
|
|
||||||
$pLang = array('fr', 'en');
|
$pLang = array('fr', 'en');
|
||||||
if (in_array($input['lang'], $pLang))
|
if (in_array($input['lang'], $pLang))
|
||||||
prefs::set('main/language', $input['lang']);
|
prefs::set('main/language', $input['lang']);
|
||||||
|
@ -65,7 +67,7 @@ class page_handler
|
||||||
if (preg_match('/^[0-4]$/', $input['fs']))
|
if (preg_match('/^[0-4]$/', $input['fs']))
|
||||||
prefs::set('main/font_size', $input['fs']);
|
prefs::set('main/font_size', $input['fs']);
|
||||||
|
|
||||||
if ($this->checkMail($input['mail']))
|
if (self::checkMail($input['mail']))
|
||||||
dbQuery("UPDATE account SET email='".$input['mail']."' WHERE id=".$_SESSION['userid']);
|
dbQuery("UPDATE account SET email='".$input['mail']."' WHERE id=".$_SESSION['userid']);
|
||||||
else
|
else
|
||||||
$this->mailError = preg_replace('/"/', '"', $input['mail']);
|
$this->mailError = preg_replace('/"/', '"', $input['mail']);
|
||||||
|
@ -91,7 +93,7 @@ class page_handler
|
||||||
$this->checkPassword($input['opass'], $input['npass'], $input['cpass']);
|
$this->checkPassword($input['opass'], $input['npass'], $input['cpass']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleQuit() {
|
private function handleQuit() {
|
||||||
if (gameAction('isFinished')) {
|
if (gameAction('isFinished')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -103,9 +105,9 @@ class page_handler
|
||||||
gameAction('setPlayerQuit', $pid);
|
gameAction('setPlayerQuit', $pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle($input)
|
public function handle($input)
|
||||||
{
|
{
|
||||||
if (!is_null($input['quit']))
|
if (isset($input['quit']))
|
||||||
$this->handleQuit();
|
$this->handleQuit();
|
||||||
elseif ($input['col'] != "")
|
elseif ($input['col'] != "")
|
||||||
$this->checkFormData($input);
|
$this->checkFormData($input);
|
||||||
|
|
|
@ -7,7 +7,8 @@ function thm_getHeaderData() {
|
||||||
|
|
||||||
$pi = $pLib->call('get', $player);
|
$pi = $pLib->call('get', $player);
|
||||||
$newMsg = ($mLib->call('getNew', $player) > 0) ? 1 : 0;
|
$newMsg = ($mLib->call('getNew', $player) > 0) ? 1 : 0;
|
||||||
return time() . "#{$pi['name']}#{$pi['cash']}#$newMsg#{$pi['alliance']}";
|
$alliance = $pi['alliance'] ?? '';
|
||||||
|
return time() . "#{$pi['name']}#{$pi['cash']}#$newMsg#$alliance";
|
||||||
}
|
}
|
||||||
|
|
||||||
function thm_getHeaderPList() {
|
function thm_getHeaderPList() {
|
||||||
|
|
|
@ -71,7 +71,7 @@ $alliance = $game->getLib('beta5/alliance');
|
||||||
|
|
||||||
$player = $_SESSION[game::sessName()]['player'];
|
$player = $_SESSION[game::sessName()]['player'];
|
||||||
$pInfo = $players->call('get', $player);
|
$pInfo = $players->call('get', $player);
|
||||||
if ($pInfo['aid']) {
|
if (isset($pInfo['aid'])) {
|
||||||
$privileges = $alliance->call('getPrivileges', $player);
|
$privileges = $alliance->call('getPrivileges', $player);
|
||||||
$techTrade = ($privileges['tech_trade'] > 0);
|
$techTrade = ($privileges['tech_trade'] > 0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -22,10 +22,10 @@ class page_layout {
|
||||||
|
|
||||||
// Generate CSS and JS resources
|
// Generate CSS and JS resources
|
||||||
$this->generateStylesheets($pg, $thm, $fs, $col);
|
$this->generateStylesheets($pg, $thm, $fs, $col);
|
||||||
if (is_null(handler::$h->customJS)) {
|
if (isset(handler::$h->customJS)) {
|
||||||
$this->generateJS($pg, $thm, $col, $lg, $tt, $fs);
|
|
||||||
} else {
|
|
||||||
$this->jsRes = handler::$h->customJS;
|
$this->jsRes = handler::$h->customJS;
|
||||||
|
} else {
|
||||||
|
$this->generateJS($pg, $thm, $col, $lg, $tt, $fs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($this->cssRes)) {
|
if (!is_null($this->cssRes)) {
|
||||||
|
@ -37,7 +37,14 @@ class page_layout {
|
||||||
|
|
||||||
// Generate HTML body tag
|
// Generate HTML body tag
|
||||||
echo "</head><body";
|
echo "</head><body";
|
||||||
if (is_null(handler::$h->customJS)) {
|
if (isset(handler::$h->customJS)) {
|
||||||
|
if (!is_null(handler::$h->customJS['load'])) {
|
||||||
|
echo " onload='" . handler::$h->customJS['load'] . "'";
|
||||||
|
}
|
||||||
|
if (!is_null(handler::$h->customJS['unload'])) {
|
||||||
|
echo " onunload='" . handler::$h->customJS['unload'] ."'";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (ajax::$init != "" || $tt) {
|
if (ajax::$init != "" || $tt) {
|
||||||
echo " onload='lwAutoInit();'";
|
echo " onload='lwAutoInit();'";
|
||||||
}
|
}
|
||||||
|
@ -45,20 +52,13 @@ class page_layout {
|
||||||
echo " onunload='tt_Disable()'";
|
echo " onunload='tt_Disable()'";
|
||||||
}
|
}
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
} else {
|
|
||||||
if (!is_null(handler::$h->customJS['load'])) {
|
|
||||||
echo " onload='" . handler::$h->customJS['load'] . "'";
|
|
||||||
}
|
|
||||||
if (!is_null(handler::$h->customJS['unload'])) {
|
|
||||||
echo " onunload='" . handler::$h->customJS['unload'] ."'";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the header
|
// Load the header
|
||||||
if (is_null(handler::$h->customHeader)) {
|
if (isset(handler::$h->customHeader)) {
|
||||||
$hdr = "header";
|
|
||||||
} else {
|
|
||||||
$hdr = handler::$h->customHeader;
|
$hdr = handler::$h->customHeader;
|
||||||
|
} else {
|
||||||
|
$hdr = "header";
|
||||||
}
|
}
|
||||||
$this->includeFile("{$this->dir}/layout/$thm/$hdr.$lg.inc");
|
$this->includeFile("{$this->dir}/layout/$thm/$hdr.$lg.inc");
|
||||||
}
|
}
|
||||||
|
@ -69,15 +69,15 @@ class page_layout {
|
||||||
$col = prefs::get('main/colour', 'purple');
|
$col = prefs::get('main/colour', 'purple');
|
||||||
$thm = prefs::get('beta5/theme', "default");
|
$thm = prefs::get('beta5/theme', "default");
|
||||||
|
|
||||||
if (is_null(handler::$h->customFooter)) {
|
if (isset(handler::$h->customFooter)) {
|
||||||
$ftr = "footer";
|
|
||||||
} else {
|
|
||||||
$ftr = handler::$h->customFooter;
|
$ftr = handler::$h->customFooter;
|
||||||
|
} else {
|
||||||
|
$ftr = "footer";
|
||||||
}
|
}
|
||||||
$this->includeFile("{$this->dir}/layout/$thm/$ftr.$lg.inc");
|
$this->includeFile("{$this->dir}/layout/$thm/$ftr.$lg.inc");
|
||||||
|
|
||||||
// Tooltips
|
// Tooltips
|
||||||
if ($tt && is_null(handler::$h->customJS)) {
|
if ($tt && !isset(handler::$h->customJS)) {
|
||||||
echo "<div id='ttPlaceHolderReserved'></div>";
|
echo "<div id='ttPlaceHolderReserved'></div>";
|
||||||
$f = getStatic("beta5/js/tt_{$thm}_$col.js");
|
$f = getStatic("beta5/js/tt_{$thm}_$col.js");
|
||||||
if (!is_null($f)) {
|
if (!is_null($f)) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ class page_handler {
|
||||||
tracking::$data['readDisclaimer'] = true;
|
tracking::$data['readDisclaimer'] = true;
|
||||||
$this->output = "disclaimer";
|
$this->output = "disclaimer";
|
||||||
$this->data = true;
|
$this->data = true;
|
||||||
} elseif (tracking::$data['bat']) {
|
} elseif (isset(tracking::$data['bat'])) {
|
||||||
$this->output = "kicked";
|
$this->output = "kicked";
|
||||||
} elseif ($input['create'] == "") {
|
} elseif ($input['create'] == "") {
|
||||||
$this->output = "create";
|
$this->output = "create";
|
||||||
|
|
Loading…
Add table
Reference in a new issue