<?php declare(strict_types = 0);
class CControllerHostList extends CController {
protected function init() {
$this->disableCsrfValidation();
protected function checkInput(): bool {
'filter_host' => 'string',
'filter_templates' => 'array_db hosts.hostid',
'filter_groups' => 'array_db hosts_groups.groupid',
'filter_dns' => 'string',
'filter_port' => 'string',
'filter_status' => 'in -1,'.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED,
'filter_monitored_by' => 'in '.implode(',', [ZBX_MONITORED_BY_ANY, ZBX_MONITORED_BY_SERVER, ZBX_MONITORED_BY_PROXY, ZBX_MONITORED_BY_PROXY_GROUP]),
'filter_proxyids' => 'array_db hosts.proxyid',
'filter_proxy_groupids' => 'array_db hosts.proxy_groupid',
'filter_evaltype' => 'in '.TAG_EVAL_TYPE_AND_OR.','.TAG_EVAL_TYPE_OR,
'filter_tags' => 'array',
'sort' => 'in name,status',
'sortorder' => 'in '.ZBX_SORT_DOWN.','.ZBX_SORT_UP,
$ret = $this->validateInput($fields);
$this->setResponse(new CControllerResponseFatal());
protected function checkPermissions(): bool {
return $this->checkAccess(CRoleHelper::UI_CONFIGURATION_HOSTS);
protected function doAction(): void {
if ($this->hasInput('filter_set')) {
CProfile::update('web.hosts.filter_ip', $this->getInput('filter_ip', ''), PROFILE_TYPE_STR);
CProfile::update('web.hosts.filter_dns', $this->getInput('filter_dns', ''), PROFILE_TYPE_STR);
CProfile::update('web.hosts.filter_host', $this->getInput('filter_host', ''), PROFILE_TYPE_STR);
CProfile::update('web.hosts.filter_port', $this->getInput('filter_port', ''), PROFILE_TYPE_STR);