if (isset($_REQUEST['druleid'])) { $dbDRule = API::DRule()->get(array('druleids' => getRequest('druleid'), 'output' => array('name', 'proxy_hostid', 'iprange', 'delay', 'status'), 'selectDChecks' => array('type', 'key_', 'snmp_community', 'ports', 'snmpv3_securityname', 'snmpv3_securitylevel', 'snmpv3_authpassphrase', 'snmpv3_privpassphrase', 'uniq', 'snmpv3_authprotocol', 'snmpv3_privprotocol', 'snmpv3_contextname'), 'editable' => true)); if (empty($dbDRule)) { access_deny(); } } // ajax if (isset($_REQUEST['output']) && $_REQUEST['output'] == 'ajax') { $ajaxResponse = new CAjaxResponse(); if (isset($_REQUEST['ajaxaction']) && $_REQUEST['ajaxaction'] == 'validate') { $ajaxData = getRequest('ajaxdata', array()); foreach ($ajaxData as $check) { switch ($check['field']) { case 'port': if (!validate_port_list($check['value'])) { $ajaxResponse->error(_('Incorrect port range.')); } break; case 'itemKey': $itemKey = new CItemKey($check['value']); if (!$itemKey->isValid()) { $ajaxResponse->error(_s('Invalid key "%1$s": %2$s.', $check['value'], $itemKey->getError())); } break; } } } $ajaxResponse->send(); require_once dirname(__FILE__) . '/include/page_footer.php'; exit; }