<?php declare(strict_types = 0);
class CControllerProxyList extends CController {
protected function init() {
$this->disableCsrfValidation();
protected function checkInput(): bool {
'filter_name' => 'string',
'filter_operating_mode' => 'in '.implode(',', [-1, PROXY_OPERATING_MODE_ACTIVE, PROXY_OPERATING_MODE_PASSIVE]),
'filter_version' => 'in '.implode(',', [-1, ZBX_PROXY_VERSION_ANY_OUTDATED, ZBX_PROXY_VERSION_CURRENT]),
'sort' => 'in '.implode(',', ['name', 'operating_mode', 'tls_accept', 'version', 'lastaccess']),
'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_ADMINISTRATION_PROXIES);
protected function doAction() {
$sortField = $this->getInput('sort', CProfile::get('web.proxies.php.sort', 'name'));
$sortOrder = $this->getInput('sortorder', CProfile::get('web.proxies.php.sortorder', ZBX_SORT_UP));
CProfile::update('web.proxies.php.sort', $sortField, PROFILE_TYPE_STR);
CProfile::update('web.proxies.php.sortorder', $sortOrder, PROFILE_TYPE_STR);
if ($this->hasInput('filter_set')) {
CProfile::update('web.proxies.filter_name', $this->getInput('filter_name', ''), PROFILE_TYPE_STR);
CProfile::update('web.proxies.filter_operating_mode',
$this->getInput('filter_operating_mode', -1), PROFILE_TYPE_INT
CProfile::update('web.proxies.filter_version', $this->getInput('filter_version', -1), PROFILE_TYPE_INT);
elseif ($this->hasInput('filter_rst')) {
CProfile::delete('web.proxies.filter_name');