CProfile::update('web.hosts.filter_host', getRequest('filter_host', ''), PROFILE_TYPE_STR); CProfile::update('web.hosts.filter_port', getRequest('filter_port', ''), PROFILE_TYPE_STR); } elseif (hasRequest('filter_rst')) { DBStart(); CProfile::delete('web.hosts.filter_ip'); CProfile::delete('web.hosts.filter_dns'); CProfile::delete('web.hosts.filter_host'); CProfile::delete('web.hosts.filter_port'); DBend(); } $filter['ip'] = CProfile::get('web.hosts.filter_ip', ''); $filter['dns'] = CProfile::get('web.hosts.filter_dns', ''); $filter['host'] = CProfile::get('web.hosts.filter_host', ''); $filter['port'] = CProfile::get('web.hosts.filter_port', ''); // remove inherited macros data (actions: 'add', 'update' and 'form') $macros = cleanInheritedMacros(getRequest('macros', [])); // remove empty new macro lines foreach ($macros as $idx => $macro) { if (!array_key_exists('hostmacroid', $macro) && $macro['macro'] === '' && $macro['value'] === '') { unset($macros[$idx]); } } /* * Actions */ if (isset($_REQUEST['add_template']) && isset($_REQUEST['add_templates'])) { $_REQUEST['templates'] = getRequest('templates', []); $_REQUEST['templates'] = array_merge($_REQUEST['templates'], $_REQUEST['add_templates']); } if (isset($_REQUEST['unlink']) || isset($_REQUEST['unlink_and_clear'])) { $_REQUEST['clear_templates'] = getRequest('clear_templates', []);
$templateIds = getRequest('templates', []); if ($exportData) { $export = new CConfigurationExport(['templates' => $templateIds]); $export->setBuilder(new CConfigurationExportBuilder()); $export->setWriter(CExportWriterFactory::getWriter(CExportWriterFactory::XML)); $exportData = $export->export(); if (hasErrorMesssages()) { show_messages(); } else { print $exportData; } exit; } // remove inherited macros data (actions: 'add', 'update' and 'form') if (hasRequest('macros')) { $_REQUEST['macros'] = cleanInheritedMacros($_REQUEST['macros']); // remove empty new macro lines foreach ($_REQUEST['macros'] as $idx => $macro) { if (!array_key_exists('hostmacroid', $macro) && $macro['macro'] === '' && $macro['value'] === '') { unset($_REQUEST['macros'][$idx]); } } } /* * Actions */ if (isset($_REQUEST['add_template']) && isset($_REQUEST['add_templates'])) { $_REQUEST['templates'] = array_merge($templateIds, $_REQUEST['add_templates']); } if (hasRequest('unlink') || hasRequest('unlink_and_clear')) { $_REQUEST['clear_templates'] = getRequest('clear_templates', []);