1<?php 2/* 3** Zabbix 4** Copyright (C) 2001-2021 Zabbix SIA 5** 6** This program is free software; you can redistribute it and/or modify 7** it under the terms of the GNU General Public License as published by 8** the Free Software Foundation; either version 2 of the License, or 9** (at your option) any later version. 10** 11** This program is distributed in the hope that it will be useful, 12** but WITHOUT ANY WARRANTY; without even the implied warranty of 13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14** GNU General Public License for more details. 15** 16** You should have received a copy of the GNU General Public License 17** along with this program; if not, write to the Free Software 18** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19**/ 20 21 22require_once dirname(__FILE__).'/include/config.inc.php'; 23 24$page['title'] = _('Other configuration parameters'); 25$page['file'] = 'adm.other.php'; 26 27require_once dirname(__FILE__).'/include/page_header.php'; 28 29$fields = [ 30 'refresh_unsupported' => [T_ZBX_STR, O_OPT, null, null, 'isset({update})', _('Refresh unsupported items')], 31 'discovery_groupid' => [T_ZBX_INT, O_OPT, null, DB_ID, 'isset({update})', 32 _('Group for discovered hosts') 33 ], 34 'default_inventory_mode' => [T_ZBX_INT, O_OPT, null, 35 IN(HOST_INVENTORY_DISABLED.','.HOST_INVENTORY_MANUAL.','.HOST_INVENTORY_AUTOMATIC), 'isset({update})', 36 _('Default host inventory mode') 37 ], 38 'alert_usrgrpid' => [T_ZBX_INT, O_OPT, null, DB_ID, 'isset({update})', 39 _('User group for database down message') 40 ], 41 'snmptrap_logging' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Log unmatched SNMP traps')], 42 // actions 43 'update' => [T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null], 44 'form_refresh' => [T_ZBX_INT, O_OPT, null, null, null] 45]; 46check_fields($fields); 47 48/* 49 * Actions 50 */ 51if (hasRequest('update')) { 52 DBstart(); 53 $result = update_config([ 54 'refresh_unsupported' => getRequest('refresh_unsupported'), 55 'alert_usrgrpid' => getRequest('alert_usrgrpid'), 56 'discovery_groupid' => getRequest('discovery_groupid'), 57 'default_inventory_mode' => getRequest('default_inventory_mode'), 58 'snmptrap_logging' => getRequest('snmptrap_logging', 0) 59 ]); 60 $result = DBend($result); 61 62 show_messages($result, _('Configuration updated'), _('Cannot update configuration')); 63} 64 65/* 66 * Display 67 */ 68$config = select_config(); 69 70if (hasRequest('form_refresh')) { 71 $data = [ 72 'refresh_unsupported' => getRequest('refresh_unsupported', $config['refresh_unsupported']), 73 'discovery_groupid' => getRequest('discovery_groupid', $config['discovery_groupid']), 74 'default_inventory_mode' => getRequest('default_inventory_mode', $config['default_inventory_mode']), 75 'alert_usrgrpid' => getRequest('alert_usrgrpid', $config['alert_usrgrpid']), 76 'snmptrap_logging' => getRequest('snmptrap_logging', 0) 77 ]; 78} 79else { 80 $data = [ 81 'refresh_unsupported' => $config['refresh_unsupported'], 82 'discovery_groupid' => $config['discovery_groupid'], 83 'default_inventory_mode' => $config['default_inventory_mode'], 84 'alert_usrgrpid' => $config['alert_usrgrpid'], 85 'snmptrap_logging' => $config['snmptrap_logging'] 86 ]; 87} 88 89$data['discovery_groups'] = API::HostGroup()->get([ 90 'output' => ['groupid', 'name'], 91 'filter' => ['flags' => ZBX_FLAG_DISCOVERY_NORMAL], 92 'editable' => true 93]); 94order_result($data['discovery_groups'], 'name'); 95 96$data['alert_usrgrps'] = DBfetchArray(DBselect('SELECT u.usrgrpid,u.name FROM usrgrp u')); 97order_result($data['alert_usrgrps'], 'name'); 98 99$view = new CView('administration.general.other.edit', $data); 100$view->render(); 101$view->show(); 102 103require_once dirname(__FILE__).'/include/page_footer.php'; 104