Source
if ($data['items'][$next] && $data['items'][$i]['sortorder'] == $data['items'][$next]['sortorder']) {
<?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 __DIR__ .'/../../include/forms.inc.php';
class CControllerGraphEdit extends CController {
protected function init(): void {
$this->disableCsrfValidation();
}
protected function checkInput(): bool {
$fields = [
'context' => 'required|in '.implode(',', ['host', 'template']),
'hostid' => 'db hosts.hostid',
'graphid' => 'db graphs.graphid',
'name' => 'string',
'width' => 'db graphs.width',
'height' => 'db graphs.height',
'graphtype' => 'db graphs.graphtype|in '.implode(',', [
GRAPH_TYPE_NORMAL, GRAPH_TYPE_STACKED, GRAPH_TYPE_PIE, GRAPH_TYPE_EXPLODED
]),
'show_legend' => 'db graphs.show_legend|in 0,1',
'show_3d' => 'db graphs.show_3d|in 0,1',
'show_work_period' => 'db graphs.show_work_period|in 0,1',
'show_triggers' => 'db graphs.show_triggers|in 0,1',
'percent_left' => 'string',
'percent_right' => 'string',
'ymin_type' => 'db graphs.ymin_type|in '.implode(',', [
GRAPH_YAXIS_TYPE_CALCULATED, GRAPH_YAXIS_TYPE_FIXED, GRAPH_YAXIS_TYPE_ITEM_VALUE
]),
'ymax_type' => 'db graphs.ymax_type|in '.implode(',', [
GRAPH_YAXIS_TYPE_CALCULATED, GRAPH_YAXIS_TYPE_FIXED, GRAPH_YAXIS_TYPE_ITEM_VALUE
]),
'yaxismin' => 'string',
'yaxismax' => 'string',
'ymin_itemid' => 'db graphs.ymin_itemid',
'ymax_itemid' => 'db graphs.ymax_itemid',
'items' => 'array',
'normal_only' => 'in 1',
'clone' => 'in 1',
'visible' => 'array'
];
$ret = $this->validateInput($fields);
if (!$ret) {
$this->setResponse(
(new CControllerResponseData(['main_block' => json_encode([
'error' => [
'messages' => array_column(get_and_clear_messages(), 'message')