diff options
author | Simon Rettberg | 2020-05-05 15:21:09 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-05-05 15:21:09 +0200 |
commit | 735f27a56c12aaccdae25292555fb29bd9255451 (patch) | |
tree | 060258053fec43b7526bef65998bda3b08ceae9b | |
parent | [rebootcontrol/statistics] Move subnet size handling to hook (diff) | |
download | slx-admin-735f27a56c12aaccdae25292555fb29bd9255451.tar.gz slx-admin-735f27a56c12aaccdae25292555fb29bd9255451.tar.xz slx-admin-735f27a56c12aaccdae25292555fb29bd9255451.zip |
[statistics] Fix handling POST for sub-pages
Fixes machine replace etc.
-rw-r--r-- | modules-available/statistics/page.inc.php | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/modules-available/statistics/page.inc.php b/modules-available/statistics/page.inc.php index deba6681..b51e2956 100644 --- a/modules-available/statistics/page.inc.php +++ b/modules-available/statistics/page.inc.php @@ -20,31 +20,35 @@ class Page_Statistics extends Page if (Request::isGet()) { $this->transformLegacyQuery(); - $this->show = Request::any('show', false, 'string'); - if ($this->show === false) { - if (Request::get('uuid') !== false) { - $this->show = 'machine'; - } elseif (User::hasPermission('view.summary')) { - $this->show = 'summary'; - } elseif (User::hasPermission('view.list')) { - $this->show = 'list'; - } else { - User::assertPermission('view.summary'); - } + } + + $this->show = Request::any('show', false, 'string'); + if ($this->show === false && Request::isGet()) { + if (Request::get('uuid') !== false) { + $this->show = 'machine'; + } elseif (User::hasPermission('view.summary')) { + $this->show = 'summary'; + } elseif (User::hasPermission('view.list')) { + $this->show = 'list'; } else { - $this->show = preg_replace('/[^a-z0-9_\-]/', '', $this->show); + User::assertPermission('view.summary'); } - - if (file_exists('modules/statistics/pages/' . $this->show . '.inc.php')) { + } + if ($this->show !== false) { + $this->show = preg_replace('/[^a-z0-9_\-]/', '', $this->show); + if (!file_exists('modules/statistics/pages/' . $this->show . '.inc.php')) { + Message::addError('main.invalid-action', $this->show); + } else { require_once 'modules/statistics/pages/' . $this->show . '.inc.php'; $this->haveSubpage = true; SubPage::doPreprocess(); - } else { - Message::addError('main.invalid-action', $this->show); } return; } + if (!Request::isPost()) + return; + // POST $action = Request::post('action'); if ($action === 'setnotes') { |