blob: 9006c3c5d4a86bed554c7f9ba16b7772baf868f1 (
plain) (
tree)
|
|
<?php
class Page_EventLog extends Page
{
private $show;
protected function doPreprocess()
{
User::load();
$this->show = Request::any('show', false, 'string');
if ($this->show === false && Request::isGet()) {
if (User::hasPermission('view')) {
$this->show = 'log';
} elseif (User::hasPermission('filter.rules.view')) {
$this->show = 'rules';
} else {
User::assertPermission('filter.transports.view');
$this->show = 'transports';
}
}
if ($this->show !== false) {
$this->show = preg_replace('/[^a-z0-9_\-]/', '', $this->show);
if (!file_exists('modules/eventlog/pages/' . $this->show . '.inc.php')) {
Message::addError('main.invalid-action', $this->show);
Util::redirect('?do=eventlog');
} else {
require_once 'modules/eventlog/pages/' . $this->show . '.inc.php';
SubPage::doPreprocess();
}
}
if (Request::isPost()) {
Util::redirect('?do=eventlog&show=' . $this->show);
}
}
protected function doRender()
{
Render::addTemplate('page-header', ['active_' . $this->show => 'active']);
if ($this->show !== false) {
SubPage::doRender();
}
}
}
|