summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics
diff options
context:
space:
mode:
authorSimon Rettberg2023-11-02 19:08:58 +0100
committerSimon Rettberg2023-11-02 19:08:58 +0100
commitc2d95ffaeaa289752b4c7b6664b6ca112a02e350 (patch)
tree2c29b0157d14198aadbdbc9f8c18ded0bd4dadcd /modules-available/statistics
parent[rebootcontrol] Remove API prototype (diff)
downloadslx-admin-c2d95ffaeaa289752b4c7b6664b6ca112a02e350.tar.gz
slx-admin-c2d95ffaeaa289752b4c7b6664b6ca112a02e350.tar.xz
slx-admin-c2d95ffaeaa289752b4c7b6664b6ca112a02e350.zip
Roundup of issues reported by PHPStorm
Mostly redundant checks, logic errors, dead code, etc.
Diffstat (limited to 'modules-available/statistics')
-rw-r--r--modules-available/statistics/inc/statisticsfilter.inc.php10
-rw-r--r--modules-available/statistics/inc/statisticshooks.inc.php2
-rw-r--r--modules-available/statistics/pages/replace.inc.php2
3 files changed, 3 insertions, 11 deletions
diff --git a/modules-available/statistics/inc/statisticsfilter.inc.php b/modules-available/statistics/inc/statisticsfilter.inc.php
index 7b00fb12..cfc724c1 100644
--- a/modules-available/statistics/inc/statisticsfilter.inc.php
+++ b/modules-available/statistics/inc/statisticsfilter.inc.php
@@ -629,15 +629,7 @@ class IpStatisticsFilter extends StatisticsFilter
}
return 'INET_ATON(clientip) BETWEEN ' . $range['start'] . ' AND ' . $range['end'];
} elseif (($num = substr_count($argument, ':')) !== 0 && $num <= 7) {
- // IPv6, not yet in DB but let's prepare
- if ($num > 7 || strpos($argument, '::') !== false) { // Too many :, or invalid compressed format
- Message::addError('invalid-ip-address', $argument);
- return '0';
- } elseif ($num <= 7 && substr($argument, -1) === ':') {
- $argument .= '*';
- } elseif ($num < 7) {
- $argument .= ':*';
- }
+ // TODO: Probably valid IPv6, not yet in DB
} elseif (($num = substr_count($argument, '.')) !== 0 && $num <= 3) {
if (substr($argument, -1) === '.') {
$argument .= '*';
diff --git a/modules-available/statistics/inc/statisticshooks.inc.php b/modules-available/statistics/inc/statisticshooks.inc.php
index 746bdabf..de20d599 100644
--- a/modules-available/statistics/inc/statisticshooks.inc.php
+++ b/modules-available/statistics/inc/statisticshooks.inc.php
@@ -18,7 +18,7 @@ class StatisticsHooks
self::getRow($machineuuid);
if (self::$row === false)
return false;
- return self::$row['hostname'] ? self::$row['hostname'] : self::$row['clientip'];
+ return self::$row['hostname'] ?: self::$row['clientip'];
}
public static function baseconfigLocationResolver($machineuuid)
diff --git a/modules-available/statistics/pages/replace.inc.php b/modules-available/statistics/pages/replace.inc.php
index 29e02292..50bfd6cf 100644
--- a/modules-available/statistics/pages/replace.inc.php
+++ b/modules-available/statistics/pages/replace.inc.php
@@ -18,7 +18,7 @@ class SubPage
private static function handleReplace()
{
$replace = Request::post('replace', false, 'array');
- if ($replace === false || empty($replace)) {
+ if (empty($replace)) {
Message::addError('main.parameter-empty', 'replace');
return;
}