fix: fix various PHP problems and a few bugs

This commit is contained in:
Emmanuel BENOîT 2024-12-31 11:24:12 +01:00
parent c91440af72
commit a4b45ddaa4
Signed by: Emmanuel BENOîT
SSH key fingerprint: SHA256:l7PFUUF5TCDsvYeQC9OnTNz08dFY7Fvf4Hv3neIqYpg
34 changed files with 27 additions and 66 deletions

View file

@ -812,7 +812,7 @@ class page_handler {
$s .= "$id#" . $afd['order'] . "#" . ($afd['user_post'] ? 1 : 0) . "#" . $afd['title'];
if ($afd['description'] != '')
{
$dll = split("\n", $afd['description']);
$dll = explode("\n", $afd['description']);
foreach ($dll as $dl)
$s .= "\n+#$dl";
}
@ -1087,7 +1087,7 @@ class page_handler {
}
// Check privileges
$pl = split('#', $privileges);
$pl = explode('#', $privileges);
$pnames = array('list_access', 'attacks', 'can_set_grades', 'can_kick',
'can_accept', 'forum_admin', 'dipl_contact', 'can_vote', 'can_be_cand',
'tech_trade');
@ -1110,7 +1110,7 @@ class page_handler {
// Check kickable ranks
if ($privs['can_kick'] && $rkick != "") {
$rkl = split('#', $rkick);
$rkl = explode('#', $rkick);
for ($i=0;$i<count($rkl);$i++) {
$rkl[$i] = (int)$rkl[$i];
if (!in_array($rkl[$i], $rl)) {
@ -1123,7 +1123,7 @@ class page_handler {
// Check changeable ranks
if ($privs['can_set_grades'] && $rchange != "") {
$rcl = split('#', $rchange);
$rcl = explode('#', $rchange);
for ($i=0;$i<count($rcl);$i++) {
$rcl[$i] = (int)$rcl[$i];
if (!in_array($rcl[$i], $rl)) {
@ -1138,7 +1138,7 @@ class page_handler {
if (!$privs['forum_admin']) {
// Check readable forums
if ($fread != '') {
$frl = split('#', $fread);
$frl = explode('#', $fread);
for ($i=0;$i<count($frl);$i++) {
$frl[$i] = (int)$frl[$i];
if (!in_array($frl[$i], $fl)) {
@ -1151,7 +1151,7 @@ class page_handler {
// Check moderated forums
if ($fmod != '') {
$mrl = split('#', $fmod);
$mrl = explode('#', $fmod);
for ($i=0;$i<count($mrl);$i++) {
$mrl[$i] = (int)$mrl[$i];
if (!in_array($mrl[$i], $fl)) {

View file

@ -135,7 +135,7 @@ class page_handler
function doForumMod(&$forum, $in, &$cats)
{
$sel = $in['msel'];
if (!count($sel))
if (!$sel)
return;
if ($in['dt'] != '')
{

View file

@ -166,7 +166,7 @@ class page_handler
switch ($type) :
case 0:
list($x,$y) = split('#',$parm);
list($x,$y) = explode('#',$parm);
$map['x'] = (int)$x;
$map['y'] = (int)$y;
$map['type'] = 0;

View file

@ -460,7 +460,7 @@ class page_handler
// Check fleets
if ($fleets != "")
{
$sFleets = split('#', $fleets);
$sFleets = explode('#', $fleets);
$flist = array_keys(gameAction('getFleetsAt', $pid, $cPlayer));
foreach ($sFleets as $fid)
{

View file

@ -31,7 +31,7 @@ class page_handler
return "ERR#0";
// Set new value
$ePolicy{$element} = $value;
$ePolicy[$element] = $value;
gameAction('setPlayerPolicy', $player, $ePolicy);
return "1\n$ePolicy";
@ -84,7 +84,7 @@ class page_handler
$pPolicy = gameAction('getPlanetPolicy', $planet);
if (is_null($pPolicy))
return "ERR#1";
$pPolicy{$element} = $value;
$pPolicy[$element] = $value;
gameAction('setPlanetPolicy', $planet, $pPolicy);
return "2\n$planet#$pPolicy";
@ -120,7 +120,7 @@ class page_handler
}
// Generate the return value
$mainData .= count($hsFleets) . "#" . count($mvFleets) . "#" . utf8entities($pinf['name']);
$mainData .= count($hsFleets) . "#0#" . utf8entities($pinf['name']);
$rv = array($mainData);
if (count($hsFleets)) {
$rv = array_merge($rv, $hsFleets);

View file

@ -47,7 +47,7 @@ class page_handler
function getDescriptions($lst)
{
$l = getLanguage();
$a = split('#', $lst);
$a = explode('#', $lst);
$s = "";
foreach ($a as $id)
{
@ -110,7 +110,7 @@ class page_handler
return "ERR#200";
}
$a = split('#', $b);
$a = explode('#', $b);
if (count($a) != 3) {
return "ERR#0";
}