summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/pages/list.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2024-01-18 14:40:35 +0100
committerSimon Rettberg2024-01-18 14:40:35 +0100
commit09847016b8816b5fbf37aeb5af93cd553f76b8ac (patch)
tree4bcb1d5eeaf34b5df3507e4dd077d2879900b758 /modules-available/statistics/pages/list.inc.php
parentFix type errors (diff)
downloadslx-admin-09847016b8816b5fbf37aeb5af93cd553f76b8ac.tar.gz
slx-admin-09847016b8816b5fbf37aeb5af93cd553f76b8ac.tar.xz
slx-admin-09847016b8816b5fbf37aeb5af93cd553f76b8ac.zip
[locations/statistics] More type safety, array key checks
Diffstat (limited to 'modules-available/statistics/pages/list.inc.php')
-rw-r--r--modules-available/statistics/pages/list.inc.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules-available/statistics/pages/list.inc.php b/modules-available/statistics/pages/list.inc.php
index facffdd0..f08cd71c 100644
--- a/modules-available/statistics/pages/list.inc.php
+++ b/modules-available/statistics/pages/list.inc.php
@@ -76,6 +76,7 @@ class SubPage
$rows = [];
$colValCount = []; // Count unique values for several columns
foreach ($allRows as &$row) {
+ settype($row['locationid'], 'int');
$row['link_details'] = in_array($row['locationid'], $detailsAllowedLocations);
//$row['firstseen'] = Util::prettyTime($row['firstseen']);
$row['lastseen_int'] = $row['lastseen'];
@@ -157,8 +158,9 @@ class SubPage
$roomsvg = null;
$side = [];
if (!empty($rows) && !empty($colValCount)) {
- if (count($colValCount['locationid']) === 1 && ($lid = array_key_first($colValCount['locationid'])) !== null
- && Module::isAvailable('roomplanner')) {
+ if (count($colValCount['locationid']) === 1
+ && ($lid = array_key_first($colValCount['locationid'])) > 0
+ && Module::isAvailable('roomplanner')) {
$roomsvg = PvsGenerator::generateSvg($lid, false, 0, 1, true, $colValCount['locationid'][$lid]);
}
// Handle our selected attributes
@@ -168,6 +170,8 @@ class SubPage
// Suffixes are not localized, but hopefully generic enough for now
switch ($key) {
case 'locationid':
+ if (!isset($location[$val]))
+ continue 2;
$val = $location[$val]['name'];
break;
case 'gbram':