summaryrefslogtreecommitdiffstats
path: root/modules-available/eventlog/page.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2022-09-12 10:02:29 +0200
committerSimon Rettberg2022-09-12 10:02:29 +0200
commit799a53be094e99b4285d6e5ce947e915b1f19750 (patch)
treed095b3a85471dde17292cc1f1653cb0acd1b67a0 /modules-available/eventlog/page.inc.php
parent[eventlog] Add more empty rows to filter rule edit page (diff)
downloadslx-admin-799a53be094e99b4285d6e5ce947e915b1f19750.tar.gz
slx-admin-799a53be094e99b4285d6e5ce947e915b1f19750.tar.xz
slx-admin-799a53be094e99b4285d6e5ce947e915b1f19750.zip
[eventlog] Improve sample data displaying when editing a filter rule
Diffstat (limited to 'modules-available/eventlog/page.inc.php')
-rw-r--r--modules-available/eventlog/page.inc.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/modules-available/eventlog/page.inc.php b/modules-available/eventlog/page.inc.php
index b24b9447..ef9870e9 100644
--- a/modules-available/eventlog/page.inc.php
+++ b/modules-available/eventlog/page.inc.php
@@ -49,14 +49,18 @@ class Page_EventLog extends Page
User::assertPermission('filter.rules.edit');
if (Request::any('show') === 'rules') {
$type = Request::any('type', Request::REQUIRED, 'string');
- $res = Database::queryFirst('SELECT data FROM notification_sample WHERE type = :type LIMIT 1',
+ $res = Database::simpleQuery('SELECT data FROM notification_sample
+ WHERE type = :type ORDER BY dateline DESC LIMIT 5',
['type' => $type]);
- Header('Content-Type: application/json');
- if ($res === false) {
- echo '{}';
- } else {
- echo $res['data'];
+ $output = [];
+ foreach ($res as $row) {
+ $row = json_decode($row['data'], true);
+ if (is_array($row)) {
+ $output += $row;
+ }
}
+ Header('Content-Type: application/json');
+ echo json_encode($output);
}
}