Source
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
class CControllerTopTriggersList extends CController {
protected function init(): void {
$this->disableCsrfValidation();
}
protected function checkInput(): bool {
$fields = [
'filter_groupids' => 'array_db hosts_groups.groupid',
'filter_hostids' => 'array_db hosts.hostid',
'filter_problem' => 'string',
'filter_severities' => 'array',
'filter_evaltype' => 'in '.TAG_EVAL_TYPE_AND_OR.','.TAG_EVAL_TYPE_OR,
'filter_tags' => 'array',
'from' => 'range_time',
'to' => 'range_time',
'filter_set' => 'in 1',
'filter_rst' => 'in 1'
];
$ret = $this->validateInput($fields) && $this->validateTimeSelectorPeriod();
if (!$ret) {
$this->setResponse(new CControllerResponseFatal());
}
return $ret;
}
protected function checkPermissions(): bool {
return $this->checkAccess(CRoleHelper::UI_REPORTS_TOP_TRIGGERS);
}
protected function doAction(): void {
if ($this->hasInput('filter_set')) {
CProfile::updateArray('web.toptriggers.filter.groupids', $this->getInput('filter_groupids', []),
PROFILE_TYPE_ID
);
CProfile::updateArray('web.toptriggers.filter.hostids', $this->getInput('filter_hostids', []),
PROFILE_TYPE_ID
);
CProfile::update('web.toptriggers.filter.problem', $this->getInput('filter_problem', ''), PROFILE_TYPE_STR);
CProfile::updateArray('web.toptriggers.filter.severities', $this->getInput('filter_severities', []),
PROFILE_TYPE_INT
);
CProfile::update('web.toptriggers.filter.evaltype',
$this->getInput('filter_evaltype', TAG_EVAL_TYPE_AND_OR), PROFILE_TYPE_INT