Skip to content

Commit

Permalink
Merge pull request #587 from lansuite/rector-UP_TO_PHP_73
Browse files Browse the repository at this point in the history
Rector: Raise Level set to UP_TO_PHP_73
  • Loading branch information
M4LuZ committed May 28, 2023
2 parents 667a83f + 9228eec commit 7e16dd2
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 51 deletions.
8 changes: 2 additions & 6 deletions inc/Classes/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,7 @@ private function cookie_set()
setcookie(
$this->cookie_name,
$this->cookiedata_pack(),
time()+3600*24*$this->cookie_time,
$this->cookie_path,
$this->cookie_domain
['expires' => time()+3600*24*$this->cookie_time, 'path' => $this->cookie_path, 'domain' => $this->cookie_domain]
);
}

Expand All @@ -708,9 +706,7 @@ private function cookie_unset()
setcookie(
$this->cookie_name,
'',
time()+1,
$this->cookie_path,
$this->cookie_domain
['expires' => time()+1, 'path' => $this->cookie_path, 'domain' => $this->cookie_domain]
);
}

Expand Down
2 changes: 1 addition & 1 deletion inc/Classes/Framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public function html_out()
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', " . json_encode($cfg['google_analytics_id']) . ", 'auto');
ga('create', " . json_encode($cfg['google_analytics_id'], JSON_THROW_ON_ERROR) . ", 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>";
Expand Down
4 changes: 2 additions & 2 deletions inc/Classes/Func.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ public function str2time($strStr, $strPattern = 'Y-m-d H:i:s')
$arrPattern = preg_split('~['.$strDelimiters.']~', $strPattern);

// If the numbers of the two array are not the same, return false, because the cannot belong together
if ((is_array($arrStr) || $arrStr instanceof \Countable ? count($arrStr) : 0) !== (is_array($arrPattern) || $arrPattern instanceof \Countable ? count($arrPattern) : 0)) {
if ((is_countable($arrStr) ? count($arrStr) : 0) !== (is_countable($arrPattern) ? count($arrPattern) : 0)) {
return false;
}

// Creates a new array which has the keys from the $arrPattern array and the values from the $arrStr array
$arrTime = [];
for ($i = 0; $i < (is_array($arrStr) || $arrStr instanceof \Countable ? count($arrStr) : 0); $i++) {
for ($i = 0; $i < (is_countable($arrStr) ? count($arrStr) : 0); $i++) {
$arrTime[$arrPattern[$i]] = $arrStr[$i];
}

Expand Down
2 changes: 1 addition & 1 deletion inc/Classes/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function check_blacklist()
global $db, $cfg;

// Global blacklist
if (strpos($cfg['ip_blacklist'], $_SERVER['REMOTE_ADDR']) !== false) {
if (strpos($cfg['ip_blacklist'], (string) $_SERVER['REMOTE_ADDR']) !== false) {
return 'Deine IP wird von LanSuite geblockt. Melde dich bitte bei den Administratoren';
}

Expand Down
2 changes: 1 addition & 1 deletion modules/about/Functions/GetTheLinesAndChars.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function GetTheLinesAndChars($file)
{
$data = [];
$file_content = file($file);
$data[0] = is_array($file_content) || $file_content instanceof \Countable ? count($file_content) : 0;
$data[0] = is_countable($file_content) ? count($file_content) : 0;
foreach ($file_content as $iValue) {
$data[1] += strlen($iValue);
}
Expand Down
6 changes: 3 additions & 3 deletions modules/downloads/show.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
if ($_GET['go_dir'] == "up") {
array_pop($_SESSION['downloads_dir']);
} elseif ($_GET['go_dir']) {
if ((is_array($_SESSION['downloads_dir']) || $_SESSION['downloads_dir'] instanceof \Countable ? count($_SESSION['downloads_dir']) : 0) > "0") {
if ((is_countable($_SESSION['downloads_dir']) ? count($_SESSION['downloads_dir']) : 0) > "0") {
foreach ($_SESSION['downloads_dir'] as $dir_entry) {
$set_dir .= "/" . $dir_entry;
}
Expand All @@ -181,7 +181,7 @@
unset($join_dir);
}

if ((is_array($_SESSION['downloads_dir']) || $_SESSION['downloads_dir'] instanceof \Countable ? count($_SESSION['downloads_dir']) : 0) > "0") {
if ((is_countable($_SESSION['downloads_dir']) ? count($_SESSION['downloads_dir']) : 0) > "0") {
foreach ($_SESSION['downloads_dir'] as $dir_entry) {
$set_dir .= "/" . $dir_entry;
}
Expand Down Expand Up @@ -267,7 +267,7 @@
}

$dsp->NewContent(t('Downloads'), t('Hier kannst du zum Download bereitgestellte Dateien downloaden. Ordner sind durch ein Ordner-Symbol gekennzeichnet und können per Klick auf dieses oder den Namen ge&ouml;ffnet werden. Bei &ouml;ffnen eines Unterverzeichnisses wird das aktuelle Verzeichnis am oberen Rand angezeigt. Ebenfalls angezeigt wird ein Symbol mit dem du zum nächst höhergelegenen Verzeichnis gelangst'));
if ((is_array($_SESSION['downloads_dir']) || $_SESSION['downloads_dir'] instanceof \Countable ? count($_SESSION['downloads_dir']) : 0) > "0") {
if ((is_countable($_SESSION['downloads_dir']) ? count($_SESSION['downloads_dir']) : 0) > "0") {
$dsp->AddSingleRow('<a href="index.php?mod=downloads&action=show&go_dir=up"><img src="design/'. $auth['design'] .'/images/downloads_goup.gif" border="0"></a> '. $dir .'/');
}
$dsp->AddTableRow($table);
Expand Down
2 changes: 1 addition & 1 deletion modules/faq/change_cat.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
$catcaption = $get_data["name"];

if ($catcaption != "") {
$change_it = $db->qry("UPDATE %prefix%faq_cat SET name = %string% WHERE catid = %int%", $_POST[cat_caption], $_GET["catid"]);
$change_it = $db->qry("UPDATE %prefix%faq_cat SET name = %string% WHERE catid = %int%", $_POST['cat_caption'], $_GET["catid"]);

if ($change_it == true) {
$_SESSION["change_blocker_faq_cat"] = 1;
Expand Down
1 change: 1 addition & 0 deletions modules/foodcenter/Classes/ProductList.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public function get_info($id, $worklink)
*/
public function add_product($id, $opt)
{
$key_array = [];
// Product already in the list?
if (in_array($id, $this->product_list)) {
if (is_array($opt)) {
Expand Down
2 changes: 1 addition & 1 deletion modules/hardware/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
$mf->AddField('Monitor', 'monitor', '', '', \LanSuite\MasterForm::FIELD_OPTIONAL);
$mf->AddField('Betriebssystem', 'os', '', '', \LanSuite\MasterForm::FIELD_OPTIONAL);
$mf->AddField('Computername', 'name', '', '', \LanSuite\MasterForm::FIELD_OPTIONAL);
$mf->AddField('Sonstiges', 'sonstiges', text, '', \LanSuite\MasterForm::FIELD_OPTIONAL);
$mf->AddField('Sonstiges', 'sonstiges', 'text', '', \LanSuite\MasterForm::FIELD_OPTIONAL);
$mf->AddFix('userid', $_GET['userid']);
$mf->SendForm('index.php?mod=hardware&action=edit&userid='.$_GET['userid'], 'hardware', 'hardwareid', $_GET['hardwareid']);
} else {
Expand Down
2 changes: 1 addition & 1 deletion modules/install/Classes/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ public function ExportExtInc($filename)
header("Content-Disposition: attachment; filename=\"$filename\"");
$zip->download_file();

if ((is_array($zip->errors) || $zip->errors instanceof \Countable ? count($zip->errors) : 0) > 0) {
if ((is_countable($zip->errors) ? count($zip->errors) : 0) > 0) {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions modules/msgsys/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

// Confirmations / Errors
// Successful
if ((is_array($sux) || $sux instanceof \Countable ? count($sux) : 0) > "0" && (is_array($err) || $err instanceof \Countable ? count($err) : 0) == "0") {
if ((is_countable($sux) ? count($sux) : 0) > "0" && (is_countable($err) ? count($err) : 0) == "0") {
foreach ($sux as $item) {
if ($names1 != "") {
$names1 .= ", ";
Expand All @@ -100,7 +100,7 @@
<b>%NAMES1%</b> ' . HTML_NEWLINE . ' Die &Auml;nderung wird beim n&auml;chsten Seitenaufruf sichtbar.')));

// Partly Successful
} elseif ((is_array($sux) || $sux instanceof \Countable ? count($sux) : 0) > "0" && (is_array($err) || $err instanceof \Countable ? count($err) : 0) > "0") {
} elseif ((is_countable($sux) ? count($sux) : 0) > "0" && (is_countable($err) ? count($err) : 0) > "0") {
foreach ($sux as $item) {
if ($names1 != "") {
$names1 .= ", ";
Expand All @@ -124,7 +124,7 @@
- Du versuchst dich selbst in die Buddy-Liste hinzuzuf&uuml;gen ' . HTML_NEWLINE . '
Die &Auml;nderung wird beim n&auml;chsten Seitenaufruf sichtbar.'))), "");
// Not successful
} elseif ((is_array($sux) || $sux instanceof \Countable ? count($sux) : 0) == "0" && (is_array($err) || $err instanceof \Countable ? count($err) : 0) > "0") {
} elseif ((is_countable($sux) ? count($sux) : 0) == "0" && (is_countable($err) ? count($err) : 0) > "0") {
$func->error(t('Es konnten keine Benutzer in die Buddy-Liste hinzugef&uuml;gt werden. ' . HTML_NEWLINE . '
Dies kann folgende Ursachen haben: ' . HTML_NEWLINE . '
- Der Benutzer ist bereits in deiner Buddy-Liste ' . HTML_NEWLINE . '
Expand Down
2 changes: 1 addition & 1 deletion modules/msgsys/query_messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
)
ORDER BY timestamp", $auth['userid'], $_GET['queryid'], $_GET['queryid'], $auth['userid']);

$row2 = $db->qry_first("SELECT username FROM %prefix%user WHERE userid = %int%", $_GET[queryid]);
$row2 = $db->qry_first("SELECT username FROM %prefix%user WHERE userid = %int%", $_GET['queryid']);

while ($row = $db->fetch_array($query)) {
$senderid = $row["senderid"];
Expand Down
20 changes: 10 additions & 10 deletions modules/msgsys/remove.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?php

if ($_GET[queryid]) {
switch ($_GET[step]) {
if ($_GET['queryid']) {
switch ($_GET['step']) {
default:
$rowcheck = $db->qry("
SELECT id
FROM %prefix%buddys
WHERE userid = %int%
AND buddyid = %int%", $auth['userid'], $_GET[queryid]);
AND buddyid = %int%", $auth['userid'], $_GET['queryid']);

// User in buddylist ?
if ($db->num_rows() != '0') {
$row = $db->qry_first("
SELECT username, name, firstname
FROM %prefix%user
WHERE userid = %int%", $_GET[queryid]);
WHERE userid = %int%", $_GET['queryid']);

if ($cfg['sys_internet'] == 0) {
$func->question(t('Willst du den Benutzer <b>%1 (%2 %3)</b> wirklich aus deiner Buddy-Liste entfernen?', $row[name], $row[firstname], $row[username]), "index.php?mod=msgsys&action=removebuddy&queryid=$_GET[queryid]&step=2", "index.php");
$func->question(t('Willst du den Benutzer <b>%1 (%2 %3)</b> wirklich aus deiner Buddy-Liste entfernen?', $row['name'], $row['firstname'], $row['username']), 'index.php?mod=msgsys&action=removebuddy&queryid=' . $_GET['queryid'] . '&step=2', "index.php");
} else {
$func->question(t('Willst du den Benutzer <b>%1</b> wirklich aus deiner Buddy-Liste entfernen?', $row[username]), "index.php?mod=msgsys&action=removebuddy&queryid=$_GET[queryid]&step=2", "index.php");
$func->question(t('Willst du den Benutzer <b>%1</b> wirklich aus deiner Buddy-Liste entfernen?', $row['username']), 'index.php?mod=msgsys&action=removebuddy&queryid=' . $_GET['queryid'] . '&step=2', "index.php");
}
} else {
$func->error(t('Dieser Benutzer befindet sich nicht in deiner Buddy-Liste'));
Expand All @@ -31,19 +31,19 @@
$row1 = $db->qry_first("
SELECT username, name, firstname
FROM %prefix%user
WHERE userid = %int%", $_GET[queryid]);
WHERE userid = %int%", $_GET['queryid']);

$row2 = $db->qry("
DELETE FROM %prefix%buddys
WHERE buddyid = %int%
AND userid = %int%", $_GET[queryid], $auth['userid']);
AND userid = %int%", $_GET['queryid'], $auth['userid']);

// Confirmation
if ($row2 == true) {
if ($cfg['sys_internet'] == 1) {
$func->confirmation(t('Der Benutzer <b>%1</b> wurde aus deiner Buddy-Liste entfernt. Die &Auml;nderung wird beim n&auml;chsten Seitenaufruf wirksam.', $row1[username]), "");
$func->confirmation(t('Der Benutzer <b>%1</b> wurde aus deiner Buddy-Liste entfernt. Die &Auml;nderung wird beim n&auml;chsten Seitenaufruf wirksam.', $row1['username']), "");
} else {
$func->confirmation(t('Der Benutzer <b>%1 (%2 %3)</b> wurde aus deiner Buddy-Liste entfernt. Die &Auml;nderung wird beim n&auml;chsten Seitenaufruf wirksam.', $row1[name], $row1[firstname], $row1[username]), "");
$func->confirmation(t('Der Benutzer <b>%1 (%2 %3)</b> wurde aus deiner Buddy-Liste entfernt. Die &Auml;nderung wird beim n&auml;chsten Seitenaufruf wirksam.', $row1['name'], $row1['firstname'], $row1['username']), "");
}
}
break;
Expand Down
2 changes: 1 addition & 1 deletion modules/noc/class_noc.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function getMacAddress($Device, $ReadComunity, $device_id, $modell)
}
}
// Array mit Ports und Adressen zusammenfügen
for ($i = 0; $i < (is_array($ports) || $ports instanceof \Countable ? count($ports) : 0); $i++) {
for ($i = 0; $i < (is_countable($ports) ? count($ports) : 0); $i++) {
if ($data[$ports[$i]] == "") {
$data[$ports[$i]] = $Addresses[$i];
} else {
Expand Down
4 changes: 2 additions & 2 deletions modules/noc/device_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
$sysLocation = $noc->getSNMPValue($_POST["device_ip"], $_POST["device_read"], ".1.3.6.1.2.1.1.6.0");
$sysName = $noc->getSNMPValue($_POST["device_ip"], $_POST["device_read"], ".1.3.6.1.2.1.1.5.0");
$ports = $noc->getSNMPwalk($_POST["device_ip"], $_POST["device_read"], ".1.3.6.1.2.1.2.2.1.1");
$numport = is_array($ports) || $ports instanceof \Countable ? count($ports) : 0;
$numport = is_countable($ports) ? count($ports) : 0;

// Store the device into a SQL table
$add_query = $db->qry("INSERT INTO %prefix%noc_devices SET
Expand All @@ -112,7 +112,7 @@

$row = $db->fetch_array();

for ($ActualPort=0; $ActualPort < (is_array($ports) || $ports instanceof \Countable ? count($ports) : 0); $ActualPort++) {
for ($ActualPort=0; $ActualPort < (is_countable($ports) ? count($ports) : 0); $ActualPort++) {
$Port[$ActualPort]["deviceid"] = $row["id"];

$Port[$ActualPort]["PortNr"] =
Expand Down
2 changes: 1 addition & 1 deletion modules/noc/statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
}

// We need more than 10 Values to continue...
if ((is_array($value) || $value instanceof \Countable ? count($value) : 0) < 10) {
if ((is_countable($value) ? count($value) : 0) < 10) {
if (!is_array($value)) {
$msg = "Es sind keine Daten vorhanden.";
} else {
Expand Down
2 changes: 1 addition & 1 deletion modules/party/plugins/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
$content .= t('Gäste bezahlt / eingecheckt / ausgecheckt') .': '. $user_paid['n'] .' / '. $user_checkin['n'] .' / '. $user_checkout['n'] . HTML_NEWLINE;

$visits = $db->qry_first("SELECT SUM(visits) AS visits, SUM(hits) AS hits FROM %prefix%stats_usage");
$content .= t('Besucher gesamt / Gerade eingeloggt') .": ". $visits['visits'] .' / '. (is_array($authentication->online_users) || $authentication->online_users instanceof \Countable ? count($authentication->online_users) : 0) . HTML_NEWLINE;
$content .= t('Besucher gesamt / Gerade eingeloggt') .": ". $visits['visits'] .' / '. (is_countable($authentication->online_users) ? count($authentication->online_users) : 0) . HTML_NEWLINE;
}
}
2 changes: 1 addition & 1 deletion modules/party/price_del.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

foreach ($_POST[action] as $key => $val) {
foreach ($_POST['action'] as $key => $val) {
$db->qry("DELETE FROM %prefix%party_prices WHERE price_id = %string%", $key);
}
$func->confirmation('Erfolgreich gelöscht', 'index.php?mod=party');
2 changes: 1 addition & 1 deletion modules/shoutbox/shoutqueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

echo json_encode($data);
echo json_encode($data, JSON_THROW_ON_ERROR);
4 changes: 2 additions & 2 deletions modules/stats/boxes/stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
$box->DotRow(t('Aufrufe').':');
$box->EngangedRow('<span class="infolink">'.number_format($total['hits'], 0, '', '.').'<span class="infobox">'.$total['hits'].' '.t('Seitenzugriffe insgesamt').'</span></span>&nbsp;<span class="infolink">('.($avg['hits'] ?: '0').')<span class="infobox">'.($avg['hits'] ?: '0').' '.t('Seitenzugriffe in der letzten Stunde').'</span></span>');

$box->DotRow(t('Online') .': '. (is_array($authentication->online_users) || $authentication->online_users instanceof \Countable ? count($authentication->online_users) : 0), 'index.php?mod=guestlist&action=onlineuser');
$box->DotRow(t('Online') .': '. (is_countable($authentication->online_users) ? count($authentication->online_users) : 0), 'index.php?mod=guestlist&action=onlineuser');
foreach ($authentication->online_users as $userid) {
$row = $db->qry_first("SELECT username FROM %prefix%user WHERE userid = %int%", $userid);
$box->EngangedRow($dsp->FetchUserIcon($userid, $row["username"]));
}

$box->DotRow(t('Untätig') .': '. (is_array($authentication->away_users) || $authentication->away_users instanceof \Countable ? count($authentication->away_users) : 0), 'index.php?mod=guestlist&action=onlineuser');
$box->DotRow(t('Untätig') .': '. (is_countable($authentication->away_users) ? count($authentication->away_users) : 0), 'index.php?mod=guestlist&action=onlineuser');
foreach ($authentication->away_users as $userid) {
$row = $db->qry_first("SELECT username FROM %prefix%user WHERE userid = %int%", $userid);
$box->EngangedRow($dsp->FetchUserIcon($userid, $row["username"]));
Expand Down
4 changes: 2 additions & 2 deletions modules/tournament2/Classes/LanSuiteTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function prepareWB()

// Determine winner of each match
foreach ($this->wb_teams as $round => $teams) {
for ($i=0; $i<(is_array($teams) || $teams instanceof \Countable ? count($teams) : 0); $i++) {
for ($i=0; $i<(is_countable($teams) ? count($teams) : 0); $i++) {
$t1 = $this->wb_teams[$round][$i];
$i++;
$t2 = $this->wb_teams[$round][$i];
Expand Down Expand Up @@ -122,7 +122,7 @@ public function prepareLB()
array_push($this->wb_teams, $fix, $fix);

foreach ($this->lb_teams as $round => $teams) {
for ($i=0; $i<(is_array($teams) || $teams instanceof \Countable ? count($teams) : 0); $i++) {
for ($i=0; $i<(is_countable($teams) ? count($teams) : 0); $i++) {
$t1 = $this->lb_teams[$round][$i];
$i++;
$t2 = $this->lb_teams[$round][$i];
Expand Down
Loading

0 comments on commit 7e16dd2

Please sign in to comment.