1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
<?php
/*
** Zabbix
** Copyright (C) 2001-2019 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.
**/
require_once dirname(__FILE__).'/include/config.inc.php';
$page['title'] = _('Configuration of GUI');
$page['file'] = 'adm.gui.php';
require_once dirname(__FILE__).'/include/page_header.php';
$themes = array_keys(Z::getThemes());
$fields = [
'default_theme' => [T_ZBX_STR, O_OPT, null, IN('"'.implode('","', $themes).'"'), 'isset({update})',
_('Default theme')
],
'dropdown_first_entry' => [T_ZBX_INT, O_OPT, null, IN('0,1,2'), 'isset({update})',
_('Dropdown first entry')
],
'dropdown_first_remember' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('remember selected')],
'search_limit' => [T_ZBX_INT, O_OPT, null, BETWEEN(1, 999999), 'isset({update})',
_('Limit for search and filter results')
],
'max_in_table' => [T_ZBX_INT, O_OPT, null, BETWEEN(1, 99999), 'isset({update})',
_('Max count of elements to show inside table cell')
],
'server_check_interval' => [T_ZBX_INT, O_OPT, null, IN(SERVER_CHECK_INTERVAL), null,
_('Show warning if Zabbix server is down')
],
// actions
'update' => [T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null],
'form_refresh' => [T_ZBX_INT, O_OPT, null, null, null]
];
check_fields($fields);
/*
* Actions
*/
if (hasRequest('update')) {
DBstart();
$result = update_config([
'default_theme' => getRequest('default_theme'),
'dropdown_first_entry' => getRequest('dropdown_first_entry'),
'dropdown_first_remember' => getRequest('dropdown_first_remember', 0),
'search_limit' => getRequest('search_limit'),
'max_in_table' => getRequest('max_in_table'),
'server_check_interval' => getRequest('server_check_interval', 0)
]);
$result = DBend($result);
show_messages($result, _('Configuration updated'), _('Cannot update configuration'));
}
/*
* Display
*/
$config = select_config();
if (hasRequest('form_refresh')) {
$data = [
'default_theme' => getRequest('default_theme', $config['default_theme']),
'dropdown_first_entry' => getRequest('dropdown_first_entry', $config['dropdown_first_entry']),
'dropdown_first_remember' => getRequest('dropdown_first_remember', 0),
'search_limit' => getRequest('search_limit', $config['search_limit']),
'max_in_table' => getRequest('max_in_table', $config['max_in_table']),
'server_check_interval' => getRequest('server_check_interval', 0)
];
}
else {
$data = [
'default_theme' => $config['default_theme'],
'dropdown_first_entry' => $config['dropdown_first_entry'],
'dropdown_first_remember' => $config['dropdown_first_remember'],
'search_limit' => $config['search_limit'],
'max_in_table' => $config['max_in_table'],
'server_check_interval' => $config['server_check_interval']
];
}
$view = new CView('administration.general.gui.edit', $data);
$view->render();
$view->show();
require_once dirname(__FILE__).'/include/page_footer.php';
|