Source
'message' => _('Item contains user-defined macros with secret values. Values of these macros should be entered manually.')
<?php
/*
** Zabbix
** 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 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.
**/
/**
* @var CView $this
*/
$form = (new CForm())
->cleanItems()
->setId('preprocessing-test-form');
if ($data['show_prev']) {
$form
->addVar('upd_last', '')
->addVar('upd_prev', '');
}
foreach ($data['inputs'] as $name => $value) {
if ($name === 'interface') {
// SNMPv3 additional details about interface.
if (array_key_exists('useip', $value)) {
$form->addVar('interface[useip]', $value['useip']);
}
if (array_key_exists('interfaceid', $value)) {
$form->addVar('interface[interfaceid]', $value['interfaceid']);
}
continue;
}
elseif ($name === 'host' && array_key_exists('hostid', $value)) {
$form->addVar('hostid', $value['hostid']);
continue;
}
elseif ($name === 'proxy_hostid') {
continue;
}
elseif ($name === 'query_fields' || $name === 'headers' || $name === 'parameters') {
foreach (['name', 'value'] as $key) {
if (array_key_exists($key, $value)) {
$form->addVar($name.'['.$key.']', $value[$key]);
}
}
continue;
}
$form->addItem((new CInput('hidden', $name, $value))->removeId());
}
// Create macros table.
$macros_table = $data['macros'] ? (new CTable())->addClass(ZBX_STYLE_TEXTAREA_FLEXIBLE_CONTAINER) : null;
$i = 0;
foreach ($data['macros'] as $macro_name => $macro_value) {
$macros_table->addRow([
(new CCol(
(new CTextAreaFlexible('macro_rows['.$i++.']', $macro_name, ['readonly' => true]))
->setWidth(ZBX_TEXTAREA_MACRO_WIDTH)
->removeId()
->removeAttribute('name')
))->addClass(ZBX_STYLE_TEXTAREA_FLEXIBLE_PARENT),
(new CCol(RARR()))->addStyle('vertical-align: top;'),
(new CCol(
(new CTextAreaFlexible('macros['.$macro_name.']', $macro_value))
->setWidth(ZBX_TEXTAREA_MACRO_VALUE_WIDTH)
->setMaxlength(CControllerPopupItemTest::INPUT_MAX_LENGTH)
->setAttribute('placeholder', _('value'))
->disableSpellcheck()
->removeId()
))->addClass(ZBX_STYLE_TEXTAREA_FLEXIBLE_PARENT)
]);
}
$form_grid = (new CFormGrid())
->addClass(CFormGrid::ZBX_STYLE_FORM_GRID_3_1);