<?php declare(strict_types = 0);
class CControllerActionList extends CController {
protected function init(): void {
$this->disableCsrfValidation();
protected function checkInput(): bool {
'eventsource' => 'required|db actions.eventsource|in '.implode(',', [
EVENT_SOURCE_TRIGGERS, EVENT_SOURCE_DISCOVERY, EVENT_SOURCE_AUTOREGISTRATION,
EVENT_SOURCE_INTERNAL, EVENT_SOURCE_SERVICE
'filter_name' => 'string',
'filter_status' => 'in '.implode(',', [-1, ACTION_STATUS_ENABLED, ACTION_STATUS_DISABLED]),
'sort' => 'in '.implode(',', ['name', 'status']),
'sortorder' => 'in '.implode(',', [ZBX_SORT_UP, ZBX_SORT_DOWN]),
$ret = $this->validateInput($fields);
$this->setResponse(new CControllerResponseFatal());
protected function checkPermissions(): bool {
switch ($this->getInput('eventsource')) {
case EVENT_SOURCE_TRIGGERS:
return $this->checkAccess(CRoleHelper::UI_CONFIGURATION_TRIGGER_ACTIONS);
case EVENT_SOURCE_DISCOVERY:
return $this->checkAccess(CRoleHelper::UI_CONFIGURATION_DISCOVERY_ACTIONS);
case EVENT_SOURCE_AUTOREGISTRATION:
return $this->checkAccess(CRoleHelper::UI_CONFIGURATION_AUTOREGISTRATION_ACTIONS);
case EVENT_SOURCE_INTERNAL:
return $this->checkAccess(CRoleHelper::UI_CONFIGURATION_INTERNAL_ACTIONS);
case EVENT_SOURCE_SERVICE:
return $this->checkAccess(CRoleHelper::UI_CONFIGURATION_SERVICE_ACTIONS);
protected function doAction(): void {
$eventsource = $this->getInput('eventsource', EVENT_SOURCE_TRIGGERS);
$sort_field = $this->getInput('sort', CProfile::get('web.action.list.sort', 'name'));
$sort_order = $this->getInput('sortorder', CProfile::get('web.action.list.sortorder', ZBX_SORT_UP));
CProfile::update('web.action.list.sort', $sort_field, PROFILE_TYPE_STR);
CProfile::update('web.action.list.sortorder', $sort_order, PROFILE_TYPE_STR);
if ($this->hasInput('filter_set')) {
CProfile::update('web.action.list.filter_name', $this->getInput('filter_name', ''), PROFILE_TYPE_STR);
CProfile::update('web.action.list.filter_status', $this->getInput('filter_status', -1), PROFILE_TYPE_INT);
elseif ($this->hasInput('filter_rst')) {
CProfile::delete('web.action.list.filter_name');
CProfile::delete('web.action.list.filter_status');
'name' => CProfile::get('web.action.list.filter_name', ''),
'status' => CProfile::get('web.action.list.filter_status', -1)
'eventsource' => $eventsource,