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
scripts/game
beta5
actions
alliance/library
fleet/library
forums/library
planet
player/library
rules
main/manual/library
|
@ -72,7 +72,8 @@ class beta5_getUniverseOverview
|
|||
return array(
|
||||
$pc, $gr['points'], $gr['ranking'], $cr['points'], $cr['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);
|
||||
if (is_null($pi['aid'])) {
|
||||
if (!isset($pi['aid'])) {
|
||||
return $nr;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class beta5_fleet_getPower {
|
|||
|
||||
// Computes a fleet's power
|
||||
function run($pl, $g, $f, $c, $b) {
|
||||
if (!is_array($this->ePower[$pl])) {
|
||||
if (!isset($this->ePower[$pl])) {
|
||||
$r = $this->rules->call('get', $pl);
|
||||
$a = array('gaship','fighter','cruiser','bcruiser');
|
||||
$this->ePower[$pl] = array();
|
||||
|
|
|
@ -69,7 +69,7 @@ class beta5_forums_getStructure {
|
|||
|
||||
// Get alliance forums
|
||||
$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(
|
||||
"id" => $pi['aid'],
|
||||
"type" => "A",
|
||||
|
|
|
@ -55,7 +55,7 @@ class beta5_planet_library {
|
|||
$r = dbFetchHash($q);
|
||||
$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'];
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class beta5_player_get {
|
|||
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") {
|
||||
return null;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class beta5_player_get {
|
|||
"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'];
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class beta5_player_isOnVacation {
|
|||
return true;
|
||||
}
|
||||
|
||||
if ($this->lib->game->params['novacation'] == 1) {
|
||||
if ($this->lib->game->params['novacation'] ?? 0 == 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<?php
|
||||
|
||||
class beta5_rules_library {
|
||||
var $index = array(
|
||||
public $index = array(
|
||||
'change',
|
||||
'get'
|
||||
);
|
||||
);
|
||||
public $rules = [];
|
||||
|
||||
|
||||
public function __construct($lib) {
|
||||
|
|
|
@ -11,7 +11,7 @@ class beta5_rules_get {
|
|||
// Loads rules for a player
|
||||
function run($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];
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ class main_manual_search {
|
|||
$required = $excluded = $normal = array();
|
||||
$tl = explode(' ', $text);
|
||||
foreach ($tl as $word) {
|
||||
if ($word{0} == '+' || $word{0} == '-') {
|
||||
$qual = $word{0};
|
||||
if ($word[0] == '+' || $word[0] == '-') {
|
||||
$qual = $word[0];
|
||||
$word = substr($word, 1);
|
||||
} else {
|
||||
$qual = '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue