From 0746d3c815fa5dffe8ed766043cb996e5e2ce581 Mon Sep 17 00:00:00 2001
From: Jannik Schönartz
Date: Mon, 20 Nov 2017 14:30:31 +0100
Subject: [statistics&syslog] Changed ip to machine-uuid for filtering. Fixed
a bug where the client-log was losing the specific client when a filter was
added.
---
modules-available/statistics/page.inc.php | 2 +-
modules-available/statistics/templates/syslog.html | 2 +-
modules-available/syslog/page.inc.php | 21 +++++++++++----------
modules-available/syslog/templates/page-syslog.html | 2 +-
4 files changed, 14 insertions(+), 13 deletions(-)
(limited to 'modules-available')
diff --git a/modules-available/statistics/page.inc.php b/modules-available/statistics/page.inc.php
index 479f3089..f8b40405 100644
--- a/modules-available/statistics/page.inc.php
+++ b/modules-available/statistics/page.inc.php
@@ -920,7 +920,7 @@ class Page_Statistics extends Page
}
}
Render::addTemplate('syslog', array(
- 'clientip' => $client['clientip'],
+ 'machineuuid' => $client['machineuuid'],
'list' => $log,
));
}
diff --git a/modules-available/statistics/templates/syslog.html b/modules-available/statistics/templates/syslog.html
index c82cb8ac..968d32ab 100644
--- a/modules-available/statistics/templates/syslog.html
+++ b/modules-available/statistics/templates/syslog.html
@@ -20,7 +20,7 @@
{{/list}}
-
+
diff --git a/modules-available/syslog/page.inc.php b/modules-available/syslog/page.inc.php
index f2bc4854..46b62d5d 100644
--- a/modules-available/syslog/page.inc.php
+++ b/modules-available/syslog/page.inc.php
@@ -21,12 +21,13 @@ class Page_SysLog extends Page
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
$types[$row['logtypeid']] = $row;
}
- if (isset($_GET['filter'])) {
- $filter = $_GET['filter'];
- $not = isset($_GET['not']) ? 'NOT' : '';
- } elseif (isset($_POST['filter'])) {
- $filter = $_POST['filter'];
- $not = isset($_POST['not']) ? 'NOT' : '';
+ if (Request::get('filter') !== false) {
+ $filter = Request::get('filter');
+ $not = Request::get('not') ? 'NOT' : '';
+ } elseif (Request::post('filter') !== false) {
+ $filter = Request::post('filter');
+ $not = Request::post('not') ? 'NOT' : '';
+
Session::set('log_filter', $filter);
Session::set('log_not', $not);
Session::save();
@@ -48,14 +49,13 @@ class Page_SysLog extends Page
if (!empty($whereClause)) $whereClause = ' WHERE logtypeid ' . $not . ' IN (' . implode(', ', $whereClause) . ')';
}
if (!isset($whereClause) || empty($whereClause)) $whereClause = '';
- if (Request::get('ip')) {
+ if (Request::get('machineuuid')) {
if (empty($whereClause))
$whereClause .= ' WHERE ';
else
$whereClause .= ' AND ';
- $whereClause .= "clientip LIKE '" . preg_replace('/[^0-9\.\:]/', '', Request::get('ip')) . "%'";
+ $whereClause .= "machineuuid='" . Request::get('machineuuid') . "'";
}
-
$today = date('d.m.Y');
$yesterday = date('d.m.Y', time() - 86400);
$lines = array();
@@ -78,9 +78,10 @@ class Page_SysLog extends Page
'not' => $not,
'list' => $lines,
'types' => json_encode(array_values($types)),
+ 'machineuuid' => Request::get('machineuuid'),
));
}
-
+
private function eventToIconName($event)
{
switch ($event) {
diff --git a/modules-available/syslog/templates/page-syslog.html b/modules-available/syslog/templates/page-syslog.html
index cb20a93a..28ab739a 100644
--- a/modules-available/syslog/templates/page-syslog.html
+++ b/modules-available/syslog/templates/page-syslog.html
@@ -4,7 +4,7 @@
max-width: 500px;
}
-