require_once dirname(__FILE__).'/include/config.inc.php';
require_once dirname(__FILE__).'/include/maps.inc.php';
require_once dirname(__FILE__).'/include/forms.inc.php';
$page['title'] = _('Configuration of network maps');
$page['file'] = 'sysmap.php';
$page['scripts'] = ['class.svg.canvas.js', 'class.svg.map.js', 'class.cmap.js',
'colorpicker.js', 'class.tagfilteritem.js'
$page['type'] = detect_page_type();
if (!CWebUser::checkAccess(CRoleHelper::ACTIONS_EDIT_MAPS)) {
access_deny(ACCESS_DENY_PAGE);
require_once dirname(__FILE__).'/include/page_header.php';
'sysmapid' => [T_ZBX_INT, O_MAND, P_SYS, DB_ID, null],
'selementid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null],
'sysmap' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({action}) && {action} == "update"'],
'action' => [T_ZBX_STR, O_OPT, P_ACT, IN('"update","expand"'), null],
'delete' => [T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null],
'cancel' => [T_ZBX_STR, O_OPT, P_SYS, null, null],
'form' => [T_ZBX_STR, O_OPT, P_SYS, null, null],
'favobj' => [T_ZBX_STR, O_OPT, P_ACT, null, null],
'favid' => [T_ZBX_STR, O_OPT, P_ACT, null, null],
'name' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({action}) && {action} == "expand"'],
'source' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({action}) && {action} == "expand"']
if (isset($_REQUEST['favobj'])) {
if (getRequest('favobj') === 'sysmap' && hasRequest('action')) {
if (getRequest('action') === 'update') {
$sysmapid = getRequest('sysmapid', 0);
$sysmap = API::Map()->get([
'sysmapids' => $sysmapid,
$sysmap = reset($sysmap);
throw new Exception(_('Access denied!'));
$sysmapUpdate = json_decode($_REQUEST['sysmap'], true);
$sysmapUpdate['sysmapid'] = $sysmapid;
$sysmapUpdate['lines'] = [];
if (array_key_exists('selements', $sysmapUpdate)) {
foreach ($sysmapUpdate['selements'] as $element) {
if (!array_key_exists('tags', $element)) {
if (array_key_exists('elementtype', $element)