From f2c5c741c6c693b5d3c7b6cea596823cfcae640d Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Fri, 15 Apr 2011 12:03:19 +0000 Subject: [PATCH] 2011-04-15 Juan Manuel Ramon * include/auth/ldap.php include/functions_config.php include/config_process.php include/functions_custom_graphs.php operation/search_graphs.php operation/reporting/graph_viewer.php godmode/setup/setup.php godmode/setup/performance.php godmode/setup/setup_visuals.php godmode/reporting/graphs.php godmode/reporting/graph_builder.preview.php: Functions of functions_config.php and function_custom_graphs.php have the "config_" and "custom_graphs_" prefix respectively. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4229 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 16 + .../reporting/graph_builder.preview.php | 2 +- pandora_console/godmode/reporting/graphs.php | 2 +- pandora_console/godmode/setup/performance.php | 2 +- pandora_console/godmode/setup/setup.php | 2 +- .../godmode/setup/setup_visuals.php | 2 +- pandora_console/include/auth/ldap.php | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/include/functions_config.php | 346 +++++++++--------- .../include/functions_custom_graphs.php | 6 +- .../operation/reporting/graph_viewer.php | 6 +- pandora_console/operation/search_graphs.php | 2 +- 12 files changed, 203 insertions(+), 187 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e3d85b0dc6..3b40f7d102 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,19 @@ +2011-04-15 Juan Manuel Ramon + + * include/auth/ldap.php + include/functions_config.php + include/config_process.php + include/functions_custom_graphs.php + operation/search_graphs.php + operation/reporting/graph_viewer.php + godmode/setup/setup.php + godmode/setup/performance.php + godmode/setup/setup_visuals.php + godmode/reporting/graphs.php + godmode/reporting/graph_builder.preview.php: Functions of functions_config.php + and function_custom_graphs.php have the "config_" and "custom_graphs_" prefix + respectively. + 2011-04-15 Juan Manuel Ramon * include/db/oracle.php diff --git a/pandora_console/godmode/reporting/graph_builder.preview.php b/pandora_console/godmode/reporting/graph_builder.preview.php index 9876bdb722..144b24b0d7 100644 --- a/pandora_console/godmode/reporting/graph_builder.preview.php +++ b/pandora_console/godmode/reporting/graph_builder.preview.php @@ -165,7 +165,7 @@ echo "".__('Period').""; echo ""; echo ""; -print_select (get_custom_graph_periods (), 'period', intval ($period / 3600), +print_select (custom_graphs_get_periods (), 'period', intval ($period / 3600), '', '', 0, false, false, false); echo ""; diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php index ef048a29f2..054c2e4d4d 100644 --- a/pandora_console/godmode/reporting/graphs.php +++ b/pandora_console/godmode/reporting/graphs.php @@ -66,7 +66,7 @@ if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) else $return_all_group = false; -$graphs = get_user_custom_graphs ($config['id_user'], false, $return_all_group, "IW"); +$graphs = custom_graphs_get_user ($config['id_user'], false, $return_all_group, "IW"); if (! empty ($graphs)) { $table->width = '720px'; diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index 4c5975da0a..f65ac6e0d7 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -31,7 +31,7 @@ enterprise_include ('godmode/setup/setup.php'); 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 update_config() in functions_config.php + If you added a new token, please check config_update_config() in functions_config.php to add it there. */ diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index af1c604795..c11fbd660a 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -44,7 +44,7 @@ enterprise_include ('godmode/setup/setup.php'); 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 update_config() in functions_config.php + If you added a new token, please check config_update_config() in functions_config.php to add it there. */ diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index dc96edf9f6..ac1bc22283 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -32,7 +32,7 @@ enterprise_include ('godmode/setup/setup_visuals.php'); 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 update_config() in functions_config.php + If you added a new token, please check config_update_config() in functions_config.php to add it there. */ diff --git a/pandora_console/include/auth/ldap.php b/pandora_console/include/auth/ldap.php index e774053f65..5c3f631f06 100644 --- a/pandora_console/include/auth/ldap.php +++ b/pandora_console/include/auth/ldap.php @@ -65,7 +65,7 @@ $config["admin_can_make_admin"] = false; $req_keys = array ("ldap_server", "ldap_base_dn", "ldap_login_attr", "ldap_admin_group_name", "ldap_admin_group_attr", "ldap_admin_group_type", "ldap_user_filter", "ldap_user_attr"); $opt_keys = array ("ldap_port", "ldap_start_tls", "ldap_version", "ldap_admin_dn", "ldap_admin_pwd"); -global $ldap_cache; //Needs to be globalized because process_config () function calls this file first and the variable would be local and subsequently lost +global $ldap_cache; //Needs to be globalized because config_process_config () function calls this file first and the variable would be local and subsequently lost $ldap_cache = array (); $ldap_cache["error"] = ""; $ldap_cache["ds"] = ""; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index f2c8f7b8f1..67941b744d 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -76,7 +76,7 @@ if (! defined ('ENTERPRISE_DIR')) require_once ($ownDir. 'functions_config.php'); -process_config(); +config_process_config(); require_once ($ownDir . 'streams.php'); require_once ($ownDir . 'gettext.php'); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index e61d546c96..683d230ac3 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -25,7 +25,7 @@ * * @return bool Config id if success. False on failure. */ -function create_config_value ($token, $value) { +function config_create_value ($token, $value) { return process_sql_insert ('tconfig', array ('value' => $value, 'token' => $token)); @@ -41,7 +41,7 @@ function create_config_value ($token, $value) { * * @return bool True if success. False on failure. */ -function update_config_value ($token, $value) { +function config_update_value ($token, $value) { global $config; switch ($token) { @@ -105,7 +105,7 @@ function update_config_value ($token, $value) { default: if (!isset ($config[$token])){ $config[$token] = $value; - return (bool) create_config_value ($token, $value); + return (bool) config_create_value ($token, $value); } /* If it has not changed */ @@ -124,7 +124,7 @@ function update_config_value ($token, $value) { /** * Updates all config values in case setup page was invoked */ -function update_config () { +function config_update_config () { global $config; /* If user is not even log it, don't try this */ @@ -142,104 +142,104 @@ function update_config () { 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'])); - 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']))); + config_update_value ('language', (string) get_parameter ('language', $config["language"])); + config_update_value ('remote_config', (string) get_parameter ('remote_config', $config["remote_config"])); + config_update_value ('block_size', (int) get_parameter ('block_size', $config["block_size"])); + config_update_value ('days_purge', (int) get_parameter ('days_purge', $config["days_purge"])); + config_update_value ('days_compact', (int) get_parameter ('days_compact', $config["days_compact"])); + config_update_value ('graph_res', (int) get_parameter ('graph_res', $config["graph_res"])); + config_update_value ('step_compact', (int) get_parameter ('step_compact', $config["step_compact"])); + config_update_value ('style', $style); + config_update_value ('graph_color1', (string) get_parameter ('graph_color1', $config["graph_color1"])); + config_update_value ('graph_color2', (string) get_parameter ('graph_color2', $config["graph_color2"])); + config_update_value ('graph_color3', (string) get_parameter ('graph_color3', $config["graph_color3"])); + config_update_value ('sla_period', (int) get_parameter ('sla_period', $config["sla_period"])); + config_update_value ('date_format', (string) get_parameter ('date_format', $config["date_format"])); + config_update_value ('trap2agent', (string) get_parameter ('trap2agent', $config["trap2agent"])); + config_update_value ('autoupdate', (bool) get_parameter ('autoupdate', $config["autoupdate"])); + config_update_value ('prominent_time', (string) get_parameter ('prominent_time', $config["prominent_time"])); + config_update_value ('timesource', (string) get_parameter ('timesource', $config["timesource"])); + config_update_value ('event_view_hr', (int) get_parameter ('event_view_hr', $config["event_view_hr"])); + config_update_value ('loginhash_pwd', (string) get_parameter ('loginhash_pwd', $config["loginhash_pwd"])); + config_update_value ('https', (bool) get_parameter ('https', $config["https"])); + config_update_value ('compact_header', (bool) get_parameter ('compact_header', $config["compact_header"])); + config_update_value ('fontpath', (string) get_parameter ('fontpath', $config["fontpath"])); + config_update_value ('round_corner', (bool) get_parameter ('round_corner', $config["round_corner"])); + config_update_value ('status_images_set', (string) get_parameter ('status_images_set', $config["status_images_set"])); + config_update_value ('agentaccess', (int) get_parameter ('agentaccess', $config['agentaccess'])); + config_update_value ('flash_charts', (bool) get_parameter ('flash_charts', $config["flash_charts"])); + config_update_value ('attachment_store', (string) get_parameter ('attachment_store', $config["attachment_store"])); + config_update_value ('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API', implode("\n", $config['list_ACL_IPs_for_API']))); - 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'])); - 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 ('autocreate_blacklist', get_parameter ('autocreate_blacklist', $config['autocreate_blacklist'])); - 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'])); + config_update_value ('custom_logo', (string) get_parameter ('custom_logo', $config["custom_logo"])); + config_update_value ('history_db_enabled', (bool) get_parameter ('history_db_enabled', $config['history_db_enabled'])); + config_update_value ('history_db_host', (string) get_parameter ('history_db_host', $config['history_db_host'])); + config_update_value ('history_db_port', (int) get_parameter ('history_db_port', $config['history_db_port'])); + config_update_value ('history_db_name', (string) get_parameter ('history_db_name', $config['history_db_name'])); + config_update_value ('history_db_user', (string) get_parameter ('history_db_user', $config['history_db_user'])); + config_update_value ('history_db_pass', (string) get_parameter ('history_db_pass', $config['history_db_pass'])); + config_update_value ('history_db_days', (string) get_parameter ('history_db_days', $config['history_db_days'])); + config_update_value ('history_db_step', (string) get_parameter ('history_db_step', $config['history_db_step'])); + config_update_value ('history_db_delay', (string) get_parameter ('history_db_delay', $config['history_db_delay'])); + config_update_value ('timezone', (string) get_parameter ('timezone', $config['timezone'])); + config_update_value ('activate_gis', (bool) get_parameter ('activate_gis', $config['activate_gis'])); + config_update_value ('stats_interval', get_parameter ('stats_interval', $config['stats_interval'])); + config_update_value ('realtimestats', get_parameter ('realtimestats', $config['realtimestats'])); + config_update_value ('event_purge', get_parameter ('event_purge', $config['event_purge'])); + config_update_value ('trap_purge', get_parameter ('trap_purge', $config['trap_purge'])); + config_update_value ('string_purge', get_parameter ('string_purge', $config['string_purge'])); + config_update_value ('audit_purge', get_parameter ('audit_purge', $config['audit_purge'])); + config_update_value ('acl_enterprise', get_parameter ('acl_enterprise', $config['acl_enterprise'])); + config_update_value ('metaconsole', get_parameter ('metaconsole', $config['metaconsole'])); + config_update_value ('gis_purge', get_parameter ('gis_purge', $config['gis_purge'])); + config_update_value ('auth', get_parameter ('auth', $config['auth'])); + config_update_value ('autocreate_remote_users', get_parameter ('autocreate_remote_users', $config['autocreate_remote_users'])); + config_update_value ('autocreate_blacklist', get_parameter ('autocreate_blacklist', $config['autocreate_blacklist'])); + config_update_value ('default_remote_profile', get_parameter ('default_remote_profile', $config['default_remote_profile'])); + config_update_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'])); + config_update_value ('ldap_server', get_parameter ('ldap_server', $config['ldap_server'])); + config_update_value ('ldap_port', get_parameter ('ldap_port', $config['ldap_port'])); + config_update_value ('ldap_version', get_parameter ('ldap_version', $config['ldap_version'])); + config_update_value ('ldap_start_tls', get_parameter ('ldap_start_tls', $config['ldap_start_tls'])); + config_update_value ('ldap_base_dn', get_parameter ('ldap_base_dn', $config['ldap_base_dn'])); + config_update_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'])); + config_update_value ('ad_server', get_parameter ('ad_server', $config['ad_server'])); + config_update_value ('ad_port', get_parameter ('ad_port', $config['ad_port'])); + config_update_value ('ad_start_tls', get_parameter ('ad_start_tls', $config['ad_start_tls'])); + config_update_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'])); + config_update_value ('rpandora_server', get_parameter ('rpandora_server', $config['rpandora_server'])); + config_update_value ('rpandora_port', get_parameter ('rpandora_port', $config['rpandora_port'])); + config_update_value ('rpandora_dbname', get_parameter ('rpandora_dbname', $config['rpandora_dbname'])); + config_update_value ('rpandora_user', get_parameter ('rpandora_user', $config['rpandora_user'])); + config_update_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'])); + config_update_value ('rbabel_server', get_parameter ('rbabel_server', $config['rbabel_server'])); + config_update_value ('rbabel_port', get_parameter ('rbabel_port', $config['rbabel_port'])); + config_update_value ('rbabel_dbname', get_parameter ('rbabel_dbname', $config['rbabel_dbname'])); + config_update_value ('rbabel_user', get_parameter ('rbabel_user', $config['rbabel_user'])); + config_update_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'])); + config_update_value ('rintegria_server', get_parameter ('rintegria_server', $config['rintegria_server'])); + config_update_value ('rintegria_port', get_parameter ('rintegria_port', $config['rintegria_port'])); + config_update_value ('rintegria_dbname', get_parameter ('rintegria_dbname', $config['rintegria_dbname'])); + config_update_value ('rintegria_user', get_parameter ('rintegria_user', $config['rintegria_user'])); + config_update_value ('rintegria_pass', get_parameter ('rintegria_pass', $config['rintegria_pass'])); - update_config_value ('integria_enabled', get_parameter ('integria_enabled', $config['integria_enabled'])); - update_config_value ('integria_inventory', get_parameter ('integria_inventory', $config['integria_inventory'])); - update_config_value ('integria_api_password', get_parameter ('integria_api_password', $config['integria_api_password'])); - update_config_value ('integria_url', get_parameter ('integria_url', $config['integria_url'])); + config_update_value ('integria_enabled', get_parameter ('integria_enabled', $config['integria_enabled'])); + config_update_value ('integria_inventory', get_parameter ('integria_inventory', $config['integria_inventory'])); + config_update_value ('integria_api_password', get_parameter ('integria_api_password', $config['integria_api_password'])); + config_update_value ('integria_url', get_parameter ('integria_url', $config['integria_url'])); - update_config_value ('sound_alert', get_parameter('sound_alert', $config['sound_alert'])); - update_config_value ('sound_critical', get_parameter('sound_critical', $config['sound_critical'])); - update_config_value ('sound_warning', get_parameter('sound_warning', $config['sound_warning'])); + config_update_value ('sound_alert', get_parameter('sound_alert', $config['sound_alert'])); + config_update_value ('sound_critical', get_parameter('sound_critical', $config['sound_critical'])); + config_update_value ('sound_warning', get_parameter('sound_warning', $config['sound_warning'])); - update_config_value ('api_password', get_parameter('api_password', $config['api_password'])); + config_update_value ('api_password', get_parameter('api_password', $config['api_password'])); - update_config_value ('collection_max_size', get_parameter('collection_max_size', $config['collection_max_size'])); + config_update_value ('collection_max_size', get_parameter('collection_max_size', $config['collection_max_size'])); $enterprise = enterprise_include_once('include/functions_policies.php'); if ($enterprise !== ENTERPRISE_NOT_HOOK) { @@ -247,7 +247,7 @@ function update_config () { if ($locked) { pandora_audit("Policy management", "BLOCK policies for change tconfig['can_block_policies'] by " . $config['id_user']); - update_config_value ('can_block_policies', get_parameter('can_block_policies', $config['can_block_policies'])); + config_update_value ('can_block_policies', get_parameter('can_block_policies', $config['can_block_policies'])); pandora_audit("Policy management", "UNBLOCK policies for change tconfig['can_block_policies'] by " . $config['id_user']); enterprise_hook('semaphore_policy_unlock'); @@ -257,7 +257,7 @@ function update_config () { } } else { - update_config_value ('can_block_policies', get_parameter('can_block_policies', $config['can_block_policies'])); + config_update_value ('can_block_policies', get_parameter('can_block_policies', $config['can_block_policies'])); } $enterprise = enterprise_include_once ('include/functions_skins.php'); if ($enterprise !== ENTERPRISE_NOT_HOOK) { @@ -269,7 +269,7 @@ function update_config () { /** * Process config variables */ -function process_config () { +function config_process_config () { global $config; $configs = get_db_all_rows_in_table ('tconfig'); @@ -285,7 +285,7 @@ function process_config () { } if (!isset ($config['language'])) { - update_config_value ('language', 'en'); + config_update_value ('language', 'en'); } if (isset ($config['homeurl']) && $config['homeurl'][0] != '/') { @@ -293,48 +293,48 @@ function process_config () { } if (!isset ($config['date_format'])) { - update_config_value ('date_format', 'F j, Y, g:i a'); + config_update_value ('date_format', 'F j, Y, g:i a'); } if (!isset ($config['event_view_hr'])) { - update_config_value ('event_view_hr', 8); + config_update_value ('event_view_hr', 8); } if (!isset ($config['loginhash_pwd'])) { - update_config_value ('loginhash_pwd', rand (0, 1000) * rand (0, 1000)."pandorahash"); + config_update_value ('loginhash_pwd', rand (0, 1000) * rand (0, 1000)."pandorahash"); } if (!isset ($config["trap2agent"])) { - update_config_value ('trap2agent', 0); + config_update_value ('trap2agent', 0); } if (!isset ($config["sla_period"]) || empty ($config["sla_period"])) { - update_config_value ('sla_period', 604800); + config_update_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'); + config_update_value ('prominent_time', 'comparation'); } if (!isset ($config["timesource"])) { // Timesource says where time comes from (system or mysql) - update_config_value ('timesource', 'system'); + config_update_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); + config_update_value ('https', false); } if (!isset ($config["compact_header"])) { - update_config_value ('compact_header', false); + config_update_value ('compact_header', false); } if (!isset ($config['status_images_set'])) { - update_config_value ('status_images_set', 'default'); + config_update_value ('status_images_set', 'default'); } // Load user session @@ -342,55 +342,55 @@ function process_config () { $config["id_user"] = $_SESSION["id_usuario"]; if (!isset ($config["round_corner"])) { - update_config_value ('round_corner', false); + config_update_value ('round_corner', false); } if (!isset ($config["agentaccess"])) { - update_config_value ('agentaccess', true); + config_update_value ('agentaccess', true); } if (!isset ($config["timezone"])) { - update_config_value ('timezone', "Europe/Berlin"); + config_update_value ('timezone', "Europe/Berlin"); } if (!isset ($config["stats_interval"])) { - update_config_value ('stats_interval', 300); + config_update_value ('stats_interval', 300); } if (!isset ($config["realtimestats"])) { - update_config_value ('realtimestats', 1); + config_update_value ('realtimestats', 1); } if (!isset ($config["event_purge"])) { - update_config_value ('event_purge', 15); + config_update_value ('event_purge', 15); } if (!isset ($config["trap_purge"])) { - update_config_value ('trap_purge', 7); + config_update_value ('trap_purge', 7); } if (!isset ($config["string_purge"])) { - update_config_value ('string_purge', 14); + config_update_value ('string_purge', 14); } if (!isset ($config["audit_purge"])) { - update_config_value ('audit_purge', 30); + config_update_value ('audit_purge', 30); } if (!isset ($config["acl_enterprise"])) { - update_config_value ('acl_enterprise', 0); + config_update_value ('acl_enterprise', 0); } if (!isset ($config["metaconsole"])) { - update_config_value ('metaconsole', 0); + config_update_value ('metaconsole', 0); } if (!isset ($config["gis_purge"])) { - update_config_value ('gis_purge', 7); + config_update_value ('gis_purge', 7); } if (!isset ($config["collection_max_size"])) { - update_config_value ('collection_max_size', 1000000); + config_update_value ('collection_max_size', 1000000); } /* @@ -417,7 +417,7 @@ function process_config () { // Not Managed here ! // if (!isset ($config["autoupdate"])){ - // update_config_value ('autoupdate', true); + // config_update_value ('autoupdate', true); // } require_once ($config["homedir"]."/include/auth/mysql.php"); @@ -426,211 +426,211 @@ function process_config () { // 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'); + config_update_value ( 'attachment_store', $config['homedir'].'/attachment'); } if (!isset ($config['fontpath'])) { - update_config_value ( 'fontpath', $config['homedir'].'/include/fonts/code.ttf'); + config_update_value ( 'fontpath', $config['homedir'].'/include/fonts/code.ttf'); } if (!isset ($config['style'])) { - update_config_value ( 'style', 'pandora'); + config_update_value ( 'style', 'pandora'); } if (!isset ($config['flash_charts'])) { - update_config_value ( 'flash_charts', true); + config_update_value ( 'flash_charts', true); } if (!isset ($config["custom_logo"])){ - update_config_value ('custom_logo', 'none.png'); + config_update_value ('custom_logo', 'none.png'); } if (!isset ($config['history_db_enabled'])) { - update_config_value ( 'history_db_enabled', false); + config_update_value ( 'history_db_enabled', false); } if (!isset ($config['history_db_host'])) { - update_config_value ( 'history_db_host', ''); + config_update_value ( 'history_db_host', ''); } if (!isset ($config['history_db_port'])) { - update_config_value ( 'history_db_port', 3306); + config_update_value ( 'history_db_port', 3306); } if (!isset ($config['history_db_name'])) { - update_config_value ( 'history_db_name', 'pandora'); + config_update_value ( 'history_db_name', 'pandora'); } if (!isset ($config['history_db_user'])) { - update_config_value ( 'history_db_user', 'pandora'); + config_update_value ( 'history_db_user', 'pandora'); } if (!isset ($config['history_db_pass'])) { - update_config_value ( 'history_db_pass', ''); + config_update_value ( 'history_db_pass', ''); } if (!isset ($config['history_db_days'])) { - update_config_value ( 'history_db_days', 0); + config_update_value ( 'history_db_days', 0); } if (!isset ($config['history_db_step'])) { - update_config_value ( 'history_db_step', 0); + config_update_value ( 'history_db_step', 0); } if (!isset ($config['history_db_delay'])) { - update_config_value ( 'history_db_delay', 0); + config_update_value ( 'history_db_delay', 0); } if (!isset ($config['activate_gis'])) { - update_config_value ( 'activate_gis', 0); + config_update_value ( 'activate_gis', 0); } if (!isset ($config['auth'])) { - update_config_value ( 'auth', 'mysql'); + config_update_value ( 'auth', 'mysql'); } if (!isset ($config['autocreate_remote_users'])) { - update_config_value ('autocreate_remote_users', 0); + config_update_value ('autocreate_remote_users', 0); } if (!isset ($config['autocreate_blacklist'])) { - update_config_value ('autocreate_blacklist', ''); + config_update_value ('autocreate_blacklist', ''); } if (!isset ($config['default_remote_profile'])) { - update_config_value ('default_remote_profile', 0); + config_update_value ('default_remote_profile', 0); } if (!isset ($config['default_remote_group'])) { - update_config_value ('default_remote_group', 0); + config_update_value ('default_remote_group', 0); } if (!isset ($config['ldap_server'])) { - update_config_value ( 'ldap_server', 'localhost'); + config_update_value ( 'ldap_server', 'localhost'); } if (!isset ($config['ldap_port'])) { - update_config_value ( 'ldap_port', 389); + config_update_value ( 'ldap_port', 389); } if (!isset ($config['ldap_version'])) { - update_config_value ( 'ldap_version', '3'); + config_update_value ( 'ldap_version', '3'); } if (!isset ($config['ldap_start_tls'])) { - update_config_value ( 'ldap_start_tls', 0); + config_update_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'); + config_update_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'); + config_update_value ( 'ldap_login_attr', 'uid'); } if (!isset ($config['ad_server'])) { - update_config_value ( 'ad_server', 'localhost'); + config_update_value ( 'ad_server', 'localhost'); } if (!isset ($config['ad_port'])) { - update_config_value ( 'ad_port', 389); + config_update_value ( 'ad_port', 389); } if (!isset ($config['ad_start_tls'])) { - update_config_value ( 'ad_start_tls', 0); + config_update_value ( 'ad_start_tls', 0); } if (!isset ($config['ad_domain'])) { - update_config_value ( 'ad_domain', ''); + config_update_value ( 'ad_domain', ''); } if (!isset ($config['rpandora_server'])) { - update_config_value ( 'rpandora_server', 'localhost'); + config_update_value ( 'rpandora_server', 'localhost'); } if (!isset ($config['rpandora_port'])) { - update_config_value ( 'rpandora_port', 3306); + config_update_value ( 'rpandora_port', 3306); } if (!isset ($config['rpandora_dbname'])) { - update_config_value ( 'rpandora_dbname', 'pandora'); + config_update_value ( 'rpandora_dbname', 'pandora'); } if (!isset ($config['rpandora_user'])) { - update_config_value ( 'rpandora_user', 'pandora'); + config_update_value ( 'rpandora_user', 'pandora'); } if (!isset ($config['rpandora_pass'])) { - update_config_value ( 'rpandora_pass', ''); + config_update_value ( 'rpandora_pass', ''); } if (!isset ($config['rbabel_server'])) { - update_config_value ( 'rbabel_server', 'localhost'); + config_update_value ( 'rbabel_server', 'localhost'); } if (!isset ($config['rbabel_port'])) { - update_config_value ( 'rbabel_port', 3306); + config_update_value ( 'rbabel_port', 3306); } if (!isset ($config['rbabel_dbname'])) { - update_config_value ( 'rbabel_dbname', 'babel'); + config_update_value ( 'rbabel_dbname', 'babel'); } if (!isset ($config['rbabel_user'])) { - update_config_value ( 'rbabel_user', 'babel'); + config_update_value ( 'rbabel_user', 'babel'); } if (!isset ($config['rbabel_pass'])) { - update_config_value ( 'rbabel_pass', ''); + config_update_value ( 'rbabel_pass', ''); } if (!isset ($config['rintegria_server'])) { - update_config_value ( 'rintegria_server', 'localhost'); + config_update_value ( 'rintegria_server', 'localhost'); } if (!isset ($config['rintegria_port'])) { - update_config_value ( 'rintegria_port', 3306); + config_update_value ( 'rintegria_port', 3306); } if (!isset ($config['rintegria_dbname'])) { - update_config_value ( 'rintegria_dbname', 'integria'); + config_update_value ( 'rintegria_dbname', 'integria'); } if (!isset ($config['rintegria_user'])) { - update_config_value ( 'rintegria_user', 'integria'); + config_update_value ( 'rintegria_user', 'integria'); } if (!isset ($config['rintegria_pass'])) { - update_config_value ( 'rintegria_pass', ''); + config_update_value ( 'rintegria_pass', ''); } if (!isset ($config['integria_enabled'])) { - update_config_value ( 'integria_enabled', '0'); + config_update_value ( 'integria_enabled', '0'); } if (!isset ($config['integria_api_password'])) { - update_config_value ( 'integria_api_password', ''); + config_update_value ( 'integria_api_password', ''); } if (!isset ($config['integria_inventory'])) { - update_config_value ( 'integria_inventory', '0'); + config_update_value ( 'integria_inventory', '0'); } if (!isset ($config['integria_url'])) { - update_config_value ( 'integria_url', ''); + config_update_value ( 'integria_url', ''); } if (!isset ($config['autoupdate'])) { - update_config_value ( 'autoupdate', 0); + config_update_value ( 'autoupdate', 0); } if (!isset ($config['can_block_policies'])) { - update_config_value ( 'can_block_policies', 0); + config_update_value ( 'can_block_policies', 0); } if (!isset ($config['api_password'])) { - update_config_value( 'api_password', ''); + config_update_value( 'api_password', ''); } if (!isset ($config['relative_path']) && (isset ($_POST['nick']) || isset ($config['id_user'])) && isset($config['enterprise_installed'])) { @@ -645,6 +645,6 @@ function process_config () { } } /* Finally, check if any value was overwritten in a form */ - update_config(); + config_update_config(); } ?> diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index 24551e1a64..0e36421496 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -41,7 +41,7 @@ require_once ($config["homedir"] . '/include/functions_graph.php'); * * @return Custom graphs of a an user. Empty array if none. */ -function get_user_custom_graphs ($id_user = 0, $only_names = false, $returnAllGroup = true, $privileges = 'IR') { +function custom_graphs_get_user ($id_user = 0, $only_names = false, $returnAllGroup = true, $privileges = 'IR') { global $config; if (!$id_user) { @@ -92,7 +92,7 @@ function get_user_custom_graphs ($id_user = 0, $only_names = false, $returnAllGr * @param $date Date to start printing the graph */ -function print_custom_graph ($id_graph, $height, $width, $period, $stacked, $return = false, $date = 0) { +function custom_graphs_print ($id_graph, $height, $width, $period, $stacked, $return = false, $date = 0) { global $config; $sources = get_db_all_rows_field_filter ('tgraph_source', 'id_graph', $id_graph); @@ -133,7 +133,7 @@ function print_custom_graph ($id_graph, $height, $width, $period, $stacked, $ret * * @return The possible periods in a custom graph in an associative array. */ -function get_custom_graph_periods () { +function custom_graphs_get_periods () { $periods = array (); $periods[1] = __('1 hour'); diff --git a/pandora_console/operation/reporting/graph_viewer.php b/pandora_console/operation/reporting/graph_viewer.php index 6f35174c7c..8162ede9eb 100644 --- a/pandora_console/operation/reporting/graph_viewer.php +++ b/pandora_console/operation/reporting/graph_viewer.php @@ -120,7 +120,7 @@ if ($view_graph) { echo ""; echo "
"; - print_custom_graph ($id_graph, $height, $width, $period, $stacked, false, $unixdate); + custom_graphs_print ($id_graph, $height, $width, $period, $stacked, false, $unixdate); echo "
"; $period_label = human_time_description_raw ($period); echo "
"; @@ -140,7 +140,7 @@ if ($view_graph) { echo ""; echo ""; - print_select (get_custom_graph_periods (), 'period', intval ($period / 3600), + print_select (custom_graphs_get_periods (), 'period', intval ($period / 3600), '', '', 0, false, false, false); echo ""; @@ -202,7 +202,7 @@ if ($view_graph) { ui_print_page_header (__('Reporting'). " » ".__('Custom graph viewer'), "images/reporting.png", false, "", false, "" ); -$graphs = get_user_custom_graphs (); +$graphs = custom_graphs_get_user (); if (! empty ($graphs)) { $table->width = '500px'; $tale->class = 'databox_frame'; diff --git a/pandora_console/operation/search_graphs.php b/pandora_console/operation/search_graphs.php index 5176c09e18..0440c0e9c0 100755 --- a/pandora_console/operation/search_graphs.php +++ b/pandora_console/operation/search_graphs.php @@ -24,7 +24,7 @@ $graphs = false; if ($searchGraphs) { //Check ACL - $usergraphs = get_user_custom_graphs($config['id_user'], true); + $usergraphs = custom_graphs_get_user($config['id_user'], true); $usergraphs_id = array_keys($usergraphs);