Source
elseif (hasRequest('action') && str_in_array(getRequest('action'), ['discoveryrule.massenable', 'discoveryrule.massdisable']) && hasRequest('g_hostdruleid')) {
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__).'/include/config.inc.php';
require_once dirname(__FILE__).'/include/hosts.inc.php';
require_once dirname(__FILE__).'/include/items.inc.php';
require_once dirname(__FILE__).'/include/forms.inc.php';
$page['title'] = _('Configuration of discovery rules');
$page['file'] = 'host_discovery.php';
$page['scripts'] = ['class.cviewswitcher.js', 'multilineinput.js', 'multiselect.js', 'items.js', 'textareaflexible.js'];
require_once dirname(__FILE__).'/include/page_header.php';
$paramsFieldName = getParamFieldNameByType(getRequest('type', 0));
// supported eval types
$evalTypes = [
CONDITION_EVAL_TYPE_AND_OR,
CONDITION_EVAL_TYPE_AND,
CONDITION_EVAL_TYPE_OR,
CONDITION_EVAL_TYPE_EXPRESSION
];
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = [
'hostid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({form}) && !isset({itemid})'],
'itemid' => [T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({form}) && ({form} == "update"))'],
'interfaceid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null, _('Interface')],
'name' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Name')],
'description' => [T_ZBX_STR, O_OPT, null, null, 'isset({add}) || isset({update})'],
'key' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Key')],
'master_itemid' => [T_ZBX_STR, O_OPT, null, null,
'(isset({add}) || isset({update})) && isset({type})'.
' && {type} == '.ITEM_TYPE_DEPENDENT,
_('Master item')
],
'delay' => [T_ZBX_TU, O_OPT, P_ALLOW_USER_MACRO, null,
'(isset({add}) || isset({update})) && isset({type})'.
' && {type} != '.ITEM_TYPE_TRAPPER.' && {type} != '.ITEM_TYPE_SNMPTRAP.
' && {type} != '.ITEM_TYPE_DEPENDENT,
_('Update interval')
],
'delay_flex' => [T_ZBX_STR, O_OPT, null, null, null],
'status' => [T_ZBX_INT, O_OPT, null, IN(ITEM_STATUS_ACTIVE), null],