diff options
author | Simon Rettberg | 2023-11-02 19:08:58 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-11-02 19:08:58 +0100 |
commit | c2d95ffaeaa289752b4c7b6664b6ca112a02e350 (patch) | |
tree | 2c29b0157d14198aadbdbc9f8c18ded0bd4dadcd /modules-available/statistics/inc | |
parent | [rebootcontrol] Remove API prototype (diff) | |
download | slx-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/inc')
-rw-r--r-- | modules-available/statistics/inc/statisticsfilter.inc.php | 10 | ||||
-rw-r--r-- | modules-available/statistics/inc/statisticshooks.inc.php | 2 |
2 files changed, 2 insertions, 10 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) |