Source
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/../../include/forms.inc.php';
class CControllerItemMassupdate extends CController {
protected function checkInput() {
$fields = [
'context' => 'required|string|in host,template',
'ids' => 'required|array_id',
'prototype' => 'required|in 0,1',
'update' => 'in 1',
'visible' => 'array',
'parent_discoveryid' => 'id',
'history_mode' => 'in '.implode(',', [ITEM_STORAGE_OFF, ITEM_STORAGE_CUSTOM]),
'trends_mode' => 'in '.implode(',', [ITEM_STORAGE_OFF, ITEM_STORAGE_CUSTOM]),
'mass_update_tags' => 'in '.implode(',', [ZBX_ACTION_ADD, ZBX_ACTION_REPLACE, ZBX_ACTION_REMOVE]),
'delay_flex' => 'array',
// The fields used for all item types.
'type' => 'int32',
'value_type' => 'in '.implode(',', [ITEM_VALUE_TYPE_UINT64, ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_STR, ITEM_VALUE_TYPE_LOG, ITEM_VALUE_TYPE_TEXT, ITEM_VALUE_TYPE_BINARY]),
'units' => 'string',
'history' => 'string',
'trends' => 'string',
'valuemapid' => 'id',
'logtimefmt' => 'string',
'description' => 'string',
'status' => 'in '.implode(',', [ITEM_STATUS_ACTIVE, ITEM_STATUS_DISABLED]),
'discover' => 'in '.ZBX_PROTOTYPE_DISCOVER.','.ZBX_PROTOTYPE_NO_DISCOVER,
'tags' => 'array',
'preprocessing' => 'array',
'preprocessing_action' => 'in '.implode(',', [ZBX_ACTION_REPLACE, ZBX_ACTION_REMOVE_ALL]),
// The fields used for multiple item types.
'interfaceid' => 'id',
'authtype' => 'string',
'username' => 'string',
'password' => 'string',
'timeout' => 'string|not_empty',
'delay' => 'string',
'trapper_hosts' => 'string',
// Dependent item type specific fields.
'master_itemid' => 'id',
// HTTP Agent item type specific fields.
'url' => 'string',
'post_type' => 'in '.implode(',', [ZBX_POSTTYPE_RAW, ZBX_POSTTYPE_JSON, ZBX_POSTTYPE_XML]),