pandorafms/pandora_console/godmode/setup/setup.php

416 lines
12 KiB
PHP
Raw Normal View History

<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Extensions
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
2020-11-27 13:52:35 +01:00
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* 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 for version 2.
* 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.
* ============================================================================
*/
global $config;
check_login();
if (is_ajax()) {
$get_os_icon = (bool) get_parameter('get_os_icon');
$select_timezone = get_parameter('select_timezone', 0);
if ($get_os_icon) {
$id_os = (int) get_parameter('id_os');
ui_print_os_icon($id_os, false);
return;
}
if ($select_timezone) {
$zone = get_parameter('zone');
$timezones = timezone_identifiers_list();
foreach ($timezones as $timezone_key => $timezone) {
if (strpos($timezone, $zone) === false) {
unset($timezones[$timezone_key]);
}
}
echo json_encode($timezones);
}
return;
2009-04-13 Esteban Sanchez <estebans@artica.es> * general/footer.php: Removed Firefox icon. Style correction. * godmode/agentes/agent_manager.php: Replaced &gt; with &raquo;. Style correction when setting bold attributes. * godmode/agentes/manage_config_remote.php, godmode/agentes/modificar_agente.php, godmode/agentes/module_manager.php, godmode/alerts/alert_list.php, godmode/db/db_audit.php, godmode/db/db_event.php, godmode/db/db_info.php, godmode/db/db_main.php, godmode/db/db_purge.php, godmode/db/db_refine.php, godmode/groups/configure_group.php, godmode/groups/group_list.php, godmode/modules/manage_nc_groups.php, godmode/modules/manage_network_components.php, godmode/modules/manage_network_templates.php, godmode/modules/manage_network_templates_form.php, godmode/modules/module_list.php, godmode/profiles/profile_list.php, godmode/reporting/graph_builder.php, godmode/reporting/map_builder.php, godmode/reporting/reporting_builder.php, godmode/servers/manage_export.php, godmode/servers/manage_export_form.php, godmode/servers/manage_recontask.php, godmode/servers/manage_recontask_form.php, godmode/servers/modificar_server.php, godmode/setup/setup_visuals.php, godmode/setup/links.php, godmode/setup/news.php, godmode/snmpconsole/snmp_alert.php, godmode/users/configure_user.php, godmode/users/user_list.php, operation/agentes/alerts_status.php, operation/agentes/estado_generalagente.php, operation/agentes/estado_agente.php, operation/agentes/estado_grupo.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/exportdata.php, operation/agentes/networkmap.php, operation/agentes/status_monitor.php, operation/agentes/tactical.php, operation/events/events.php, operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/incidents/incident_statistics.php, operation/messages/message.php, operation/reporting/custom_reporting.php, operation/reporting/graph_viewer.php, operation/reporting/reporting_viewer.php, operation/servers/view_server.php, operation/users/user.php, operation/users/user_edit.php, operation/users/user_statistics.php, operation/visual_console/index.php, godmode/agentes/agent_template.php: Replaced &gt; with &raquo; * operation/agentes/datos_agente.php: Return instead of exit * include/javascript/jquery.pandora.controls.js: Added pandoraSelectOS control to preview the OS icon on a select. * include/functions_reports.php: Fixed a bug on delete_report() that returns error when the report has no content. * include/functions_ui.php: Removed border attribute on print_os_icon(). Some fixes to meta refresh element on process_page_head(). Fixed format_filesize() when length is zero. * godmode/menu.php: Replaced link to file manager. Added enterprise hook. * godmode/setup/file_manager.php: Renamed from obfuscated name filemgr.php * include/styles/pandora.css: Textarea width reduced to 99% * godmode/setup/setup.php: Added get_os_icon AJAX operation. * images/mimetypes/, images/mimetypes/zip.png, images/mimetypes/image.png, images/mimetypes/unknown.png, images/mimetypes/directory.png: Added to repository. Mime type icons. * extras/pandoradb_migrate_v2.x_to_v3.0.sql: Removed date comments. * include/functions_filemanager.php: Added to repository. Minimal API for file manager system. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1608 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-13 11:50:56 +02:00
}
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
2022-02-01 13:39:18 +01:00
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
2008-06-26 Esteban Sanchez <estebans@artica.es> * ajax.php: Sed id_user in config array. * godmode/menu.php, general/header.php, operation/menu.php: Replaced lang_label with lang_string(). * general/logon_ok.php: Reduced one indentation level. * godmode/agentes/agent_manager.php: Replaced lang_label with lang_string(). Use pandora functions. * include/functions_html.php, godmode/agentes/configurar_agente.php: Tab and blankspaces style correction. * godmode/reporting/map_builder.php: Complete rewritten to provide an intuitive way of build the maps. It's cool, useful and very simple. * godmode/reporting/reporting_builder.php: Deleted an output debug. * godmode/setup/setup.php: Rewritten to use pandora functions. Added a colorpicker for color settings. * include/config.php: Reset pandora password. We must solve things with this file... * include/functions.php: Check if input is an array on safe_input(). Use filename as id in array returned by list_files(). * include/functions_db.php: Renamed return_coordinate_* functions. Style correction. * include/javascript/jquery.js: Updated to 1.2.6. * include/javascript/jquery.ui.datepicker.js: Code minimized. * include/javascript/pandora.js: Style correction. * include/javascript/wz_jsgraphics.js: Added a class to the elements of a line, so it can be modified using javascript. * /include/styles/pandora.css: Added style to some tables dropdowns. Added new styles relative to visual map editor. * operation/reporting/reporting_viewer.php: Style correction. Added jQuery UI. * operation/visual_console/index.php: Use Pandora functions. * operation/visual_console/render_view.php: Drawing the map is now on functions_visual_map.php. Added a countdown if a refresh time is set. Use pandora functions. Style correction. * reporting/fgraph.php: Style correction. Use graphic_error() if there's no data on grafico_modulo_sparse(). * images/trash.png: Added to repository. Image used on trash area on visual map editor. * images/console/background/africa.jpg, images/console/background/asia.jpg, images/console/background/europe.jpg, images/console/background/north_america.jpg, images/console/background/oceania.jpg, images/console/background/shouth_america.jpg, images/console/background/world.jpg: Added to repository. Useful and cool map backgrounds. * include/functions_visual_map.php: Added to repository. Implements visual map functions like drawing the map. * include/javascript/jquery.colorpicker.js: Added to repository. Implements a color picker widget. * /include/javascript/jquery.countdown.js: Added to repository. Implements a countdown widget. * include/javascript/jquery.ui.core.js: Added to repository. jQuery UI core. * include/javascript/jquery.ui.draggable.js: Added to repository. jQuery draggable plugin. * include/javascript/jquery.ui.droppable.js: Added to repository. jQuery droppable plugin. * include/javascript/pandora_visual_console.js: Added to repository. Function useful to visual map interface. * include/languages/countdown_*.js: Added to repository. Countdown localization. * include/languages/date_es_la.js, include/languages/date_gl.js, include/languages/time_es_la.js, include/languages/time_gl.js: Added to repository. Missing localizations. * include/styles/color-picker.css: Added to repository. Colorpicker style sheet. * include/styles/countdown.css: Added to repository. Countdown style sheet. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@899 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-26 15:26:48 +02:00
}
// Load enterprise extensions.
enterprise_include_once('include/functions_setup.php');
enterprise_include_once('include/functions_io.php');
enterprise_include_once('godmode/setup/setup.php');
/*
NOTICE FOR DEVELOPERS:
2015-06-08 13:13:09 +02:00
Update operation is done in config_process.php
This is done in that way so the user can see the changes inmediatly.
If you added a new token, please check config_update_config() in functions_config.php
to add it there.
*/
2008-06-26 Esteban Sanchez <estebans@artica.es> * ajax.php: Sed id_user in config array. * godmode/menu.php, general/header.php, operation/menu.php: Replaced lang_label with lang_string(). * general/logon_ok.php: Reduced one indentation level. * godmode/agentes/agent_manager.php: Replaced lang_label with lang_string(). Use pandora functions. * include/functions_html.php, godmode/agentes/configurar_agente.php: Tab and blankspaces style correction. * godmode/reporting/map_builder.php: Complete rewritten to provide an intuitive way of build the maps. It's cool, useful and very simple. * godmode/reporting/reporting_builder.php: Deleted an output debug. * godmode/setup/setup.php: Rewritten to use pandora functions. Added a colorpicker for color settings. * include/config.php: Reset pandora password. We must solve things with this file... * include/functions.php: Check if input is an array on safe_input(). Use filename as id in array returned by list_files(). * include/functions_db.php: Renamed return_coordinate_* functions. Style correction. * include/javascript/jquery.js: Updated to 1.2.6. * include/javascript/jquery.ui.datepicker.js: Code minimized. * include/javascript/pandora.js: Style correction. * include/javascript/wz_jsgraphics.js: Added a class to the elements of a line, so it can be modified using javascript. * /include/styles/pandora.css: Added style to some tables dropdowns. Added new styles relative to visual map editor. * operation/reporting/reporting_viewer.php: Style correction. Added jQuery UI. * operation/visual_console/index.php: Use Pandora functions. * operation/visual_console/render_view.php: Drawing the map is now on functions_visual_map.php. Added a countdown if a refresh time is set. Use pandora functions. Style correction. * reporting/fgraph.php: Style correction. Use graphic_error() if there's no data on grafico_modulo_sparse(). * images/trash.png: Added to repository. Image used on trash area on visual map editor. * images/console/background/africa.jpg, images/console/background/asia.jpg, images/console/background/europe.jpg, images/console/background/north_america.jpg, images/console/background/oceania.jpg, images/console/background/shouth_america.jpg, images/console/background/world.jpg: Added to repository. Useful and cool map backgrounds. * include/functions_visual_map.php: Added to repository. Implements visual map functions like drawing the map. * include/javascript/jquery.colorpicker.js: Added to repository. Implements a color picker widget. * /include/javascript/jquery.countdown.js: Added to repository. Implements a countdown widget. * include/javascript/jquery.ui.core.js: Added to repository. jQuery UI core. * include/javascript/jquery.ui.draggable.js: Added to repository. jQuery draggable plugin. * include/javascript/jquery.ui.droppable.js: Added to repository. jQuery droppable plugin. * include/javascript/pandora_visual_console.js: Added to repository. Function useful to visual map interface. * include/languages/countdown_*.js: Added to repository. Countdown localization. * include/languages/date_es_la.js, include/languages/date_gl.js, include/languages/time_es_la.js, include/languages/time_gl.js: Added to repository. Missing localizations. * include/styles/color-picker.css: Added to repository. Colorpicker style sheet. * include/styles/countdown.css: Added to repository. Countdown style sheet. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@899 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-26 15:26:48 +02:00
// Gets section to jump to another section.
$section = (string) get_parameter('section', 'general');
$buttons = [];
// Draws header.
$buttons['general'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general').'">'.html_print_image(
'images/setup.png',
true,
[
'title' => __('General'),
'class' => 'invert_filter',
]
).'</a>',
];
if (enterprise_installed()) {
$buttons = setup_enterprise_add_Tabs($buttons);
}
$buttons['auth'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=auth').'">'.html_print_image(
'images/key.png',
true,
[
'title' => __('Authentication'),
'class' => 'invert_filter',
]
).'</a>',
];
$buttons['perf'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=perf').'">'.html_print_image(
'images/performance.png',
true,
[
'title' => __('Performance'),
'class' => 'invert_filter',
]
).'</a>',
];
$buttons['vis'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=vis').'">'.html_print_image(
'images/chart.png',
true,
[
'title' => __('Visual styles'),
'class' => 'invert_filter',
]
).'</a>',
];
if (check_acl($config['id_user'], 0, 'AW')) {
if ($config['activate_netflow']) {
$buttons['net'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=net').'">'.html_print_image(
'images/op_netflow.png',
true,
[
'title' => __('Netflow'),
'class' => 'invert_filter',
]
).'</a>',
];
}
}
2019-09-02 17:01:41 +02:00
$buttons['integria'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=integria').'">'.html_print_image(
'images/integria.png',
true,
[
'title' => __('Integria IMS'),
'class' => 'invert_filter',
]
).'</a>',
2019-09-02 17:01:41 +02:00
];
$buttons['ehorus'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus').'">'.html_print_image(
'images/ehorus/ehorus.png',
true,
[
'title' => __('eHorus'),
'class' => 'invert_filter',
]
).'</a>',
];
2016-05-04 19:19:07 +02:00
if (check_acl($config['id_user'], 0, 'PM') && enterprise_installed()) {
$buttons['module_library'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=module_library').'">'.html_print_image(
'images/library.png',
true,
[
'title' => __('Module Library'),
'class' => 'invert_filter',
]
).'</a>',
];
}
// FIXME: Not definitive icon
$buttons['notifications'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=notifications').'">'.html_print_image(
'images/alerts_template.png',
true,
[
'title' => __('Notifications'),
'class' => 'invert_filter',
]
).'</a>',
];
2019-12-13 13:11:38 +01:00
$buttons['websocket_engine'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=websocket_engine').'">'.html_print_image(
'images/websocket_small.png',
true,
[
'title' => __('Websocket engine'),
'class' => 'invert_filter',
]
).'</a>',
];
2020-12-18 12:34:39 +01:00
$buttons['external_tools'] = [
2020-12-16 14:09:54 +01:00
'active' => false,
2021-03-16 11:24:05 +01:00
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=external_tools').'">'.html_print_image('images/nettool.png', true, ['title' => __('External Tools'), 'class' => 'invert_filter']).'</a>',
];
2020-01-08 15:57:18 +01:00
if ($config['activate_gis']) {
$buttons['gis'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=gis').'">'.html_print_image(
'images/gis_tab.png',
true,
[
'title' => __('GIS Map connection'),
'class' => 'invert_filter',
]
).'</a>',
2020-01-08 15:57:18 +01:00
];
}
2020-01-08 15:44:59 +01:00
$help_header = '';
if (enterprise_installed()) {
$subpage = setup_enterprise_add_subsection_main($section, $buttons, $help_header);
}
2020-01-08 15:44:59 +01:00
switch ($section) {
case 'general':
$buttons['general']['active'] = true;
$subpage = ' &raquo '.__('General');
$help_header = 'setup_general_tab';
break;
case 'auth':
$buttons['auth']['active'] = true;
$subpage = ' &raquo '.__('Authentication');
break;
case 'perf':
$buttons['perf']['active'] = true;
$subpage = ' &raquo '.__('Performance');
$help_header = '';
break;
case 'vis':
$buttons['vis']['active'] = true;
$subpage = ' &raquo '.__('Visual styles');
break;
case 'net':
$buttons['net']['active'] = true;
$subpage = ' &raquo '.__('Netflow');
$help_header = 'setup_netflow_tab';
2020-01-08 15:44:59 +01:00
break;
case 'ehorus':
$buttons['ehorus']['active'] = true;
$subpage = ' &raquo '.__('eHorus');
$help_header = 'setup_ehorus_tab';
break;
case 'integria':
$buttons['integria']['active'] = true;
$subpage = ' &raquo '.__('Integria IMS');
$help_header = 'setup_integria_tab';
break;
case 'module_library':
$buttons['module_library']['active'] = true;
$subpage = ' &raquo '.__('Module Library');
$help_header = 'setup_module_library_tab';
break;
2020-01-08 15:48:07 +01:00
case 'gis':
$buttons['gis']['active'] = true;
$subpage = ' &raquo '.__('Map conections GIS');
break;
2020-01-08 15:44:59 +01:00
case 'notifications':
$buttons['notifications']['active'] = true;
$subpage = ' &raquo '.__('Notifications');
break;
case 'websocket_engine':
$buttons['websocket_engine']['active'] = true;
$subpage = ' &raquo '.__('Pandora Websocket Engine');
2020-01-08 15:44:59 +01:00
$help_header = 'quickshell_settings';
break;
2020-12-18 12:34:39 +01:00
case 'external_tools':
$buttons['external_tools']['active'] = true;
$subpage = ' &raquo '.__('External Tools');
2021-06-24 14:31:15 +02:00
$help_header = '';
2020-12-16 14:09:54 +01:00
break;
2020-01-08 15:44:59 +01:00
case 'enterprise':
$buttons['enterprise']['active'] = true;
$subpage = ' &raquo '.__('Enterprise');
$help_header = 'setup_enterprise_tab';
break;
default:
// Default.
break;
}
2022-03-23 18:03:27 +01:00
// Put header inside div for special sizing.(No right margin).
echo '<div id="header_configuration" style="width: calc(100% + 3em);">';
2020-01-08 15:44:59 +01:00
// Header.
ui_print_page_header(
__('Configuration').$subpage,
'',
false,
$help_header,
true,
2022-03-09 17:20:24 +01:00
$buttons,
false,
'',
GENERIC_SIZE_TEXT,
'',
'',
true
2020-01-08 15:44:59 +01:00
);
2022-03-23 18:03:27 +01:00
echo '</div>';
2020-01-08 15:44:59 +01:00
if (isset($config['error_config_update_config'])) {
if ($config['error_config_update_config']['correct'] == false) {
ui_print_error_message($config['error_config_update_config']['message']);
} else {
ui_print_success_message(__('Correct update the setup options'));
}
if (is_array($config['error_config_update_config']['errors']) === true) {
foreach ($config['error_config_update_config']['errors'] as $msg) {
ui_print_error_message($msg);
}
}
if (is_array($config['error_config_update_config']['warnings']) === true) {
foreach ($config['error_config_update_config']['warnings'] as $msg) {
ui_print_warning_message($msg);
}
}
2020-01-08 15:44:59 +01:00
unset($config['error_config_update_config']);
}
2020-01-08 15:44:59 +01:00
switch ($section) {
case 'general':
include_once $config['homedir'].'/godmode/setup/setup_general.php';
break;
2020-01-08 15:44:59 +01:00
case 'auth':
include_once $config['homedir'].'/godmode/setup/setup_auth.php';
break;
2020-01-08 15:44:59 +01:00
case 'perf':
include_once $config['homedir'].'/godmode/setup/performance.php';
break;
2020-01-08 15:44:59 +01:00
case 'net':
include_once $config['homedir'].'/godmode/setup/setup_netflow.php';
break;
2020-01-08 15:44:59 +01:00
case 'vis':
include_once $config['homedir'].'/godmode/setup/setup_visuals.php';
break;
2020-01-08 15:44:59 +01:00
case 'ehorus':
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
break;
2020-01-08 15:44:59 +01:00
case 'integria':
include_once $config['homedir'].'/godmode/setup/setup_integria.php';
break;
2019-08-05 13:42:01 +02:00
2020-01-08 15:48:07 +01:00
case 'gis':
include_once $config['homedir'].'/godmode/setup/gis.php';
break;
2020-01-08 15:44:59 +01:00
case 'notifications':
include_once $config['homedir'].'/godmode/setup/setup_notifications.php';
break;
2020-01-08 15:44:59 +01:00
case 'websocket_engine':
include_once $config['homedir'].'/godmode/setup/setup_websocket_engine.php';
break;
2020-12-18 12:34:39 +01:00
case 'external_tools':
include_once $config['homedir'].'/godmode/setup/setup_external_tools.php';
2020-12-16 14:09:54 +01:00
break;
2020-01-08 15:44:59 +01:00
default:
enterprise_hook('setup_enterprise_select_tab', [$section]);
break;
}