diff options
Diffstat (limited to 'modules-available/eventlog/page.inc.php')
-rw-r--r-- | modules-available/eventlog/page.inc.php | 16 |
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); } } |