summaryrefslogtreecommitdiffstats
path: root/modules-available/syslog/page.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2025-08-07 17:51:54 +0200
committerSimon Rettberg2025-08-07 17:51:54 +0200
commited9b97d6c7dddb153b2e0178fd0bd0e8d6bf4f16 (patch)
tree9ca54ef9e079899695568faa6cb77d6d63f44256 /modules-available/syslog/page.inc.php
parentJS: Reorganize script to lower number of ready listeners (diff)
downloadslx-admin-ed9b97d6c7dddb153b2e0178fd0bd0e8d6bf4f16.tar.gz
slx-admin-ed9b97d6c7dddb153b2e0178fd0bd0e8d6bf4f16.tar.xz
slx-admin-ed9b97d6c7dddb153b2e0178fd0bd0e8d6bf4f16.zip
[syslog] Improve POSTs for audit logging
Diffstat (limited to 'modules-available/syslog/page.inc.php')
-rw-r--r--modules-available/syslog/page.inc.php46
1 files changed, 25 insertions, 21 deletions
diff --git a/modules-available/syslog/page.inc.php b/modules-available/syslog/page.inc.php
index bbc12e92..632e5e3f 100644
--- a/modules-available/syslog/page.inc.php
+++ b/modules-available/syslog/page.inc.php
@@ -14,31 +14,35 @@ class Page_SysLog extends Page
Message::addError('main.no-permission');
Util::redirect('?do=Main');
}
-
- if (($days = Request::post('anondays', false, 'int')) !== false) {
- User::assertPermission('configure-anonymization', NULL,'?do=syslog');
- if ($days < 0 || $days > 366) {
- Audit::overrideResponseCode(400);
- Message::addError('anon-days-out-of-range', $days);
- } else {
- Property::set(self::PROP_ANON_DAYS, $days);
- Message::addSuccess('anon-days-saved');
+ $action = Request::post('action', null, 'string');
+ if ($action !== null) {
+ if ($action === 'anondays') {
+ User::assertPermission('configure-anonymization', NULL,'?do=syslog');
+ $days = Request::post('anondays', 0, 'int');
+ if ($days < 0 || $days > 366) {
+ Audit::overrideResponseCode(400);
+ Message::addError('anon-days-out-of-range', $days);
+ } else {
+ Property::set(self::PROP_ANON_DAYS, $days);
+ Message::addSuccess('anon-days-saved');
+ }
+ Util::redirect('?do=syslog', 200);
}
- Util::redirect('?do=syslog');
- }
- if (Request::isPost()) {
- $pairs = [];
- foreach (['search', 'filter', 'not', 'machineuuid'] as $key) {
- $val = Request::any($key, false, 'string');
- if (!empty($val)) {
- if ($key === 'not') {
- $val = (bool)$val;
+
+ if ($action === 'filter') {
+ $pairs = [];
+ foreach (['search', 'filter', 'not', 'machineuuid'] as $key) {
+ $val = Request::any($key, false, 'string');
+ if (!empty($val)) {
+ if ($key === 'not') {
+ $val = (bool)$val;
+ }
+ $pairs[$key] = $val;
}
- $pairs[$key] = $val;
+ Session::set('log_' . $key, $pairs[$key] ?? false, false);
}
- Session::set('log_' . $key, $pairs[$key] ?? false, false);
+ Util::redirect('?do=syslog&' . http_build_query($pairs), 200);
}
- Util::redirect('?do=syslog&' . http_build_query($pairs));
}
User::assertPermission('*');
}