diff options
author | Simon Rettberg | 2022-09-12 10:33:41 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-09-12 10:33:41 +0200 |
commit | 798ebc01e6c81cc95323de068477711e2b95b9cc (patch) | |
tree | 23f4bb18be4593570934597273c11ecaa72c8c39 /modules-available/syslog/page.inc.php | |
parent | [rebootcontrol] Work around bogus warnings in older PHP versions (diff) | |
download | slx-admin-798ebc01e6c81cc95323de068477711e2b95b9cc.tar.gz slx-admin-798ebc01e6c81cc95323de068477711e2b95b9cc.tar.xz slx-admin-798ebc01e6c81cc95323de068477711e2b95b9cc.zip |
[syslog] Minor refactor
Diffstat (limited to 'modules-available/syslog/page.inc.php')
-rw-r--r-- | modules-available/syslog/page.inc.php | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/modules-available/syslog/page.inc.php b/modules-available/syslog/page.inc.php index 71a07e14..cd1c9d4d 100644 --- a/modules-available/syslog/page.inc.php +++ b/modules-available/syslog/page.inc.php @@ -26,20 +26,18 @@ class Page_SysLog extends Page Util::redirect('?do=syslog'); } if (Request::isPost()) { - $search = Request::any('search', false, 'string'); - $filter = Request::any('filter', false, 'string'); - $not = Request::any('not', false, 'bool'); - $machineuuid = Request::any('machineuuid'); - if (empty($search)) { - $search = false; - } - if (empty($filter)) { - $filter = false; + $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; + } + Session::set('log_' . $key, $pairs[$key] ?? false, false); } - Session::set('log_search', $search, false); - Session::set('log_filter', $filter, false); - Session::set('log_not', $not, false); - Util::redirect('?do=syslog&' . http_build_query(compact('search', 'filter', 'not', 'machineuuid'))); + Util::redirect('?do=syslog&' . http_build_query($pairs)); } User::assertPermission('*'); } |