pandorafms/pandora_console/include/functions_config.php

558 lines
20 KiB
PHP
Raw Normal View History

<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; 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.
2009-08-24 Miguel de Dios <miguel.dedios@artica.es> * include/functions_menu.php, include/functions_html.php, include/functions_events.php, include/functions_messages.php, include/functions_modules.php, include/functions_exportserver.php, include/functions_reporting.php, include/functions_filemanager.php, include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php, include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php, include/functions_networkmap.php, include/functions_servers.php, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FusionCharts.php, include/functions_network_profiles.php, include/gettext.php, include/functions_network_components.php, include/functions_visual_map.php, include/fgraph2.php, include/Image/image_functions.php, include/functions_config.php, include/help/en/help_plugin_parameters.php, include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php, include/help/en/help_postprocess.php, include/help/en/help_prediction_source_module.php, include/help/en/help_date_format.php, include/help/en/help_recontask.php, include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php, include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php, include/help/en/help_agent_status.php, include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php, include/help/en/help_alert_type.php, include/help/en/help_network_component.php, include/help/en/help_time_stamp-comparation.php, include/help/en/help_eventview.php, include/help/en/help_timesource.php, include/help/en/help_alert_validation.php, include/help/en/help_map_builder.php, include/help/en/help_alert_recovery.php, include/help/en/help_module_type.php, include/help/en/help_planned_downtime.php, include/help/en/help_serverlag.php, include/help/en/help_alerts.php, include/help/en/help_snmpwalk.php, include/help/en/help_module_definition.php, include/help/en/help_plugin_definition.php, include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php include/help/en/help_manageconfig.php, include/help/es/help_alert_validation.php, include/help/es/help_plugin_parameters.php, include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php, include/help/es/help_map_builder.php, include/help/es/help_postprocess.php, include/help/es/help_date_format.php, include/help/es/help_alert_recovery.php, include/help/es/help_prediction_source_module.php, include/help/es/help_module_type.php, include/help/es/help_planned_downtime.php, include/help/es/help_alert-matches.php, include/help/es/help_recontask.php, include/help/es/help_alerts.php, include/help/es/help_serverlag.php, include/help/es/help_snmpwalk.php, include/help/es/help_module_definition.php, include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php, include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php, include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php, include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php, include/help/es/help_wminamespace.php, include/help/es/help_network_component.php, include/help/es/help_time_stamp-comparation.php, include/help/es/help_manageconfig.php, include/help/es/help_timesource.php, include/config_process.php, include/functions_ui.php, include/htmlawed.php, include/functions_custom_graphs.php, include/fgraph.php, include/functions_incidents.php, include/functions.php, include/functions_agents.php, include/functions_db.php, include/functions_themes.php, include/streams.php, include/functions_fsgraph.php, include/functions_alerts.php, include/functions_reports.php, include/functions_extensions.php, include/functions_ui_renders.php: change comments blocks for delete the warnings to construct phpDoc Files, give a struct and order in the phpDoc files. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
/**
* @package Include
* @subpackage Config
2009-08-24 Miguel de Dios <miguel.dedios@artica.es> * include/functions_menu.php, include/functions_html.php, include/functions_events.php, include/functions_messages.php, include/functions_modules.php, include/functions_exportserver.php, include/functions_reporting.php, include/functions_filemanager.php, include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php, include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php, include/functions_networkmap.php, include/functions_servers.php, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FusionCharts.php, include/functions_network_profiles.php, include/gettext.php, include/functions_network_components.php, include/functions_visual_map.php, include/fgraph2.php, include/Image/image_functions.php, include/functions_config.php, include/help/en/help_plugin_parameters.php, include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php, include/help/en/help_postprocess.php, include/help/en/help_prediction_source_module.php, include/help/en/help_date_format.php, include/help/en/help_recontask.php, include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php, include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php, include/help/en/help_agent_status.php, include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php, include/help/en/help_alert_type.php, include/help/en/help_network_component.php, include/help/en/help_time_stamp-comparation.php, include/help/en/help_eventview.php, include/help/en/help_timesource.php, include/help/en/help_alert_validation.php, include/help/en/help_map_builder.php, include/help/en/help_alert_recovery.php, include/help/en/help_module_type.php, include/help/en/help_planned_downtime.php, include/help/en/help_serverlag.php, include/help/en/help_alerts.php, include/help/en/help_snmpwalk.php, include/help/en/help_module_definition.php, include/help/en/help_plugin_definition.php, include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php include/help/en/help_manageconfig.php, include/help/es/help_alert_validation.php, include/help/es/help_plugin_parameters.php, include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php, include/help/es/help_map_builder.php, include/help/es/help_postprocess.php, include/help/es/help_date_format.php, include/help/es/help_alert_recovery.php, include/help/es/help_prediction_source_module.php, include/help/es/help_module_type.php, include/help/es/help_planned_downtime.php, include/help/es/help_alert-matches.php, include/help/es/help_recontask.php, include/help/es/help_alerts.php, include/help/es/help_serverlag.php, include/help/es/help_snmpwalk.php, include/help/es/help_module_definition.php, include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php, include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php, include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php, include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php, include/help/es/help_wminamespace.php, include/help/es/help_network_component.php, include/help/es/help_time_stamp-comparation.php, include/help/es/help_manageconfig.php, include/help/es/help_timesource.php, include/config_process.php, include/functions_ui.php, include/htmlawed.php, include/functions_custom_graphs.php, include/fgraph.php, include/functions_incidents.php, include/functions.php, include/functions_agents.php, include/functions_db.php, include/functions_themes.php, include/streams.php, include/functions_fsgraph.php, include/functions_alerts.php, include/functions_reports.php, include/functions_extensions.php, include/functions_ui_renders.php: change comments blocks for delete the warnings to construct phpDoc Files, give a struct and order in the phpDoc files. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
*/
/**
* Creates a single config value in the database.
*
* @param string Config token to create.
* @param string Value to set.
*
* @return bool Config id if success. False on failure.
*/
function create_config_value ($token, $value) {
return process_sql_insert ('tconfig',
array ('value' => $value,
'token' => $token));
}
/**
* Update a single config value in the database.
*
* If the config token doesn't exists, it's created.
*
* @param string Config token to update.
* @param string New value to set.
*
* @return bool True if success. False on failure.
*/
function update_config_value ($token, $value) {
global $config;
switch ($token) {
case 'list_ACL_IPs_for_API':
$rows = get_db_all_rows_sql('SELECT id_config
FROM tconfig
WHERE token LIKE "%list_ACL_IPs_for_API_%"');
if ($rows !== false) {
foreach ($rows as $row)
$idListACLofIP[] = $row['id_config'];
process_sql_delete('tconfig', 'id_config IN (' . implode(',', $idListACLofIP) . ')' );
}
if (strpos($value, "\r\n") !== false)
$ips = explode("\r\n", $value);
else
$ips = explode("\n", $value);
$valueDB = '';
$count = 0;
$lastInsert = false;
foreach ($ips as $ip) {
$lastInsert = false;
if (strlen($valueDB . ';' . $ip) < 100) {
//100 is the size of field 'value' in tconfig.
if (strlen($valueDB) == 0)
$valueDB .= $ip;
else
$valueDB .= ';' . $ip;
}
else {
if (strlen($ip) > 100)
return false;
process_sql_insert('tconfig',
array('token' => 'list_ACL_IPs_for_API_' . $count , 'value' => $valueDB));
$valueDB = $ip;
$count++;
$lastInsert = true;
}
}
if (!$lastInsert)
process_sql_insert('tconfig',
array('token' => 'list_ACL_IPs_for_API_' . $count , 'value' => $valueDB));
break;
default:
if (!isset ($config[$token])){
$config[$token] = $value;
return (bool) create_config_value ($token, $value);
}
/* If it has not changed */
if ($config[$token] == $value)
return true;
$config[$token] = $value;
return (bool) process_sql_update ('tconfig',
array ('value' => $value),
array ('token' => $token));
break;
}
}
/**
* Updates all config values in case setup page was invoked
*/
function update_config () {
global $config;
/* If user is not even log it, don't try this */
if (! isset ($config['id_user']))
return false;
2009-03-31 Sancho Lerena <slerena@artica.es> * include/styles/menu.css: Added icons for dashboard option (enterprise). * include/functions_config.php: Added support for round_corner option. * include/functions_db.php: Temporal support (not really work) for enterprise servers webcheck/goliat and inventory. This code should be corrected when make final dbstruct changes for new server_type numeric field. * include/functions_reports.php: Fixed an annoying notice. * index.php: Dashboard is not entered automatically on login in enterprise. * operation/events/events.php: Events from group 0 always displayed. * operation/servers/view_server.php: Icon for server status is now smaller. * operation/menu.php: New enterprise hook for Dashboard menu entry. * reporting/pchart_graph.php: Round corners on progressbar acording to setup option. Color of border is smoother. * godmode/setup/links.php: Fixed ACL condition (AND -> OR). * godmode/setup/setup.php: Fixed ACL. Moved visual options to other setup. * godmode/setup/filemgr.php: Fixed ACL condition (AND -> OR). * godmode/agentes/modificar_agente.php: Support for IP address search. * godmode/menu.php: Added new setup section for visual options. * godmode/setup/setup_visuals.php: New setup section for visual options. * images/mod_web_proc.png, images/screenshot_not_found.jpg images/mod_web_data.png images/server_web.png: New icons added for enterprise options. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1580 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-31 16:32:58 +02:00
if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user']))
return false;
$update_config = (bool) get_parameter ('update_config');
if (! $update_config)
return false;
$style = (string) get_parameter ('style', $config["style"]);
if ($style != $config['style'])
$style = substr ($style, 0, strlen ($style) - 4);
update_config_value ('language', (string) get_parameter ('language', $config["language"]));
update_config_value ('remote_config', (string) get_parameter ('remote_config', $config["remote_config"]));
update_config_value ('block_size', (int) get_parameter ('block_size', $config["block_size"]));
update_config_value ('days_purge', (int) get_parameter ('days_purge', $config["days_purge"]));
update_config_value ('days_compact', (int) get_parameter ('days_compact', $config["days_compact"]));
update_config_value ('graph_res', (int) get_parameter ('graph_res', $config["graph_res"]));
update_config_value ('step_compact', (int) get_parameter ('step_compact', $config["step_compact"]));
update_config_value ('style', $style);
update_config_value ('graph_color1', (string) get_parameter ('graph_color1', $config["graph_color1"]));
update_config_value ('graph_color2', (string) get_parameter ('graph_color2', $config["graph_color2"]));
update_config_value ('graph_color3', (string) get_parameter ('graph_color3', $config["graph_color3"]));
update_config_value ('sla_period', (int) get_parameter ('sla_period', $config["sla_period"]));
update_config_value ('date_format', (string) get_parameter ('date_format', $config["date_format"]));
update_config_value ('trap2agent', (string) get_parameter ('trap2agent', $config["trap2agent"]));
update_config_value ('autoupdate', (bool) get_parameter ('autoupdate', $config["autoupdate"]));
update_config_value ('prominent_time', (string) get_parameter ('prominent_time', $config["prominent_time"]));
update_config_value ('timesource', (string) get_parameter ('timesource', $config["timesource"]));
update_config_value ('event_view_hr', (int) get_parameter ('event_view_hr', $config["event_view_hr"]));
update_config_value ('loginhash_pwd', (string) get_parameter ('loginhash_pwd', $config["loginhash_pwd"]));
update_config_value ('https', (bool) get_parameter ('https', $config["https"]));
update_config_value ('compact_header', (bool) get_parameter ('compact_header', $config["compact_header"]));
update_config_value ('fontpath', (string) get_parameter ('fontpath', $config["fontpath"]));
update_config_value ('round_corner', (bool) get_parameter ('round_corner', $config["round_corner"]));
update_config_value ('status_images_set', (string) get_parameter ('status_images_set', $config["status_images_set"]));
update_config_value ('agentaccess', (int) get_parameter ('agentaccess', $config['agentaccess']));
2009-06-30 Ramon Novoa <rnovoa@artica.es> * nclude/FusionCharts, include/FusionCharts/FCF_Column3D.swf, include/FusionCharts/FCF_Pie3D.swf, include/FusionCharts/FusionCharts.js, include/FusionCharts/FCF_MSLine.swf, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FCF_StackedArea2D.swf, include/FusionCharts/FCF_Area2D.swf, include/FusionCharts/FCF_MSArea2D.swf, include/FusionCharts/FusionCharts.php: Added to repository. Fusion Charts Free. * include/functions_fsgraph.php: Added to repository. Fusion Charts chart generation functions for Pandora FMS. * include/pchart_graph.php, include/pandora_graph.php, include/fgraph2.php, include/pChart, include/Image, include/fgraph.php: Moved from reporting to include. * operation/agentes/stat_win.php: Moved from reporting to operation/agentes. * reporting: Deleted from repository. * general/logon_ok.php, godmode/setup/setup.php, godmode/admin_access_logs.php, godmode/db/db_main.php, godmode/db/db_info.php, godmode/db/db_purge.php, godmode/reporting/graph_builder.php, operation/reporting/reporting_xml.php, operation/reporting/reporting_viewer.php, operation/servers/view_server.php, operation/servers/view_server_detail.php, operation/incidents/incident_statistics.php operation/users/user_statistics.php, operation/events/event_statistics.php, operation/events/events.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/estado_generalagente.php, operation/agentes/tactical.php, include/functions_config.php, include/functions_custom_graphs.php, include/functions_visual_map.php, include/functions_reporting.php: Added flash charts. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1779 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-06-30 17:08:14 +02:00
update_config_value ('flash_charts', (bool) get_parameter ('flash_charts', $config["flash_charts"]));
update_config_value ('attachment_store', (string) get_parameter ('attachment_store', $config["attachment_store"]));
update_config_value ('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API', implode("\n", $config['list_ACL_IPs_for_API'])));
2009-11-30 18:38:45 +01:00
update_config_value ('custom_logo', (string) get_parameter ('custom_logo', $config["custom_logo"]));
update_config_value ('history_db_enabled', (bool) get_parameter ('history_db_enabled', $config['history_db_enabled']));
update_config_value ('history_db_host', (string) get_parameter ('history_db_host', $config['history_db_host']));
update_config_value ('history_db_port', (int) get_parameter ('history_db_port', $config['history_db_port']));
update_config_value ('history_db_name', (string) get_parameter ('history_db_name', $config['history_db_name']));
update_config_value ('history_db_user', (string) get_parameter ('history_db_user', $config['history_db_user']));
update_config_value ('history_db_pass', (string) get_parameter ('history_db_pass', $config['history_db_pass']));
update_config_value ('history_db_days', (string) get_parameter ('history_db_days', $config['history_db_days']));
update_config_value ('history_db_step', (string) get_parameter ('history_db_step', $config['history_db_step']));
update_config_value ('history_db_delay', (string) get_parameter ('history_db_delay', $config['history_db_delay']));
update_config_value ('timezone', (string) get_parameter ('timezone', $config['timezone']));
update_config_value ('activate_gis', (bool) get_parameter ('activate_gis', $config['activate_gis']));
update_config_value ('stats_interval', get_parameter ('stats_interval', $config['stats_interval']));
update_config_value ('realtimestats', get_parameter ('realtimestats', $config['realtimestats']));
2010-02-19 Sancho Lerena <slerena@artica.es> * functions_events.php: Fixed typo (switched meaning) in two labels. * include/styles/pandora.css: Changed background color of th default style. * include/functions_reporting.php: Improved function get_group_stats(). Now supports stats from batch-mode and get realtime stats in a more efficient way. Fixed get_fired_alerts_reporting_table() to avoid problems in external reporting (PDF & XML). * include/functions_servers.php: get_server_performance() now uses batch mode stats reporting, and improved also the realtime stats generation. Same with function get_server_info(). * include/functions_config.php: Added new config tokens (not fully implemented yet) for event, trap, strings and audit automatic purge. * include/functions_ui.php: Added new print_page_header() function to set the new standard header in all pages, using the "tabbed" format to show the title, subtitle and other options like help, or custom-tabs for the page * pandoradb.sql: Added tserver.stat_utimestamp field. Added indexes to tsession table. Fixed typo in field name in tgroup_stat: agents_uknown to agents_unknown. * extensions/ext_backup: New directory to place "deleted" extensions. * extensions/dbmanager/dbmanager.css: Table names now are in it's original lowercase/uppercase format. * extensions/dbmanager.php: Updated headers, and now return "empty" when a search is empty, instead "error" as before. * extensions/users_connected.php extensions/module_groups.php extensions/plugin_registration.php extensions/pandora_logs.php operation/incidents/incident.php operation/snmpconsole/snmp_view.php operation/users/user.php operation/users/user_edit.php godmode/agentes/planned_downtime.php operation/events/events.php operation/visual_console/index.php operation/agentes/estado_generalagente.php operation/agentes/estado_agente.php operation/agentes/exportdata.php operation/agentes/ver_agente.php operation/agentes/status_monitor.php operation/agentes/alerts_status.php operation/users/user_statistics.php: Added new header format. * operation/agentes/estado_grupo.php: Removed old group view. * operation/agentes/tactical.php: Adapted to use new realtime/batch statistical system. Placed events above server info. Showing only pending events and other minor changes. * operation/agentes/group_view.php: NEW screen, replacing old one. Probably most ugly, but much more useful than before. * operation/agentes/networkmap.php: Added title. * operation/messages/message.php: Added title and adding some exists in code was missing before. * operation/reporting/reporting_viewer.php: Added title. * operation/reporting/graph_viewer.php: Added title. * operation/reporting/custom_reporting.php: Added title. * operation/servers/view_server.php: * operation/menu.php: Replaced old group view with new (this has english name). Removed autorefresh "by default" in server view. * extras/pandoradb_migrate_v3.0_to_v3.1.sql: Fixed typo. * extras/pandora_diag.php: Minor changes, removed some info and added other. * general/logon_ok.php: Minor aesthetic changes. * general/header.php: Fixed missing ";" * operation/extensions.php, godmode/extensions.php: Added support for delete extensions. * godmode/menu.php: New setup items. * godmode/setup/setup.php, godmode/setup/performance.php, godmode/setup/setup_visuals.php: Reordered setup options, new setup section "Performance", added new performance options to set "realtime" statistics or "batchmode" with it's own interval. Some setup info is now shared with the servers (but it it's any change in setup, servers should be restarted anyway). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2390 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-02-19 16:16:03 +01:00
update_config_value ('event_purge', get_parameter ('event_purge', $config['event_purge']));
update_config_value ('trap_purge', get_parameter ('trap_purge', $config['trap_purge']));
update_config_value ('string_purge', get_parameter ('string_purge', $config['string_purge']));
update_config_value ('audit_purge', get_parameter ('audit_purge', $config['audit_purge']));
update_config_value ('acl_enterprise', get_parameter ('acl_enterprise', $config['acl_enterprise']));
update_config_value ('metaconsole', get_parameter ('metaconsole', $config['metaconsole']));
update_config_value ('gis_purge', get_parameter ('gis_purge', $config['gis_purge']));
update_config_value ('auth', get_parameter ('auth', $config['auth']));
update_config_value ('autocreate_remote_users', get_parameter ('autocreate_remote_users', $config['autocreate_remote_users']));
update_config_value ('default_remote_profile', get_parameter ('default_remote_profile', $config['default_remote_profile']));
update_config_value ('default_remote_group', get_parameter ('default_remote_group', $config['default_remote_group']));
update_config_value ('ldap_server', get_parameter ('ldap_server', $config['ldap_server']));
update_config_value ('ldap_port', get_parameter ('ldap_port', $config['ldap_port']));
update_config_value ('ldap_version', get_parameter ('ldap_version', $config['ldap_version']));
update_config_value ('ldap_start_tls', get_parameter ('ldap_start_tls', $config['ldap_start_tls']));
update_config_value ('ldap_base_dn', get_parameter ('ldap_base_dn', $config['ldap_base_dn']));
update_config_value ('ldap_login_attr', get_parameter ('ldap_login_attr', $config['ldap_login_attr']));
update_config_value ('ad_server', get_parameter ('ad_server', $config['ad_server']));
update_config_value ('ad_port', get_parameter ('ad_port', $config['ad_port']));
update_config_value ('ad_start_tls', get_parameter ('ad_start_tls', $config['ad_start_tls']));
update_config_value ('ad_domain', get_parameter ('ad_domain', $config['ad_domain']));
update_config_value ('rpandora_server', get_parameter ('rpandora_server', $config['rpandora_server']));
update_config_value ('rpandora_port', get_parameter ('rpandora_port', $config['rpandora_port']));
update_config_value ('rpandora_dbname', get_parameter ('rpandora_dbname', $config['rpandora_dbname']));
update_config_value ('rpandora_user', get_parameter ('rpandora_user', $config['rpandora_user']));
update_config_value ('rpandora_pass', get_parameter ('rpandora_pass', $config['rpandora_pass']));
update_config_value ('rbabel_server', get_parameter ('rbabel_server', $config['rbabel_server']));
update_config_value ('rbabel_port', get_parameter ('rbabel_port', $config['rbabel_port']));
update_config_value ('rbabel_dbname', get_parameter ('rbabel_dbname', $config['rbabel_dbname']));
update_config_value ('rbabel_user', get_parameter ('rbabel_user', $config['rbabel_user']));
update_config_value ('rbabel_pass', get_parameter ('rbabel_pass', $config['rbabel_pass']));
update_config_value ('rintegria_server', get_parameter ('rintegria_server', $config['rintegria_server']));
update_config_value ('rintegria_port', get_parameter ('rintegria_port', $config['rintegria_port']));
update_config_value ('rintegria_dbname', get_parameter ('rintegria_dbname', $config['rintegria_dbname']));
update_config_value ('rintegria_user', get_parameter ('rintegria_user', $config['rintegria_user']));
update_config_value ('rintegria_pass', get_parameter ('rintegria_pass', $config['rintegria_pass']));
}
/**
* Process config variables
*/
function process_config () {
global $config;
$configs = get_db_all_rows_in_table ('tconfig');
if (empty ($configs)) {
include ($config["homedir"]."/general/error_emptyconfig.php");
exit;
}
/* Compatibility fix */
foreach ($configs as $c) {
$config[$c['token']] = $c['value'];
}
if (!isset ($config['language'])) {
update_config_value ('language', 'en');
}
if (isset ($config['homeurl']) && $config['homeurl'][0] != '/') {
$config['homeurl'] = '/'.$config['homeurl'];
}
if (!isset ($config['date_format'])) {
update_config_value ('date_format', 'F j, Y, g:i a');
}
if (!isset ($config['event_view_hr'])) {
update_config_value ('event_view_hr', 8);
}
if (!isset ($config['loginhash_pwd'])) {
update_config_value ('loginhash_pwd', rand (0, 1000) * rand (0, 1000)."pandorahash");
}
if (!isset ($config["trap2agent"])) {
update_config_value ('trap2agent', 0);
}
if (!isset ($config["sla_period"]) || empty ($config["sla_period"])) {
update_config_value ('sla_period', 604800);
}
if (!isset ($config["prominent_time"])) {
// Prominent time tells us what to show prominently when a timestamp is
// displayed. The comparation (... days ago) or the timestamp (full date)
update_config_value ('prominent_time', 'comparation');
}
if (!isset ($config["timesource"])) {
// Timesource says where time comes from (system or mysql)
update_config_value ('timesource', 'system');
}
if (!isset ($config["https"])) {
// Sets whether or not we want to enforce https. We don't want to go to a
// potentially unexisting config by default
update_config_value ('https', false);
}
if (!isset ($config["compact_header"])) {
update_config_value ('compact_header', false);
}
if (!isset ($config['status_images_set'])) {
update_config_value ('status_images_set', 'default');
}
// Load user session
if (isset ($_SESSION['id_usuario']))
$config["id_user"] = $_SESSION["id_usuario"];
2009-03-31 Sancho Lerena <slerena@artica.es> * include/styles/menu.css: Added icons for dashboard option (enterprise). * include/functions_config.php: Added support for round_corner option. * include/functions_db.php: Temporal support (not really work) for enterprise servers webcheck/goliat and inventory. This code should be corrected when make final dbstruct changes for new server_type numeric field. * include/functions_reports.php: Fixed an annoying notice. * index.php: Dashboard is not entered automatically on login in enterprise. * operation/events/events.php: Events from group 0 always displayed. * operation/servers/view_server.php: Icon for server status is now smaller. * operation/menu.php: New enterprise hook for Dashboard menu entry. * reporting/pchart_graph.php: Round corners on progressbar acording to setup option. Color of border is smoother. * godmode/setup/links.php: Fixed ACL condition (AND -> OR). * godmode/setup/setup.php: Fixed ACL. Moved visual options to other setup. * godmode/setup/filemgr.php: Fixed ACL condition (AND -> OR). * godmode/agentes/modificar_agente.php: Support for IP address search. * godmode/menu.php: Added new setup section for visual options. * godmode/setup/setup_visuals.php: New setup section for visual options. * images/mod_web_proc.png, images/screenshot_not_found.jpg images/mod_web_data.png images/server_web.png: New icons added for enterprise options. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1580 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-31 16:32:58 +02:00
if (!isset ($config["round_corner"])) {
update_config_value ('round_corner', false);
}
if (!isset ($config["agentaccess"])){
update_config_value ('agentaccess', true);
}
if (!isset ($config["timezone"])){
update_config_value ('timezone', "Europe/Berlin");
}
if (!isset ($config["stats_interval"])){
update_config_value ('stats_interval', 300);
}
if (!isset ($config["realtimestats"])){
update_config_value ('realtimestats', 1);
}
2010-02-19 Sancho Lerena <slerena@artica.es> * functions_events.php: Fixed typo (switched meaning) in two labels. * include/styles/pandora.css: Changed background color of th default style. * include/functions_reporting.php: Improved function get_group_stats(). Now supports stats from batch-mode and get realtime stats in a more efficient way. Fixed get_fired_alerts_reporting_table() to avoid problems in external reporting (PDF & XML). * include/functions_servers.php: get_server_performance() now uses batch mode stats reporting, and improved also the realtime stats generation. Same with function get_server_info(). * include/functions_config.php: Added new config tokens (not fully implemented yet) for event, trap, strings and audit automatic purge. * include/functions_ui.php: Added new print_page_header() function to set the new standard header in all pages, using the "tabbed" format to show the title, subtitle and other options like help, or custom-tabs for the page * pandoradb.sql: Added tserver.stat_utimestamp field. Added indexes to tsession table. Fixed typo in field name in tgroup_stat: agents_uknown to agents_unknown. * extensions/ext_backup: New directory to place "deleted" extensions. * extensions/dbmanager/dbmanager.css: Table names now are in it's original lowercase/uppercase format. * extensions/dbmanager.php: Updated headers, and now return "empty" when a search is empty, instead "error" as before. * extensions/users_connected.php extensions/module_groups.php extensions/plugin_registration.php extensions/pandora_logs.php operation/incidents/incident.php operation/snmpconsole/snmp_view.php operation/users/user.php operation/users/user_edit.php godmode/agentes/planned_downtime.php operation/events/events.php operation/visual_console/index.php operation/agentes/estado_generalagente.php operation/agentes/estado_agente.php operation/agentes/exportdata.php operation/agentes/ver_agente.php operation/agentes/status_monitor.php operation/agentes/alerts_status.php operation/users/user_statistics.php: Added new header format. * operation/agentes/estado_grupo.php: Removed old group view. * operation/agentes/tactical.php: Adapted to use new realtime/batch statistical system. Placed events above server info. Showing only pending events and other minor changes. * operation/agentes/group_view.php: NEW screen, replacing old one. Probably most ugly, but much more useful than before. * operation/agentes/networkmap.php: Added title. * operation/messages/message.php: Added title and adding some exists in code was missing before. * operation/reporting/reporting_viewer.php: Added title. * operation/reporting/graph_viewer.php: Added title. * operation/reporting/custom_reporting.php: Added title. * operation/servers/view_server.php: * operation/menu.php: Replaced old group view with new (this has english name). Removed autorefresh "by default" in server view. * extras/pandoradb_migrate_v3.0_to_v3.1.sql: Fixed typo. * extras/pandora_diag.php: Minor changes, removed some info and added other. * general/logon_ok.php: Minor aesthetic changes. * general/header.php: Fixed missing ";" * operation/extensions.php, godmode/extensions.php: Added support for delete extensions. * godmode/menu.php: New setup items. * godmode/setup/setup.php, godmode/setup/performance.php, godmode/setup/setup_visuals.php: Reordered setup options, new setup section "Performance", added new performance options to set "realtime" statistics or "batchmode" with it's own interval. Some setup info is now shared with the servers (but it it's any change in setup, servers should be restarted anyway). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2390 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-02-19 16:16:03 +01:00
if (!isset ($config["event_purge"])){
update_config_value ('event_purge', 15);
}
if (!isset ($config["trap_purge"])){
update_config_value ('trap_purge', 7);
}
if (!isset ($config["string_purge"])){
update_config_value ('string_purge', 14);
}
if (!isset ($config["audit_purge"])){
update_config_value ('audit_purge', 30);
}
if (!isset ($config["acl_enterprise"])){
update_config_value ('acl_enterprise', 0);
}
2010-02-19 Sancho Lerena <slerena@artica.es> * functions_events.php: Fixed typo (switched meaning) in two labels. * include/styles/pandora.css: Changed background color of th default style. * include/functions_reporting.php: Improved function get_group_stats(). Now supports stats from batch-mode and get realtime stats in a more efficient way. Fixed get_fired_alerts_reporting_table() to avoid problems in external reporting (PDF & XML). * include/functions_servers.php: get_server_performance() now uses batch mode stats reporting, and improved also the realtime stats generation. Same with function get_server_info(). * include/functions_config.php: Added new config tokens (not fully implemented yet) for event, trap, strings and audit automatic purge. * include/functions_ui.php: Added new print_page_header() function to set the new standard header in all pages, using the "tabbed" format to show the title, subtitle and other options like help, or custom-tabs for the page * pandoradb.sql: Added tserver.stat_utimestamp field. Added indexes to tsession table. Fixed typo in field name in tgroup_stat: agents_uknown to agents_unknown. * extensions/ext_backup: New directory to place "deleted" extensions. * extensions/dbmanager/dbmanager.css: Table names now are in it's original lowercase/uppercase format. * extensions/dbmanager.php: Updated headers, and now return "empty" when a search is empty, instead "error" as before. * extensions/users_connected.php extensions/module_groups.php extensions/plugin_registration.php extensions/pandora_logs.php operation/incidents/incident.php operation/snmpconsole/snmp_view.php operation/users/user.php operation/users/user_edit.php godmode/agentes/planned_downtime.php operation/events/events.php operation/visual_console/index.php operation/agentes/estado_generalagente.php operation/agentes/estado_agente.php operation/agentes/exportdata.php operation/agentes/ver_agente.php operation/agentes/status_monitor.php operation/agentes/alerts_status.php operation/users/user_statistics.php: Added new header format. * operation/agentes/estado_grupo.php: Removed old group view. * operation/agentes/tactical.php: Adapted to use new realtime/batch statistical system. Placed events above server info. Showing only pending events and other minor changes. * operation/agentes/group_view.php: NEW screen, replacing old one. Probably most ugly, but much more useful than before. * operation/agentes/networkmap.php: Added title. * operation/messages/message.php: Added title and adding some exists in code was missing before. * operation/reporting/reporting_viewer.php: Added title. * operation/reporting/graph_viewer.php: Added title. * operation/reporting/custom_reporting.php: Added title. * operation/servers/view_server.php: * operation/menu.php: Replaced old group view with new (this has english name). Removed autorefresh "by default" in server view. * extras/pandoradb_migrate_v3.0_to_v3.1.sql: Fixed typo. * extras/pandora_diag.php: Minor changes, removed some info and added other. * general/logon_ok.php: Minor aesthetic changes. * general/header.php: Fixed missing ";" * operation/extensions.php, godmode/extensions.php: Added support for delete extensions. * godmode/menu.php: New setup items. * godmode/setup/setup.php, godmode/setup/performance.php, godmode/setup/setup_visuals.php: Reordered setup options, new setup section "Performance", added new performance options to set "realtime" statistics or "batchmode" with it's own interval. Some setup info is now shared with the servers (but it it's any change in setup, servers should be restarted anyway). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2390 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-02-19 16:16:03 +01:00
if (!isset ($config["metaconsole"])){
update_config_value ('metaconsole', 0);
}
if (!isset ($config["gis_purge"])){
update_config_value ('gis_purge', 7);
}
if (!isset ($config["collection_max_size"])){
update_config_value ('collection_max_size', 1000000);
}
/*
*Parse the ACL IP list for access API that it's save in chunks as
*list_ACL_IPs_for_API_<num>, because the value has a limit of 100
*characters.
*/
$config['list_ACL_IPs_for_API'] = array();
$keysConfig = array_keys($config);
foreach($keysConfig as $keyConfig)
if (strpos($keyConfig, 'list_ACL_IPs_for_API_') !== false) {
$ips = explode(';',$config[$keyConfig]);
$config['list_ACL_IPs_for_API'] =
array_merge($config['list_ACL_IPs_for_API'], $ips);
unset($config[$keyConfig]);
}
// This is not set here. The first time, when no
// setup is done, update_manager extension manage it
// the first time make a conenction and disable itself
// Not Managed here !
// if (!isset ($config["autoupdate"])){
// update_config_value ('autoupdate', true);
// }
require_once ($config["homedir"]."/include/auth/mysql.php");
// Next is the directory where "/attachment" directory is placed, to upload files stores.
// This MUST be writtable by http server user, and should be in pandora root.
// By default, Pandora adds /attachment to this, so by default is the pandora console home dir
if (!isset ($config['attachment_store'])) {
update_config_value ( 'attachment_store', $config['homedir'].'/attachment');
}
if (!isset ($config['fontpath'])) {
2009-06-30 Ramon Novoa <rnovoa@artica.es> * nclude/FusionCharts, include/FusionCharts/FCF_Column3D.swf, include/FusionCharts/FCF_Pie3D.swf, include/FusionCharts/FusionCharts.js, include/FusionCharts/FCF_MSLine.swf, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FCF_StackedArea2D.swf, include/FusionCharts/FCF_Area2D.swf, include/FusionCharts/FCF_MSArea2D.swf, include/FusionCharts/FusionCharts.php: Added to repository. Fusion Charts Free. * include/functions_fsgraph.php: Added to repository. Fusion Charts chart generation functions for Pandora FMS. * include/pchart_graph.php, include/pandora_graph.php, include/fgraph2.php, include/pChart, include/Image, include/fgraph.php: Moved from reporting to include. * operation/agentes/stat_win.php: Moved from reporting to operation/agentes. * reporting: Deleted from repository. * general/logon_ok.php, godmode/setup/setup.php, godmode/admin_access_logs.php, godmode/db/db_main.php, godmode/db/db_info.php, godmode/db/db_purge.php, godmode/reporting/graph_builder.php, operation/reporting/reporting_xml.php, operation/reporting/reporting_viewer.php, operation/servers/view_server.php, operation/servers/view_server_detail.php, operation/incidents/incident_statistics.php operation/users/user_statistics.php, operation/events/event_statistics.php, operation/events/events.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/estado_generalagente.php, operation/agentes/tactical.php, include/functions_config.php, include/functions_custom_graphs.php, include/functions_visual_map.php, include/functions_reporting.php: Added flash charts. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1779 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-06-30 17:08:14 +02:00
update_config_value ( 'fontpath', $config['homedir'].'/include/FreeSans.ttf');
}
if (!isset ($config['style'])) {
update_config_value ( 'style', 'pandora');
}
2009-06-30 Ramon Novoa <rnovoa@artica.es> * nclude/FusionCharts, include/FusionCharts/FCF_Column3D.swf, include/FusionCharts/FCF_Pie3D.swf, include/FusionCharts/FusionCharts.js, include/FusionCharts/FCF_MSLine.swf, include/FusionCharts/FusionCharts_Gen.php, include/FusionCharts/FCF_StackedArea2D.swf, include/FusionCharts/FCF_Area2D.swf, include/FusionCharts/FCF_MSArea2D.swf, include/FusionCharts/FusionCharts.php: Added to repository. Fusion Charts Free. * include/functions_fsgraph.php: Added to repository. Fusion Charts chart generation functions for Pandora FMS. * include/pchart_graph.php, include/pandora_graph.php, include/fgraph2.php, include/pChart, include/Image, include/fgraph.php: Moved from reporting to include. * operation/agentes/stat_win.php: Moved from reporting to operation/agentes. * reporting: Deleted from repository. * general/logon_ok.php, godmode/setup/setup.php, godmode/admin_access_logs.php, godmode/db/db_main.php, godmode/db/db_info.php, godmode/db/db_purge.php, godmode/reporting/graph_builder.php, operation/reporting/reporting_xml.php, operation/reporting/reporting_viewer.php, operation/servers/view_server.php, operation/servers/view_server_detail.php, operation/incidents/incident_statistics.php operation/users/user_statistics.php, operation/events/event_statistics.php, operation/events/events.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/estado_generalagente.php, operation/agentes/tactical.php, include/functions_config.php, include/functions_custom_graphs.php, include/functions_visual_map.php, include/functions_reporting.php: Added flash charts. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1779 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-06-30 17:08:14 +02:00
if (!isset ($config['flash_charts'])) {
update_config_value ( 'flash_charts', true);
}
2009-11-30 18:38:45 +01:00
if (!isset ($config["custom_logo"])){
update_config_value ('custom_logo', 'none.png');
2009-11-30 18:38:45 +01:00
}
if (!isset ($config['history_db_enabled'])) {
update_config_value ( 'history_db_enabled', false);
}
if (!isset ($config['history_db_host'])) {
update_config_value ( 'history_db_host', '');
}
if (!isset ($config['history_db_port'])) {
update_config_value ( 'history_db_port', 3306);
}
if (!isset ($config['history_db_name'])) {
update_config_value ( 'history_db_name', 'pandora');
}
if (!isset ($config['history_db_user'])) {
update_config_value ( 'history_db_user', 'pandora');
}
if (!isset ($config['history_db_pass'])) {
update_config_value ( 'history_db_pass', '');
}
if (!isset ($config['history_db_days'])) {
update_config_value ( 'history_db_days', 0);
}
if (!isset ($config['history_db_step'])) {
update_config_value ( 'history_db_step', 0);
}
if (!isset ($config['history_db_delay'])) {
update_config_value ( 'history_db_delay', 0);
}
if (!isset ($config['activate_gis'])) {
update_config_value ( 'activate_gis', 0);
}
if (!isset ($config['auth'])) {
update_config_value ( 'auth', 'mysql');
}
if (!isset ($config['autocreate_remote_users'])) {
update_config_value ('autocreate_remote_users', 0);
}
if (!isset ($config['default_remote_profile'])) {
update_config_value ('default_remote_profile', 0);
}
if (!isset ($config['default_remote_group'])) {
update_config_value ('default_remote_group', 0);
}
if (!isset ($config['ldap_server'])) {
update_config_value ( 'ldap_server', 'localhost');
}
if (!isset ($config['ldap_port'])) {
update_config_value ( 'ldap_port', 389);
}
if (!isset ($config['ldap_version'])) {
update_config_value ( 'ldap_version', '3');
}
if (!isset ($config['ldap_start_tls'])) {
update_config_value ( 'ldap_start_tls', 0);
}
if (!isset ($config['ldap_base_dn'])) {
update_config_value ( 'ldap_base_dn', 'ou=People,dc=edu,dc=example,dc=org');
}
if (!isset ($config['ldap_login_attr'])) {
update_config_value ( 'ldap_login_attr', 'uid');
}
if (!isset ($config['ad_server'])) {
update_config_value ( 'ad_server', 'localhost');
}
if (!isset ($config['ad_port'])) {
update_config_value ( 'ad_port', 389);
}
if (!isset ($config['ad_start_tls'])) {
update_config_value ( 'ad_start_tls', 0);
}
if (!isset ($config['ad_domain'])) {
update_config_value ( 'ad_domain', '');
}
if (!isset ($config['rpandora_server'])) {
update_config_value ( 'rpandora_server', 'localhost');
}
if (!isset ($config['rpandora_port'])) {
update_config_value ( 'rpandora_port', 3306);
}
if (!isset ($config['rpandora_dbname'])) {
update_config_value ( 'rpandora_dbname', 'pandora');
}
if (!isset ($config['rpandora_user'])) {
update_config_value ( 'rpandora_user', 'pandora');
}
if (!isset ($config['rpandora_pass'])) {
update_config_value ( 'rpandora_pass', '');
}
if (!isset ($config['rbabel_server'])) {
update_config_value ( 'rbabel_server', 'localhost');
}
if (!isset ($config['rbabel_port'])) {
update_config_value ( 'rbabel_port', 3306);
}
if (!isset ($config['rbabel_dbname'])) {
update_config_value ( 'rbabel_dbname', 'babel');
}
if (!isset ($config['rbabel_user'])) {
update_config_value ( 'rbabel_user', 'babel');
}
if (!isset ($config['rbabel_pass'])) {
update_config_value ( 'rbabel_pass', '');
}
if (!isset ($config['rintegria_server'])) {
update_config_value ( 'rintegria_server', 'localhost');
}
if (!isset ($config['rintegria_port'])) {
update_config_value ( 'rintegria_port', 3306);
}
if (!isset ($config['rintegria_dbname'])) {
update_config_value ( 'rintegria_dbname', 'integria');
}
if (!isset ($config['rintegria_user'])) {
update_config_value ( 'rintegria_user', 'integria');
}
if (!isset ($config['rintegria_pass'])) {
update_config_value ( 'rintegria_pass', '');
}
/* Finally, check if any value was overwritten in a form */
update_config ();
}
?>