From a23c412b984e10bd326ed0d87957c98ddf07650e Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Mon, 9 May 2011 17:30:55 +0000 Subject: [PATCH] 2011-05-09 Juan Manuel Ramon * include/functions_graph.php include/functions_html.php include/functions_menu.php include/graphs/fgraph.php include/functions_messages.php include/functions_modules.php include/functions_reporting.php include/functions_filemanager.php include/functions_networkmap.php include/functions_servers.php include/functions_network_profiles.php include/functions_network_components.php include/functions_visual_map.php include/ajax/visual_console_builder.ajax.php include/ajax/agent.php include/ajax/alert_list.ajax.php include/ajax/module.php include/functions_io.php include/functions_api.php include/functions_ui.php include/fgraph.php include/functions_incidents.php include/functions.php include/functions_agents.php include/functions_db.php include/functions_alerts.php include/functions_reports.php include/functions_ui_renders.php extensions/insert_data.php extensions/agents_modules.php extensions/resource_registration.php extensions/resource_exportation.php extensions/module_groups.php extensions/plugin_registration.php operation/incidents/incident.incident.php operation/incidents/incident.php operation/incidents/incident_detail.php operation/incidents/incident.download_file.php operation/incidents/incident.list.php operation/search_modules.php operation/agentes/status_monitor.php operation/agentes/export_csv.php operation/agentes/estado_ultimopaquete.php operation/agentes/datos_agente.php operation/agentes/estado_agente.php operation/agentes/networkmap.topology.php operation/agentes/networkmap.groups.php operation/agentes/sla_view.php operation/agentes/exportdata.php operation/agentes/estado_monitores.php operation/agentes/ver_agente.php operation/agentes/tactical.php operation/agentes/group_view.php operation/agentes/networkmap.php operation/agentes/stat_win.php operation/servers/view_server.php operation/servers/view_server_detail.php operation/menu.php operation/search_agents.php operation/integria_incidents/incident.incident.php operation/integria_incidents/incident.php operation/integria_incidents/incident_detail.php operation/integria_incidents/incident.download_file.php operation/integria_incidents/incident.list.php operation/events/events_rss.php operation/events/events_list.php operation/search_alerts.php operation/messages/message.php operation/reporting/reporting_xml.php operation/reporting/reporting_viewer.php operation/reporting/custom_reporting.php operation/search_reports.php operation/search_results.php mobile/operation/agents/monitor_status.php mobile/operation/agents/view_agents.php mobile/operation/agents/tactical.php mobile/operation/agents/view_alerts.php mobile/operation/agents/group_view.php mobile/operation/servers/view_servers.php general/logon_ok.php general/header.php godmode/admin_access_logs.php godmode/db/db_refine.php godmode/db/db_info.php godmode/db/db_purge.php godmode/agentes/agent_template.php godmode/agentes/module_manager_editor_common.php godmode/agentes/module_manager.php godmode/agentes/configurar_agente.php godmode/agentes/module_manager_editor.php godmode/agentes/agent_manager.php godmode/servers/recon_script.php godmode/servers/plugin.php godmode/servers/manage_recontask.php godmode/servers/modificar_server.php godmode/menu.php godmode/alerts/alert_list.list.php godmode/alerts/configure_alert_compound.php godmode/alerts/configure_alert_action.php godmode/setup/os.list.php godmode/setup/links.php godmode/setup/setup.php godmode/users/user_list.php godmode/users/configure_user.php godmode/massive/massive_add_alerts.php godmode/massive/massive_delete_profiles.php godmode/massive/massive_edit_agents.php godmode/massive/massive_delete_modules.php godmode/massive/massive_add_profiles.php godmode/massive/massive_delete_alerts.php godmode/massive/massive_edit_modules.php godmode/modules/manage_network_components_form.php godmode/modules/manage_nc_groups_form.php godmode/modules/manage_network_templates.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_templates_form.php godmode/modules/manage_network_components_form_wmi.php godmode/modules/manage_network_components.php godmode/modules/manage_nc_groups.php godmode/reporting/reporting_builder.preview.php godmode/reporting/graph_builder.graph_editor.php godmode/reporting/reporting_builder.php godmode/reporting/reporting_builder.item_editor.php: Functions in functions_incidents.php, functions_io.php, functions_menu.php, functions_messages.php, functions_modules.php, functions_network_components.php, functions_network_profiles.php, functions_networkmap.php, functions_reporting.php, functions_reports.php, functions_servers.php have "incidents_", "io_", "menu_", "messages_", "modules_", "network_profiles_", "network_components_", "networkmap_", "reporting_", "reports_", "servers_" prefixes respectively. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4326 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 132 ++++++++++ pandora_console/extensions/agents_modules.php | 4 +- pandora_console/extensions/insert_data.php | 12 +- pandora_console/extensions/module_groups.php | 6 +- .../extensions/plugin_registration.php | 24 +- .../extensions/resource_exportation.php | 58 ++--- .../extensions/resource_registration.php | 116 ++++----- pandora_console/general/header.php | 4 +- pandora_console/general/logon_ok.php | 4 +- pandora_console/godmode/admin_access_logs.php | 2 +- .../godmode/agentes/agent_manager.php | 4 +- .../godmode/agentes/agent_template.php | 2 +- .../godmode/agentes/configurar_agente.php | 14 +- .../godmode/agentes/module_manager.php | 6 +- .../godmode/agentes/module_manager_editor.php | 4 +- .../agentes/module_manager_editor_common.php | 4 +- .../godmode/alerts/alert_list.list.php | 4 +- .../godmode/alerts/configure_alert_action.php | 2 +- .../alerts/configure_alert_compound.php | 4 +- pandora_console/godmode/db/db_info.php | 2 +- pandora_console/godmode/db/db_purge.php | 2 +- pandora_console/godmode/db/db_refine.php | 2 +- .../godmode/massive/massive_add_alerts.php | 2 +- .../godmode/massive/massive_add_profiles.php | 2 +- .../godmode/massive/massive_delete_alerts.php | 2 +- .../massive/massive_delete_modules.php | 6 +- .../massive/massive_delete_profiles.php | 2 +- .../godmode/massive/massive_edit_agents.php | 2 +- .../godmode/massive/massive_edit_modules.php | 4 +- pandora_console/godmode/menu.php | 2 +- .../godmode/modules/manage_nc_groups.php | 2 +- .../godmode/modules/manage_nc_groups_form.php | 4 +- .../modules/manage_network_components.php | 18 +- .../manage_network_components_form.php | 2 +- .../manage_network_components_form_common.php | 2 +- .../manage_network_components_form_wmi.php | 6 +- .../modules/manage_network_templates.php | 8 +- .../modules/manage_network_templates_form.php | 4 +- .../reporting/graph_builder.graph_editor.php | 2 +- .../reporting_builder.item_editor.php | 2 +- .../godmode/reporting/reporting_builder.php | 8 +- .../reporting/reporting_builder.preview.php | 2 +- .../godmode/servers/manage_recontask.php | 2 +- .../godmode/servers/modificar_server.php | 2 +- pandora_console/godmode/servers/plugin.php | 2 +- .../godmode/servers/recon_script.php | 2 +- pandora_console/godmode/setup/links.php | 10 +- pandora_console/godmode/setup/os.list.php | 4 +- pandora_console/godmode/setup/setup.php | 2 +- .../godmode/users/configure_user.php | 8 +- pandora_console/godmode/users/user_list.php | 2 +- pandora_console/include/ajax/agent.php | 2 +- .../include/ajax/alert_list.ajax.php | 4 +- pandora_console/include/ajax/module.php | 6 +- .../ajax/visual_console_builder.ajax.php | 6 +- pandora_console/include/fgraph.php | 78 +++--- pandora_console/include/functions.php | 4 +- pandora_console/include/functions_agents.php | 30 +-- pandora_console/include/functions_alerts.php | 2 +- pandora_console/include/functions_api.php | 14 +- pandora_console/include/functions_db.php | 4 +- .../include/functions_filemanager.php | 12 +- pandora_console/include/functions_graph.php | 74 +++--- pandora_console/include/functions_html.php | 16 +- .../include/functions_incidents.php | 59 +++-- pandora_console/include/functions_io.php | 60 +++-- pandora_console/include/functions_menu.php | 2 +- .../include/functions_messages.php | 20 +- pandora_console/include/functions_modules.php | 157 ++++++++---- .../include/functions_network_components.php | 40 +-- .../include/functions_network_profiles.php | 10 +- .../include/functions_networkmap.php | 78 +++--- .../include/functions_reporting.php | 237 +++++++++--------- pandora_console/include/functions_reports.php | 38 +-- pandora_console/include/functions_servers.php | 20 +- pandora_console/include/functions_ui.php | 20 +- .../include/functions_ui_renders.php | 2 +- .../include/functions_visual_map.php | 22 +- pandora_console/include/graphs/fgraph.php | 2 +- .../mobile/operation/agents/group_view.php | 2 +- .../operation/agents/monitor_status.php | 4 +- .../mobile/operation/agents/tactical.php | 4 +- .../mobile/operation/agents/view_agents.php | 32 +-- .../mobile/operation/agents/view_alerts.php | 8 +- .../mobile/operation/servers/view_servers.php | 2 +- .../operation/agentes/datos_agente.php | 18 +- .../operation/agentes/estado_agente.php | 6 +- .../operation/agentes/estado_monitores.php | 12 +- .../agentes/estado_ultimopaquete.php | 20 +- .../operation/agentes/export_csv.php | 4 +- .../operation/agentes/exportdata.php | 16 +- .../operation/agentes/group_view.php | 2 +- .../operation/agentes/networkmap.groups.php | 4 +- .../operation/agentes/networkmap.php | 12 +- .../operation/agentes/networkmap.topology.php | 4 +- .../operation/agentes/sla_view.php | 12 +- .../operation/agentes/stat_win.php | 2 +- .../operation/agentes/status_monitor.php | 10 +- .../operation/agentes/tactical.php | 8 +- .../operation/agentes/ver_agente.php | 18 +- .../operation/events/events_list.php | 6 +- .../operation/events/events_rss.php | 16 +- .../incidents/incident.download_file.php | 2 +- .../operation/incidents/incident.incident.php | 2 +- .../operation/incidents/incident.list.php | 4 +- .../operation/incidents/incident.php | 46 ++-- .../operation/incidents/incident_detail.php | 28 +-- .../incident.download_file.php | 2 +- .../integria_incidents/incident.incident.php | 2 +- .../integria_incidents/incident.list.php | 4 +- .../operation/integria_incidents/incident.php | 46 ++-- .../integria_incidents/incident_detail.php | 28 +-- pandora_console/operation/menu.php | 4 +- .../operation/messages/message.php | 18 +- .../operation/reporting/custom_reporting.php | 2 +- .../operation/reporting/reporting_viewer.php | 2 +- .../operation/reporting/reporting_xml.php | 44 ++-- pandora_console/operation/search_agents.php | 2 +- pandora_console/operation/search_alerts.php | 2 +- pandora_console/operation/search_modules.php | 6 +- pandora_console/operation/search_reports.php | 2 +- pandora_console/operation/search_results.php | 2 +- .../operation/servers/view_server.php | 2 +- .../operation/servers/view_server_detail.php | 4 +- 124 files changed, 1121 insertions(+), 902 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 105ce1317f..e9126e4de8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,135 @@ +2011-05-09 Juan Manuel Ramon + + * include/functions_graph.php + include/functions_html.php + include/functions_menu.php + include/graphs/fgraph.php + include/functions_messages.php + include/functions_modules.php + include/functions_reporting.php + include/functions_filemanager.php + include/functions_networkmap.php + include/functions_servers.php + include/functions_network_profiles.php + include/functions_network_components.php + include/functions_visual_map.php + include/ajax/visual_console_builder.ajax.php + include/ajax/agent.php + include/ajax/alert_list.ajax.php + include/ajax/module.php + include/functions_io.php + include/functions_api.php + include/functions_ui.php + include/fgraph.php + include/functions_incidents.php + include/functions.php + include/functions_agents.php + include/functions_db.php + include/functions_alerts.php + include/functions_reports.php + include/functions_ui_renders.php + extensions/insert_data.php + extensions/agents_modules.php + extensions/resource_registration.php + extensions/resource_exportation.php + extensions/module_groups.php + extensions/plugin_registration.php + operation/incidents/incident.incident.php + operation/incidents/incident.php + operation/incidents/incident_detail.php + operation/incidents/incident.download_file.php + operation/incidents/incident.list.php + operation/search_modules.php + operation/agentes/status_monitor.php + operation/agentes/export_csv.php + operation/agentes/estado_ultimopaquete.php + operation/agentes/datos_agente.php + operation/agentes/estado_agente.php + operation/agentes/networkmap.topology.php + operation/agentes/networkmap.groups.php + operation/agentes/sla_view.php + operation/agentes/exportdata.php + operation/agentes/estado_monitores.php + operation/agentes/ver_agente.php + operation/agentes/tactical.php + operation/agentes/group_view.php + operation/agentes/networkmap.php + operation/agentes/stat_win.php + operation/servers/view_server.php + operation/servers/view_server_detail.php + operation/menu.php + operation/search_agents.php + operation/integria_incidents/incident.incident.php + operation/integria_incidents/incident.php + operation/integria_incidents/incident_detail.php + operation/integria_incidents/incident.download_file.php + operation/integria_incidents/incident.list.php + operation/events/events_rss.php + operation/events/events_list.php + operation/search_alerts.php + operation/messages/message.php + operation/reporting/reporting_xml.php + operation/reporting/reporting_viewer.php + operation/reporting/custom_reporting.php + operation/search_reports.php + operation/search_results.php + mobile/operation/agents/monitor_status.php + mobile/operation/agents/view_agents.php + mobile/operation/agents/tactical.php + mobile/operation/agents/view_alerts.php + mobile/operation/agents/group_view.php + mobile/operation/servers/view_servers.php + general/logon_ok.php + general/header.php + godmode/admin_access_logs.php + godmode/db/db_refine.php + godmode/db/db_info.php + godmode/db/db_purge.php + godmode/agentes/agent_template.php + godmode/agentes/module_manager_editor_common.php + godmode/agentes/module_manager.php + godmode/agentes/configurar_agente.php + godmode/agentes/module_manager_editor.php + godmode/agentes/agent_manager.php + godmode/servers/recon_script.php + godmode/servers/plugin.php + godmode/servers/manage_recontask.php + godmode/servers/modificar_server.php + godmode/menu.php + godmode/alerts/alert_list.list.php + godmode/alerts/configure_alert_compound.php + godmode/alerts/configure_alert_action.php + godmode/setup/os.list.php + godmode/setup/links.php + godmode/setup/setup.php + godmode/users/user_list.php + godmode/users/configure_user.php + godmode/massive/massive_add_alerts.php + godmode/massive/massive_delete_profiles.php + godmode/massive/massive_edit_agents.php + godmode/massive/massive_delete_modules.php + godmode/massive/massive_add_profiles.php + godmode/massive/massive_delete_alerts.php + godmode/massive/massive_edit_modules.php + godmode/modules/manage_network_components_form.php + godmode/modules/manage_nc_groups_form.php + godmode/modules/manage_network_templates.php + godmode/modules/manage_network_components_form_common.php + godmode/modules/manage_network_templates_form.php + godmode/modules/manage_network_components_form_wmi.php + godmode/modules/manage_network_components.php + godmode/modules/manage_nc_groups.php + godmode/reporting/reporting_builder.preview.php + godmode/reporting/graph_builder.graph_editor.php + godmode/reporting/reporting_builder.php + godmode/reporting/reporting_builder.item_editor.php: Functions in + functions_incidents.php, functions_io.php, functions_menu.php, functions_messages.php, + functions_modules.php, functions_network_components.php, functions_network_profiles.php, + functions_networkmap.php, functions_reporting.php, functions_reports.php, + functions_servers.php have "incidents_", "io_", "menu_", "messages_", "modules_", + "network_profiles_", "network_components_", "networkmap_", "reporting_", "reports_", + "servers_" prefixes respectively. + 2011-05-09 Ramon Novoa * operation/agentes/estado_agente.php: Replaced a call to the old diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 97e8aa07e4..33d5fcfd9b 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -242,10 +242,10 @@ function mainAgentsModules() { $match = false; foreach($module['id'] as $module_id){ if(!$match && array_key_exists($module_id,$agent_modules)) { - $status = get_agentmodule_status($module_id); + $status = modules_get_agentmodule_status($module_id); echo ""; $win_handle = dechex(crc32($module_id.$module["name"])); - $graph_type = return_graphtype (get_agentmodule_type($module_id)); + $graph_type = return_graphtype (modules_get_agentmodule_type($module_id)); $link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module_id."&label=".base64_encode($module["name"])."&refresh=600','day_".$win_handle."')"; echo ''; diff --git a/pandora_console/extensions/insert_data.php b/pandora_console/extensions/insert_data.php index a143d4a6f1..6bb53dfa9e 100644 --- a/pandora_console/extensions/insert_data.php +++ b/pandora_console/extensions/insert_data.php @@ -34,13 +34,13 @@ function createXMLData($agent, $agentModule, $time, $data) { "; - $xml = sprintf($xmlTemplate, safe_output(get_os_name($agent['id_os'])), - safe_output($agent['os_version']), $agent['intervalo'], - safe_output($agent['agent_version']), $time, - safe_output($agent['nombre']), $agent['timezone_offset'], - safe_output($agentModule['nombre']), safe_output($agentModule['descripcion']), get_module_type_name($agentModule['id_tipo_modulo']), $data); + $xml = sprintf($xmlTemplate, io_safe_output(get_os_name($agent['id_os'])), + io_safe_output($agent['os_version']), $agent['intervalo'], + io_safe_output($agent['agent_version']), $time, + io_safe_output($agent['nombre']), $agent['timezone_offset'], + io_safe_output($agentModule['nombre']), io_safe_output($agentModule['descripcion']), modules_get_type_name($agentModule['id_tipo_modulo']), $data); - if (false === @file_put_contents($config['remote_config'] . '/' . safe_output($agent['nombre']) . '.' . strtotime($time) . '.data', $xml)) { + if (false === @file_put_contents($config['remote_config'] . '/' . io_safe_output($agent['nombre']) . '.' . strtotime($time) . '.data', $xml)) { ui_print_error_message(sprintf(__('Can\'t save agent (%s), module (%s) data xml.'), $agent['nombre'], $agentModule['nombre'])); } else { diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index c0cd065e5f..8d02efbdb6 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -39,12 +39,12 @@ if (is_ajax ()) { echo '' . __('Number fired of alerts').': ' . $alert["times_fired"] . '
'; $agent = db_get_row('tagente', 'id_agente', $module['id_agente']); echo '' . __('Agent').': '; - echo safe_output($agent['nombre']) . '
'; + echo io_safe_output($agent['nombre']) . '
'; echo '' . __('Module') . ': '; - echo safe_output($module['nombre']) . '
'; + echo io_safe_output($module['nombre']) . '
'; $template = db_get_row('talert_templates', 'id' , $alert['id_alert_template']); echo '' . __('Alert template') . ': '; - echo safe_output($template['name']) . '
'; + echo io_safe_output($template['name']) . '
'; $sql = 'SELECT * FROM talert_template_module_actions AS t1 diff --git a/pandora_console/extensions/plugin_registration.php b/pandora_console/extensions/plugin_registration.php index 257fd8a3bc..9a4008894b 100644 --- a/pandora_console/extensions/plugin_registration.php +++ b/pandora_console/extensions/plugin_registration.php @@ -92,7 +92,7 @@ function pluginreg_extension_main () { // Verify if a plugin with the same name is already registered - $sql0 = "SELECT COUNT(*) FROM tplugin WHERE name = '" . safe_input ($ini_array["plugin_definition"]["name"]) . "'"; + $sql0 = "SELECT COUNT(*) FROM tplugin WHERE name = '" . io_safe_input ($ini_array["plugin_definition"]["name"]) . "'"; $result = db_get_sql ($sql0); @@ -103,10 +103,10 @@ function pluginreg_extension_main () { } $values = array( - 'name' => safe_input ($ini_array["plugin_definition"]["name"]), - 'description' => safe_input ($ini_array["plugin_definition"]["description"]), + 'name' => io_safe_input ($ini_array["plugin_definition"]["name"]), + 'description' => io_safe_input ($ini_array["plugin_definition"]["description"]), 'max_timeout' => $ini_array["plugin_definition"]["timeout"], - 'execute' => safe_input ($exec_path), + 'execute' => io_safe_input ($exec_path), 'net_dst_opt' => $ini_array["plugin_definition"]["ip_opt"], 'net_port_opt' => $ini_array["plugin_definition"]["port_opt"], 'user_opt' => $ini_array["plugin_definition"]["user_opt"], @@ -116,10 +116,10 @@ function pluginreg_extension_main () { $create_id = db_process_sql_insert('tplugin', $values); $values = array( - 'name' => safe_input ($ini_array["plugin_definition"]["name"]), - 'description' => safe_input ($ini_array["plugin_definition"]["description"]), + 'name' => io_safe_input ($ini_array["plugin_definition"]["name"]), + 'description' => io_safe_input ($ini_array["plugin_definition"]["description"]), 'max_timeout' => $ini_array["plugin_definition"]["timeout"], - 'execute' => safe_input ($exec_path), + 'execute' => io_safe_input ($exec_path), 'net_dst_opt' => $ini_array["plugin_definition"]["ip_opt"], 'net_port_opt' => $ini_array["plugin_definition"]["port_opt"], 'user_opt' => $ini_array["plugin_definition"]["user_opt"], @@ -131,8 +131,8 @@ function pluginreg_extension_main () { $label = "module".$ax; $values = array( - 'name' => safe_input ($ini_array[$label]["name"]), - 'description' => safe_input ($ini_array[$label]["description"]), + 'name' => io_safe_input ($ini_array[$label]["name"]), + 'description' => io_safe_input ($ini_array[$label]["description"]), 'id_group' => $ini_array[$label]["id_group"], 'type' => $ini_array[$label]["type"], 'max' => $ini_array[$label]["max"], @@ -140,9 +140,9 @@ function pluginreg_extension_main () { 'module_interval' => $ini_array[$label]["module_interval"], 'id_module_group' => $ini_array[$label]["id_module_group"], 'id_modulo' => $ini_array[$label]["id_modulo"], - 'plugin_user' => safe_input ($ini_array[$label]["plugin_user"]), - 'plugin_pass' => safe_input ($ini_array[$label]["plugin_pass"]), - 'plugin_parameter' => safe_input ($ini_array[$label]["plugin_parameter"]), + 'plugin_user' => io_safe_input ($ini_array[$label]["plugin_user"]), + 'plugin_pass' => io_safe_input ($ini_array[$label]["plugin_pass"]), + 'plugin_parameter' => io_safe_input ($ini_array[$label]["plugin_parameter"]), 'max_timeout' => $ini_array[$label]["max_timeout"], 'history_data' => $ini_array[$label]["history_data"], 'min_warning' => $ini_array[$label]["min_warning"], diff --git a/pandora_console/extensions/resource_exportation.php b/pandora_console/extensions/resource_exportation.php index ad43460e9f..924e6ba208 100644 --- a/pandora_console/extensions/resource_exportation.php +++ b/pandora_console/extensions/resource_exportation.php @@ -91,17 +91,17 @@ function output_xml_report($id) { echo '' . "\n"; echo "\n"; - echo "\n"; + echo "\n"; if (isset($report['description'])) - echo "\n"; + echo "\n"; $group = db_get_value('nombre', 'tgrupo', 'id_grupo', $report['id_group']); - echo "\n"; + echo "\n"; $items = db_get_all_rows_field_filter('treport_content', 'id_report', $report['id_report']); foreach ($items as $item) { echo "\n"; - echo "" . safe_output($item['type']) . "\n"; - echo "" . safe_output($item['description']) . "\n"; - echo "" . safe_output($item['period']) . "\n"; + echo "" . io_safe_output($item['type']) . "\n"; + echo "" . io_safe_output($item['description']) . "\n"; + echo "" . io_safe_output($item['period']) . "\n"; if ($item['id_agent'] != 0) { $agent = get_agent_name($item['id_agent']); } @@ -110,12 +110,12 @@ function output_xml_report($id) { $id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']); $agent = get_agent_name($item['id_agent']); - echo "\n"; + echo "\n"; } if (isset($agent)) echo "\n"; $agent = null; - switch (safe_output($item['type'])) { + switch (io_safe_output($item['type'])) { case 1: case 'simple_graph': break; @@ -124,7 +124,7 @@ function output_xml_report($id) { case 2: case 'custom_graph': $graph = db_get_value('name', 'tgraph', 'id_graph', $item['id_gs']); - echo "\n"; + echo "\n"; break; case 3: case 'SLA': @@ -148,7 +148,7 @@ function output_xml_report($id) { $agent = get_agent_name($item['id_agent']); echo ""; echo "\n"; - echo "\n"; + echo "\n"; echo "" . $sla['sla_max'] . "\n"; echo "" . $sla['sla_min'] . "\n"; echo "" . $sla['sla_limit'] . "\n"; @@ -174,33 +174,33 @@ function output_xml_report($id) { case 'event_report_agent': break; case 'text': - echo "\n"; + echo "\n"; break; case 'sql': - echo "\n"; + echo "\n"; if (!empty($item['external_source'])) { - echo "\n"; + echo "\n"; } else { $sql = db_get_value('sql', 'treport_custom_sql', 'id', $item['treport_custom_sql_id']); - echo "" . safe_output($sql) . "\n"; + echo "" . io_safe_output($sql) . "\n"; } break; case 'sql_graph_pie': case 'sql_graph_vbar': case 'sql_graph_hbar': - echo "" . safe_output($item['header_definition']) . "\n"; + echo "" . io_safe_output($item['header_definition']) . "\n"; if (!empty($item['external_source'])) { - echo "" . safe_output($item['external_source']) . "\n"; + echo "" . io_safe_output($item['external_source']) . "\n"; } else { $sql = db_get_value('sql', 'treport_custom_sql', 'id', $item['treport_custom_sql_id']); - echo "" . safe_output($sql) . "\n"; + echo "" . io_safe_output($sql) . "\n"; } break; case 'event_report_group': $group = db_get_value('nombre', 'tgrupo', 'id_grupo', $item['id_agent']); - echo "\n"; + echo "\n"; break; case 'event_report_module': break; @@ -209,12 +209,12 @@ function output_xml_report($id) { case 'alert_report_agent': break; case 'url': - echo ""; + echo ""; break; case 'database_serialized': - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; break; case 'TTRT': break; @@ -235,21 +235,21 @@ function output_xml_visual_console($id) { echo '' . "\n"; echo "\n"; - echo "\n"; + echo "\n"; if ($visual_map['id_group'] != 0) { $group = db_get_value('nombre', 'tgrupo', 'id_grupo', $visual_map['id_group']); - echo "\n"; + echo "\n"; } - echo "\n"; - echo "" . safe_output($visual_map['height']) . "\n"; - echo "" . safe_output($visual_map['width']) . "\n"; + echo "\n"; + echo "" . io_safe_output($visual_map['height']) . "\n"; + echo "" . io_safe_output($visual_map['width']) . "\n"; $items = db_get_all_rows_field_filter('tlayout_data', 'id_layout', $visual_map['id']); if ($items === false) $items = array(); foreach ($items as $item){ echo "\n"; echo "" . $item['id'] . "\n"; //OLD ID USE FOR parent item if (!empty($item['label'])) { - echo "\n"; + echo "\n"; } echo "" . $item['pos_x'] . "\n"; echo "" . $item['pos_y'] . "\n"; @@ -276,7 +276,7 @@ function output_xml_visual_console($id) { $id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']); $agent = get_agent_name($id_agent); - echo "\n"; + echo "\n"; } } if (!empty($agent)) { diff --git a/pandora_console/extensions/resource_registration.php b/pandora_console/extensions/resource_registration.php index 654f86248a..a18fb7660a 100644 --- a/pandora_console/extensions/resource_registration.php +++ b/pandora_console/extensions/resource_registration.php @@ -54,7 +54,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { $exist = true; $loops = 30; //Loops to exit or tries while ($exist && $loops > 0) { - $exist = (bool)db_get_row_filter('treport', array('name' => safe_input($posible_name))); + $exist = (bool)db_get_row_filter('treport', array('name' => io_safe_input($posible_name))); if ($exist) { $loops--; @@ -76,7 +76,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { $reportElement->name, $posible_name)); } - $values['name'] = safe_input($posible_name); + $values['name'] = io_safe_input($posible_name); } else { ui_print_error_message(__("Error the report haven't name.")); @@ -112,11 +112,11 @@ function process_upload_xml_report($xml, $group_filter = 0) { $values = array(); $values['id_report'] = $id_report; if (isset($item['description'])) - $values['description'] = safe_input($item['description']); + $values['description'] = io_safe_input($item['description']); if (isset($item['period'])) - $values['period'] = safe_input($item['period']); + $values['period'] = io_safe_input($item['period']); if (isset($item['type'])) - $values['type'] = safe_input($item['type']); + $values['type'] = io_safe_input($item['type']); $agents_item= array(); if (isset($item['agent'])) { @@ -127,12 +127,12 @@ function process_upload_xml_report($xml, $group_filter = 0) { foreach ($agents as $agent) { if ($regular_expresion) { - if ((bool)preg_match("/" . $agent_clean . "/", safe_output($agent['nombre']))) { + if ((bool)preg_match("/" . $agent_clean . "/", io_safe_output($agent['nombre']))) { $agents_item[$agent['id_agente']]['name'] = $agent['nombre']; } } else { - if ($agent_clean == safe_output($agent['nombre'])) { + if ($agent_clean == io_safe_output($agent['nombre'])) { $agents_item[$agent['id_agente']]['name'] = $agent['nombre']; } } @@ -150,13 +150,13 @@ function process_upload_xml_report($xml, $group_filter = 0) { foreach ($modules as $module) { if ($regular_expresion) { - if ((bool)preg_match("/" . $module_clean . "/", safe_output($module['nombre']))) { + if ((bool)preg_match("/" . $module_clean . "/", io_safe_output($module['nombre']))) { $agents_item[$id]['modules'][$module['id_agente_modulo']]['name'] = $module['nombre']; } } else { - if ($module_clean == safe_output($module['nombre'])) { + if ($module_clean == io_safe_output($module['nombre'])) { $agents_item[$id]['modules'][$module['id_agente_modulo']]['name'] = $module['nombre']; } @@ -173,7 +173,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { break; case 2: case 'custom_graph': - $group = db_get_value('id_grupo', 'tgrupo', 'nombre', safe_input($item['graph'])); + $group = db_get_value('id_grupo', 'tgrupo', 'nombre', io_safe_input($item['graph'])); $values['id_gs'] = $group; break; case 3: @@ -213,11 +213,11 @@ function process_upload_xml_report($xml, $group_filter = 0) { foreach ($agents as $agent) { $id_agent = false; if ($regular_expresion) { - if ((bool)preg_match("/" . $agent_clean . "/", safe_output($agent['nombre']))) { + if ((bool)preg_match("/" . $agent_clean . "/", io_safe_output($agent['nombre']))) { $id_agent = $agent['id_agente']; } else { - if ($agent_clean == safe_output($agent['nombre'])) { + if ($agent_clean == io_safe_output($agent['nombre'])) { $id_agent = $agent['id_agente']; } } @@ -233,7 +233,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { foreach ($modules as $module) { if ($regular_expresion) { - if ((bool)preg_match("/" . $module_clean . "/", safe_output($module['nombre']))) { + if ((bool)preg_match("/" . $module_clean . "/", io_safe_output($module['nombre']))) { $slas[] = array( 'id_agent_module' => $module['id_agente_modulo'], 'sla_max' => (string)$sla_xml->sla_max, @@ -243,7 +243,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { } } else { - if ($module_clean == safe_output($module['nombre'])) { + if ($module_clean == io_safe_output($module['nombre'])) { $slas[] = array( 'id_agent_module' => $module['id_agente_modulo'], 'sla_max' => (string)$sla_xml->sla_max, @@ -278,20 +278,20 @@ function process_upload_xml_report($xml, $group_filter = 0) { case 'event_report_agent': break; case 'text': - $values['text'] = safe_input($item['text']); + $values['text'] = io_safe_input($item['text']); break; case 'sql': - $values['header_definition'] = safe_input($item['header_definition']); - $values['external_source'] = safe_input($item['sql']); + $values['header_definition'] = io_safe_input($item['header_definition']); + $values['external_source'] = io_safe_input($item['sql']); break; case 'sql_graph_pie': case 'sql_graph_vbar': case 'sql_graph_hbar': - $values['header_definition'] = safe_input($item['header_definition']); - $values['external_source'] = safe_input($item['sql']); + $values['header_definition'] = io_safe_input($item['header_definition']); + $values['external_source'] = io_safe_input($item['sql']); break; case 'event_report_group': - $values['id_agent'] = db_get_value('id_grupo', 'tgrupo', 'nombre', safe_input($item->group)); + $values['id_agent'] = db_get_value('id_grupo', 'tgrupo', 'nombre', io_safe_input($item->group)); break; case 'event_report_module': break; @@ -300,12 +300,12 @@ function process_upload_xml_report($xml, $group_filter = 0) { case 'alert_report_agent': break; case 'url': - $values["external_source"] = safe_input($item['url']); + $values["external_source"] = io_safe_input($item['url']); break; case 'database_serialized': - $values['header_definition'] = safe_input($item['header_definition']); - $values['line_separator'] = safe_input($item['line_separator']); - $values['column_separator'] = safe_input($item['column_separator']); + $values['header_definition'] = io_safe_input($item['header_definition']); + $values['line_separator'] = io_safe_input($item['line_separator']); + $values['column_separator'] = io_safe_input($item['column_separator']); break; case 'TTRT': break; @@ -376,7 +376,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { $values['id_group'] = 0; if (isset($visual_map->group)) { - $id_group = db_get_value('id_grupo', 'tgrupo', 'nombre', safe_input($visual_map->group)); + $id_group = db_get_value('id_grupo', 'tgrupo', 'nombre', io_safe_input($visual_map->group)); if ($id_group !== false) $values['id_group'] = $id_group; } @@ -395,7 +395,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { $exist = true; $loops = 30; //Loops to exit or tries while ($exist && $loops > 0) { - $exist = (bool)db_get_row_filter('tlayout', array('name' => safe_input($posible_name))); + $exist = (bool)db_get_row_filter('tlayout', array('name' => io_safe_input($posible_name))); if ($exist) { $loops--; @@ -417,7 +417,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { $values['name'], $posible_name)); } - $values['name'] = safe_input($posible_name); + $values['name'] = io_safe_input($posible_name); $id_visual_map = db_process_sql_insert('tlayout', $values); ui_print_result_message((bool)$id_visual_map, @@ -451,13 +451,13 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { $agents_in_item = array(); foreach ($agents as $id => $agent) { if ($regular_expresion) { - if ((bool)preg_match("/" . $agent_clean . "/", safe_input($agent))) { + if ((bool)preg_match("/" . $agent_clean . "/", io_safe_input($agent))) { $agents_in_item[$id]['name'] = $agent; $no_agents = false; } } else { - if ($agent_clean == safe_input($agent)) { + if ($agent_clean == io_safe_input($agent)) { $agents_in_item[$id]['name'] = $agent; $no_agents = false; break; @@ -478,13 +478,13 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { $modules_in_item = array(); foreach ($modules as $module) { if ($regular_expresion) { - if ((bool)preg_match("/" . $module_clean . "/", safe_input($module['nombre']))) { + if ((bool)preg_match("/" . $module_clean . "/", io_safe_input($module['nombre']))) { $modules_in_item[$module['id_agente_modulo']] = $module['nombre']; $no_modules = false; } } else { - if ($module_clean == safe_input($module['nombre'])) { + if ($module_clean == io_safe_input($module['nombre'])) { $modules_in_item[$module['id_agente_modulo']] = $module['nombre']; $no_modules = false; break; @@ -500,7 +500,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { $values['id_layout'] = $id_visual_map; if (isset($item->label)) - $values['label'] = safe_input($item->label); + $values['label'] = io_safe_input($item->label); if (isset($item->x)) $values['pos_x'] = (string)$item->x; if (isset($item->y)) @@ -582,27 +582,27 @@ function process_upload_xml_component($xml) { //Extract components $components = array(); foreach ($xml->xpath('/component') as $componentElement) { - $name = safe_input((string)$componentElement->name); + $name = io_safe_input((string)$componentElement->name); $id_os = (int)$componentElement->id_os; - $os_version = safe_input((string)$componentElement->os_version); - $data = safe_input((string)$componentElement->data); + $os_version = io_safe_input((string)$componentElement->os_version); + $data = io_safe_input((string)$componentElement->data); $type = (int)$componentElement->type; $group = (int)$componentElement->group; - $description = safe_input((string)$componentElement->description); + $description = io_safe_input((string)$componentElement->description); $module_interval = (int)$componentElement->module_interval; $max = (float)$componentElement->max; $min = (float)$componentElement->min; - $tcp_send = safe_input((string)$componentElement->tcp_send); - $tcp_rcv_text = safe_input((string)$componentElement->tcp_rcv_text); + $tcp_send = io_safe_input((string)$componentElement->tcp_send); + $tcp_rcv_text = io_safe_input((string)$componentElement->tcp_rcv_text); $tcp_port = (int)$componentElement->tcp_port; - $snmp_oid = safe_input((string)$componentElement->snmp_oid); - $snmp_community = safe_input((string)$componentElement->snmp_community); + $snmp_oid = io_safe_input((string)$componentElement->snmp_oid); + $snmp_community = io_safe_input((string)$componentElement->snmp_community); $id_module_group = (int)$componentElement->id_module_group; $module_source = (int)$componentElement->module_source; $plugin = (int)$componentElement->plugin; - $plugin_username = safe_input((string)$componentElement->plugin_username); - $plugin_password = safe_input((string)$componentElement->plugin_password); - $plugin_parameters = safe_input((string)$componentElement->plugin_parameters); + $plugin_username = io_safe_input((string)$componentElement->plugin_username); + $plugin_password = io_safe_input((string)$componentElement->plugin_password); + $plugin_parameters = io_safe_input((string)$componentElement->plugin_parameters); $max_timeout = (int)$componentElement->max_timeout; $historical_data = (int)$componentElement->historical_data; $min_war = (float)$componentElement->min_war; @@ -611,19 +611,19 @@ function process_upload_xml_component($xml) { $max_cri = (float)$componentElement->max_cri; $ff_treshold = (int)$componentElement->ff_treshold; $snmp_version = (int)$componentElement->snmp_version; - $auth_user = safe_input((string)$componentElement->auth_user); - $auth_password = safe_input((string)$componentElement->auth_password); - $auth_method = safe_input((string)$componentElement->auth_method); - $privacy_method = safe_input((string)$componentElement->privacy_method); - $privacy_pass = safe_input((string)$componentElement->privacy_pass); - $security_level = safe_input((string)$componentElement->security_level); - $wmi_query = safe_input((string)$componentElement->wmi_query); - $key_string = safe_input((string)$componentElement->key_string); + $auth_user = io_safe_input((string)$componentElement->auth_user); + $auth_password = io_safe_input((string)$componentElement->auth_password); + $auth_method = io_safe_input((string)$componentElement->auth_method); + $privacy_method = io_safe_input((string)$componentElement->privacy_method); + $privacy_pass = io_safe_input((string)$componentElement->privacy_pass); + $security_level = io_safe_input((string)$componentElement->security_level); + $wmi_query = io_safe_input((string)$componentElement->wmi_query); + $key_string = io_safe_input((string)$componentElement->key_string); $field_number = (int)$componentElement->field_number; - $namespace = safe_input((string)$componentElement->namespace); - $wmi_user = safe_input((string)$componentElement->wmi_user); - $wmi_password = safe_input((string)$componentElement->wmi_password); - $post_process = safe_input((float)$componentElement->post_process); + $namespace = io_safe_input((string)$componentElement->namespace); + $wmi_user = io_safe_input((string)$componentElement->wmi_user); + $wmi_password = io_safe_input((string)$componentElement->wmi_password); + $post_process = io_safe_input((float)$componentElement->post_process); $idComponent = false; switch ((int)$componentElement->module_source) { @@ -655,7 +655,7 @@ function process_upload_xml_component($xml) { $custom_string_3 = $security_level; } - $idComponent = create_network_component ($name, + $idComponent = network_components_create_network_component ($name, $type, $group, array ('description' => $description, 'module_interval' => $module_interval, @@ -688,7 +688,7 @@ function process_upload_xml_component($xml) { } break; case 4: //Plugin component - $idComponent = create_network_component ($name, + $idComponent = network_components_create_network_component ($name, $type, $group, array ('description' => $description, 'module_interval' => $module_interval, @@ -723,7 +723,7 @@ function process_upload_xml_component($xml) { case 5: //Prediction component break; case 6: //WMI component - $idComponent = create_network_component ($name, + $idComponent = network_components_create_network_component ($name, $type, $group, array ('description' => $description, 'module_interval' => $module_interval, diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 4811b53cc4..bf81fc383b 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -46,7 +46,7 @@ $msg_cnt = 0; 0) { echo ''; @@ -71,7 +71,7 @@ $msg_cnt = 0; echo '
'; $servers["all"] = (int) db_get_value ('COUNT(id_server)','tserver'); - $servers["up"] = (int) check_server_status (); + $servers["up"] = (int) servers_check_status (); $servers["down"] = $servers["all"] - $servers["up"]; if ($servers["up"] == 0) { //All Servers down or no servers at all diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 5b111ccc28..6f5aac6cd1 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -67,7 +67,7 @@ echo ''; // Site stats (global!) // --------------------------------------------------------------------------- echo '
'; -$data = get_group_stats (); +$data = reporting_get_group_stats (); $table->class = "databox"; $table->cellpadding = 4; @@ -209,7 +209,7 @@ foreach ($sessions as $session) { $data[1] = $session['accion']; $data[2] = $session['fecha']; $data[3] = $session_ip_origen; - $data[4] = safe_output ($session['descripcion']); + $data[4] = io_safe_output ($session['descripcion']); array_push ($table->data, $data); } diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php index d2ed2a4502..26bf267b41 100644 --- a/pandora_console/godmode/admin_access_logs.php +++ b/pandora_console/godmode/admin_access_logs.php @@ -245,7 +245,7 @@ foreach ($result as $row) { $data[3] = $row["ip_origen"]; break; } - $data[4] = safe_output($row["descripcion"]); + $data[4] = io_safe_output($row["descripcion"]); if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { switch ($config['dbtype']) { case "mysql": diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index fc1ac08604..8e4216eb1c 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -31,7 +31,7 @@ if (is_ajax ()) { return; foreach ($agents as $agent) { - echo safe_output($agent['nombre']) . "|" . safe_output($agent['direccion']) . "\n"; + echo io_safe_output($agent['nombre']) . "|" . io_safe_output($agent['direccion']) . "\n"; } return; @@ -167,7 +167,7 @@ $none = ''; if ($server_name == '' && $id_agente) $none = __('None'); $table->data[6][0] = __('Server'); -$table->data[6][1] = html_print_select (get_server_names (), +$table->data[6][1] = html_print_select (servers_get_names (), 'server_name', $server_name, '', $none, 0, true); // Description diff --git a/pandora_console/godmode/agentes/agent_template.php b/pandora_console/godmode/agentes/agent_template.php index 1359eb6d63..f03c0869ff 100644 --- a/pandora_console/godmode/agentes/agent_template.php +++ b/pandora_console/godmode/agentes/agent_template.php @@ -164,7 +164,7 @@ foreach ($result as $row) { $data[0] = $row["nombre"]; if ($row["id_tipo_modulo"] > 0) { - $data[1] = html_print_image("images/" . show_icon_type ($row["id_tipo_modulo"]), true, array("border" => "0")); + $data[1] = html_print_image("images/" . modules_show_icon_type ($row["id_tipo_modulo"]), true, array("border" => "0")); } else { $data[1] = ''; } diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 1d370806e5..fc073f93e8 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -355,7 +355,7 @@ if ($create_agent) { if (isset( $_GET["fix_module"])) { $id_module = get_parameter_get ("fix_module",0); // get info about this module - $media = get_agentmodule_data_average ($id_module, 30758400); //Get average over the year + $media = reporting_get_agentmodule_data_average ($id_module, 30758400); //Get average over the year $media *= 1.3; $error = ""; //If the value of media is 0 or something went wrong, don't delete @@ -663,7 +663,7 @@ if ($update_module) { 'custom_integer_2' => $custom_integer_2, 'min_ff_event' => $ff_event); - $result = update_agent_module ($id_agent_module, + $result = modules_update_agent_module ($id_agent_module, $values); if ($result === false) { @@ -741,7 +741,7 @@ if ($create_module) { 'min_ff_event' => $ff_event ); - $id_agent_module = create_agent_module ($id_agente, $name, $values); + $id_agent_module = modules_create_agent_module ($id_agente, $name, $values); if ($id_agent_module === false) { echo '

'.__('There was a problem adding module').'

'; @@ -785,7 +785,7 @@ if ($delete_module) { // DELETE agent module ! } enterprise_include_once('include/functions_config_agents.php'); - enterprise_hook('deleteLocalModuleInConf', array(get_agentmodule_agent($id_borrar_modulo), get_agentmodule_name($id_borrar_modulo))); + enterprise_hook('deleteLocalModuleInConf', array(modules_get_agentmodule_agent($id_borrar_modulo), modules_get_agentmodule_name($id_borrar_modulo))); //Init transaction $error = 0; @@ -834,9 +834,9 @@ if ($delete_module) { // DELETE agent module ! // ================= if ($duplicate_module) { // DUPLICATE agent module ! $id_duplicate_module = (int) get_parameter_get ("duplicate_module",0); - $result = copy_agent_module_to_agent ($id_duplicate_module, - get_agentmodule_agent($id_duplicate_module), - __('copy of').' '.get_agentmodule_name($id_duplicate_module)); + $result = modules_copy_agent_module_to_agent ($id_duplicate_module, + modules_get_agentmodule_agent($id_duplicate_module), + __('copy of').' '.modules_get_agentmodule_name($id_duplicate_module)); $agent = db_get_row ('tagente', 'id_agente', $id_agente); diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 280d9aac71..e110c4ec0d 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -101,7 +101,7 @@ if ($multiple_delete) { } enterprise_include_once('include/functions_config_agents.php'); - enterprise_hook('deleteLocalModuleInConf', array(get_agentmodule_agent($id_agent_module_del), get_agentmodule_name($id_agent_module_del))); + enterprise_hook('deleteLocalModuleInConf', array(modules_get_agentmodule_agent($id_agent_module_del), modules_get_agentmodule_name($id_agent_module_del))); //Init transaction $error = 0; @@ -325,7 +325,7 @@ foreach ($modules as $module) { if ($module['id_module_group'] != $last_modulegroup) { $last_modulegroup = $module['id_module_group']; - $data[0] = ''.get_modulegroup_name ($last_modulegroup).''; + $data[0] = ''.modules_get_modulegroup_name ($last_modulegroup).''; $i = array_push ($table->data, $data); $table->rowclass[$i - 1] = 'datos3'; if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) @@ -385,7 +385,7 @@ foreach ($modules as $module) { // Module type (by server type ) $data[2] = ''; if ($module['id_modulo'] > 0) { - $data[2] = show_server_type ($module['id_modulo']); + $data[2] = servers_show_type ($module['id_modulo']); } // This module is initialized ? (has real data) diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 32c1078931..2c5229725d 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -38,7 +38,7 @@ if (is_ajax ()) { $id_module_group = (int) get_parameter ('id_module_component_group'); $id_module_component = (int) get_parameter ('id_module_component_type'); - $components = get_network_components ($id_module_component, + $components = network_components_get_network_components ($id_module_component, array ('id_group' => $id_module_group, 'order' => 'name ASC'), array ('id_nc', 'name')); @@ -120,7 +120,7 @@ require_once($config['homedir'] . "/include/functions_agents.php"); // Using network component to fill some fields if ($id_agent_module) { - $module = get_agentmodule ($id_agent_module); + $module = modules_get_agentmodule ($id_agent_module); $moduletype = $module['id_modulo']; $name = $module['nombre']; $description = $module['descripcion']; diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 55dffff7d9..38583857da 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -67,7 +67,7 @@ function add_component_selection ($id_network_component_type) { $data[0] = __('Using module component').' '; $data[0] .= ui_print_help_icon ('network_component', true); - $component_groups = get_network_component_groups ($id_network_component_type); + $component_groups = network_components_get_groups ($id_network_component_type); $data[1] = ''; $data[1] .= html_print_select ($component_groups, 'network_component_group', '', '', '--'.__('Manual setup').'--', 0, @@ -143,7 +143,7 @@ else } if (!$edit) { - $table_simple->data[1][1] = ''.get_moduletype_description ($id_module_type).''; + $table_simple->data[1][1] = ''.modules_get_moduletype_description ($id_module_type).''; } else { if (isset($id_module_type)) { diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 8654653df3..92b2a70c39 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -412,7 +412,7 @@ foreach ($simple_alerts as $alert) { $data[1] .= ''; if (! $id_agente) { - $id_agent = get_agentmodule_agent ($alert['id_agent_module']); + $id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']); $data[2] = '
'; if ($alert['disabled']) $data[2] .= ''; @@ -421,7 +421,7 @@ foreach ($simple_alerts as $alert) { $data[2] .= ''; $data[2] .= ''; } - $data[3] = ui_print_truncate_text(get_agentmodule_name ($alert['id_agent_module']), 25, false); + $data[3] = ui_print_truncate_text(modules_get_agentmodule_name ($alert['id_agent_module']), 25, false); $data[4] = ' ' . html_print_image("images/zoom.png", true, array("id" => 'template-details-'.$alert['id_alert_template'], "class" => "img_help")) . ' '; diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index 9d477ab899..cf7dccf5cd 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -153,7 +153,7 @@ ui_require_javascript_file ('pandora_alerts'); $(document).ready (function () { original_command = ""; render_command_preview (); diff --git a/pandora_console/godmode/alerts/configure_alert_compound.php b/pandora_console/godmode/alerts/configure_alert_compound.php index fd1cd721cf..98c580a39e 100644 --- a/pandora_console/godmode/alerts/configure_alert_compound.php +++ b/pandora_console/godmode/alerts/configure_alert_compound.php @@ -479,7 +479,7 @@ if ($step == 2) { $nameAgent = get_agent_name($idAgent); $data[1] = '' . $nameAgent . ''; $data[2] = alerts_get_alert_template_name ($alert['id_alert_template']); - $data[3] = get_agentmodule_name ($alert['id_agent_module']); + $data[3] = modules_get_agentmodule_name ($alert['id_agent_module']); if ($condition['operation'] == 'NOP') { $data[4] = html_print_input_hidden ('operations['.$alert['id'].']', 'NOP', true); } else { @@ -576,7 +576,7 @@ if ($step == 1) { $data[0] = ''; $data[0] .= html_print_image('images/add.png', true); $data[0] .= ''; - $data[1] = get_agentmodule_name ($alert['id_agent_module']); + $data[1] = modules_get_agentmodule_name ($alert['id_agent_module']); $data[2] = alerts_get_alert_template_name ($alert['id_alert_template']); array_push ($table_alerts->data, $data); diff --git a/pandora_console/godmode/db/db_info.php b/pandora_console/godmode/db/db_info.php index 2f55d3aa26..b6de670003 100644 --- a/pandora_console/godmode/db/db_info.php +++ b/pandora_console/godmode/db/db_info.php @@ -83,7 +83,7 @@ foreach ($count as $agent_id => $value) { //First row is a link to the agent $data[0] = ''.$agents[$agent_id].''; //Second row is a number of modules for the agent - $data[1] = get_agent_modules_count ($agent_id); + $data[1] = modules_get_agent_modules_count ($agent_id); //Then the number of data packets for the agent $data[2] = $value; diff --git a/pandora_console/godmode/db/db_purge.php b/pandora_console/godmode/db/db_purge.php index a5206a6fc4..c3b24ea296 100644 --- a/pandora_console/godmode/db/db_purge.php +++ b/pandora_console/godmode/db/db_purge.php @@ -91,7 +91,7 @@ if (isset($_POST["purgedb"])) { $errors = 0; $affected = 0; foreach ($result as $row) { - echo __('Deleting records for module')." ".get_agentmodule_name ($row["id_agente_modulo"]); + echo __('Deleting records for module')." ".modules_get_agentmodule_name ($row["id_agente_modulo"]); echo "
"; flush (); //Flush here in case there are errors and the script dies, at least we know where we ended set_time_limit (); //Reset the time limit just in case diff --git a/pandora_console/godmode/db/db_refine.php b/pandora_console/godmode/db/db_refine.php index be96cc938b..00e6892395 100644 --- a/pandora_console/godmode/db/db_refine.php +++ b/pandora_console/godmode/db/db_refine.php @@ -53,7 +53,7 @@ if ((isset ($_GET["operacion"])) && (!isset ($_POST["update_agent"]))) { // Copy foreach ($origen_modulo as $id_agentemodulo) { - echo "

".__('Filtering data module')." [".get_agentmodule_name ($id_agentemodulo)."]"; + echo "

".__('Filtering data module')." [".modules_get_agentmodule_name ($id_agentemodulo)."]"; $sql = sprintf ("DELETE FROM tagente_datos WHERE id_agente_modulo = %d AND (datos < '%s' OR datos > '%s')", $id_agentemodulo, $min, $max); db_process_sql ($sql); } diff --git a/pandora_console/godmode/massive/massive_add_alerts.php b/pandora_console/godmode/massive/massive_add_alerts.php index ca1ab3af1d..e380ee5121 100644 --- a/pandora_console/godmode/massive/massive_add_alerts.php +++ b/pandora_console/godmode/massive/massive_add_alerts.php @@ -56,7 +56,7 @@ function process_manage_add ($id_alert_template, $id_agents, $module_names) { foreach($module_names as $module){ foreach($id_agents as $id_agent) { - $module_id = get_agentmodule_id($module, $id_agent); + $module_id = modules_get_agentmodule_id($module, $id_agent); $modules_id[] = $module_id['id_agente_modulo']; } } diff --git a/pandora_console/godmode/massive/massive_add_profiles.php b/pandora_console/godmode/massive/massive_add_profiles.php index f13abaf800..bdc42cb464 100644 --- a/pandora_console/godmode/massive/massive_add_profiles.php +++ b/pandora_console/godmode/massive/massive_add_profiles.php @@ -48,7 +48,7 @@ if ($create_profiles) { // If the profile doesnt exist, we create it if ($profile_data === false) { db_pandora_audit("User management", - "Added profile for user ".safe_input($user)); + "Added profile for user ".io_safe_input($user)); $return = create_user_profile ($user, $profile, $group); if ($return !== false) { $n_added ++; diff --git a/pandora_console/godmode/massive/massive_delete_alerts.php b/pandora_console/godmode/massive/massive_delete_alerts.php index 8f44f6b92f..3b08c9bc9b 100644 --- a/pandora_console/godmode/massive/massive_delete_alerts.php +++ b/pandora_console/godmode/massive/massive_delete_alerts.php @@ -58,7 +58,7 @@ function process_manage_delete ($id_alert_template, $id_agents, $module_names) { foreach($module_names as $module){ foreach($id_agents as $id_agent) { - $module_id = get_agentmodule_id($module, $id_agent); + $module_id = modules_get_agentmodule_id($module, $id_agent); $modules_id[] = $module_id['id_agente_modulo']; } } diff --git a/pandora_console/godmode/massive/massive_delete_modules.php b/pandora_console/godmode/massive/massive_delete_modules.php index dfd46f3f3e..3132adfbf0 100644 --- a/pandora_console/godmode/massive/massive_delete_modules.php +++ b/pandora_console/godmode/massive/massive_delete_modules.php @@ -35,7 +35,7 @@ if (is_ajax ()) { $id_group = (int) get_parameter ('id_group'); $module_name = (string) get_parameter ('module_name'); - $agents_modules = get_agents_with_module_name ($module_name, $id_group, + $agents_modules = modules_get_agents_with_module_name ($module_name, $id_group, array ('delete_pending' => 0, 'tagente_modulo.disabled' => 0), array ('tagente.id_agente', 'tagente.nombre')); @@ -60,7 +60,7 @@ function process_manage_delete ($module_name, $id_agents) { db_process_sql_begin (); $modules = get_agent_modules ($id_agents, 'id_agente_modulo', array ('nombre' => $module_name), true); - $success = delete_agent_module ($modules); + $success = modules_delete_agent_module ($modules); if (! $success) { echo '

'.__('There was an error deleting the modules, the operation has been cancelled').'

'; echo '

'.__('Could not delete modules').'

'; @@ -126,7 +126,7 @@ $table->data[2][0] = __('Agent'); $table->data[2][0] .= ''; -$agents = get_agents_with_module_name ($module_name, $id_group, +$agents = modules_get_agents_with_module_name ($module_name, $id_group, array ('delete_pending' => 0, 'tagente_modulo.disabled' => 0), array ('tagente.id_agente', 'tagente.nombre')); diff --git a/pandora_console/godmode/massive/massive_delete_profiles.php b/pandora_console/godmode/massive/massive_delete_profiles.php index 21182e90b9..ea4b5597cb 100644 --- a/pandora_console/godmode/massive/massive_delete_profiles.php +++ b/pandora_console/godmode/massive/massive_delete_profiles.php @@ -60,7 +60,7 @@ if ($delete_profiles) { $user = (string) db_get_value_filter ('id_usuario', 'tusuario_perfil', array('id_up' => $id_up)); db_pandora_audit("User management", - "Deleted profile for user ".safe_input($user)); + "Deleted profile for user ".io_safe_input($user)); $result = delete_user_profile ($user, $id_up); } diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index f983f3f233..4b7f2505b6 100644 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -263,7 +263,7 @@ $none = ''; if ($server_name == '' && $id_agente) $none = __('None'); $table->data[4][0] = __('Server'); -$table->data[4][1] = html_print_select (get_server_names (), +$table->data[4][1] = html_print_select (servers_get_names (), 'server_name', $server_name, '', __('No change'), -1, true, false, true, '', false, 'width: 150px;'); // Description diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index fabfaf2cf7..0bcbb71506 100644 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -59,7 +59,7 @@ function process_manage_edit ($module_name, $agents_select = null) { return false; foreach ($modules as $module) { - $result = update_agent_module ($module['id_agente_modulo'], $values, true); + $result = modules_update_agent_module ($module['id_agente_modulo'], $values, true); if ($result === false) { db_process_sql_rollback (); @@ -322,7 +322,7 @@ $table->data['edit4'][1] .= html_print_input_text ('min', '', '', 5, 15, true); $table->data['edit4'][1] .= '
'.__('Max.').''; $table->data['edit4'][1] .= html_print_input_text ('max', '', '', 5, 15, true); $table->data['edit4'][2] = __('Module group'); -$table->data['edit4'][3] = html_print_select (get_modulegroups(), +$table->data['edit4'][3] = html_print_select (modules_get_modulegroups(), 'id_module_group', '', '', __('Select'), 0, true, false, false); $table->data['edit5'][0] = __('Username'); diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 97659ae0d2..717d41a750 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -246,5 +246,5 @@ if (check_acl ($config['id_user'], 0, "PM")) { } } -print_menu ($menu); +menu_print_menu ($menu); ?> diff --git a/pandora_console/godmode/modules/manage_nc_groups.php b/pandora_console/godmode/modules/manage_nc_groups.php index 2357625bc1..8bb70a47b5 100644 --- a/pandora_console/godmode/modules/manage_nc_groups.php +++ b/pandora_console/godmode/modules/manage_nc_groups.php @@ -118,7 +118,7 @@ foreach ($groups as $group) { $data[0] = ''.$group['name'].''; - $data[1] = get_network_component_group_name ($group['parent']); + $data[1] = network_components_get_group_name ($group['parent']); $data[2] = '
'; $data[2] .= html_print_input_hidden ('delete', 1, true); diff --git a/pandora_console/godmode/modules/manage_nc_groups_form.php b/pandora_console/godmode/modules/manage_nc_groups_form.php index 6af095ef92..e01f643422 100644 --- a/pandora_console/godmode/modules/manage_nc_groups_form.php +++ b/pandora_console/godmode/modules/manage_nc_groups_form.php @@ -30,7 +30,7 @@ require_once ('include/functions_network_components.php'); $id = (int) get_parameter ('id'); if ($id) { - $group = get_network_component_group ($id); + $group = network_components_get_group ($id); $name = $group['name']; $parent = $group['parent']; } else { @@ -47,7 +47,7 @@ $table->data[0][0] = __('Name'); $table->data[0][1] = html_print_input_text ('name', $name, '', 15, 255, true); $table->data[1][0] = __('Parent'); -$table->data[1][1] = html_print_select (get_network_component_groups (), +$table->data[1][1] = html_print_select (network_components_get_groups (), 'parent', $parent, false, __('None'), 0, true, false, false); echo ''; diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index e09f371810..79e30968ca 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -76,9 +76,9 @@ $delete_multiple = (bool) get_parameter('delete_multiple'); if ($duplicate_network_component) { $source_id = (int) get_parameter ('source_id'); - $id = duplicate_network_component ($source_id); + $id = network_components_duplicate_network_component ($source_id); ui_print_result_message ($id, - __('Successfully created from %s', get_network_component_name ($source_id)), + __('Successfully created from %s', network_components_get_name ($source_id)), __('Could not be created')); //List unset for jump the bug in the pagination (TODO) that the make another @@ -104,7 +104,7 @@ if ($create_component) { $custom_string_3 = $snmp3_security_level; } - $id = create_network_component ($name, $type, $id_group, + $id = network_components_create_network_component ($name, $type, $id_group, array ('description' => $description, 'module_interval' => $module_interval, 'max' => $max, @@ -157,7 +157,7 @@ if ($update_component) { $custom_string_3 = $snmp3_security_level; } - $result = update_network_component ($id, + $result = network_components_update_network_component ($id, array ('type' => $type, 'name' => $name, 'id_group' => $id_group, @@ -200,7 +200,7 @@ if ($update_component) { if ($delete_component) { $id = (int) get_parameter ('id'); - $result = delete_network_component ($id); + $result = network_components_delete_network_component ($id); ui_print_result_message ($result, __('Successfully deleted'), @@ -259,7 +259,7 @@ $table->style[2] = 'font-weight: bold'; $table->data = array (); $table->data[0][0] = __('Group'); -$table->data[0][1] = html_print_select (get_network_component_groups (), +$table->data[0][1] = html_print_select (network_components_get_groups (), 'search_id_group', $search_id_group, '', __('All'), 0, true, false, false); $table->data[0][2] = __('Search'); $table->data[0][3] = html_print_input_text ('search_string', $search_string, '', 25, @@ -279,12 +279,12 @@ if ($search_id_group) if ($search_string != '') $filter[] = '(name LIKE "%'.$search_string.'%" OR description LIKE "%'.$search_string.'%" OR tcp_send LIKE "%'.$search_string.'%" OR tcp_rcv LIKE "%'.$search_string.'%")'; -$total_components = get_network_components (false, $filter, 'COUNT(*) AS total'); +$total_components = network_components_get_network_components (false, $filter, 'COUNT(*) AS total'); $total_components = $total_components[0]['total']; ui_pagination ($total_components, $url); $filter['offset'] = (int) get_parameter ('offset'); $filter['limit'] = (int) $config['block_size']; -$components = get_network_components (false, $filter, +$components = network_components_get_network_components (false, $filter, array ('id_nc', 'name', 'description', 'id_group', 'type', 'max', 'min', 'module_interval')); if ($components === false) @@ -318,7 +318,7 @@ foreach ($components as $component) { $data[1] = ui_print_moduletype_icon ($component['type'], true); $data[2] = $component['module_interval'] ? $component['module_interval'] : __('N/A '); $data[3] = mb_strimwidth ($component['description'], 0, 30, "..."); - $data[4] = get_network_component_group_name ($component['id_group']); + $data[4] = network_components_get_group_name ($component['id_group']); $data[5] = $component['max']." / ".$component['min']; $data[6] = 'data[1][3] = html_print_select_from_sql ('SELECT id_mg, name FROM tmodul 'id_module_group', $id_module_group, '', '', '', true, false, false); $table->data[2][0] = __('Group'); -$table->data[2][1] = html_print_select (get_network_component_groups (), +$table->data[2][1] = html_print_select (network_components_get_groups (), 'id_group', $id_group, '', '', '', true, false, false); $table->data[2][2] = __('Interval'); $table->data[2][3] = html_print_input_text ('module_interval', $module_interval, '', diff --git a/pandora_console/godmode/modules/manage_network_components_form_wmi.php b/pandora_console/godmode/modules/manage_network_components_form_wmi.php index 6b719e4b32..65f9a7296a 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_wmi.php +++ b/pandora_console/godmode/modules/manage_network_components_form_wmi.php @@ -90,7 +90,7 @@ echo '' . __('Module type') . ''; echo ''; echo ''; if ($id) { - echo ''. safe_output($row["name"]).''; - $data[1] = ui_print_truncate_text(safe_output($row["description"]), 70, true, true, true, true); + $data[0] = ''. io_safe_output($row["name"]).''; + $data[1] = ui_print_truncate_text(io_safe_output($row["description"]), 70, true, true, true, true); $data[2] = html_print_input_image ("delete_profile", "images/cross.png", $row["id_np"],'', true, array ('onclick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;')); diff --git a/pandora_console/godmode/modules/manage_network_templates_form.php b/pandora_console/godmode/modules/manage_network_templates_form.php index 22baa332b2..fec16a15a7 100644 --- a/pandora_console/godmode/modules/manage_network_templates_form.php +++ b/pandora_console/godmode/modules/manage_network_templates_form.php @@ -186,9 +186,9 @@ if ($id_np > 0) { foreach ($result as $row) { $data = array (); $data[0] = $row["name"]; - $data[1] = html_print_image("images/".show_icon_type($row["type"]), true, array("border" => '0')); + $data[1] = html_print_image("images/".modules_show_icon_type($row["type"]), true, array("border" => '0')); $data[2] = mb_strimwidth($row["description"],0,30,"..."); - $data[3] = get_network_component_group_name ($row["group"]); + $data[3] = network_components_get_group_name ($row["group"]); $data[4] = html_print_checkbox ("components[]", $row["component_id"], false, true); array_push ($table->data, $data); } diff --git a/pandora_console/godmode/reporting/graph_builder.graph_editor.php b/pandora_console/godmode/reporting/graph_builder.graph_editor.php index 02fb8d9f53..b3fe23de46 100644 --- a/pandora_console/godmode/reporting/graph_builder.graph_editor.php +++ b/pandora_console/godmode/reporting/graph_builder.graph_editor.php @@ -95,7 +95,7 @@ if(count($module_array) > 0){ echo "" . $agent_array[$a] . ""; echo ""; - echo get_agentmodule_name ($module_array[$a]).""; + echo modules_get_agentmodule_name ($module_array[$a]).""; echo ""; echo ""; $new_weight = $weight_array[$a]-0.125; diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 6ea56f8e15..bd1d9179d0 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -72,7 +72,7 @@ switch ($action) { $actionParameter = 'update'; $item = db_get_row_filter('treport_content', array('id_rc' => $idItem)); - $style = json_decode(safe_output($item['style']), true); + $style = json_decode(io_safe_output($item['style']), true); $show_in_two_columns = $style['show_in_two_columns']; $show_in_landscape = $style['show_in_landscape']; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index b40728f25a..e9c7e3254b 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -44,7 +44,7 @@ switch ($action) { ui_print_page_header (__('Reporting').' » '.__('Custom reporting'), "images/reporting_edit.png", false, "", true); if ($action == 'delete_report') { - $result = delete_report ($idReport); + $result = reports_delete_report ($idReport); ui_print_result_message ($result, __('Successfully deleted'), __('Could not be deleted')); @@ -56,7 +56,7 @@ switch ($action) { else $return_all_group = false; - $reports = get_reports (array ('order' => 'name'), + $reports = reports_get_reports (array ('order' => 'name'), array ('name', 'id_report', 'description', 'private', 'id_user', 'id_group'), $return_all_group, 'IW'); $table->width = '0px'; if (sizeof ($reports)) { @@ -218,7 +218,7 @@ switch ($action) { $style = array(); $style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0); $style['show_in_landscape'] = get_parameter('show_in_landscape', 0); - $values['style'] = safe_input(json_encode($style)); + $values['style'] = io_safe_input(json_encode($style)); $resultOperationDB = db_process_sql_update('treport_content', $values, array('id_rc' => $idItem)); break; @@ -274,7 +274,7 @@ switch ($action) { $style = array(); $style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0); $style['show_in_landscape'] = get_parameter('show_in_landscape', 0); - $values['style'] = safe_input(json_encode($style)); + $values['style'] = io_safe_input(json_encode($style)); $result = db_process_sql_insert('treport_content', $values); diff --git a/pandora_console/godmode/reporting/reporting_builder.preview.php b/pandora_console/godmode/reporting/reporting_builder.preview.php index 8237fc1560..29609dc517 100644 --- a/pandora_console/godmode/reporting/reporting_builder.preview.php +++ b/pandora_console/godmode/reporting/reporting_builder.preview.php @@ -145,7 +145,7 @@ foreach ($contents as $content) { $table->colspan = array (); $table->rowstyle = array (); - render_report_html_item ($content, $table, $report); + reporting_render_report_html_item ($content, $table, $report); echo '
'; html_print_table ($table); echo "
"; diff --git a/pandora_console/godmode/servers/manage_recontask.php b/pandora_console/godmode/servers/manage_recontask.php index 5a4af25f4d..dbaae1dd10 100644 --- a/pandora_console/godmode/servers/manage_recontask.php +++ b/pandora_console/godmode/servers/manage_recontask.php @@ -196,7 +196,7 @@ if ($result !== false) { if ($row["id_recon_script"] == 0){ // Network recon task $data[2] = html_print_image ("images/network.png", true, array ("title" => __('Network recon task')))."  "; - $data[2] .= get_networkprofile_name ($row["id_network_profile"]); + $data[2] .= network_profiles_get_name ($row["id_network_profile"]); } else { // APP recon task $data[2] = html_print_image ("images/plugin.png", true). "  "; diff --git a/pandora_console/godmode/servers/modificar_server.php b/pandora_console/godmode/servers/modificar_server.php index b79ba628d9..00565ead93 100644 --- a/pandora_console/godmode/servers/modificar_server.php +++ b/pandora_console/godmode/servers/modificar_server.php @@ -82,7 +82,7 @@ else { } } - $servers = get_server_info (); + $servers = servers_get_info (); if ($servers !== false) { $table->width = "90%"; $table->class = "databox"; diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 411633d758..83ecc2881f 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -20,7 +20,7 @@ if (is_ajax ()) { $description = db_get_value_filter('description', 'tplugin', array('id' => $id_plugin)); - echo htmlentities (safe_output($description), ENT_QUOTES, "UTF-8", true); + echo htmlentities (io_safe_output($description), ENT_QUOTES, "UTF-8", true); return; } diff --git a/pandora_console/godmode/servers/recon_script.php b/pandora_console/godmode/servers/recon_script.php index 2aac7cc402..190f1c536c 100644 --- a/pandora_console/godmode/servers/recon_script.php +++ b/pandora_console/godmode/servers/recon_script.php @@ -20,7 +20,7 @@ if (is_ajax ()) { $description = db_get_value_filter('description', 'trecon_script', array('id_recon_script' => $id_reconscript)); - echo htmlentities (safe_output($description), ENT_QUOTES, "UTF-8", true); + echo htmlentities (io_safe_output($description), ENT_QUOTES, "UTF-8", true); return; } diff --git a/pandora_console/godmode/setup/links.php b/pandora_console/godmode/setup/links.php index a59ecffb73..00b39b4b88 100644 --- a/pandora_console/godmode/setup/links.php +++ b/pandora_console/godmode/setup/links.php @@ -42,9 +42,9 @@ if (isset($_POST["create"])){ // If create } if (isset($_POST["update"])){ // if update - $id_link = safe_input($_POST["id_link"]); - $name = safe_input($_POST["name"]); - $link = safe_input($_POST["link"]); + $id_link = io_safe_input($_POST["id_link"]); + $name = io_safe_input($_POST["name"]); + $link = io_safe_input($_POST["link"]); $result = db_process_sql_update("tlink", array('name' => $name, 'link' => $link), array('id_link' => $id_link)); @@ -55,7 +55,7 @@ if (isset($_POST["update"])){ // if update } if (isset($_GET["borrar"])){ // if delete - $id_link = safe_input($_GET["borrar"]); + $id_link = io_safe_input($_GET["borrar"]); $result = db_process_sql_delete("tlink", array("id_link" => $id_link)); @@ -70,7 +70,7 @@ if (isset($_GET["borrar"])){ // if delete if ((isset($_GET["form_add"])) or (isset($_GET["form_edit"]))){ if (isset($_GET["form_edit"])){ $creation_mode = 0; - $id_link = safe_input($_GET["id_link"]); + $id_link = io_safe_input($_GET["id_link"]); $row = db_get_row("tlink", "id_link", $id_link); diff --git a/pandora_console/godmode/setup/os.list.php b/pandora_console/godmode/setup/os.list.php index 866943a44d..84383a8b35 100644 --- a/pandora_console/godmode/setup/os.list.php +++ b/pandora_console/godmode/setup/os.list.php @@ -42,8 +42,8 @@ $table->data = array(); foreach ($osList as $os) { $data = array(); $data[] = ui_print_os_icon($os['id_os'], false, true); - $data[] = '' . safe_output($os['name']) . ''; - $data[] = ui_print_truncate_text(safe_output($os['description']), 25, true, true); + $data[] = '' . io_safe_output($os['name']) . ''; + $data[] = ui_print_truncate_text(io_safe_output($os['description']), 25, true, true); if ($os['id_os'] > 13) { $data[] = '' . html_print_image("images/cross.png", true) . ''; } diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 836eaba20a..2c9eed7439 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -130,7 +130,7 @@ if($config["integria_enabled"]) { $table->data[20][1] = html_print_input_text ('integria_api_password', $config["integria_api_password"], '', 25, 25, true); require_once('include/functions_incidents.php'); - $invent = call_api($config['integria_url']."/include/api.php?user=".$config['id_user']."&pass=".$config['integria_api_password']."&op=get_inventories"); + $invent = incidents_call_api($config['integria_url']."/include/api.php?user=".$config['id_user']."&pass=".$config['integria_api_password']."&op=get_inventories"); $invent = explode("\n",$invent); $inventories = array(); foreach($invent as $inv) { diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index f08231e598..140d848180 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -136,7 +136,7 @@ if ($create_user) { $result = create_user($id, $password_new, $values); db_pandora_audit("User management", - "Created user ".safe_input($id), false, false, $info); + "Created user ".io_safe_input($id), false, false, $info); ui_print_result_message ($result, __('Successfully created'), @@ -201,7 +201,7 @@ if ($update_user) { $info .= ' Skin: ' . $values['id_skin']; } - db_pandora_audit("User management", "Updated user ".safe_input($id), + db_pandora_audit("User management", "Updated user ".io_safe_input($id), false, false, $info); ui_print_result_message ($res1, @@ -223,7 +223,7 @@ if ($add_profile) { $group2 = (int) get_parameter ('assign_group'); $profile2 = (int) get_parameter ('assign_profile'); db_pandora_audit("User management", - "Added profile for user ".safe_input($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2); + "Added profile for user ".io_safe_input($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2); $return = create_user_profile ($id2, $profile2, $group2); ui_print_result_message ($return, __('Profile added successfully'), @@ -239,7 +239,7 @@ if ($delete_profile) { $perfil = db_get_row('tperfil', 'id_perfil', $id_perfil); db_pandora_audit("User management", - "Deleted profile for user ".safe_input($id2), false, false, 'The profile with id ' . $id_perfil . ' in the group ' . $perfilUser['id_grupo']); + "Deleted profile for user ".io_safe_input($id2), false, false, 'The profile with id ' . $id_perfil . ' in the group ' . $perfilUser['id_grupo']); $return = delete_user_profile ($id2, $id_up); ui_print_result_message ($return, diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 1784754a92..4736b21298 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -99,7 +99,7 @@ if (isset ($_GET["user_del"])) { //delete user $result = delete_user ($id_user); db_pandora_audit("User management", - "Deleted user ".safe_input($id_user)); + "Deleted user ".io_safe_input($id_user)); ui_print_result_message ($result, __('Successfully deleted'), diff --git a/pandora_console/include/ajax/agent.php b/pandora_console/include/ajax/agent.php index 62683189dd..a18f805396 100644 --- a/pandora_console/include/ajax/agent.php +++ b/pandora_console/include/ajax/agent.php @@ -57,7 +57,7 @@ if ($search_agents) { return; foreach ($agents as $agent) { - echo safe_output($agent['nombre']) . "|" . safe_output($agent['id_agente']) . "|" . safe_output($agent['direccion']) . "\n"; + echo io_safe_output($agent['nombre']) . "|" . io_safe_output($agent['id_agente']) . "|" . io_safe_output($agent['direccion']) . "\n"; } return; diff --git a/pandora_console/include/ajax/alert_list.ajax.php b/pandora_console/include/ajax/alert_list.ajax.php index e6bbbbdeae..3b39f552d5 100644 --- a/pandora_console/include/ajax/alert_list.ajax.php +++ b/pandora_console/include/ajax/alert_list.ajax.php @@ -61,8 +61,8 @@ if ($get_agent_alerts_simple) { $retval = array (); foreach ($alerts as $alert) { $alert['template'] = alerts_get_alert_template ($alert['id_alert_template']); - $alert['module_name'] = get_agentmodule_name ($alert['id_agent_module']); - $alert['agent_name'] = get_agentmodule_agent_name ($alert['id_agent_module']); + $alert['module_name'] = modules_get_agentmodule_name ($alert['id_agent_module']); + $alert['agent_name'] = modules_get_agentmodule_agent_name ($alert['id_agent_module']); $retval[$alert['id']] = $alert; } diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index e6aaebc7e0..dd3a75c74b 100644 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -19,9 +19,9 @@ include_once($config['homedir'] . "/include/functions_agents.php"); $search_modules = get_parameter('search_modules'); if ($search_modules) { - $id_agents = json_decode(safe_output(get_parameter('id_agents'))); + $id_agents = json_decode(io_safe_output(get_parameter('id_agents'))); $filter = get_parameter('q', '') . '%'; - $other_filter = json_decode(safe_output(get_parameter('other_filter')), true); + $other_filter = json_decode(io_safe_output(get_parameter('other_filter')), true); $modules = get_agent_modules($id_agents, false, (array('nombre' => $filter) + $other_filter)); @@ -29,7 +29,7 @@ if ($search_modules) { $modules = array_unique($modules); foreach ($modules as $module) { - echo safe_output($module) . "\n"; + echo io_safe_output($module) . "\n"; } } ?> \ No newline at end of file diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 1791410db7..ce6839ee1c 100644 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -208,14 +208,14 @@ switch ($action) { case 'label': case 'icon': $elementFields = db_get_row_filter('tlayout_data', array('id' => $id_element)); - $elementFields['agent_name'] = safe_output(get_agent_name($elementFields['id_agent'])); + $elementFields['agent_name'] = io_safe_output(get_agent_name($elementFields['id_agent'])); //Make the html of select box of modules about id_agent. if ($elementFields['id_agent'] != 0) { $modules = get_agent_modules($elementFields['id_agent'], false, array('disabled' => 0, 'id_agente' => $elementFields['id_agent'])); $elementFields['modules_html'] = ''; foreach ($modules as $id => $name) { - $elementFields['modules_html'] .= ''; + $elementFields['modules_html'] .= ''; } } else { @@ -231,7 +231,7 @@ switch ($action) { $elementFields['height_module_graph'] = $elementFields['height']; break; } - $elementFields['label'] = safe_output($elementFields['label']); + $elementFields['label'] = io_safe_output($elementFields['label']); echo json_encode($elementFields); break; } diff --git a/pandora_console/include/fgraph.php b/pandora_console/include/fgraph.php index 21e759c1bb..28df7f99ab 100644 --- a/pandora_console/include/fgraph.php +++ b/pandora_console/include/fgraph.php @@ -179,12 +179,12 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ for ($i = 0; $i < $module_number; $i++) { $agent_module_id = $module_list[$i]; - $agent_name = get_agentmodule_agent_name ($agent_module_id); + $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_id = get_agent_id ($agent_name); - $module_name = get_agentmodule_name ($agent_module_id); + $module_name = modules_get_agentmodule_name ($agent_module_id); $module_name_list[$i] = $agent_name." / ".substr ($module_name, 0, 40); - $id_module_type = get_agentmodule_type ($agent_module_id); - $module_type = get_moduletype_name ($id_module_type); + $id_module_type = modules_get_agentmodule_type ($agent_module_id); + $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); if ($uncompressed_module) { $avg_only = 1; @@ -221,14 +221,14 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ // Compressed module data } else { // Get previous data - $previous_data = get_previous_data ($agent_module_id, $datelimit); + $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($data, $previous_data); } // Get next data - $nextData = get_next_data ($agent_module_id, $date); + $nextData = modules_get_next_data ($agent_module_id, $date); if ($nextData !== false) { array_push ($data, $nextData); } else if (count ($data) > 0) { @@ -1278,11 +1278,11 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $datelimit = $date - $period; $resolution = $config['graph_res'] * 50; //Number of points of the graph $interval = (int) ($period / $resolution); - $agent_name = get_agentmodule_agent_name ($agent_module_id); + $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_id = get_agent_id ($agent_name); - $module_name = get_agentmodule_name ($agent_module_id); - $id_module_type = get_agentmodule_type ($agent_module_id); - $module_type = get_moduletype_name ($id_module_type); + $module_name = modules_get_agentmodule_name ($agent_module_id); + $id_module_type = modules_get_agentmodule_type ($agent_module_id); + $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); if ($uncompressed_module) { $avg_only = 1; @@ -1319,14 +1319,14 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, // Compressed module data } else { // Get previous data - $previous_data = get_previous_data ($agent_module_id, $datelimit); + $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($data, $previous_data); } // Get next data - $nextData = get_next_data ($agent_module_id, $date); + $nextData = modules_get_next_data ($agent_module_id, $date); if ($nextData !== false) { array_push ($data, $nextData); } else if (count ($data) > 0) { @@ -1454,9 +1454,9 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, } // Get min, max and avg (less efficient but centralized for all modules and reports) - $min_value = round(get_agentmodule_data_min ($agent_module_id, $period, $date), 2); - $max_value = round(get_agentmodule_data_max ($agent_module_id, $period, $date), 2); - $avg_value = round(get_agentmodule_data_average ($agent_module_id, $period, $date), 2); + $min_value = round(reporting_get_agentmodule_data_min ($agent_module_id, $period, $date), 2); + $max_value = round(reporting_get_agentmodule_data_max ($agent_module_id, $period, $date), 2); + $avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2); // Fix event and alert scale $event_max = $max_value * 1.25; @@ -1534,11 +1534,11 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, $datelimit = $date - $period; $resolution = $config['graph_res'] * 50; //Number of points of the graph $interval = (int) ($period / $resolution); - $agent_name = get_agentmodule_agent_name ($agent_module_id); + $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_id = get_agent_id ($agent_name); - $module_name = get_agentmodule_name ($agent_module_id); - $id_module_type = get_agentmodule_type ($agent_module_id); - $module_type = get_moduletype_name ($id_module_type); + $module_name = modules_get_agentmodule_name ($agent_module_id); + $id_module_type = modules_get_agentmodule_type ($agent_module_id); + $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); if ($uncompressed_module) { $avg_only = 1; @@ -1575,14 +1575,14 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, // Compressed module data } else { // Get previous data - $previous_data = get_previous_data ($agent_module_id, $datelimit); + $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($data, $previous_data); } // Get next data - $nextData = get_next_data ($agent_module_id, $date); + $nextData = modules_get_next_data ($agent_module_id, $date); if ($nextData !== false) { array_push ($data, $nextData); } else if (count ($data) > 0) { @@ -1698,9 +1698,9 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, } // Get min, max and avg (less efficient but centralized for all modules and reports) - $min_value = round(get_agentmodule_data_min ($agent_module_id, $period, $date), 2); - $max_value = round(get_agentmodule_data_max ($agent_module_id, $period, $date), 2); - $avg_value = round(get_agentmodule_data_average ($agent_module_id, $period, $date), 2); + $min_value = round(reporting_get_agentmodule_data_min ($agent_module_id, $period, $date), 2); + $max_value = round(reporting_get_agentmodule_data_max ($agent_module_id, $period, $date), 2); + $avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2); // Fix event and alert scale $event_max = $max_value * 1.25; @@ -1795,11 +1795,11 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, $datelimit = $date - $period; $resolution = $config['graph_res'] * 50; //Number of points of the graph $interval = (int) ($period / $resolution); - $agent_name = get_agentmodule_agent_name ($agent_module_id); + $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_id = get_agent_id ($agent_name); - $module_name = get_agentmodule_name ($agent_module_id); - $id_module_type = get_agentmodule_type ($agent_module_id); - $module_type = get_moduletype_name ($id_module_type); + $module_name = modules_get_agentmodule_name ($agent_module_id); + $id_module_type = modules_get_agentmodule_type ($agent_module_id); + $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); if ($uncompressed_module) { $avg_only = 1; @@ -1836,14 +1836,14 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, // Compressed module data } else { // Get previous data - $previous_data = get_previous_data ($agent_module_id, $datelimit, 1); + $previous_data = modules_get_previous_data ($agent_module_id, $datelimit, 1); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($data, $previous_data); } // Get next data - $nextData = get_next_data ($agent_module_id, $date, 1); + $nextData = modules_get_next_data ($agent_module_id, $date, 1); if ($nextData !== false) { array_push ($data, $nextData); } else if (count ($data) > 0) { @@ -1923,9 +1923,9 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, } // Get min, max and avg (less efficient but centralized for all modules and reports) - $min_value = round(get_agentmodule_data_min ($agent_module_id, $period, $date), 2); - $max_value = round(get_agentmodule_data_max ($agent_module_id, $period, $date), 2); - $avg_value = round(get_agentmodule_data_average ($agent_module_id, $period, $date), 2); + $min_value = round(reporting_get_agentmodule_data_min ($agent_module_id, $period, $date), 2); + $max_value = round(reporting_get_agentmodule_data_max ($agent_module_id, $period, $date), 2); + $avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2); // Fix event and alert scale $event_max = $max_value * 1.25; @@ -2011,8 +2011,8 @@ function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event, $fechatope = $now - $periodo; // limit date - $nombre_agente = get_agentmodule_agent_name ($id_agente_modulo); - $nombre_modulo = get_agentmodule_name ($id_agente_modulo); + $nombre_agente = modules_get_agentmodule_agent_name ($id_agente_modulo); + $nombre_modulo = modules_get_agentmodule_name ($id_agente_modulo); $id_agente = get_agent_id ($nombre_agente); @@ -2382,11 +2382,11 @@ function graph_custom_sql_graph ($id, $width, $height, $type = 1) { $report_content = db_get_row ('treport_content', 'id_rc', $id); if ($report_content["external_source"] != ""){ - $sql = safe_output ($report_content["external_source"]); + $sql = io_safe_output ($report_content["external_source"]); } else { $sql = db_get_row('treport_custom_sql', 'id', $report_content["treport_custom_sql_id"]); - $sql = safe_output($sql['sql']); + $sql = io_safe_output($sql['sql']); } $data_result = db_get_all_rows_sql ($sql); @@ -2613,12 +2613,12 @@ if ($graphic_type) { break; case 'generic_pie_graph': $data_pie_graph = array(); - $data_pie_graph = json_decode(safe_output($array), true); + $data_pie_graph = json_decode(io_safe_output($array), true); generic_pie_graph ($width, $height, $data_pie_graph, array ('show_legend' => true)); break; case 'generic_horizontal_bar_graph': $data_pie_graph = array(); - $data_pie_graph = json_decode(safe_output($array), true); + $data_pie_graph = json_decode(io_safe_output($array), true); generic_horizontal_bar_graph ($width, $height, $data_pie_graph); break; diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 4255fa5849..d965dfe5ae 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -486,7 +486,7 @@ function get_parameter ($name, $default = '') { */ function get_parameter_get ($name, $default = "") { if ((isset ($_GET[$name])) && ($_GET[$name] != "")) - return safe_input ($_GET[$name]); + return io_safe_input ($_GET[$name]); return $default; } @@ -501,7 +501,7 @@ function get_parameter_get ($name, $default = "") { */ function get_parameter_post ($name, $default = "") { if ((isset ($_POST[$name])) && ($_POST[$name] != "")) - return safe_input ($_POST[$name]); + return io_safe_input ($_POST[$name]); return $default; } diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 7178bbfe45..7b9aee30c9 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -439,7 +439,7 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co if ($alert === false) continue; /* Check if some alerts which doesn't belong to the agent was given */ - if (get_agentmodule_agent ($alert['id_agent_module']) != $source_id_agent) + if (modules_get_agentmodule_agent ($alert['id_agent_module']) != $source_id_agent) continue; array_push ($target_modules, $alert['id_agent_module']); } @@ -459,7 +459,7 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co foreach ($destiny_id_agents as $id_destiny_agent) { foreach ($target_modules as $id_agent_module) { - $result = copy_agent_module_to_agent ($id_agent_module, + $result = modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent); if ($result === false) { @@ -631,7 +631,7 @@ function agents_common_modules_with_alerts ($id_agent, $filter = false, $indexed $modules = array (); foreach ($result as $module) { - if($get_not_init_modules || get_agentmodule_is_init($module['id_agente_modulo'])) { + if($get_not_init_modules || modules_get_agentmodule_is_init($module['id_agente_modulo'])) { $modules[$module['id_agente_modulo']] = $module['id_agente_modulo']; } } @@ -708,7 +708,7 @@ function agents_common_modules ($id_agent, $filter = false, $indexed = true, $ge $modules = array (); foreach ($result as $module) { - if($get_not_init_modules || get_agentmodule_is_init($module['id_agente_modulo'])) { + if($get_not_init_modules || modules_get_agentmodule_is_init($module['id_agente_modulo'])) { $modules[$module['id_agente_modulo']] = $module['id_agente_modulo']; } } @@ -766,13 +766,13 @@ function get_group_agents ($id_group = 0, $search = false, $case = "lower", $noA } unset ($search["disabled"]); if (isset ($search["string"])) { - $string = safe_input ($search["string"]); + $string = io_safe_input ($search["string"]); switch ($config["dbtype"]) { case "mysql": $search_sql .= ' AND (nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%")'; break; case "postgresql": - $search_sql .= ' AND (nombre LIKE \'%'.$string.'%\' OR direccion LIKE \'%'.$string.'%\')'; + $search_sql .= ' AND (nombre COLLATE utf8_general_ci LIKE \'%'.$string.'%\' OR direccion LIKE \'%'.$string.'%\')'; break; case "oracle": $search_sql .= ' AND (UPPER(nombre) LIKE UPPER(\'%'.$string.'%\') OR direccion LIKE upper(\'%'.$string.'%\'))'; @@ -783,13 +783,13 @@ function get_group_agents ($id_group = 0, $search = false, $case = "lower", $noA } if (isset ($search["name"])) { - $name = safe_input ($search["name"]); + $name = io_safe_input ($search["name"]); switch ($config["dbtype"]) { case "mysql": $search_sql .= ' AND nombre COLLATE utf8_general_ci LIKE "' . $name . '" '; break; case "postgresql": - $search_sql .= ' AND nombre LIKE \'' . $name . '\' '; + $search_sql .= ' AND nombre COLLATE utf8_general_ci LIKE \'' . $name . '\' '; break; case "oracle": $search_sql .= ' AND nombre LIKE UPPER("' . $name . '") '; @@ -970,7 +970,7 @@ function get_agent_modules ($id_agent = null, $details = false, $filter = false, $details = "nombre"; } else { - $details = safe_input ($details); + $details = io_safe_input ($details); } switch ($config["dbtype"]) { @@ -981,7 +981,7 @@ function get_agent_modules ($id_agent = null, $details = false, $filter = false, %s ORDER BY nombre', ($details != '*' && $indexed) ? 'id_agente_modulo,' : '', - safe_output(implode (",", (array) $details)), + io_safe_output(implode (",", (array) $details)), $where); break; case "oracle": @@ -990,7 +990,7 @@ function get_agent_modules ($id_agent = null, $details = false, $filter = false, %s ORDER BY dbms_lob.substr(nombre, 4000, 1)', ($details != '*' && $indexed) ? 'id_agente_modulo,' : '', - safe_output(implode (",", (array) $details)), + io_safe_output(implode (",", (array) $details)), $where); break; } @@ -1007,7 +1007,7 @@ function get_agent_modules ($id_agent = null, $details = false, $filter = false, $modules = array (); foreach ($result as $module) { - if ($get_not_init_modules || get_agentmodule_is_init($module['id_agente_modulo'])) { + if ($get_not_init_modules || modules_get_agentmodule_is_init($module['id_agente_modulo'])) { if (is_array ($details) || $details == '*') { //Just stack the information in array by ID $modules[$module['id_agente_modulo']] = $module; @@ -1325,9 +1325,9 @@ function get_agent_status($id_agent = 0) { $modules_status = array(); $modules_async = 0; foreach($modules as $module) { - $modules_status[] = get_agentmodule_status($module); + $modules_status[] = modules_get_agentmodule_status($module); - $module_type = get_agentmodule_type($module); + $module_type = modules_get_agentmodule_type($module); if(($module_type >= 21 && $module_type <= 23) || $module_type == 100) { $modules_async++; } @@ -1526,7 +1526,7 @@ function delete_agent ($id_agents, $disableACL = false) { * @return int The group id */ function get_agentmodule_group ($id_module) { - $agent = (int) get_agentmodule_agent ((int) $id_module); + $agent = (int) modules_get_agentmodule_agent ((int) $id_module); return (int) get_agent_group ($agent); } diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 090224f98d..24f60950ae 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -1112,7 +1112,7 @@ function alerts_validate_alert_agent_module ($id_alert_agent_module) { foreach ($alerts as $id) { $alert = alerts_get_alert_agent_module ($id); - $agent_id = get_agentmodule_agent ($alert["id_agent_module"]); + $agent_id = modules_get_agentmodule_agent ($alert["id_agent_module"]); $group_id = get_agentmodule_group ($agent_id); if (! check_acl ($config['id_user'], $group_id, "AW")) { diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 3d82e02f85..8f4b60ab80 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -745,7 +745,7 @@ function set_create_network_module($id, $thrash1, $other, $thrash3) { 'descripcion' => $other['data'][19], ); - $idModule = create_agent_module($idAgent, $name, $values, true); + $idModule = modules_create_agent_module($idAgent, $name, $values, true); if ($idModule === false) returnError('error_create_network_module', 'Error in creation network module.'); @@ -991,14 +991,14 @@ function set_module_data($id, $thrash2, $other, $trash1) { "; - $xml = sprintf($xmlTemplate, safe_output(get_os_name($agent['id_os'])), - safe_output($agent['os_version']), $agent['intervalo'], - safe_output($agent['agent_version']), date('Y/m/d h:i:s', $time), - safe_output($agent['nombre']), $agent['timezone_offset'], - safe_output($agentModule['nombre']), safe_output($agentModule['descripcion']), get_module_type_name($agentModule['id_tipo_modulo']), $data); + $xml = sprintf($xmlTemplate, io_safe_output(get_os_name($agent['id_os'])), + io_safe_output($agent['os_version']), $agent['intervalo'], + io_safe_output($agent['agent_version']), date('Y/m/d h:i:s', $time), + io_safe_output($agent['nombre']), $agent['timezone_offset'], + io_safe_output($agentModule['nombre']), io_safe_output($agentModule['descripcion']), modules_get_type_name($agentModule['id_tipo_modulo']), $data); - if (false === @file_put_contents($config['remote_config'] . '/' . safe_output($agent['nombre']) . '.' . $time . '.data', $xml)) { + if (false === @file_put_contents($config['remote_config'] . '/' . io_safe_output($agent['nombre']) . '.' . $time . '.data', $xml)) { returnError('error_file', 'Can save agent data xml.'); } else { diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 8a633c1303..34fb0a2a5e 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -124,8 +124,8 @@ function db_pandora_audit($accion, $descripcion, $user_id = false, $ip = false, $id = $config["id_user"]; } - $accion = safe_input($accion); - $descripcion = safe_input($descripcion); + $accion = io_safe_input($accion); + $descripcion = io_safe_input($descripcion); $values = array('id_usuario' => $id, 'accion' => $accion, diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 2510e04595..2ea01199fb 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -193,14 +193,14 @@ if ($create_text_file) { return; } - $filename = safe_output(get_parameter('name_file')); + $filename = io_safe_output(get_parameter('name_file')); if ($filename != "") { $real_directory = (string) get_parameter('real_directory'); - $real_directory = safe_output($real_directory); + $real_directory = io_safe_output($real_directory); $directory = (string) get_parameter ('directory'); - $directory = safe_output($directory); + $directory = io_safe_output($directory); $hash = get_parameter('hash', ''); $testHash = md5($real_directory . $directory . $config['dbpass']); @@ -298,7 +298,7 @@ if ($create_dir) { $config['filemanager']['message'] = null; $directory = (string) get_parameter ('directory', "/"); - $directory = safe_output($directory); + $directory = io_safe_output($directory); $hash = get_parameter('hash', ''); $testHash = md5($directory . $config['dbpass']); @@ -307,7 +307,7 @@ if ($create_dir) { } else { $dirname = (string) get_parameter ('dirname'); - $dirname = safe_output($dirname); + $dirname = io_safe_output($dirname); if ($dirname != '') { @mkdir ($directory.'/'.$dirname); $config['filemanager']['message'] = '

'.__('Created directory').'

'; @@ -330,7 +330,7 @@ if ($delete_file) { $config['filemanager']['message'] = null; $filename = (string) get_parameter ('filename'); - $filename = safe_output($filename); + $filename = io_safe_output($filename); $hash = get_parameter('hash', ''); $testHash = md5($filename . $config['dbpass']); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 25decb8d07..5ee332702a 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -40,11 +40,11 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, $datelimit = $date - $period; $resolution = $config['graph_res'] * 50; //Number of points of the graph $interval = (int) ($period / $resolution); - $agent_name = get_agentmodule_agent_name ($agent_module_id); + $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_id = get_agent_id ($agent_name); - $module_name = get_agentmodule_name ($agent_module_id); - $id_module_type = get_agentmodule_type ($agent_module_id); - $module_type = get_moduletype_name ($id_module_type); + $module_name = modules_get_agentmodule_name ($agent_module_id); + $id_module_type = modules_get_agentmodule_type ($agent_module_id); + $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); if ($uncompressed_module) { $avg_only = 1; @@ -82,14 +82,14 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, } else { // Get previous data - $previous_data = get_previous_data ($agent_module_id, $datelimit); + $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($data, $previous_data); } // Get next data - $nextData = get_next_data ($agent_module_id, $date); + $nextData = modules_get_next_data ($agent_module_id, $date); if ($nextData !== false) { array_push ($data, $nextData); } @@ -251,9 +251,9 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, } // Get min, max and avg (less efficient but centralized for all modules and reports) - $min_value = round(get_agentmodule_data_min ($agent_module_id, $period, $date), 2); - $max_value = round(get_agentmodule_data_max ($agent_module_id, $period, $date), 2); - $avg_value = round(get_agentmodule_data_average ($agent_module_id, $period, $date), 2); + $min_value = round(reporting_get_agentmodule_data_min ($agent_module_id, $period, $date), 2); + $max_value = round(reporting_get_agentmodule_data_max ($agent_module_id, $period, $date), 2); + $avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2); // Fix event and alert scale $event_max = $max_value * 1.25; @@ -404,12 +404,12 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width, for ($i = 0; $i < $module_number; $i++) { $agent_module_id = $module_list[$i]; - $agent_name = get_agentmodule_agent_name ($agent_module_id); + $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_id = get_agent_id ($agent_name); - $module_name = get_agentmodule_name ($agent_module_id); + $module_name = modules_get_agentmodule_name ($agent_module_id); $module_name_list[$i] = $agent_name." / ".substr ($module_name, 0, 40); - $id_module_type = get_agentmodule_type ($agent_module_id); - $module_type = get_moduletype_name ($id_module_type); + $id_module_type = modules_get_agentmodule_type ($agent_module_id); + $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); if ($uncompressed_module) { $avg_only = 1; @@ -446,14 +446,14 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width, // Compressed module data } else { // Get previous data - $previous_data = get_previous_data ($agent_module_id, $datelimit); + $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($data, $previous_data); } // Get next data - $nextData = get_next_data ($agent_module_id, $date); + $nextData = modules_get_next_data ($agent_module_id, $date); if ($nextData !== false) { array_push ($data, $nextData); } else if (count ($data) > 0) { @@ -1308,11 +1308,11 @@ function graph_custom_sql_graph2 ($id, $width, $height, $type = 'sql_graph_vbar' $report_content = db_get_row ('treport_content', 'id_rc', $id); if ($report_content["external_source"] != ""){ - $sql = safe_output ($report_content["external_source"]); + $sql = io_safe_output ($report_content["external_source"]); } else { $sql = db_get_row('treport_custom_sql', 'id', $report_content["treport_custom_sql_id"]); - $sql = safe_output($sql['sql']); + $sql = io_safe_output($sql['sql']); } $data_result = db_get_all_rows_sql ($sql); @@ -1478,11 +1478,11 @@ function grafico_modulo_boolean2 ($agent_module_id, $period, $show_events, $datelimit = $date - $period; $resolution = $config['graph_res'] * 50; //Number of points of the graph $interval = (int) ($period / $resolution); - $agent_name = get_agentmodule_agent_name ($agent_module_id); + $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_id = get_agent_id ($agent_name); - $module_name = get_agentmodule_name ($agent_module_id); - $id_module_type = get_agentmodule_type ($agent_module_id); - $module_type = get_moduletype_name ($id_module_type); + $module_name = modules_get_agentmodule_name ($agent_module_id); + $id_module_type = modules_get_agentmodule_type ($agent_module_id); + $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); if ($uncompressed_module) { $avg_only = 1; @@ -1519,14 +1519,14 @@ function grafico_modulo_boolean2 ($agent_module_id, $period, $show_events, // Compressed module data } else { // Get previous data - $previous_data = get_previous_data ($agent_module_id, $datelimit); + $previous_data = modules_get_previous_data ($agent_module_id, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($data, $previous_data); } // Get next data - $nextData = get_next_data ($agent_module_id, $date); + $nextData = modules_get_next_data ($agent_module_id, $date); if ($nextData !== false) { array_push ($data, $nextData); } else if (count ($data) > 0) { @@ -1682,9 +1682,9 @@ function grafico_modulo_boolean2 ($agent_module_id, $period, $show_events, } // Get min, max and avg (less efficient but centralized for all modules and reports) - $min_value = round(get_agentmodule_data_min ($agent_module_id, $period, $date), 2); - $max_value = round(get_agentmodule_data_max ($agent_module_id, $period, $date), 2); - $avg_value = round(get_agentmodule_data_average ($agent_module_id, $period, $date), 2); + $min_value = round(reporting_get_agentmodule_data_min ($agent_module_id, $period, $date), 2); + $max_value = round(reporting_get_agentmodule_data_max ($agent_module_id, $period, $date), 2); + $avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2); // Fix event and alert scale $event_max = $max_value * 1.25; @@ -1792,11 +1792,11 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events, $datelimit = $date - $period; $resolution = $config['graph_res'] * 50; //Number of points of the graph $interval = (int) ($period / $resolution); - $agent_name = get_agentmodule_agent_name ($agent_module_id); + $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_id = get_agent_id ($agent_name); - $module_name = get_agentmodule_name ($agent_module_id); - $id_module_type = get_agentmodule_type ($agent_module_id); - $module_type = get_moduletype_name ($id_module_type); + $module_name = modules_get_agentmodule_name ($agent_module_id); + $id_module_type = modules_get_agentmodule_type ($agent_module_id); + $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); if ($uncompressed_module) { $avg_only = 1; @@ -1833,14 +1833,14 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events, // Compressed module data } else { // Get previous data - $previous_data = get_previous_data ($agent_module_id, $datelimit, 1); + $previous_data = modules_get_previous_data ($agent_module_id, $datelimit, 1); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($data, $previous_data); } // Get next data - $nextData = get_next_data ($agent_module_id, $date, 1); + $nextData = modules_get_next_data ($agent_module_id, $date, 1); if ($nextData !== false) { array_push ($data, $nextData); } else if (count ($data) > 0) { @@ -1950,9 +1950,9 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events, } // Get min, max and avg (less efficient but centralized for all modules and reports) - $min_value = round(get_agentmodule_data_min ($agent_module_id, $period, $date), 2); - $max_value = round(get_agentmodule_data_max ($agent_module_id, $period, $date), 2); - $avg_value = round(get_agentmodule_data_average ($agent_module_id, $period, $date), 2); + $min_value = round(reporting_get_agentmodule_data_min ($agent_module_id, $period, $date), 2); + $max_value = round(reporting_get_agentmodule_data_max ($agent_module_id, $period, $date), 2); + $avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2); // Fix event and alert scale $event_max = $max_value * 1.25; @@ -2011,8 +2011,8 @@ function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event, $fechatope = $now - $periodo; // limit date - $nombre_agente = get_agentmodule_agent_name ($id_agente_modulo); - $nombre_modulo = get_agentmodule_name ($id_agente_modulo); + $nombre_agente = modules_get_agentmodule_agent_name ($id_agente_modulo); + $nombre_modulo = modules_get_agentmodule_name ($id_agente_modulo); $id_agente = get_agent_id ($nombre_agente); diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 12d5b2ad71..5cd494c8d0 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -593,7 +593,7 @@ function html_print_input_image ($name, $src, $value, $style = '', $return = fal foreach ($attrs as $attribute) { if (isset ($options[$attribute])) { - $output .= ' '.$attribute.'="'.safe_input_html ($options[$attribute]).'"'; + $output .= ' '.$attribute.'="'.io_safe_input_html ($options[$attribute]).'"'; } } @@ -727,7 +727,7 @@ function html_print_textarea ($name, $rows, $columns, $value = '', $attributes = } $output = ''; @@ -1136,13 +1136,13 @@ function html_print_image ($src, $return = false, $options = false, $return_src // Only return src field of image if ($return_src){ if (!$return){ - echo safe_input($src); + echo io_safe_input($src); return; } - return safe_input($src); + return io_safe_input($src); } - $output = ''; + $output .= 'alt="'.io_safe_input_html ($options['alt']).'" />'; if (!$return) { echo $output; diff --git a/pandora_console/include/functions_incidents.php b/pandora_console/include/functions_incidents.php index cfca3fb470..5eac6f53e5 100644 --- a/pandora_console/include/functions_incidents.php +++ b/pandora_console/include/functions_incidents.php @@ -24,7 +24,7 @@ * * @return array The several priorities with their values */ -function get_incidents_priorities () { +function incidents_get_priorities () { $fields = array(); $fields[0] = __('Informative'); $fields[1] = __('Low'); @@ -43,7 +43,7 @@ function get_incidents_priorities () { * * @return string The string with the image tag */ -function print_incidents_priority_img ($id_priority, $return = false) { +function incidents_print_priority_img ($id_priority, $return = false) { switch ($id_priority) { case 0: $img = html_print_image ("images/dot_green.png", true, array('title' => __('Informative'))).html_print_image ("images/dot_green.png", true, array('title' => __('Informative'))).html_print_image ("images/dot_yellow.png", true, array('title' => __('Informative'))); @@ -77,7 +77,7 @@ function print_incidents_priority_img ($id_priority, $return = false) { * * @return array The several status with their values */ -function get_incidents_status () { +function incidents_get_status () { $fields = array (); $fields[0] = __('Active incidents'); $fields[1] = __('Active incidents, with comments'); @@ -95,7 +95,7 @@ function get_incidents_status () { * * @return string The string with the image tag */ -function print_incidents_status_img ($id_status, $return = false) { +function incidents_print_status_img ($id_status, $return = false) { switch ($id_status) { case 0: $img = html_print_image ("images/dot_red.png", true, array('title' => __('Active incidents'))); @@ -128,7 +128,7 @@ function print_incidents_status_img ($id_status, $return = false) { * * @return bool True if it was done, false if it wasn't */ -function process_incidents_touch ($id_incident) { +function incidents_process_touch ($id_incident) { global $config; $id_incident = (array) safe_int ($id_incident, 1); //Make sure we have all positive int's @@ -150,7 +150,7 @@ function process_incidents_touch ($id_incident) { * * @return bool True if it was done, false if it wasn't */ -function process_incidents_chown ($id_incident, $owner = false) { +function incidents_process_chown ($id_incident, $owner = false) { if ($owner === false) { global $config; $owner = $config["id_user"]; @@ -173,7 +173,7 @@ function process_incidents_chown ($id_incident, $owner = false) { * * @return string The author of an incident */ -function get_incidents_author ($id_incident) { +function incidents_get_author ($id_incident) { if ($id_incident < 1) { return ""; } @@ -187,7 +187,7 @@ function get_incidents_author ($id_incident) { * * @return string The last updater of an incident */ -function get_incidents_owner ($id_incident) { +function incidents_get_owner ($id_incident) { if ($id_incident < 1) { return ""; } @@ -201,7 +201,7 @@ function get_incidents_owner ($id_incident) { * * @return string The last updater of an incident */ -function get_incidents_lastupdate ($id_incident) { +function incidents_get_lastupdate ($id_incident) { if ($id_incident < 1) { return ""; } @@ -216,7 +216,7 @@ function get_incidents_lastupdate ($id_incident) { * * @return int The group id of an incident */ -function get_incidents_group ($id_incident) { +function incidents_get_group ($id_incident) { if ($id_incident < 1) { return 0; } @@ -230,7 +230,7 @@ function get_incidents_group ($id_incident) { * * @return bool True if incident was succesfully deleted, false if not */ -function delete_incidents ($id_incident) { +function incidents_delete_incident ($id_incident) { global $config; $ids = (array) safe_int ($id_incident, 1); //Make the input an array $notes = array (); @@ -247,15 +247,15 @@ function delete_incidents ($id_incident) { $errors++; } //We only need the ID's - $notes = array_merge ($notes, array_keys (get_incidents_notes ($id_inc))); - $attachments = array_merge ($attachments, array_keys (get_incidents_attach ($id_inc))); + $notes = array_merge ($notes, array_keys (incidents_get_notes ($id_inc))); + $attachments = array_merge ($attachments, array_keys (incidents_get_attach ($id_inc))); db_pandora_audit("Incident deleted", $config['id_user']." deleted incident #".$id_inc); } //Delete notes - $note_err = delete_incidents_note ($notes, false); - $attach_err = delete_incidents_attach ($attachments, false); + $note_err = incidents_delete_note ($notes, false); + $attach_err = incidents_delete_attach ($attachments, false); if ($note_err === false || $attach_err === false) { $errors++; @@ -279,7 +279,7 @@ function delete_incidents ($id_incident) { * * @return bool True if note was succesfully deleted, false if not */ -function delete_incidents_note ($id_note, $transact = true) { +function incidents_delete_note ($id_note, $transact = true) { $id_note = (array) safe_int ($id_note, 1); //cast as array $errors = 0; @@ -318,7 +318,7 @@ function delete_incidents_note ($id_note, $transact = true) { * * @return bool True if attachment was succesfully deleted, false if not */ -function delete_incidents_attach ($id_attach, $transact = true) { +function incidents_delete_attach ($id_attach, $transact = true) { global $config; $id_attach = (array) safe_int ($id_attach, 1); //cast as array @@ -363,7 +363,7 @@ function delete_incidents_attach ($id_attach, $transact = true) { * * @return array An array of all the notes for that incident */ -function get_incidents_notes ($id_incident) { +function incidents_get_notes ($id_incident) { $return = db_get_all_rows_field_filter ("tnota", "id_incident", (int) $id_incident); if ($return === false) { @@ -385,7 +385,7 @@ function get_incidents_notes ($id_incident) { * * @return array An array of all the notes for that incident */ -function get_incidents_attach ($id_incident) { +function incidents_get_attach ($id_incident) { $return = db_get_all_rows_field_filter ("tattachment", "id_incidencia", (int) $id_incident); if ($return === false) { @@ -408,11 +408,19 @@ function get_incidents_attach ($id_incident) { * * @return string User id of the given note. */ -function get_incidents_notes_author ($id_note) { +function incidents_get_notes_author ($id_note) { return (string) db_get_value ('id_usuario', 'tnota', 'id_nota', (int) $id_note); } -function call_api($url, $postparameters = false) { +/** + * Interface to Integria API functionality. + * + * @param string $url Url to Integria API with user, password and option (function to use). + * @param string $postparameters Additional parameters to pass. + * + * @return variant The function result called in the API. + */ +function incidents_call_api($url, $postparameters = false) { $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, $url); @@ -426,7 +434,14 @@ function call_api($url, $postparameters = false) { return $result; } -function xml_to_array($xml) { +/** + * Converts Xml format file to an array datatype. + * + * @param string $xml Xml file to convert. + * + * @return array A Json encoded array with xml content. + */ +function incidents_xml_to_array($xml) { $xmlObj = simplexml_load_string($xml); return json_decode(json_encode($xmlObj), true); } diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php index a14a8981c7..bb2cd33333 100755 --- a/pandora_console/include/functions_io.php +++ b/pandora_console/include/functions_io.php @@ -1,4 +1,24 @@ $id_agent_module); - enterprise_hook('deleteLocalModuleInConf', array(get_agentmodule_agent($id_agent_module), get_agentmodule_name($id_agent_module))); + enterprise_hook('deleteLocalModuleInConf', array(modules_get_agentmodule_agent($id_agent_module), modules_get_agentmodule_name($id_agent_module))); db_process_sql_delete ('talert_template_modules', $where); db_process_sql_delete ('tgraph_source', $where); @@ -175,7 +175,7 @@ function delete_agent_module ($id_agent_module) { * * @return True if the module was updated. False if not. */ -function update_agent_module ($id, $values, $onlyNoDeletePending = false) { +function modules_update_agent_module ($id, $values, $onlyNoDeletePending = false) { if (! is_array ($values) || empty ($values)) return false; @@ -204,7 +204,7 @@ function update_agent_module ($id, $values, $onlyNoDeletePending = false) { * * @return New module id if the module was created. False if not. */ -function create_agent_module ($id_agent, $name, $values = false, $disableACL = false) { +function modules_create_agent_module ($id_agent, $name, $values = false, $disableACL = false) { global $config; if (!$disableACL) { @@ -283,7 +283,7 @@ function create_agent_module ($id_agent, $name, $values = false, $disableACL = f * * @return array All the agents which have a module with the name given. */ -function get_agents_with_module_name ($module_name, $id_group, $filter = false, $fields = 'tagente.*') { +function modules_get_agents_with_module_name ($module_name, $id_group, $filter = false, $fields = 'tagente.*') { if (empty ($module_name)) return false; @@ -301,29 +301,57 @@ function get_agents_with_module_name ($module_name, $id_group, $filter = false, // This are functions to format the data // -function format_time($ts) +/** + * Formats time data to tiemstamp format. + * + * @param numeric Numeric data. + * + * @return string HTML Code with data time with timestamp format. + */ +function modules_format_time($ts) { return ui_print_timestamp ($ts, true, array("prominent" => "comparation")); } -function format_data($data) +/** + * Formats module data. + * + * @param variant Numeric or string data. + * + * @return variant Module data formated. + */ +function modules_format_data($data) { if (is_numeric ($data)) { $data = format_numeric($data, 2); } else { - $data = safe_input ($data); + $data = io_safe_input ($data); } return $data; } -function format_verbatim($data){ +/** + * Formats verbatim to string data. + * + * @param string String data. + * + * @return string HTML string data with verbatim format. + */ +function modules_format_verbatim($data){ // We need to replace \n by
to create a "similar" output to // information recolected in logs. $data2 = preg_replace ("/\\n/", "
", $data); return "" . $data2 . ""; } -function format_timestamp($ts) +/** + * Formats data time to timestamp format. + * + * @param int Data time. + * + * @return int Data time with timestamp format. + */ +function modules_format_timestamp($ts) { global $config; @@ -333,7 +361,14 @@ function format_timestamp($ts) return date ($config["date_format"], $ts); } -function format_delete($id) +/** + * Writes HTML code to perform delete module action for a particular module. + * + * @param int Id of the module. + * + * @return string HTML code to perform delete action. + */ +function modules_format_delete($id) { global $period, $module_id, $config, $group; @@ -345,7 +380,14 @@ function format_delete($id) return $txt; } -function format_delete_string($id) +/** + * Writes HTML code to perform delete string module action for a particular module. + * + * @param int Id of the module. + * + * @return string HTML code to perform delete action. + */ +function modules_format_delete_string($id) { global $period, $module_id, $config, $group; @@ -357,7 +399,14 @@ function format_delete_string($id) return $txt; } -function format_delete_log4x($id) +/** + * Writes HTML code to perform delete log4x module action for a particular module. + * + * @param int Id of the module. + * + * @return string HTML code to perform delete action. + */ +function modules_format_delete_log4x($id) { global $period, $module_id, $config, $group; @@ -376,7 +425,7 @@ function format_delete_log4x($id) * * @return array An array with module information */ -function get_agentmodule ($id_agentmodule) { +function modules_get_agentmodule ($id_agentmodule) { return db_get_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); } @@ -388,7 +437,7 @@ function get_agentmodule ($id_agentmodule) { * * @return int the agentmodule id */ -function get_agentmodule_id ($agentmodule_name, $agent_id) { +function modules_get_agentmodule_id ($agentmodule_name, $agent_id) { return db_get_row_filter ('tagente_modulo', array('nombre' => $agentmodule_name, 'id_agente' => $agent_id, 'delete_pending' => 0)); } @@ -399,7 +448,7 @@ function get_agentmodule_id ($agentmodule_name, $agent_id) { * * @return bool true if is init and false if is not init */ -function get_agentmodule_is_init ($id_agentmodule) { +function modules_get_agentmodule_is_init ($id_agentmodule) { $result = db_get_row_filter ('tagente_estado', array('id_agente_modulo' => $id_agentmodule), 'utimestamp'); return (bool)$result['utimestamp']; } @@ -412,7 +461,7 @@ function get_agentmodule_is_init ($id_agentmodule) { * * @return int The number of agent modules */ -function get_agent_modules_count ($id_agent = 0) { +function modules_get_agent_modules_count ($id_agent = 0) { //Make sure we're all int's and filter out bad stuff $id_agent = safe_int ($id_agent, 1); @@ -434,7 +483,7 @@ function get_agent_modules_count ($id_agent = 0) { * * @return string The name of the given type. */ -function get_module_type_name ($id_type) { +function modules_get_type_name ($id_type) { return (string) db_get_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type); } @@ -445,7 +494,7 @@ function get_module_type_name ($id_type) { * * @return string The name of the icon. */ -function get_module_type_icon ($id_type) { +function modules_get_type_icon ($id_type) { return (string) db_get_value ('icon', 'ttipo_modulo', 'id_tipo', (int) $id_type); } @@ -456,7 +505,7 @@ function get_module_type_icon ($id_type) { * * @return int The id of the agent of given agent module */ -function get_agentmodule_agent ($id_agentmodule) { +function modules_get_agentmodule_agent ($id_agentmodule) { return (int) db_get_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); } @@ -467,9 +516,9 @@ function get_agentmodule_agent ($id_agentmodule) { * * @return string The name of the given agent module. */ -function get_agentmodule_agent_name ($id_agentmodule) { +function modules_get_agentmodule_agent_name ($id_agentmodule) { // Since this is a helper function we don't need to do casting - return (string) get_agent_name (get_agentmodule_agent ($id_agentmodule)); + return (string) get_agent_name (modules_get_agentmodule_agent ($id_agentmodule)); } /** @@ -479,7 +528,7 @@ function get_agentmodule_agent_name ($id_agentmodule) { * * @return string Name of the given agent module. */ -function get_agentmodule_name ($id_agente_modulo) { +function modules_get_agentmodule_name ($id_agente_modulo) { return (string) db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', (int) $id_agente_modulo); } @@ -490,7 +539,7 @@ function get_agentmodule_name ($id_agente_modulo) { * * @return string Module type of the given agent module. */ -function get_agentmodule_type ($id_agentmodule) { +function modules_get_agentmodule_type ($id_agentmodule) { return (int) db_get_value ('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); } @@ -503,7 +552,7 @@ function get_agentmodule_type ($id_agentmodule) { * * @return int The number of times a monitor went down. */ -function get_monitor_downs_in_period ($id_agent_module, $period, $date = 0) { +function modules_get_monitor_downs_in_period ($id_agent_module, $period, $date = 0) { global $config; if ($date == 0) { @@ -550,7 +599,7 @@ function get_monitor_downs_in_period ($id_agent_module, $period, $date = 0) { * * @return int The last time a monitor went down. */ -function get_monitor_last_down_timestamp_in_period ($id_agent_module, $period, $date = 0) { +function modules_get_last_down_timestamp_in_period ($id_agent_module, $period, $date = 0) { global $config; if ($date == 0) { @@ -595,7 +644,7 @@ function get_monitor_last_down_timestamp_in_period ($id_agent_module, $period, $ * * @return array An array with all the monitors defined in the group (tagente_modulo). */ -function get_monitors_in_group ($id_group) { +function modules_get_monitors_in_group ($id_group) { global $config; if ($id_group <= 0) { @@ -636,7 +685,7 @@ function get_monitors_in_group ($id_group) { * * @return array An array with all the monitors defined (tagente_modulo). */ -function get_monitors_in_agent ($id_agent) { +function modules_get_monitors_in_agent ($id_agent) { global $config; switch ($config["dbtype"]) { @@ -673,13 +722,13 @@ function get_monitors_in_agent ($id_agent) { * @return array An array with all the monitors that went down in that * period of time. */ -function get_monitors_down ($monitors, $period = 0, $date = 0) { +function modules_get_monitors_down ($monitors, $period = 0, $date = 0) { $monitors_down = array (); if (empty ($monitors)) return $monitors_down; foreach ($monitors as $monitor) { - $down = get_monitor_downs_in_period ($monitor['id_agente_modulo'], $period, $date); + $down = modules_get_monitor_downs_in_period ($monitor['id_agente_modulo'], $period, $date); if ($down > 0) array_push ($monitors_down, $monitor); } @@ -693,7 +742,7 @@ function get_monitors_down ($monitors, $period = 0, $date = 0) { * * @return string Name of the given type. */ -function get_moduletype_name ($id_type) { +function modules_get_moduletype_name ($id_type) { return (string) db_get_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type); } @@ -704,7 +753,7 @@ function get_moduletype_name ($id_type) { * * @return string Description of the given type. */ -function get_moduletype_description ($id_type) { +function modules_get_moduletype_description ($id_type) { return (string) db_get_value ('descripcion', 'ttipo_modulo', 'id_tipo', (int) $id_type); } @@ -718,7 +767,7 @@ function get_moduletype_description ($id_type) { * * @return array Either the full table or if a type is specified, an array with id's */ -function get_moduletypes ($type = "all", $rows = "nombre") { +function modules_get_moduletypes ($type = "all", $rows = "nombre") { $return = array (); $rows = (array) $rows; //Cast as array $row_cnt = count ($rows); @@ -755,12 +804,12 @@ function get_moduletypes ($type = "all", $rows = "nombre") { * * @return int Module interval or agent interval if no module interval */ -function get_module_interval ($id_agent_module) { +function modules_get_interval ($id_agent_module) { $interval = (int) db_get_value ('module_interval', 'tagente_modulo', 'id_agente_modulo', (int) $id_agent_module); if ($interval > 0) return $interval; - $id_agent = give_agent_id_from_module_id ($id_agent_module); + $id_agent = modules_give_agent_id_from_module_id ($id_agent_module); return (int) get_agent_interval ($id_agent); } @@ -774,7 +823,7 @@ function get_module_interval ($id_agent_module) { * * @return string Icon filename of the given group */ -function show_icon_type ($id_type) { +function modules_show_icon_type ($id_type) { return (string) db_get_value ('icon', 'ttipo_modulo', 'id_tipo', $id_type); } @@ -785,7 +834,7 @@ function show_icon_type ($id_type) { * * @return Name of the given category */ -function give_modulecategory_name ($id_category) { +function modules_give_modulecategory_name ($id_category) { switch ($id_category) { case 0: return __('Software agent data'); @@ -811,7 +860,7 @@ function give_modulecategory_name ($id_category) { * * @return int The agent id of the given module. */ -function give_agent_id_from_module_id ($id_agent_module) { +function modules_give_agent_id_from_module_id ($id_agent_module) { return (int) db_get_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_agent_module); } @@ -824,7 +873,7 @@ function give_agent_id_from_module_id ($id_agent_module) { * @return int Module status. Value 4 means that some alerts assigned to the * module were fired. */ -function get_agentmodule_status($id_agentmodule = 0, $without_alerts = false) { +function modules_get_agentmodule_status($id_agentmodule = 0, $without_alerts = false) { $current_timestamp = get_system_time (); if (!$without_alerts) { @@ -846,7 +895,7 @@ function get_agentmodule_status($id_agentmodule = 0, $without_alerts = false) { * * @return int Module last status. */ -function get_agentmodule_last_status($id_agentmodule = 0) { +function modules_get_agentmodule_last_status($id_agentmodule = 0) { $status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule); return $status_row['last_status']; @@ -860,7 +909,7 @@ function get_agentmodule_last_status($id_agentmodule = 0) { * @return int Worst status of a module for all of its agents. * The value -1 is returned in case the agent has exceed its interval. <-- DISABLED */ -function get_module_status ($id_module = 0) { +function modules_get_status ($id_module = 0) { $time = get_system_time (); $status = db_get_sql ("SELECT estado @@ -882,7 +931,7 @@ function get_module_status ($id_module = 0) { * * @return int a numerically formatted value */ -function get_agent_module_last_value ($id_agentmodule) { +function modules_get_last_value ($id_agentmodule) { return db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $id_agentmodule); } @@ -901,7 +950,7 @@ function get_agent_module_last_value ($id_agentmodule) { * * @return mixed The row of tagente_datos of the last period. False if there were no data. */ -function get_previous_data ($id_agent_module, $utimestamp = 0, $string = 0) { +function modules_get_previous_data ($id_agent_module, $utimestamp = 0, $string = 0) { if (empty ($utimestamp)) $utimestamp = time (); @@ -933,7 +982,7 @@ function get_previous_data ($id_agent_module, $utimestamp = 0, $string = 0) { * * @return mixed The row of tagente_datos of the last period. False if there were no data. */ -function get_next_data ($id_agent_module, $utimestamp = 0, $string = 0) { +function modules_get_next_data ($id_agent_module, $utimestamp = 0, $string = 0) { if (empty ($utimestamp)) $utimestamp = time (); @@ -944,7 +993,7 @@ function get_next_data ($id_agent_module, $utimestamp = 0, $string = 0) { $table = 'tagente_datos'; } - $interval = get_module_interval ($id_agent_module); + $interval = modules_get_interval ($id_agent_module); $sql = sprintf ('SELECT * FROM tagente_datos WHERE id_agente_modulo = %d @@ -965,7 +1014,7 @@ function get_next_data ($id_agent_module, $utimestamp = 0, $string = 0) { * * @return array The module value and the timestamp */ -function get_agentmodule_data ($id_agent_module, $period, $date = 0) { +function modules_get_agentmodule_data ($id_agent_module, $period, $date = 0) { if ($date < 1) { $date = get_system_time (); } @@ -985,9 +1034,9 @@ function get_agentmodule_data ($id_agent_module, $period, $date = 0) { return array (); } - $module_name = get_agentmodule_name ($id_agent_module); - $agent_id = get_agentmodule_agent ($id_agent_module); - $agent_name = get_agentmodule_agent_name ($id_agent_module); + $module_name = modules_get_agentmodule_name ($id_agent_module); + $agent_id = modules_get_agentmodule_agent ($id_agent_module); + $agent_name = modules_get_agentmodule_agent_name ($id_agent_module); foreach ($values as $key => $data) { $values[$key]["module_name"] = $module_name; @@ -1005,7 +1054,7 @@ function get_agentmodule_data ($id_agent_module, $period, $date = 0) { * * @return int The modulegroup id */ -function get_agentmodule_modulegroup ($id_module) { +function modules_get_agentmodule_modulegroup ($id_module) { return (int) db_get_value ('id_module_group', 'tagente_modulo', 'id_agente_modulo', (int) $id_module); } @@ -1016,7 +1065,7 @@ function get_agentmodule_modulegroup ($id_module) { * * @return array All module groups */ -function get_modulegroups () { +function modules_get_modulegroups () { $result = db_get_all_fields_in_table ("tmodule_group"); $return = array (); @@ -1038,7 +1087,7 @@ function get_modulegroups () { * * @return string The modulegroup name */ -function get_modulegroup_name ($modulegroup_id) { +function modules_get_modulegroup_name ($modulegroup_id) { if($modulegroup_id == 0) return false; else diff --git a/pandora_console/include/functions_network_components.php b/pandora_console/include/functions_network_components.php index 1d4811557d..ca8f7f0a6c 100644 --- a/pandora_console/include/functions_network_components.php +++ b/pandora_console/include/functions_network_components.php @@ -15,7 +15,7 @@ /** * @package Include - * @subpackage Modules + * @subpackage Network components */ /** @@ -33,15 +33,15 @@ require_once ('include/functions_users.php'); * (keys would be the field name and value the expected value, and would be * joined with an AND operator). Examples: * - * $components = get_network_components ($id_module, array ('id_module_group', 10)); - * $components = get_network_components ($id_module, 'id_module_group = 10')); + * $components = network_components_get_network_components ($id_module, array ('id_module_group', 10)); + * $components = network_components_get_network_components ($id_module, 'id_module_group = 10')); * * @param mixed Fields to retrieve on each component. * * @return array A list of network components matching. Empty array is returned * if none matches. */ -function get_network_components ($id_module, $filter = false, $fields = false) { +function network_components_get_network_components ($id_module, $filter = false, $fields = false) { global $config; if (! is_array ($filter)) @@ -87,7 +87,7 @@ function get_network_components ($id_module, $filter = false, $fields = false) { * * @return string The name of the components group. */ -function get_network_component_group_name ($id_network_component_group) { +function network_components_get_group_name ($id_network_component_group) { if (empty ($id_network_component_group)) return false; @@ -103,7 +103,7 @@ function get_network_component_group_name ($id_network_component_group) { * * @return array A network component group matching id and filter. */ -function get_network_component_group ($id_network_component_group, $filter = false, $fields = false) { +function network_components_get_group ($id_network_component_group, $filter = false, $fields = false) { if (empty ($id_network_component_group)) return false; if (! is_array ($filter)) @@ -127,7 +127,7 @@ function get_network_component_group ($id_network_component_group, $filter = fal * * @return array An ordered list of component groups with childs indented. */ -function get_network_component_groups ($id_module_components = 0, $localComponent = false) { +function network_components_get_groups ($id_module_components = 0, $localComponent = false) { /* Special vars to keep track of indentation level */ static $level = 0; static $id_parent = 0; @@ -145,7 +145,7 @@ function get_network_component_groups ($id_module_components = 0, $localComponen $level++; $tmp = $id_parent; $id_parent = (int) $group['id_sg']; - $childs = get_network_component_groups ($id_module_components, $localComponent); + $childs = network_components_get_groups ($id_module_components, $localComponent); $id_parent = $tmp; $level--; @@ -194,7 +194,7 @@ function get_network_component_groups ($id_module_components = 0, $localComponen * * @return array A network component matching id and filter. */ -function get_network_component ($id_network_component, $filter = false, $fields = false) { +function network_components_get_network_component ($id_network_component, $filter = false, $fields = false) { if (empty ($id_network_component)) return false; if (! is_array ($filter)) @@ -214,7 +214,7 @@ function get_network_component ($id_network_component, $filter = false, $fields * * @return int New component id. False on error. */ -function create_network_component ($name, $type, $id_group, $values = false) { +function network_components_create_network_component ($name, $type, $id_group, $values = false) { global $config; switch ($config['dbtype']) { @@ -246,10 +246,10 @@ function create_network_component ($name, $type, $id_group, $values = false) { * * @return bool True if updated. False on error. */ -function update_network_component ($id_network_component, $values = false) { +function network_components_update_network_component ($id_network_component, $values = false) { if (empty ($id_network_component)) return false; - $component = get_network_component ($id_network_component); + $component = network_components_get_network_component ($id_network_component); if (empty ($component)) return false; if (! is_array ($values)) @@ -268,7 +268,7 @@ function update_network_component ($id_network_component, $values = false) { * * @return bool True if deleted. False on error. */ -function delete_network_component ($id_network_component) { +function network_components_delete_network_component ($id_network_component) { if (empty ($id_network_component)) return false; $filter = array (); @@ -288,10 +288,10 @@ function delete_network_component ($id_network_component) { * * @return array New agent module id if created. False if could not be created */ -function create_agent_module_from_network_component ($id_network_component, $id_agent) { +function network_components_create_module_from_network_component ($id_network_component, $id_agent) { if (! user_access_to_agent ($id_agent, 'AW')) return false; - $component = get_network_component ($id_network_component, + $component = network_components_get_network_component ($id_network_component, false, array ('name', 'description AS descripcion', @@ -326,7 +326,7 @@ function create_agent_module_from_network_component ($id_network_component, $id_ unset ($values['name']); $values['ip_target'] = get_agent_address ($id_agent); - return create_agent_module ($id_agent, $name, $values); + return modules_create_agent_module ($id_agent, $name, $values); } /** @@ -336,7 +336,7 @@ function create_agent_module_from_network_component ($id_network_component, $id_ * * @return Component name with the given id. False if not available or readable. */ -function get_network_component_name ($id_network_component) { +function network_components_get_name ($id_network_component) { if (empty ($id_network_component)) return false; return @db_get_value ('name', 'tnetwork_component', 'id', $id_network_component); @@ -346,8 +346,8 @@ function get_network_component_name ($id_network_component) { * Duplicate local compoment. * @param integer id_local_component Id of localc component for duplicate. */ -function duplicate_network_component ($id_local_component) { - $network = get_network_component ($id_local_component); +function network_components_duplicate_network_component ($id_local_component) { + $network = network_components_get_network_component ($id_local_component); if ($network === false) return false; @@ -377,6 +377,6 @@ function duplicate_network_component ($id_local_component) { $networkCopy['max_critical'] = $network['max_critical']; $networkCopy['min_ff_event'] = $network['min_ff_event']; - return create_network_component ($name, $network['type'], $network['id_group'], $networkCopy); + return network_components_create_network_component ($name, $network['type'], $network['id_group'], $networkCopy); } ?> diff --git a/pandora_console/include/functions_network_profiles.php b/pandora_console/include/functions_network_profiles.php index 28dbead8cc..da41361305 100644 --- a/pandora_console/include/functions_network_profiles.php +++ b/pandora_console/include/functions_network_profiles.php @@ -16,7 +16,7 @@ /** * @package Include - * @subpackage Modules + * @subpackage Network profiles */ /** @@ -28,7 +28,7 @@ * * @return Profile with the given id. False if not available or readable. */ -function get_network_profile ($id_network_profile, $filter = false, $fields = false) { +function network_profiles_get_network_profile ($id_network_profile, $filter = false, $fields = false) { global $config; $id_network_profile = safe_int ($id_network_profile); @@ -48,11 +48,11 @@ function get_network_profile ($id_network_profile, $filter = false, $fields = fa * * @return bool True if deleted, false otherwise. */ -function delete_network_profile ($id_network_profile) { +function network_profiles_delete_network_profile ($id_network_profile) { $id_network_profile = safe_int ($id_network_profile); if (empty ($id_network_profile)) return false; - $profile = get_network_profile ($id_network_profile); + $profile = network_profiles_get_network_profile ($id_network_profile); if ($profile === false) return false; return @db_process_sql_delete ('tnetwork_profile', @@ -66,7 +66,7 @@ function delete_network_profile ($id_network_profile) { * * @return string Name of the given network profile. */ -function get_networkprofile_name ($id_network_profile) { +function network_profiles_get_name ($id_network_profile) { return (string) db_get_value ('name', 'tnetwork_profile', 'id_np', $id_network_profile); } diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 70bdeeb838..a8c3bd56c1 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -29,7 +29,7 @@ ui_require_css_file ('cluetip'); ui_require_jquery_file ('cluetip'); // Check if a node descends from a given node -function is_descendant ($node, $ascendant, $parents) { +function networkmap_is_descendant ($node, $ascendant, $parents) { if (! isset ($parents[$node])) { return false; } @@ -38,11 +38,11 @@ function is_descendant ($node, $ascendant, $parents) { return true; } - return is_descendant ($parents[$node], $ascendant, $parents); + return networkmap_is_descendant ($parents[$node], $ascendant, $parents); } // Generate a dot graph definition for graphviz -function generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0, $id_networkmap = 0) { +function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0, $id_networkmap = 0) { $parents = array(); $orphans = array(); @@ -58,7 +58,7 @@ function generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12, return false; // Open Graph - $graph = open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $font_size); + $graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $font_size); // Parse agents $nodes = array (); @@ -81,21 +81,21 @@ function generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12, } // Create nodes foreach ($nodes as $node_id => $node) { - if ($center > 0 && ! is_descendant ($node_id, $center, $parents)) { + if ($center > 0 && ! networkmap_is_descendant ($node_id, $center, $parents)) { unset ($parents[$node_id]); unset ($orphans[$node_id]); unset ($nodes[$node_id]); continue; } - $graph .= create_agent_node ($node , $simple, $font_size)."\n\t\t"; + $graph .= networkmap_create_agent_node ($node , $simple, $font_size)."\n\t\t"; } // Define edges foreach ($parents as $node => $parent_id) { // Verify that the parent is in the graph if (isset ($nodes[$parent_id])) { - $graph .= create_edge ($node, $parent_id, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'topology', $id_networkmap); + $graph .= networkmap_create_edge ($node, $parent_id, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'topology', $id_networkmap); } else { $orphans[$node] = 1; } @@ -103,22 +103,22 @@ function generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12, // Create a central node if orphan nodes exist if (count ($orphans)) { - $graph .= create_pandora_node ($pandora_name, $font_size, $simple); + $graph .= networkmap_create_pandora_node ($pandora_name, $font_size, $simple); } // Define edges for orphan nodes foreach (array_keys($orphans) as $node) { - $graph .= create_edge ('0', $node, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'topology', $id_networkmap); + $graph .= networkmap_create_edge ('0', $node, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'topology', $id_networkmap); } // Close graph - $graph .= close_graph (); + $graph .= networkmap_close_graph (); return $graph; } // Generate a dot graph definition for graphviz with groups -function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0, $modwithalerts = 0, $module_group = 0, $hidepolicymodules = 0, $depth = 'all', $id_networkmap = 0) { +function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0, $modwithalerts = 0, $module_group = 0, $hidepolicymodules = 0, $depth = 'all', $id_networkmap = 0) { global $config; $parents = array(); @@ -145,7 +145,7 @@ function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size } // Open Graph - $graph = open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $font_size); + $graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $font_size); $node_count = 0; @@ -206,7 +206,7 @@ function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size // Parse modules foreach ($modules as $key => $module) { $node_count ++; - $agent_module = get_agentmodule($key); + $agent_module = modules_get_agentmodule($key); $alerts_module = db_get_sql('SELECT count(*) as num FROM talert_template_modules WHERE id_agent_module = '.$key); @@ -242,7 +242,7 @@ function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size } // Create nodes foreach ($nodes as $node_id => $node) { - if ($center > 0 && ! is_descendant ($node_id, $center, $parents)) { + if ($center > 0 && ! networkmap_is_descendant ($node_id, $center, $parents)) { unset ($parents[$node_id]); unset ($orphans[$node_id]); unset ($nodes[$node_id]); @@ -251,13 +251,13 @@ function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size switch($node['type']){ case 'group': - $graph .= create_group_node ($node , $simple, $font_size)."\n\t\t"; + $graph .= networkmap_create_group_node ($node , $simple, $font_size)."\n\t\t"; break; case 'agent': - $graph .= create_agent_node ($node , $simple, $font_size)."\n\t\t"; + $graph .= networkmap_create_agent_node ($node , $simple, $font_size)."\n\t\t"; break; case 'module': - $graph .= create_module_node ($node , $simple, $font_size)."\n\t\t"; + $graph .= networkmap_create_module_node ($node , $simple, $font_size)."\n\t\t"; break; } } @@ -266,7 +266,7 @@ function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size foreach ($parents as $node => $parent_id) { // Verify that the parent is in the graph if (isset ($nodes[$parent_id])) { - $graph .= create_edge ($node, $parent_id, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'groups', $id_networkmap); + $graph .= networkmap_create_edge ($node, $parent_id, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'groups', $id_networkmap); } else { $orphans[$node] = 1; } @@ -274,22 +274,22 @@ function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size // Create a central node if orphan nodes exist if (count ($orphans)) { - $graph .= create_pandora_node ($pandora_name, $font_size, $simple); + $graph .= networkmap_create_pandora_node ($pandora_name, $font_size, $simple); } // Define edges for orphan nodes foreach (array_keys($orphans) as $node) { - $graph .= create_edge ('0', $node, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'groups', $id_networkmap); + $graph .= networkmap_create_edge ('0', $node, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'groups', $id_networkmap); } // Close graph - $graph .= close_graph (); + $graph .= networkmap_close_graph (); return $graph; } // Returns an edge definition -function create_edge ($head, $tail, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, $sec2 = 'operation/agentes/networkmap', $tab = 'topology', $id_networkmap = 0) { +function networkmap_create_edge ($head, $tail, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, $sec2 = 'operation/agentes/networkmap', $tab = 'topology', $id_networkmap = 0) { // edgeURL allows node navigation $edge = $head.' -- '.$tail.'[color="#BDBDBD", headclip=false, tailclip=false, @@ -302,7 +302,7 @@ function create_edge ($head, $tail, $layout, $nooverlap, $pure, $zoom, $ranksep, } // Returns a group node definition -function create_group_node ($group, $simple = 0, $font_size = 10) { +function networkmap_create_group_node ($group, $simple = 0, $font_size = 10) { $status = groups_get_status ($group['id_grupo']); // Set node status @@ -347,7 +347,7 @@ function create_group_node ($group, $simple = 0, $font_size = 10) { } // Returns a node definition -function create_agent_node ($agent, $simple = 0, $font_size = 10) { +function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10) { $status = get_agent_status($agent['id_agente']); // Set node status @@ -393,8 +393,8 @@ function create_agent_node ($agent, $simple = 0, $font_size = 10) { } // Returns a module node definition -function create_module_node ($module, $simple = 0, $font_size = 10) { - $status = get_agentmodule_status($module['id_agente_modulo']); +function networkmap_create_module_node ($module, $simple = 0, $font_size = 10) { + $status = modules_get_agentmodule_status($module['id_agente_modulo']); // Set node status switch($status) { @@ -428,7 +428,7 @@ function create_module_node ($module, $simple = 0, $font_size = 10) { } // Returns the definition of the central module -function create_pandora_node ($name, $font_size = 10, $simple = 0) { +function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0) { $img = ''; $name = ''; $label = '
' . html_print_image("images/networkmap/pandora_node.png", true) . '
'.$name.'
'.$img.$name.'
'; @@ -443,7 +443,7 @@ function create_pandora_node ($name, $font_size = 10, $simple = 0) { } // Opens a group definition -function open_group ($id) { +function networkmap_open_group ($id) { $img = 'images/'.groups_get_icon ($id).'.png'; $name = groups_get_name ($id); @@ -458,12 +458,12 @@ function open_group ($id) { } // Closes a group definition -function close_group () { +function networkmap_close_group () { return '}'; } // Opens a graph definition -function open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $font_size) { +function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $font_size) { $overlap = 'compress'; $size_x = 8; $size_y = 5.4; @@ -501,12 +501,12 @@ function open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $font_size) { } // Closes a graph definition -function close_graph () { +function networkmap_close_graph () { return '}'; } // Returns the filter used to achieve the desired layout -function get_filter ($layout) { +function networkmap_get_filter ($layout) { switch($layout) { case 'flat': return 'dot'; @@ -543,7 +543,7 @@ function get_filter ($layout) { * * @return mixed New networkmap id if created. False if it could not be created. */ -function create_networkmap ($name, $type = 'topology', $layout = 'radial', $nooverlap = true, $simple = false, $regenerate = true, $font_size = 12, $id_group = 0, $id_module_group = 0, $depth = 'all', $only_modules_with_alerts = false, $hide_policy_modules = false, $zoom = 1, $distance_nodes = 2.5, $center = 0) { +function networkmap_create_networkmap ($name, $type = 'topology', $layout = 'radial', $nooverlap = true, $simple = false, $regenerate = true, $font_size = 12, $id_group = 0, $id_module_group = 0, $depth = 'all', $only_modules_with_alerts = false, $hide_policy_modules = false, $zoom = 1, $distance_nodes = 2.5, $center = 0) { global $config; @@ -578,7 +578,7 @@ function create_networkmap ($name, $type = 'topology', $layout = 'radial', $noov * * @return Networkmap with the given id. False if not available or readable. */ -function get_networkmap ($id_networkmap, $filter = false, $fields = false) { +function networkmap_get_networkmap ($id_networkmap, $filter = false, $fields = false) { global $config; $id_networkmap = safe_int ($id_networkmap); @@ -604,7 +604,7 @@ function get_networkmap ($id_networkmap, $filter = false, $fields = false) { * * @return Networkmap with the given id. False if not available or readable. */ -function get_networkmaps ($id_user = '', $type = '', $optgrouped = true) { +function networkmap_get_networkmaps ($id_user = '', $type = '', $optgrouped = true) { global $config; if($id_user == '') { @@ -659,11 +659,11 @@ function get_networkmaps ($id_user = '', $type = '', $optgrouped = true) { * * @return bool True if the map was deleted, false otherwise. */ -function delete_networkmap ($id_networkmap) { +function networkmap_delete_networkmap ($id_networkmap) { $id_networkmap = safe_int ($id_networkmap); if (empty ($id_networkmap)) return false; - $networkmap = get_networkmap ($id_networkmap); + $networkmap = networkmap_get_networkmap ($id_networkmap); if ($networkmap === false) return false; return @db_process_sql_delete ('tnetwork_map', array ('id_networkmap' => $id_networkmap)); @@ -677,8 +677,8 @@ function delete_networkmap ($id_networkmap) { * * @return bool True if the map was updated. False otherwise. */ -function update_networkmap ($id_networkmap, $values) { - $networkmap = get_networkmap ($id_networkmap); +function networkmap_update_networkmap ($id_networkmap, $values) { + $networkmap = networkmap_get_networkmap ($id_networkmap); if ($networkmap === false) return false; return (db_process_sql_update ('tnetwork_map', diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 5cef084c08..d71d883e1e 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -42,7 +42,7 @@ include_once($config['homedir'] . '/include/functions_users.php'); * * @return float The average module value in the interval. */ -function get_agentmodule_data_average ($id_agent_module, $period, $date = 0) { +function reporting_get_agentmodule_data_average ($id_agent_module, $period, $date = 0) { global $config; // Initialize variables @@ -50,8 +50,8 @@ function get_agentmodule_data_average ($id_agent_module, $period, $date = 0) { if ((empty ($period)) OR ($period == 0)) $period = $config["sla_period"]; $datelimit = $date - $period; - $id_module_type = get_agentmodule_type ($id_agent_module); - $module_type = get_moduletype_name ($id_module_type); + $id_module_type = modules_get_agentmodule_type ($id_agent_module); + $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); // Get module data @@ -70,14 +70,14 @@ function get_agentmodule_data_average ($id_agent_module, $period, $date = 0) { } else { // Get previous data - $previous_data = get_previous_data ($id_agent_module, $datelimit); + $previous_data = modules_get_previous_data ($id_agent_module, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($interval_data, $previous_data); } // Get next data - $next_data = get_next_data ($id_agent_module, $date); + $next_data = modules_get_next_data ($id_agent_module, $date); if ($next_data !== false) { $next_data['utimestamp'] = $date; array_push ($interval_data, $next_data); @@ -140,7 +140,7 @@ function get_agentmodule_data_average ($id_agent_module, $period, $date = 0) { * * @return float The maximum module value in the interval. */ -function get_agentmodule_data_max ($id_agent_module, $period, $date = 0) { +function reporting_get_agentmodule_data_max ($id_agent_module, $period, $date = 0) { global $config; // Initialize variables @@ -148,8 +148,8 @@ function get_agentmodule_data_max ($id_agent_module, $period, $date = 0) { if ((empty ($period)) OR ($period == 0)) $period = $config["sla_period"]; $datelimit = $date - $period; - $id_module_type = get_agentmodule_type ($id_agent_module); - $module_type = get_moduletype_name ($id_module_type); + $id_module_type = modules_get_agentmodule_type ($id_agent_module); + $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); // Get module data @@ -166,14 +166,14 @@ function get_agentmodule_data_max ($id_agent_module, $period, $date = 0) { // Compressed module data } else { // Get previous data - $previous_data = get_previous_data ($id_agent_module, $datelimit); + $previous_data = modules_get_previous_data ($id_agent_module, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($interval_data, $previous_data); } // Get next data - $next_data = get_next_data ($id_agent_module, $date); + $next_data = modules_get_next_data ($id_agent_module, $date); if ($next_data !== false) { $next_data['utimestamp'] = $date; array_push ($interval_data, $next_data); @@ -217,7 +217,7 @@ function get_agentmodule_data_max ($id_agent_module, $period, $date = 0) { * * @return float The minimum module value of the module */ -function get_agentmodule_data_min ($id_agent_module, $period, $date = 0) { +function reporting_get_agentmodule_data_min ($id_agent_module, $period, $date = 0) { global $config; // Initialize variables @@ -225,8 +225,8 @@ function get_agentmodule_data_min ($id_agent_module, $period, $date = 0) { if ((empty ($period)) OR ($period == 0)) $period = $config["sla_period"]; $datelimit = $date - $period; - $id_module_type = get_agentmodule_type ($id_agent_module); - $module_type = get_moduletype_name ($id_module_type); + $id_module_type = modules_get_agentmodule_type ($id_agent_module); + $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); // Get module data @@ -244,14 +244,14 @@ function get_agentmodule_data_min ($id_agent_module, $period, $date = 0) { // Compressed module data } else { // Get previous data - $previous_data = get_previous_data ($id_agent_module, $datelimit); + $previous_data = modules_get_previous_data ($id_agent_module, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($interval_data, $previous_data); } // Get next data - $next_data = get_next_data ($id_agent_module, $date); + $next_data = modules_get_next_data ($id_agent_module, $date); if ($next_data !== false) { $next_data['utimestamp'] = $date; array_push ($interval_data, $next_data); @@ -289,7 +289,7 @@ function get_agentmodule_data_min ($id_agent_module, $period, $date = 0) { * * @return float The sumatory of the module values in the interval. */ -function get_agentmodule_data_sum ($id_agent_module, $period, $date = 0) { +function reporting_get_agentmodule_data_sum ($id_agent_module, $period, $date = 0) { // Initialize variables if (empty ($date)) $date = get_system_time (); @@ -298,7 +298,7 @@ function get_agentmodule_data_sum ($id_agent_module, $period, $date = 0) { $id_module_type = db_get_value ('id_tipo_modulo', 'tagente_modulo','id_agente_modulo', $id_agent_module); $module_name = db_get_value ('nombre', 'ttipo_modulo', 'id_tipo', $id_module_type); - $module_interval = get_module_interval ($id_agent_module); + $module_interval = modules_get_interval ($id_agent_module); $uncompressed_module = is_module_uncompressed ($module_name); // Wrong module type @@ -325,14 +325,14 @@ function get_agentmodule_data_sum ($id_agent_module, $period, $date = 0) { } else { // Get previous data - $previous_data = get_previous_data ($id_agent_module, $datelimit); + $previous_data = modules_get_previous_data ($id_agent_module, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($interval_data, $previous_data); } // Get next data - $next_data = get_next_data ($id_agent_module, $date); + $next_data = modules_get_next_data ($id_agent_module, $date); if ($next_data !== false) { $next_data['utimestamp'] = $date; array_push ($interval_data, $next_data); @@ -390,7 +390,7 @@ function get_agentmodule_data_sum ($id_agent_module, $period, $date = 0) { * @return float SLA percentage of the requested module. False if no data were * found */ -function get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) { +function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) { global $config; // Initialize variables @@ -461,14 +461,14 @@ function get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $ma } // Get previous data - $previous_data = get_previous_data ($id_agent_module, $datelimit); + $previous_data = modules_get_previous_data ($id_agent_module, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($interval_data, $previous_data); } // Get next data - $next_data = get_next_data ($id_agent_module, $date); + $next_data = modules_get_next_data ($id_agent_module, $date); if ($next_data !== false) { $next_data['utimestamp'] = $date; array_push ($interval_data, $next_data); @@ -534,7 +534,7 @@ function get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $ma * @return Array with values either 1, 2, 3 or 4 depending if the SLA percentage for this subperiod * is within the sla limits, on the edge, outside or with an unknown value. */ -function get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) { +function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) { global $config; // Initialize variables @@ -700,7 +700,7 @@ function get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = * * @return array Group statistics */ -function get_group_stats ($id_group = 0) { +function reporting_get_group_stats ($id_group = 0) { global $config; $data = array (); @@ -1019,7 +1019,7 @@ function get_group_stats ($id_group = 0) { * * @return object A table object */ -function event_reporting ($id_group, $period, $date = 0, $return = false) { +function reporting_event_reporting ($id_group, $period, $date = 0, $return = false) { if (empty ($date)) { $date = get_system_time (); } elseif (!is_numeric ($date)) { @@ -1062,7 +1062,7 @@ function event_reporting ($id_group, $period, $date = 0, $return = false) { * * @return object A table object with a report of the fired alerts. */ -function get_fired_alerts_reporting_table ($alerts_fired) { +function reporting_get_fired_alerts_table ($alerts_fired) { $agents = array (); global $config; @@ -1120,7 +1120,7 @@ function get_fired_alerts_reporting_table ($alerts_fired) { * * @return mixed A table object (XHTML) or object table is false the html. */ -function alert_reporting_agent ($id_agent, $period = 0, $date = 0, $return = true, $html = true) { +function reporting_alert_reporting_agent ($id_agent, $period = 0, $date = 0, $return = true, $html = true) { if (!is_numeric ($date)) { $date = strtotime ($date); } @@ -1213,7 +1213,7 @@ function alert_reporting_agent ($id_agent, $period = 0, $date = 0, $return = tru * * @return mixed A table object (XHTML) or object table is false the html. */ -function alert_reporting_module ($id_agent_module, $period = 0, $date = 0, $return = true, $html = true) { +function reporting_alert_reporting_module ($id_agent_module, $period = 0, $date = 0, $return = true, $html = true) { if (!is_numeric ($date)) { $date = strtotime ($date); } @@ -1299,7 +1299,7 @@ function alert_reporting_module ($id_agent_module, $period = 0, $date = 0, $retu * * @return string */ -function alert_reporting ($id_group, $period = 0, $date = 0, $return = false) { +function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return = false) { global $config; $output = ''; @@ -1327,7 +1327,7 @@ function alert_reporting ($id_group, $period = 0, $date = 0, $return = false) { echo $output; return $output; } - $table = get_fired_alerts_reporting_table ($alerts_fired); + $table = reporting_get_fired_alerts_table ($alerts_fired); $table->width = '100%'; $table->class = 'databox'; $table->size = array (); @@ -1355,24 +1355,24 @@ function alert_reporting ($id_group, $period = 0, $date = 0, $return = false) { * * @return string */ -function monitor_health_reporting ($id_group, $period = 0, $date = 0, $return = false) { +function reporting_monitor_health ($id_group, $period = 0, $date = 0, $return = false) { if (empty ($date)) //If date is 0, false or empty $date = get_system_time (); $datelimit = $date - $period; $output = ''; - $monitors = get_monitors_in_group ($id_group); + $monitors = modules_get_monitors_in_group ($id_group); if (empty ($monitors)) //If monitors has returned false or an empty array return; - $monitors_down = get_monitors_down ($monitors, $period, $date); + $monitors_down = modules_get_monitors_down ($monitors, $period, $date); $down_percentage = round (count ($monitors_down) / count ($monitors) * 100, 2); $not_down_percentage = 100 - $down_percentage; $output .= ''.__('Total monitors').': '.count ($monitors).'
'; $output .= ''.__('Monitors down on period').': '.count ($monitors_down).'
'; - $table = get_monitors_down_reporting_table ($monitors_down); + $table = reporting_get_monitors_down_table ($monitors_down); $table->width = '100%'; $table->class = 'databox'; $table->size = array (); @@ -1403,11 +1403,11 @@ function monitor_health_reporting ($id_group, $period = 0, $date = 0, $return = * Get a report table with all the monitors down. * * @param array An array with all the monitors down - * @see function get_monitors_down() + * @see function modules_get_monitors_down() * * @return object A table object with a monitors down report. */ -function get_monitors_down_reporting_table ($monitors_down) { +function reporting_get_monitors_down_table ($monitors_down) { $table->data = array (); $table->head = array (); $table->head[0] = __('Agent'); @@ -1454,7 +1454,7 @@ function get_monitors_down_reporting_table ($monitors_down) { * * @return HTML string with group report */ -function print_group_reporting ($id_group, $return = false) { +function reporting_print_group_reporting ($id_group, $return = false) { $agents = get_group_agents ($id_group, false, "none"); $output = ''.__('Agents in group').': '.count ($agents).'
'; @@ -1473,7 +1473,7 @@ function print_group_reporting ($id_group, $return = false) { * * @return object A table object with the alert reporting.. */ -function get_agent_alerts_reporting_table ($id_agent, $period = 0, $date = 0) { +function reporting_get_agent_alerts_table ($id_agent, $period = 0, $date = 0) { global $config; $table->data = array (); $table->head = array (); @@ -1543,19 +1543,19 @@ function get_agent_alerts_reporting_table ($id_agent, $period = 0, $date = 0) { * * @return object A table object with the report. */ -function get_agent_monitors_reporting_table ($id_agent, $period = 0, $date = 0) { +function reporting_get_agent_monitors_table ($id_agent, $period = 0, $date = 0) { $n_a_string = __('N/A').'(*)'; $table->head = array (); $table->head[0] = __('Monitor'); $table->head[1] = __('Last failure'); $table->data = array (); - $monitors = get_monitors_in_agent ($id_agent); + $monitors = modules_get_monitors_in_agent ($id_agent); if ($monitors === false) { return $table; } foreach ($monitors as $monitor) { - $downs = get_monitor_downs_in_period ($monitor['id_agente_modulo'], $period, $date); + $downs = modules_get_monitor_downs_in_period ($monitor['id_agente_modulo'], $period, $date); if (! $downs) { continue; } @@ -1564,7 +1564,7 @@ function get_agent_monitors_reporting_table ($id_agent, $period = 0, $date = 0) $data[0] = $monitor['descripcion']; else $data[0] = $monitor['nombre']; - $data[1] = get_monitor_last_down_timestamp_in_period ($monitor['id_agente_modulo'], $period, $date); + $data[1] = modules_get_last_down_timestamp_in_period ($monitor['id_agente_modulo'], $period, $date); array_push ($table->data, $data); } @@ -1580,7 +1580,7 @@ function get_agent_monitors_reporting_table ($id_agent, $period = 0, $date = 0) * * @return object */ -function get_agent_modules_reporting_table ($id_agent, $period = 0, $date = 0) { +function reporting_get_agent_modules_table ($id_agent, $period = 0, $date = 0) { $table->data = array (); $n_a_string = __('N/A').'(*)'; $modules = get_agent_modules ($id_agent, array ("nombre", "descripcion")); @@ -1609,7 +1609,7 @@ function get_agent_modules_reporting_table ($id_agent, $period = 0, $date = 0) { * * @return string */ -function get_agent_detailed_reporting ($id_agent, $period = 0, $date = 0, $return = false) { +function reporting_get_agent_detailed ($id_agent, $period = 0, $date = 0, $return = false) { $output = ''; $n_a_string = __('N/A').'(*)'; @@ -1617,12 +1617,12 @@ function get_agent_detailed_reporting ($id_agent, $period = 0, $date = 0, $retur $output .= '
'; $output .= '

'.__('Agent').' - '.get_agent_name ($id_agent).'

'; $output .= '

'.__('Modules').'

'; - $table_modules = get_agent_modules_reporting_table ($id_agent, $period, $date); + $table_modules = reporting_get_agent_modules_table ($id_agent, $period, $date); $table_modules->width = '99%'; $output .= html_print_table ($table_modules, true); /* Show alerts in agent */ - $table_alerts = get_agent_alerts_reporting_table ($id_agent, $period, $date); + $table_alerts = reporting_get_agent_alerts_table ($id_agent, $period, $date); $table_alerts->width = '99%'; if (sizeof ($table_alerts->data)) { $output .= '

'.__('Alerts').'

'; @@ -1630,7 +1630,7 @@ function get_agent_detailed_reporting ($id_agent, $period = 0, $date = 0, $retur } /* Show monitor status in agent (if any) */ - $table_monitors = get_agent_monitors_reporting_table ($id_agent, $period, $date); + $table_monitors = reporting_get_agent_monitors_table ($id_agent, $period, $date); if (sizeof ($table_monitors->data) == 0) { $output .= '
'; if (! $return) @@ -1662,12 +1662,12 @@ function get_agent_detailed_reporting ($id_agent, $period = 0, $date = 0, $retur * * @return string */ -function get_group_agents_detailed_reporting ($id_group, $period = 0, $date = 0, $return = false) { +function reporting_get_group_agents_detailed ($id_group, $period = 0, $date = 0, $return = false) { $agents = get_group_agents ($id_group, false, "none"); $output = ''; foreach ($agents as $agent_id => $agent_name) { - $output .= get_agent_detailed_reporting ($agent_id, $period, $date, true); + $output .= reporting_get_agent_detailed ($agent_id, $period, $date, true); } if ($return === false) @@ -1690,7 +1690,7 @@ function get_group_agents_detailed_reporting ($id_group, $period = 0, $date = 0, * * @return A table object (XHTML) */ -function get_agents_detailed_event_reporting ($id_agents, $period = 0, $date = 0, $return = false) { +function reporting_get_agents_detailed_event ($id_agents, $period = 0, $date = 0, $return = false) { $id_agents = (array)safe_int ($id_agents, 1); if (!is_numeric ($date)) { @@ -1740,14 +1740,17 @@ function get_agents_detailed_event_reporting ($id_agents, $period = 0, $date = 0 } /** - * - * @param unknown_type $id_group - * @param unknown_type $period - * @param unknown_type $date - * @param unknown_type $return - * @param unknown_type $html + * Gets a detailed reporting of groups's events. + * + * @param unknown_type $id_group Id of the group. + * @param unknown_type $period Time period of the report. + * @param unknown_type $date Date of the report. + * @param unknown_type $return Whether to return or not. + * @param unknown_type $html Whether to return HTML code or not. + * + * @return string Report of groups's events */ -function get_group_detailed_event_reporting ($id_group, $period = 0, $date = 0, $return = false, $html = true) { +function reporting_get_group_detailed_event ($id_group, $period = 0, $date = 0, $return = false, $html = true) { if (!is_numeric ($date)) { $date = strtotime ($date); } @@ -1805,7 +1808,7 @@ function get_group_detailed_event_reporting ($id_group, $period = 0, $date = 0, * * @return mixed A table object (XHTML) or object table is false the html. */ -function get_module_detailed_event_reporting ($id_modules, $period = 0, $date = 0, $return = false, $html = true) { +function reporting_get_module_detailed_event ($id_modules, $period = 0, $date = 0, $return = false, $html = true) { $id_modules = (array)safe_int ($id_modules, 1); if (!is_numeric ($date)) { @@ -1870,7 +1873,7 @@ function get_module_detailed_event_reporting ($id_modules, $period = 0, $date = * * @return array An array */ -function get_agent_module_info ($id_agent, $filter = false) { +function reporting_get_agent_module_info ($id_agent, $filter = false) { global $config; $return = array (); @@ -1910,8 +1913,8 @@ function get_agent_module_info ($id_agent, $filter = false) { foreach ($modules as $key => $module) { $return["modules"]++; - $alert_status = get_agentmodule_status($key, false); - $module_status = get_agentmodule_status($key, true); + $alert_status = modules_get_agentmodule_status($key, false); + $module_status = modules_get_agentmodule_status($key, true); switch ($module_status) { case 0: @@ -1980,7 +1983,7 @@ function get_agent_module_info ($id_agent, $filter = false) { * */ -function render_report_html_item ($content, $table, $report, $mini = false) { +function reporting_render_report_html_item ($content, $table, $report, $mini = false) { global $config; global $graphic_type; @@ -2002,7 +2005,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $module_name = db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']); if ($content['id_agent_module'] != 0) { - $agent_name = get_agentmodule_agent_name ($content['id_agent_module']); + $agent_name = modules_get_agentmodule_agent_name ($content['id_agent_module']); } else { $agent_name = get_agent_name($content['id_agent']); @@ -2176,7 +2179,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $sla_failed = false; foreach ($slas as $sla) { //Get the sla_value in % and store it on $sla_value - $sla_value = get_agentmodule_sla ($sla['id_agent_module'], $content['period'], + $sla_value = reporting_get_agentmodule_sla ($sla['id_agent_module'], $content['period'], $sla['sla_min'], $sla['sla_max'], $report["datetime"], $content, $content['time_from'], $content['time_to']); @@ -2203,8 +2206,8 @@ function render_report_html_item ($content, $table, $report, $mini = false) { if ($show_graph == 0 || $show_graph == 1) { $data = array (); - $data[0] = printSmallFont(get_agentmodule_agent_name ($sla['id_agent_module'])); - $data[1] = printSmallFont(get_agentmodule_name ($sla['id_agent_module'])); + $data[0] = printSmallFont(modules_get_agentmodule_agent_name ($sla['id_agent_module'])); + $data[1] = printSmallFont(modules_get_agentmodule_name ($sla['id_agent_module'])); $data[2] = $sla['sla_max'].'/'; $data[2] .= $sla['sla_min']; $data[3] = $sla['sla_limit']; @@ -2256,9 +2259,9 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $table2->data = array (); foreach ($slas as $sla) { $data = array(); - $data[0] = printSmallFont(get_agentmodule_agent_name ($sla['id_agent_module'])); + $data[0] = printSmallFont(modules_get_agentmodule_agent_name ($sla['id_agent_module'])); $data[0] .= "
"; - $data[0] .= printSmallFont(get_agentmodule_name ($sla['id_agent_module'])); + $data[0] .= printSmallFont(modules_get_agentmodule_name ($sla['id_agent_module'])); $data[1] = graph_sla_slicebar ($sla['id_agent_module'], $content['period'], $sla['sla_min'], $sla['sla_max'], $report["datetime"], $content, $content['time_from'], @@ -2290,7 +2293,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { } $data = array (); - $monitor_value = get_agentmodule_sla ($content['id_agent_module'], $content['period'], 1, false, $report["datetime"]); + $monitor_value = reporting_get_agentmodule_sla ($content['id_agent_module'], $content['period'], 1, false, $report["datetime"]); if ($monitor_value === false) { $monitor_value = __('Unknown'); } else { @@ -2325,7 +2328,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[2][0] = 3; - $value = get_agentmodule_data_average ($content['id_agent_module'], $content['period'], $report["datetime"]); + $value = reporting_get_agentmodule_data_average ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($value === false) { $value = __('Unknown'); } else { @@ -2354,7 +2357,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[2][0] = 3; - $value = format_numeric (get_agentmodule_data_max ($content['id_agent_module'], $content['period'], $report["datetime"])); + $value = format_numeric (reporting_get_agentmodule_data_max ($content['id_agent_module'], $content['period'], $report["datetime"])); $data[0] = '

'.$value.'

'; array_push ($table->data, $data); @@ -2378,7 +2381,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[1][0] = 2; - $value = get_agentmodule_data_min ($content['id_agent_module'], $content['period'], $report["datetime"]); + $value = reporting_get_agentmodule_data_min ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($value === false) { $value = __('Unknown'); } else { @@ -2407,7 +2410,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[1][0] = 2; - $value = get_agentmodule_data_sum ($content['id_agent_module'], $content['period'], $report["datetime"]); + $value = reporting_get_agentmodule_data_sum ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($value === false) { $value = __('Unknown'); } else { @@ -2436,7 +2439,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[2][0] = 3; - $data[0] = get_agents_detailed_event_reporting ($content['id_agent'], $content['period'], $report["datetime"], true); + $data[0] = reporting_get_agents_detailed_event ($content['id_agent'], $content['period'], $report["datetime"], true); array_push ($table->data, $data); break; case 'text': @@ -2482,18 +2485,18 @@ function render_report_html_item ($content, $table, $report, $mini = false) { if ($content['treport_custom_sql_id'] != 0) { switch ($config["dbtype"]) { case "mysql": - $sql = safe_output_html (db_get_value_filter('`sql`', 'treport_custom_sql', array('id' => $content['treport_custom_sql_id']))); + $sql = io_safe_output_html (db_get_value_filter('`sql`', 'treport_custom_sql', array('id' => $content['treport_custom_sql_id']))); break; case "postgresql": - $sql = safe_output_html (db_get_value_filter('"sql"', 'treport_custom_sql', array('id' => $content['treport_custom_sql_id']))); + $sql = io_safe_output_html (db_get_value_filter('"sql"', 'treport_custom_sql', array('id' => $content['treport_custom_sql_id']))); break; case "oracle": - $sql = safe_output_html (db_get_value_filter('sql', 'treport_custom_sql', array('id' => $content['treport_custom_sql_id']))); + $sql = io_safe_output_html (db_get_value_filter('sql', 'treport_custom_sql', array('id' => $content['treport_custom_sql_id']))); break; } } else { - $sql = safe_output_html ($content['external_source']); + $sql = io_safe_output_html ($content['external_source']); } // Do a security check on SQL coming from the user @@ -2575,7 +2578,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[2][0] = 3; - $data[0] = get_group_detailed_event_reporting($content['id_group'], $content['period'], $report["datetime"], true); + $data[0] = reporting_get_group_detailed_event($content['id_group'], $content['period'], $report["datetime"], true); array_push ($table->data, $data); break; @@ -2595,7 +2598,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[2][0] = 3; - $data[0] = get_module_detailed_event_reporting($content['id_agent_module'], $content['period'], $report["datetime"], true); + $data[0] = reporting_get_module_detailed_event($content['id_agent_module'], $content['period'], $report["datetime"], true); array_push ($table->data, $data); break; case 'alert_report_module': @@ -2614,7 +2617,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[2][0] = 3; - $data[0] = alert_reporting_module ($content['id_agent_module'], $content['period'], $report["datetime"], true); + $data[0] = reporting_alert_reporting_module ($content['id_agent_module'], $content['period'], $report["datetime"], true); array_push ($table->data, $data); break; case 'alert_report_agent': @@ -2633,7 +2636,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[2][0] = 3; - $data[0] = alert_reporting_agent ($content['id_agent'], $content['period'], $report["datetime"], true); + $data[0] = reporting_alert_reporting_agent ($content['id_agent'], $content['period'], $report["datetime"], true); array_push ($table->data, $data); break; case 'url': @@ -2727,7 +2730,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[2][0] = 3; - $ttr = get_agentmodule_ttr ($content['id_agent_module'], $content['period'], $report["datetime"]); + $ttr = reporting_get_agentmodule_ttr ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($ttr === false) { $ttr = __('Unknown'); } else if ($ttr != 0) { @@ -2755,7 +2758,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[2][0] = 3; - $tto = get_agentmodule_tto ($content['id_agent_module'], $content['period'], $report["datetime"]); + $tto = reporting_get_agentmodule_tto ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($tto === false) { $tto = __('Unknown'); } else if ($tto != 0) { @@ -2783,7 +2786,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[2][0] = 3; - $mtbf = get_agentmodule_mtbf ($content['id_agent_module'], $content['period'], $report["datetime"]); + $mtbf = reporting_get_agentmodule_mtbf ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($mtbf === false) { $mtbf = __('Unknown'); } else if ($mtbf != 0) { @@ -2811,7 +2814,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $table->colspan[2][0] = 3; - $mttr = get_agentmodule_mttr ($content['id_agent_module'], $content['period'], $report["datetime"]); + $mttr = reporting_get_agentmodule_mttr ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($mttr === false) { $mttr = __('Unknown'); } else if ($mttr != 0) { @@ -2870,7 +2873,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data_avg = array(); foreach ($generals as $key => $row) { - $data_avg[$key] = get_agentmodule_data_average ($row['id_agent_module'], $content['period']); + $data_avg[$key] = reporting_get_agentmodule_data_average ($row['id_agent_module'], $content['period']); $id_agent_module[$key] = $row['id_agent_module']; $agent_name[$key] = $row['agent_name']; $module_name[$key] = $row['module_name']; @@ -2968,10 +2971,10 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $module_name = $g['module_name']; $found = false; if (strcmp($a['nombre'], $agent_name) == 0 && strcmp($m['nombre'], $module_name) == 0) { - if (get_agentmodule_data_average($g['id_agent_module'], $content['period']) === false) + if (reporting_get_agentmodule_data_average($g['id_agent_module'], $content['period']) === false) $data[$i] = '--'; else { - $data[$i] = get_agentmodule_data_average($g['id_agent_module'], $content['period']); + $data[$i] = reporting_get_agentmodule_data_average($g['id_agent_module'], $content['period']); } $found = true; } @@ -2997,7 +3000,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $min = false; $i=0; do { - $min = get_agentmodule_data_average($generals[$i]['id_agent_module'], $content['period']); + $min = reporting_get_agentmodule_data_average($generals[$i]['id_agent_module'], $content['period']); $i++; } while ($min === false && $i < count($generals)); $max = $min; @@ -3009,7 +3012,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { } foreach ($generals as $g) { - $value = get_agentmodule_data_average ($g['id_agent_module'], $content['period']); + $value = reporting_get_agentmodule_data_average ($g['id_agent_module'], $content['period']); if ($value !== false) { if ($value > $max) { $max = $value; @@ -3087,19 +3090,19 @@ function render_report_html_item ($content, $table, $report, $mini = false) { switch ($top_n) { //Max case 1: - $value = get_agentmodule_data_max ($row['id_agent_module'], $content['period']); + $value = reporting_get_agentmodule_data_max ($row['id_agent_module'], $content['period']); break; //Min case 2: - $value = get_agentmodule_data_min ($row['id_agent_module'], $content['period']); + $value = reporting_get_agentmodule_data_min ($row['id_agent_module'], $content['period']); break; //Nothing or Average case 0: //If nothing is selected then it will be shown the average data case 3: - $value = get_agentmodule_data_average ($row['id_agent_module'], $content['period']); + $value = reporting_get_agentmodule_data_average ($row['id_agent_module'], $content['period']); break; } - //If the returned value from get_agentmodule_data... is false it won't be stored. + //If the returned value from modules_get_agentmodule_data... is false it won't be stored. if ($value !== false) { $data_top[$key] = $value; $id_agent_module[$key] = $row['id_agent_module']; @@ -3305,7 +3308,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { //Get the very first not null value $i=0; do { - $min = get_agentmodule_data_average ($exceptions[$i]['id_agent_module'], $content['period']); + $min = reporting_get_agentmodule_data_average ($exceptions[$i]['id_agent_module'], $content['period']); $i++; } while ($min === false && $i < count($exceptions)); $max = $min; @@ -3313,7 +3316,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $i=0; foreach ($exceptions as $exc) { - $value = get_agentmodule_data_average ($exc['id_agent_module'], $content['period']); + $value = reporting_get_agentmodule_data_average ($exc['id_agent_module'], $content['period']); if ($value !== false) { if ($value > $max) $max = $value; if ($value < $min) $min = $value; @@ -3339,14 +3342,14 @@ function render_report_html_item ($content, $table, $report, $mini = false) { //Display modules at Normal status case 3: //Skip modules without normal status - if (get_agentmodule_status($exc['id_agent_module']) != 0) { + if (modules_get_agentmodule_status($exc['id_agent_module']) != 0) { continue 2; } break; //Display modules at critical, warning or unknown status case 4: //Skip modules at normal status - if (get_agentmodule_status($exc['id_agent_module']) == 0) { + if (modules_get_agentmodule_status($exc['id_agent_module']) == 0) { continue 2; } break; @@ -3614,10 +3617,10 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $match = false; foreach($module['id'] as $module_id){ if(!$match && array_key_exists($module_id,$agent_modules)) { - $status = get_agentmodule_status($module_id); + $status = modules_get_agentmodule_status($module_id); $table_data .= ""; $win_handle = dechex(crc32($module_id.$module["name"])); - $graph_type = return_graphtype (get_agentmodule_type($module_id)); + $graph_type = return_graphtype (modules_get_agentmodule_type($module_id)); switch($status){ case 0: @@ -3693,7 +3696,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { * * @return float The MTBF value in the interval. */ -function get_agentmodule_mtbf ($id_agent_module, $period, $date = 0) { +function reporting_get_agentmodule_mtbf ($id_agent_module, $period, $date = 0) { // Initialize variables if (empty ($date)) $date = get_system_time (); @@ -3713,7 +3716,7 @@ function get_agentmodule_mtbf ($id_agent_module, $period, $date = 0) { $module_type = $module['id_tipo_modulo']; // Set critical_min and critical for proc modules - $module_type_str = get_module_type_name ($module_type); + $module_type_str = modules_get_type_name ($module_type); if (strstr ($module_type_str, 'proc') !== false && ($critical_min == 0 && $critical_max == 0)) { $critical_min = 1; @@ -3728,14 +3731,14 @@ function get_agentmodule_mtbf ($id_agent_module, $period, $date = 0) { if ($interval_data === false) $interval_data = array (); // Get previous data - $previous_data = get_previous_data ($id_agent_module, $datelimit); + $previous_data = modules_get_previous_data ($id_agent_module, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($interval_data, $previous_data); } // Get next data - $next_data = get_next_data ($id_agent_module, $date); + $next_data = modules_get_next_data ($id_agent_module, $date); if ($next_data !== false) { $next_data['utimestamp'] = $date; array_push ($interval_data, $next_data); @@ -3804,7 +3807,7 @@ function get_agentmodule_mtbf ($id_agent_module, $period, $date = 0) { * * @return float The MTTR value in the interval. */ -function get_agentmodule_mttr ($id_agent_module, $period, $date = 0) { +function reporting_get_agentmodule_mttr ($id_agent_module, $period, $date = 0) { // Initialize variables if (empty ($date)) $date = get_system_time (); @@ -3824,7 +3827,7 @@ function get_agentmodule_mttr ($id_agent_module, $period, $date = 0) { $module_type = $module['id_tipo_modulo']; // Set critical_min and critical for proc modules - $module_type_str = get_module_type_name ($module_type); + $module_type_str = modules_get_type_name ($module_type); if (strstr ($module_type_str, 'proc') !== false && ($critical_min == 0 && $critical_max == 0)) { $critical_min = 1; @@ -3839,14 +3842,14 @@ function get_agentmodule_mttr ($id_agent_module, $period, $date = 0) { if ($interval_data === false) $interval_data = array (); // Get previous data - $previous_data = get_previous_data ($id_agent_module, $datelimit); + $previous_data = modules_get_previous_data ($id_agent_module, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($interval_data, $previous_data); } // Get next data - $next_data = get_next_data ($id_agent_module, $date); + $next_data = modules_get_next_data ($id_agent_module, $date); if ($next_data !== false) { $next_data['utimestamp'] = $date; array_push ($interval_data, $next_data); @@ -3914,7 +3917,7 @@ function get_agentmodule_mttr ($id_agent_module, $period, $date = 0) { * * @return float The TTO value in the interval. */ -function get_agentmodule_tto ($id_agent_module, $period, $date = 0) { +function reporting_get_agentmodule_tto ($id_agent_module, $period, $date = 0) { // Initialize variables if (empty ($date)) $date = get_system_time (); @@ -3934,7 +3937,7 @@ function get_agentmodule_tto ($id_agent_module, $period, $date = 0) { $module_type = $module['id_tipo_modulo']; // Set critical_min and critical for proc modules - $module_type_str = get_module_type_name ($module_type); + $module_type_str = modules_get_type_name ($module_type); if (strstr ($module_type_str, 'proc') !== false && ($critical_min == 0 && $critical_max == 0)) { $critical_min = 1; @@ -3949,14 +3952,14 @@ function get_agentmodule_tto ($id_agent_module, $period, $date = 0) { if ($interval_data === false) $interval_data = array (); // Get previous data - $previous_data = get_previous_data ($id_agent_module, $datelimit); + $previous_data = modules_get_previous_data ($id_agent_module, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($interval_data, $previous_data); } // Get next data - $next_data = get_next_data ($id_agent_module, $date); + $next_data = modules_get_next_data ($id_agent_module, $date); if ($next_data !== false) { $next_data['utimestamp'] = $date; array_push ($interval_data, $next_data); @@ -4015,7 +4018,7 @@ function get_agentmodule_tto ($id_agent_module, $period, $date = 0) { * * @return float The TTR value in the interval. */ -function get_agentmodule_ttr ($id_agent_module, $period, $date = 0) { +function reporting_get_agentmodule_ttr ($id_agent_module, $period, $date = 0) { // Initialize variables if (empty ($date)) $date = get_system_time (); @@ -4035,7 +4038,7 @@ function get_agentmodule_ttr ($id_agent_module, $period, $date = 0) { $module_type = $module['id_tipo_modulo']; // Set critical_min and critical for proc modules - $module_type_str = get_module_type_name ($module_type); + $module_type_str = modules_get_type_name ($module_type); if (strstr ($module_type_str, 'proc') !== false && ($critical_min == 0 && $critical_max == 0)) { $critical_min = 1; @@ -4050,14 +4053,14 @@ function get_agentmodule_ttr ($id_agent_module, $period, $date = 0) { if ($interval_data === false) $interval_data = array (); // Get previous data - $previous_data = get_previous_data ($id_agent_module, $datelimit); + $previous_data = modules_get_previous_data ($id_agent_module, $datelimit); if ($previous_data !== false) { $previous_data['utimestamp'] = $datelimit; array_unshift ($interval_data, $previous_data); } // Get next data - $next_data = get_next_data ($id_agent_module, $date); + $next_data = modules_get_next_data ($id_agent_module, $date); if ($next_data !== false) { $next_data['utimestamp'] = $date; array_push ($interval_data, $next_data); diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 04e99f1ab2..8ff7a68c53 100644 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -30,7 +30,7 @@ require_once ($config['homedir'].'/include/functions_users.php'); * * @return Report with the given id. False if not available or readable. */ -function get_report ($id_report, $filter = false, $fields = false) { +function reports_get_report ($id_report, $filter = false, $fields = false) { global $config; $id_report = safe_int ($id_report); @@ -64,7 +64,7 @@ function get_report ($id_report, $filter = false, $fields = false) { * * @return array An array with all the reports the user can view. */ -function get_reports ($filter = false, $fields = false, $returnAllGroup = true, $privileges = 'IR') { +function reports_get_reports ($filter = false, $fields = false, $returnAllGroup = true, $privileges = 'IR') { global $config; if (! is_array ($filter)) @@ -102,7 +102,7 @@ function get_reports ($filter = false, $fields = false, $returnAllGroup = true, * * @return mixed New report id if created. False if it could not be created. */ -function create_report ($name, $id_group, $values = false) { +function reports_create_report ($name, $id_group, $values = false) { global $config; if (! is_array ($values)) @@ -123,8 +123,8 @@ function create_report ($name, $id_group, $values = false) { * * @return bool True if the report was updated. False otherwise. */ -function update_report ($id_report, $values) { - $report = get_report ($id_report, false, array ('id_report')); +function reports_update_report ($id_report, $values) { + $report = reports_get_report ($id_report, false, array ('id_report')); if ($report === false) return false; return (@db_process_sql_update ('treport', @@ -139,11 +139,11 @@ function update_report ($id_report, $values) { * * @return bool True if deleted, false otherwise. */ -function delete_report ($id_report) { +function reports_delete_report ($id_report) { $id_report = safe_int ($id_report); if (empty ($id_report)) return false; - $report = get_report ($id_report); + $report = reports_get_report ($id_report); if ($report === false) return false; @db_process_sql_delete ('treport_content', array ('id_report' => $id_report)); @@ -157,7 +157,7 @@ function delete_report ($id_report) { * * @return bool True if deleted, false otherwise. */ -function get_report_content ($id_report_content, $filter = false, $fields = false) { +function reports_get_content ($id_report_content, $filter = false, $fields = false) { $id_report_content = safe_int ($id_report_content); if (empty ($id_report_content)) return false; @@ -170,7 +170,7 @@ function get_report_content ($id_report_content, $filter = false, $fields = fals $content = @db_get_row_filter ('treport_content', $filter, $fields); if ($content === false) return false; - $report = get_report ($content['id_report']); + $report = reports_get_report ($content['id_report']); if ($report === false) return false; return $content; @@ -185,13 +185,13 @@ function get_report_content ($id_report_content, $filter = false, $fields = fals * * @return array All the contents of a report. */ -function create_report_content ($id_report, $values) { +function reports_create_content ($id_report, $values) { global $config; $id_report = safe_int ($id_report); if (empty ($id_report)) return false; - $report = get_report ($id_report); + $report = reports_get_report ($id_report); if ($report === false) return false; if (! is_array ($values)) @@ -226,12 +226,12 @@ function create_report_content ($id_report, $values) { * * @return array All the contents of a report. */ -function get_report_contents ($id_report, $filter = false, $fields = false) { +function reports_get_contents ($id_report, $filter = false, $fields = false) { $id_report = safe_int ($id_report); if (empty ($id_report)) return array (); - $report = get_report ($id_report); + $report = reports_get_report ($id_report); if ($report === false) return array (); if (! is_array ($filter)) @@ -252,13 +252,13 @@ function get_report_contents ($id_report, $filter = false, $fields = false) { * * @return bool True if moved, false otherwise. */ -function move_report_content_up ($id_report_content) { +function reports_move_content_up ($id_report_content) { global $config; if (empty ($id_report_content)) return false; - $content = get_report_content ($id_report_content); + $content = reports_get_content ($id_report_content); if ($content === false) return false; @@ -298,13 +298,13 @@ function move_report_content_up ($id_report_content) { * * @return bool True if moved, false otherwise. */ -function move_report_content_down ($id_report_content) { +function reports_move_content_down ($id_report_content) { global $config; if (empty ($id_report_content)) return false; - $content = get_report_content ($id_report_content); + $content = reports_get_content ($id_report_content); if ($content === false) return false; @@ -342,11 +342,11 @@ function move_report_content_down ($id_report_content) { * * @return bool True if deleted, false otherwise. */ -function delete_report_content ($id_report_content) { +function reports_delete_content ($id_report_content) { if (empty ($id_report_content)) return false; - $content = get_report_content ($id_report_content); + $content = reports_get_content ($id_report_content); if ($content === false) return false; diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index 050463ed38..6b37955ed0 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -28,7 +28,7 @@ * * @return Server with the given id. False if not available. */ -function get_server ($id_server, $filter = false, $fields = false) { +function servers_get_server ($id_server, $filter = false, $fields = false) { if (empty ($id_server)) return false; if (! is_array ($filter)) @@ -43,7 +43,7 @@ function get_server ($id_server, $filter = false, $fields = false) { * * @return All the servers available. */ -function get_server_names () { +function servers_get_names () { $all_servers = @db_get_all_rows_filter ('tserver', false, array ('DISTINCT(name) as name')); if ($all_servers === false) return array (); @@ -60,7 +60,7 @@ function get_server_names () { * This function will get several metrics from the database to get info about server performance * @return array with several data */ -function get_server_performance () { +function servers_get_performance () { global $config; @@ -123,7 +123,7 @@ function get_server_performance () { * * @return mixed False in case the server doesn't exist or an array with info. */ -function get_server_info ($id_server = -1) { +function servers_get_info ($id_server = -1) { global $config; if (is_array ($id_server)) { @@ -383,7 +383,7 @@ function get_server_info ($id_server = -1) { * * @return string Name of the given server */ -function get_server_name ($id_server) { +function servers_get_name ($id_server) { return (string) db_get_value ('name', 'tserver', 'id_server', (int) $id_server); } @@ -397,7 +397,7 @@ function get_server_name ($id_server) { * * @return string Fully formatted IMG HTML tag with icon */ -function show_server_type ($id) { +function servers_show_type ($id) { global $config; switch ($id) { @@ -432,7 +432,7 @@ function show_server_type ($id) { * * @return int The number of servers alive. */ -function check_server_status () { +function servers_check_status () { global $config; switch ($config["dbtype"]) { @@ -453,15 +453,15 @@ function check_server_status () { } /** - * @deprecated use get_server_info instead + * @deprecated use servers_get_info instead * Get statistical information for a given server * * @param int Server id to get status. * * @return array Server info array */ -function server_status ($id_server) { - $serverinfo = get_server_info ($id_server); +function servers_get_status ($id_server) { + $serverinfo = servers_get_info ($id_server); return $serverinfo[$id_server]; } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 8fa4a6a33d..7df2b139d7 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -47,7 +47,7 @@ function ui_print_truncate_text($text, $numChars = 25, $showTextInAToopTip = tru } } - $text = safe_output($text); + $text = io_safe_output($text); if ((strlen($text)) > ($numChars)) { $half_lenght = intval(($numChars - 3) / 2); // '/2' because [...] is in the middle of the word. $truncateText2 = mb_strimwidth($text, (strlen($text) - $half_lenght), strlen($text)); @@ -474,9 +474,9 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = ' $description = $alert['description']; } else { - $id_agent = get_agentmodule_agent ($alert['id_agent_module']); + $id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']); $template = alerts_get_alert_template ($alert['id_alert_template']); - $description = safe_output($template['name']); + $description = io_safe_output($template['name']); } $data = array (); @@ -519,11 +519,11 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = ' $data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 20, $styleDisabled); } elseif ($agent == 0) { - $data[$index['module_name']] .= mb_substr (get_agentmodule_name ($alert["id_agent_module"]), 0, 20); + $data[$index['module_name']] .= mb_substr (modules_get_agentmodule_name ($alert["id_agent_module"]), 0, 20); } else { - $data[$index['agent_name']] .= ui_print_agent_name (get_agentmodule_agent ($alert["id_agent_module"]), true, 20, $styleDisabled); - $data[$index['module_name']] = mb_substr (get_agentmodule_name ($alert["id_agent_module"]), 0, 20); + $data[$index['agent_name']] .= ui_print_agent_name (modules_get_agentmodule_agent ($alert["id_agent_module"]), true, 20, $styleDisabled); + $data[$index['module_name']] = mb_substr (modules_get_agentmodule_name ($alert["id_agent_module"]), 0, 20); } $data[$index['agent_name']] .= $disabledHtmlEnd; @@ -538,7 +538,7 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = ' else { $actionDefault = db_get_value_sql("SELECT id_alert_action FROM talert_compound_actions WHERE id_alert_compound = " . $alert['id']); } - $data[$index['description']] .= $disabledHtmlStart . mb_substr (safe_input ($description), 0, 35) . $disabledHtmlEnd; + $data[$index['description']] .= $disabledHtmlStart . mb_substr (io_safe_input ($description), 0, 35) . $disabledHtmlEnd; $actions = alerts_get_alert_agent_module_actions ($alert['id'], false, $compound); @@ -603,7 +603,7 @@ function ui_print_string_substr ($string, $cutoff = 16, $return = false) { return ""; } - $string2 = safe_output ($string); + $string2 = io_safe_output ($string); if (mb_strlen($string2, "UTF-8") > $cutoff){ $string3 = "..."; } else { @@ -611,7 +611,7 @@ function ui_print_string_substr ($string, $cutoff = 16, $return = false) { } - $string = ''.mb_substr ($string2, 0, $cutoff, "UTF-8").$string3.''; + $string = ''.mb_substr ($string2, 0, $cutoff, "UTF-8").$string3.''; if ($return === false) { echo $string; @@ -1620,7 +1620,7 @@ function ui_get_full_url ($url = false) { */ function ui_print_page_header ($title, $icon = "", $return = false, $help = "", $godmode = false, $options = ""){ - $title = safe_input_html($title); + $title = io_safe_input_html($title); if (($icon == "") && ($godmode == true)){ $icon = "images/setup.png"; } diff --git a/pandora_console/include/functions_ui_renders.php b/pandora_console/include/functions_ui_renders.php index d53f29ed62..77cee5d1fc 100644 --- a/pandora_console/include/functions_ui_renders.php +++ b/pandora_console/include/functions_ui_renders.php @@ -76,7 +76,7 @@ function render_agent_field ($agent, $field, $field_value = false, $return = fal return ui_print_status_image (STATUS_AGENT_NO_DATA, '', $return); require_once ('include/functions_reporting.php'); - $info = get_agent_module_info ($agent['id_agente']); + $info = reporting_get_agent_module_info ($agent['id_agente']); $output = $info['status_img']; break; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index eae0f4396b..3a5c9e0385 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -253,13 +253,13 @@ function process_wizard_add_modules ($id_modules, $image, $id_layout, $range, $w $pos_y = $pos_y + $range; } - $id_agent = get_agentmodule_agent ($id_module); + $id_agent = modules_get_agentmodule_agent ($id_module); db_process_sql_insert ('tlayout_data', array ('id_layout' => $id_layout, 'pos_x' => $pos_x, 'pos_y' => $pos_y, - 'label' => get_agentmodule_name ($id_module), + 'label' => modules_get_agentmodule_name ($id_module), 'image' => $image, 'id_agent' => $id_agent, 'id_agente_modulo' => $id_module, @@ -368,7 +368,7 @@ function getStatusElement($layoutData) { else if ($layoutData["type"] == 0) { //Single object //Status for a simple module if ($layoutData['id_agente_modulo'] != 0) { - $status = get_agentmodule_status ($layoutData['id_agente_modulo']); + $status = modules_get_agentmodule_status ($layoutData['id_agente_modulo']); //Status for a whole agent, if agente_modulo was == 0 } @@ -417,12 +417,12 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = $mapHeight = $proportion * $layout["height"]; } $backgroundImage = 'include/Image/image_functions.php?getFile=1&thumb=1&thumb_size=' . $mapWidth . 'x' . $mapHeight . '&file=' . - $config['homeurl'] . '/' . 'images/console/background/'.safe_input ($layout["background"]); + $config['homeurl'] . '/' . 'images/console/background/'.io_safe_input ($layout["background"]); } else { $mapWidth = $layout["width"]; $mapHeight = $layout["height"]; - $backgroundImage = 'images/console/background/'.safe_input ($layout["background"]); + $backgroundImage = 'images/console/background/'.io_safe_input ($layout["background"]); } echo '
".substr(safe_output($row["datos"]),0,12).""; + $data[] = "".substr(io_safe_output($row["datos"]),0,12).""; $data[] = ui_print_timestamp ($row["utimestamp"], true, array('units' => 'tiny')); diff --git a/pandora_console/mobile/operation/agents/tactical.php b/pandora_console/mobile/operation/agents/tactical.php index 7ec8ee93ab..51b6c3dd5d 100644 --- a/pandora_console/mobile/operation/agents/tactical.php +++ b/pandora_console/mobile/operation/agents/tactical.php @@ -26,7 +26,7 @@ class Tactical { require_once ($config["homedir"] . '/include/functions_graph.php'); - $data = get_group_stats(); + $data = reporting_get_group_stats(); $table = null; //$table->width = '100%'; @@ -80,7 +80,7 @@ class Tactical { echo "

" . __('Server performance') . "

"; - $server_performance = get_server_performance(); + $server_performance = servers_get_performance(); $table = null; //$table->width = '100%'; diff --git a/pandora_console/mobile/operation/agents/view_agents.php b/pandora_console/mobile/operation/agents/view_agents.php index bb89f0188b..83672e2ae7 100644 --- a/pandora_console/mobile/operation/agents/view_agents.php +++ b/pandora_console/mobile/operation/agents/view_agents.php @@ -104,7 +104,7 @@ class ViewAgents { $rowPair = !$rowPair; $iterator++; - $agent_info = get_agent_module_info ($agent["id_agente"]); //$this->system->debug($agent_info); + $agent_info = reporting_get_agent_module_info ($agent["id_agente"]); //$this->system->debug($agent_info); $data = array(); @@ -257,7 +257,7 @@ class ViewAgent { $title = __('NORMAL'); } elseif ($module["estado"] == 3) { - $last_status = get_agentmodule_last_status($module['id_agente_modulo']); + $last_status = modules_get_agentmodule_last_status($module['id_agente_modulo']); switch($last_status) { case 0: $status = STATUS_MODULE_OK; @@ -278,7 +278,7 @@ class ViewAgent { $title .= ": " . format_for_graph($module["datos"]); } else { - $title .= ": " . substr(safe_output($module["datos"]),0,42); + $title .= ": " . substr(io_safe_output($module["datos"]),0,42); } $data[] = str_replace(array('images/status_sets', '".substr(safe_output($module["datos"]),0,12).""; + $salida = "".substr(io_safe_output($module["datos"]),0,12).""; } } $data[] = $salida; @@ -347,10 +347,10 @@ class ViewAgent { $data = array(); - $data[] = ui_print_truncate_text(get_agentmodule_name($alert["id_agent_module"]), 20, true, true); + $data[] = ui_print_truncate_text(modules_get_agentmodule_name($alert["id_agent_module"]), 20, true, true); - $template = safe_output(alerts_get_alert_template ($alert['id_alert_template'])); - $data[] = ui_print_truncate_text(safe_output($template['name']), 20, true, true); + $template = io_safe_output(alerts_get_alert_template ($alert['id_alert_template'])); + $data[] = ui_print_truncate_text(io_safe_output($template['name']), 20, true, true); $data[] = ui_print_timestamp ($alert["last_fired"], true, array('units' => 'tiny')); @@ -405,12 +405,12 @@ class viewGraph { return; } - echo "

" . get_agentmodule_agent_name($this->idAgentModule)." / ".safe_output($this->agentModule['nombre']) . "

"; + echo "

" . modules_get_agentmodule_agent_name($this->idAgentModule)." / ".io_safe_output($this->agentModule['nombre']) . "

"; echo "

" . __('Graph') . "

"; echo grafico_modulo_sparse2($this->idAgentModule, $this->period, 0, 240, - 120, safe_output($this->agentModule['nombre']), null, true, + 120, io_safe_output($this->agentModule['nombre']), null, true, 0, true, 0, true, true, true, true); echo "

" . __('Data') . "

"; @@ -425,7 +425,7 @@ class viewGraph { echo html_print_extended_select_for_time ($intervals, 'period', $this->period, 'this.form.submit();', '', '0', 5) . __(" secs"); echo "
"; - $moduletype_name = get_moduletype_name (get_agentmodule_type ($this->idAgentModule)); + $moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($this->idAgentModule)); if ($moduletype_name == "log4x") { $sql_body = sprintf ("FROM tagente_datos_log4x @@ -433,10 +433,10 @@ class viewGraph { $columns = array( - //"Timestamp" => array("utimestamp", "format_timestamp", "align" => "center" ), + //"Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "center" ), "Sev" => array("severity", "format_data", "align" => "center", "width" => "70px"), - "Message" => array("message", "format_verbatim", "align" => "left", "width" => "45%"), - "StackTrace" => array("stacktrace", "format_verbatim", "align" => "left", "width" => "50%") + "Message" => array("message", "modules_format_verbatim", "align" => "left", "width" => "45%"), + "StackTrace" => array("stacktrace", "modules_format_verbatim", "align" => "left", "width" => "50%") ); } else if (preg_match ("/string/", $moduletype_name)) { @@ -444,9 +444,9 @@ class viewGraph { WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $this->idAgentModule, (get_system_time () - $this->period)); $columns = array( - //"Timestamp" => array("utimestamp", "format_timestamp", "align" => "center"), + //"Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "center"), "Data" => array("datos", "format_data", "align" => "center"), - "Time" => array("utimestamp", "format_time", "align" => "center") + "Time" => array("utimestamp", "modules_format_time", "align" => "center") ); } else { @@ -456,7 +456,7 @@ class viewGraph { $columns = array( "Data" => array("datos", "format_data", "align" => "center"), - "Time" => array("utimestamp", "format_time", "align" => "center") + "Time" => array("utimestamp", "modules_format_time", "align" => "center") ); } diff --git a/pandora_console/mobile/operation/agents/view_alerts.php b/pandora_console/mobile/operation/agents/view_alerts.php index bd3f5dd927..ca10fc5673 100644 --- a/pandora_console/mobile/operation/agents/view_alerts.php +++ b/pandora_console/mobile/operation/agents/view_alerts.php @@ -62,11 +62,11 @@ class ViewAlerts { $data = array(); - $idAgent = get_agentmodule_agent($alert["id_agent_module"]); + $idAgent = modules_get_agentmodule_agent($alert["id_agent_module"]); - $data[] = '' . ui_print_truncate_text(get_agentmodule_name($alert["id_agent_module"]), 20, true, true) . ''; - $template = safe_output(alerts_get_alert_template ($alert['id_alert_template'])); - $data[] = ui_print_truncate_text(safe_output($template['name']), 20, true, true); + $data[] = '' . ui_print_truncate_text(modules_get_agentmodule_name($alert["id_agent_module"]), 20, true, true) . ''; + $template = io_safe_output(alerts_get_alert_template ($alert['id_alert_template'])); + $data[] = ui_print_truncate_text(io_safe_output($template['name']), 20, true, true); $data[] = ui_print_timestamp ($alert["last_fired"], true, array('units' => 'tiny')); $status = STATUS_ALERT_NOT_FIRED; diff --git a/pandora_console/mobile/operation/servers/view_servers.php b/pandora_console/mobile/operation/servers/view_servers.php index 9c651a0b96..e9c52d7667 100644 --- a/pandora_console/mobile/operation/servers/view_servers.php +++ b/pandora_console/mobile/operation/servers/view_servers.php @@ -24,7 +24,7 @@ class ViewServers { } public function show() { - $servers = get_server_info (); + $servers = servers_get_info (); if ($servers === false) $servers = array(); diff --git a/pandora_console/operation/agentes/datos_agente.php b/pandora_console/operation/agentes/datos_agente.php index f067da15e1..8b507899e4 100644 --- a/pandora_console/operation/agentes/datos_agente.php +++ b/pandora_console/operation/agentes/datos_agente.php @@ -45,7 +45,7 @@ $table->align = array (); $table->size = array (); -$moduletype_name = get_moduletype_name (get_agentmodule_type ($module_id)); +$moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($module_id)); $offset = (int) get_parameter("offset"); $block_size = (int) $config["block_size"]; @@ -69,27 +69,27 @@ if ($moduletype_name == "log4x") { $columns = array( - "Timestamp" => array("utimestamp", "format_timestamp", "align" => "center" ), + "Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "center" ), "Sev" => array("severity", "format_data", "align" => "center", "width" => "70px"), - "Message" => array("message", "format_verbatim", "align" => "left", "width" => "45%"), - "StackTrace" => array("stacktrace", "format_verbatim", "align" => "left", "width" => "50%") + "Message" => array("message", "modules_format_verbatim", "align" => "left", "width" => "45%"), + "StackTrace" => array("stacktrace", "modules_format_verbatim", "align" => "left", "width" => "50%") ); } else if (preg_match ("/string/", $moduletype_name)) { $sql_body = sprintf (" FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period); $columns = array( - "Timestamp" => array("utimestamp", "format_timestamp", "align" => "center"), + "Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "center"), "Data" => array("datos", "format_data", "align" => "center"), - "Time" => array("utimestamp", "format_time", "align" => "center") + "Time" => array("utimestamp", "modules_format_time", "align" => "center") ); } else { $sql_body = sprintf (" FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period); $columns = array( - "Timestamp" => array("utimestamp", "format_timestamp", "align" => "center"), + "Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "center"), "Data" => array("datos", "format_data", "align" => "center"), - "Time" => array("utimestamp", "format_time", "align" => "center") + "Time" => array("utimestamp", "modules_format_time", "align" => "center") ); } @@ -124,7 +124,7 @@ if (($config['dbtype'] == 'oracle') && ($result !== false)) { } } -$header_title = __('Received data from')." ".get_agentmodule_agent_name ($module_id)." / ".get_agentmodule_name ($module_id); +$header_title = __('Received data from')." ".modules_get_agentmodule_agent_name ($module_id)." / ".modules_get_agentmodule_name ($module_id); $header_title .= "

" . __("From the last") . " " . human_time_description_raw ($period); echo "

".$header_title. "

"; diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 6549f5f820..eeb604ec11 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -92,7 +92,7 @@ if (is_ajax ()) { echo json_encode (false); return; } - echo json_encode (get_agent_module_last_value ($id_module)); + echo json_encode (modules_get_last_value ($id_module)); return; } @@ -107,7 +107,7 @@ while ($row = db_get_all_row_by_steps_sql($first, $result, "SELECT * FROM tgrupo // Take some parameters (GET) $group_id = (int) get_parameter ("group_id", 0); -$search = safe_output(get_parameter ("search", "")); +$search = io_safe_output(get_parameter ("search", "")); $offset = get_parameter('offset', 0); $refr = get_parameter('refr', 0); @@ -343,7 +343,7 @@ foreach ($agents as $agent) { $rowPair = !$rowPair; $iterator++; - $agent_info = get_agent_module_info ($agent["id_agente"]); + $agent_info = reporting_get_agent_module_info ($agent["id_agente"]); $data = array (); diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index 8e5c1cba65..57b1d5e2a9 100644 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -260,7 +260,7 @@ foreach ($modules as $module) { } } - $data[2] = show_server_type ($module['id_modulo']); + $data[2] = servers_show_type ($module['id_modulo']); if (check_acl ($config['id_user'], $id_grupo, "AW")) $data[2] .= '' . html_print_image("images/config.png", true, array("alt" => '0', "border" => "")) . ''; @@ -284,7 +284,7 @@ foreach ($modules as $module) { $title = __('NORMAL'); } elseif ($module["estado"] == 3) { - $last_status = get_agentmodule_last_status($module['id_agente_modulo']); + $last_status = modules_get_agentmodule_last_status($module['id_agente_modulo']); switch($last_status) { case 0: $status = STATUS_MODULE_OK; @@ -305,7 +305,7 @@ foreach ($modules as $module) { $title .= ": " . format_for_graph($module["datos"]); } else { - $title .= ": " . substr(safe_output($module["datos"]),0,42); + $title .= ": " . substr(io_safe_output($module["datos"]),0,42); } $data[5] = ui_print_status_image($status, $title, true); @@ -326,8 +326,8 @@ foreach ($modules as $module) { $salida = format_numeric($module["datos"]); } else { - $module_value = safe_output($module["datos"]); - $sub_string = substr(safe_output($module["datos"]),0, 12); + $module_value = io_safe_output($module["datos"]); + $sub_string = substr(io_safe_output($module["datos"]),0, 12); if ($module_value == $sub_string) { $salida = $module_value; @@ -346,7 +346,7 @@ foreach ($modules as $module) { $data[7] = " "; if ($module['history_data'] == 1){ - $nombre_tipo_modulo = get_moduletype_name ($module["id_tipo_modulo"]); + $nombre_tipo_modulo = modules_get_moduletype_name ($module["id_tipo_modulo"]); $handle = "stat".$nombre_tipo_modulo."_".$module["id_agente_modulo"]; $url = 'include/procesos.php?agente='.$module["id_agente_modulo"]; $win_handle=dechex(crc32($module["id_agente_modulo"].$module["nombre"])); diff --git a/pandora_console/operation/agentes/estado_ultimopaquete.php b/pandora_console/operation/agentes/estado_ultimopaquete.php index 7e84b366dd..fbefe121ab 100644 --- a/pandora_console/operation/agentes/estado_ultimopaquete.php +++ b/pandora_console/operation/agentes/estado_ultimopaquete.php @@ -236,7 +236,7 @@ foreach ($modules as $module) { if ($module["id_module_group"] != $last_modulegroup ){ // Render module group names (fixed code) - $nombre_grupomodulo = get_modulegroup_name ($module["id_module_group"]); + $nombre_grupomodulo = modules_get_modulegroup_name ($module["id_module_group"]); $last_modulegroup = $module["id_module_group"]; $colspan = 9 + (int)$isFunctionPolicies; echo " @@ -303,7 +303,7 @@ foreach ($modules as $module) { echo ""; } } - $nombre_grupomodulo = get_modulegroup_name ($module["id_module_group"]); + $nombre_grupomodulo = modules_get_modulegroup_name ($module["id_module_group"]); if ($nombre_grupomodulo != ""){ if (($label_group == 0) || ($last_label != $nombre_grupomodulo)){ // Show label module group $label_group = -1; @@ -313,8 +313,8 @@ foreach ($modules as $module) { ".$nombre_grupomodulo.""; } } - $nombre_tipo_modulo = get_moduletype_name ($module["id_tipo_modulo"]); - echo ""; + $nombre_tipo_modulo = modules_get_moduletype_name ($module["id_tipo_modulo"]); + echo ""; ui_print_string_substr ($module["nombre"]); echo " "; @@ -334,8 +334,8 @@ foreach ($modules as $module) { AND ($module["id_tipo_modulo"] != 10) AND ($module["id_tipo_modulo"] != 17) AND ($module["id_tipo_modulo"] != 23)) { - echo ""; - echo safe_output(substr($module["descripcion"],0,32)); + echo ""; + echo io_safe_output(substr($module["descripcion"],0,32)); if (strlen($module["descripcion"]) > 32){ echo "..."; } @@ -358,7 +358,7 @@ foreach ($modules as $module) { } else if (($module["id_tipo_modulo"] == 100) OR ($module['history_data'] == 0)) { echo ""; - echo substr(safe_output($module["datos"]),0,12); + echo substr(io_safe_output($module["datos"]),0,12); } else { $graph_type = return_graphtype ($module["id_tipo_modulo"]); @@ -372,8 +372,8 @@ foreach ($modules as $module) { if (strlen($module["datos"]) > 0 ) $colspan = 2; else $colspan= 1; - echo ""; - echo substr(safe_output($module["datos"]),0,42); + echo ""; + echo substr(io_safe_output($module["datos"]),0,42); } echo ""; @@ -381,7 +381,7 @@ foreach ($modules as $module) { $url = 'include/procesos.php?agente='.$module["id_agente_modulo"]; $win_handle=dechex(crc32($module["id_agente_modulo"].$module["nombre"])); echo ""; - $graph_label = safe_output($module["nombre"]); + $graph_label = io_safe_output($module["nombre"]); echo "" . html_print_image('images/grafica_m.png' , true, array("border" => '0', "alt" => '')) . " "; diff --git a/pandora_console/operation/agentes/export_csv.php b/pandora_console/operation/agentes/export_csv.php index e5630a5a17..c511871fa4 100644 --- a/pandora_console/operation/agentes/export_csv.php +++ b/pandora_console/operation/agentes/export_csv.php @@ -30,7 +30,7 @@ if (! check_acl ($config['id_user'], 0, "AR") && ! check_acl ($config['id_user'] if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){ $id_agentmodule = $_GET["agentmodule"]; $id_agent = $_GET["agent"]; - $agentmodule_name = get_agentmodule_name ($id_agentmodule); + $agentmodule_name = modules_get_agentmodule_name ($id_agentmodule); if (! check_acl ($config['id_user'], get_agent_group($id_agent), "AR")) { db_pandora_audit("ACL Violation", "Trying to access Agent Export Data"); @@ -60,7 +60,7 @@ if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){ // Make the query $sql1="SELECT * FROM tdatos WHERE id_agente = $id_agent AND id_agente_modulo = $id_agentmodule"; - $tipo = get_moduletype_name (get_agentmodule_type ($id_agentmodule)); + $tipo = modules_get_moduletype_name (modules_get_agentmodule_type ($id_agentmodule)); if ($tipo == "generic_data_string") $sql1 = "SELECT * FROM tagente_datos_string diff --git a/pandora_console/operation/agentes/exportdata.php b/pandora_console/operation/agentes/exportdata.php index f6bd3dbffa..3c3b9ce4b8 100644 --- a/pandora_console/operation/agentes/exportdata.php +++ b/pandora_console/operation/agentes/exportdata.php @@ -60,7 +60,7 @@ if (is_ajax ()) { return; foreach ($agents as $agent) { - echo safe_output($agent['nombre'])."|".safe_output($agent['direccion'])."\n"; + echo io_safe_output($agent['nombre'])."|".io_safe_output($agent['direccion'])."\n"; } return; @@ -216,17 +216,17 @@ if (!empty ($export_btn) && !empty ($module)) { $data = array (); // Reinitialize array for each module chunk if ($export_type == "avg") { $arr = array (); - $arr["data"] = get_agentmodule_data_average ($selected, $work_period, $work_end); + $arr["data"] = reporting_get_agentmodule_data_average ($selected, $work_period, $work_end); if ($arr["data"] === false) { continue; } - $arr["module_name"] = get_agentmodule_name ($selected); - $arr["agent_name"] = get_agentmodule_agent_name ($selected); - $arr["agent_id"] = get_agentmodule_agent ($selected); + $arr["module_name"] = modules_get_agentmodule_name ($selected); + $arr["agent_name"] = modules_get_agentmodule_agent_name ($selected); + $arr["agent_id"] = modules_get_agentmodule_agent ($selected); $arr["utimestamp"] = $end; array_push ($data, $arr); } else { - $data_single = get_agentmodule_data ($selected, $work_period, $work_end); + $data_single = modules_get_agentmodule_data ($selected, $work_period, $work_end); if (!empty ($data_single)) { $data = array_merge ($data, $data_single); } @@ -240,9 +240,9 @@ if (!empty ($export_btn) && !empty ($module)) { */ foreach ($data as $key => $module) { $output .= $rowstart; - $output .= safe_output($module['agent_name']); + $output .= io_safe_output($module['agent_name']); $output .= $divider; - $output .= safe_output($module['module_name']); + $output .= io_safe_output($module['module_name']); $output .= $divider; $output .= $module['data']; $output .= $divider; diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index 7f469926b4..0e12d87553 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -87,7 +87,7 @@ foreach ($groups as $id_group => $group_name) { continue; // Skip group 0 // Get stats for this group - $data = get_group_stats($id_group); + $data = reporting_get_group_stats($id_group); if ($data["total_agents"] == 0) continue; // Skip empty groups diff --git a/pandora_console/operation/agentes/networkmap.groups.php b/pandora_console/operation/agentes/networkmap.groups.php index 819fab9a73..a907659389 100644 --- a/pandora_console/operation/agentes/networkmap.groups.php +++ b/pandora_console/operation/agentes/networkmap.groups.php @@ -29,10 +29,10 @@ if (! check_acl ($config['id_user'], 0, "AR")) { require_once ('include/functions_networkmap.php'); // Set filter -$filter = get_filter ($layout); +$filter = networkmap_get_filter ($layout); // Generate dot file -$graph = generate_dot_groups (__('Pandora FMS'), $group, $simple, $font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen, $pure, $modwithalerts, $module_group, $hidepolicymodules, $depth, $id_networkmap); +$graph = networkmap_generate_dot_groups (__('Pandora FMS'), $group, $simple, $font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen, $pure, $modwithalerts, $module_group, $hidepolicymodules, $depth, $id_networkmap); if ($graph === false) { ui_print_error_message (__('Map could not be generated')); diff --git a/pandora_console/operation/agentes/networkmap.php b/pandora_console/operation/agentes/networkmap.php index 4869fcde1b..db5f8dcd51 100644 --- a/pandora_console/operation/agentes/networkmap.php +++ b/pandora_console/operation/agentes/networkmap.php @@ -39,7 +39,7 @@ $recenter_networkmap = get_parameter ('recenter_networkmap', 0); $hidden_options = get_parameter ('hidden_options', 1); if($delete_networkmap) { - $result = delete_networkmap($id_networkmap); + $result = networkmap_delete_networkmap($id_networkmap); $message = ui_print_result_message ($result, __('Network map deleted successfully'), __('Could not delete network map'), '', true); @@ -64,7 +64,7 @@ if($add_networkmap) { $center = 0; $name = $activeTab; - $id_networkmap = create_networkmap($name, $activeTab, $layout, $nooverlap, $simple, $regen, $font_size, $group, $module_group, $depth, $modwithalerts, $hidepolicymodules, $zoom, $ranksep, $center); + $id_networkmap = networkmap_create_networkmap($name, $activeTab, $layout, $nooverlap, $simple, $regen, $font_size, $group, $module_group, $depth, $modwithalerts, $hidepolicymodules, $zoom, $ranksep, $center); $message = ui_print_result_message ($id_networkmap, __('Network map created successfully'), __('Could not create network map'), '', true); @@ -88,7 +88,7 @@ if($save_networkmap || $update_networkmap) { $name = (string) get_parameter ('name', $activeTab); if($save_networkmap){ - $result = update_networkmap($id_networkmap, array('name' => $name, 'type' => $activeTab, 'layout' => $layout, + $result = networkmap_update_networkmap($id_networkmap, array('name' => $name, 'type' => $activeTab, 'layout' => $layout, 'nooverlap' => $nooverlap, 'simple' => $simple, 'regenerate' => $regen, 'font_size' => $font_size, 'id_group' => $group, 'id_module_group' => $module_group, 'depth' => $depth, 'only_modules_with_alerts' => $modwithalerts, 'hide_policy_modules' => $hidepolicymodules, 'zoom' => $zoom, 'distance_nodes' => $ranksep, 'center' => $center)); @@ -98,7 +98,7 @@ if($save_networkmap || $update_networkmap) { } } -$networkmaps = get_networkmaps(); +$networkmaps = networkmap_get_networkmaps(); $nomaps = false; if($networkmaps === false) { @@ -111,14 +111,14 @@ if($nomaps && $id_networkmap == 0) { // If the map id is not defined, we set the first id of the active type if(!$nomaps && $id_networkmap == 0) { - $networkmaps_of_type = get_networkmaps('', $activeTab); + $networkmaps_of_type = networkmap_get_networkmaps('', $activeTab); if($networkmaps_of_type !== false){ $id_networkmap = reset(array_keys($networkmaps_of_type)); } } if(!$update_networkmap && !$save_networkmap && $id_networkmap != 0) { - $networkmap_data = get_networkmap($id_networkmap); + $networkmap_data = networkmap_get_networkmap($id_networkmap); $layout = $networkmap_data['layout']; $depth = $networkmap_data['depth']; diff --git a/pandora_console/operation/agentes/networkmap.topology.php b/pandora_console/operation/agentes/networkmap.topology.php index fb62724ba5..14e1bdebe8 100644 --- a/pandora_console/operation/agentes/networkmap.topology.php +++ b/pandora_console/operation/agentes/networkmap.topology.php @@ -29,10 +29,10 @@ if (! check_acl ($config['id_user'], 0, "AR")) { require_once ('include/functions_networkmap.php'); // Set filter -$filter = get_filter ($layout); +$filter = networkmap_get_filter ($layout); // Generate dot file -$graph = generate_dot (__('Pandora FMS'), $group, $simple, $font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen, $pure, $id_networkmap); +$graph = networkmap_generate_dot (__('Pandora FMS'), $group, $simple, $font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen, $pure, $id_networkmap); if ($graph === false) { ui_print_error_message (__('Map could not be generated')); diff --git a/pandora_console/operation/agentes/sla_view.php b/pandora_console/operation/agentes/sla_view.php index 5be08c7bba..a6237fa649 100644 --- a/pandora_console/operation/agentes/sla_view.php +++ b/pandora_console/operation/agentes/sla_view.php @@ -76,17 +76,17 @@ foreach ($modules as $module_id => $module) { } $data = array (); $data[0] = ui_print_moduletype_icon ($module["id_tipo_modulo"], true); - $data[1] = print_string_substr ($module["nombre"], 25, true); + $data[1] = ui_print_string_substr ($module["nombre"], 25, true); if ($module["min_critical"] != 0){ $sla_min = $module["min_critical"]; - $data[2] = format_numeric (get_agentmodule_sla ($module_id, $config["sla_period"], $sla_min)); + $data[2] = format_numeric (reporting_get_agentmodule_sla ($module_id, $config["sla_period"], $sla_min)); $data[2] = 100 - $data[2]. "%"; } else { - $data[2] = format_numeric (get_agentmodule_sla ($module_id, $config["sla_period"], 1)).'%'; + $data[2] = format_numeric (reporting_get_agentmodule_sla ($module_id, $config["sla_period"], 1)).'%'; } //TODO: Make this work for all new status - $status = get_agentmodule_status ($module_id); + $status = modules_get_agentmodule_status ($module_id); if ($status == 1){ $data[3] = html_print_image ("images/pixel_red.png", true, array ("width" => 40, "height" => 18, "title" => __('Module Down'))); } else { @@ -128,8 +128,8 @@ if ($result !== false) { $data[0] = ui_print_moduletype_icon ($modules[$sla_data["id_agent_module"]]["id_tipo_modulo"], true); $data[1] = print_string_substr ($modules[$sla_data["id_agent_module"]]["nombre"], 25, true); $data[1] .= "(".$sla_data["sla_min"]." / ".$sla_data["sla_max"]." / ".$sla_data["sla_limit"].")"; - $data[2] = format_numeric (get_agentmodule_sla ($sla_data["id_agent_module"], $config["sla_period"], 1)).'%'; - $status = get_agentmodule_status ($sla_data["id_agent_module"]); + $data[2] = format_numeric (reporting_get_agentmodule_sla ($sla_data["id_agent_module"], $config["sla_period"], 1)).'%'; + $status = modules_get_agentmodule_status ($sla_data["id_agent_module"]); if ($status == 1){ $data[3] = html_print_image ("images/pixel_red.png", true, array ("width" => 40, "height" => 18, "title" => __('Module Down'))); } else { diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index 17ac1a014c..60c159af5a 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -48,7 +48,7 @@ if ($refresh > 0) { } ?> -Pandora FMS Graph (<?php echo get_agentmodule_agent_name ($id) . ' - ' . $label; ?>) +Pandora FMS Graph (<?php echo modules_get_agentmodule_agent_name ($id) . ' - ' . $label; ?>) diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 5de33793c4..baebf7c161 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -418,9 +418,9 @@ foreach ($result as $row) { $data[1] .= substr ($row["agent_name"], 0, 25); $data[1] .= ''; - $data[2] = html_print_image("images/" . show_icon_type ($row["module_type"]), true); + $data[2] = html_print_image("images/" . modules_show_icon_type ($row["module_type"]), true); - $data[3] = mb_strimwidth (safe_output($row["module_name"]), 0, 30); + $data[3] = mb_strimwidth (io_safe_output($row["module_name"]), 0, 30); $data[4] = ($row['module_interval'] == 0) ? $row['agent_interval'] : $row['module_interval']; @@ -437,7 +437,7 @@ foreach ($result as $row) { $data[5] = ui_print_status_image(STATUS_MODULE_WARNING, __('WARNING').": ".$row["datos"], true); } else { - $last_status = get_agentmodule_last_status($row['id_agente_modulo']); + $last_status = modules_get_agentmodule_last_status($row['id_agente_modulo']); switch($last_status) { case 0: $data[5] = ui_print_status_image(STATUS_MODULE_OK, __('UNKNOWN')." - ".__('Last status')." ".__('NORMAL').": ".$row["datos"], true); @@ -457,7 +457,7 @@ foreach ($result as $row) { $graph_type = return_graphtype ($row["module_type"]); - $nombre_tipo_modulo = get_moduletype_name ($row["module_type"]); + $nombre_tipo_modulo = modules_get_moduletype_name ($row["module_type"]); $handle = "stat".$nombre_tipo_modulo."_".$row["id_agente_modulo"]; $url = 'include/procesos.php?agente='.$row["id_agente_modulo"]; $win_handle=dechex(crc32($row["id_agente_modulo"].$row["module_name"])); @@ -471,7 +471,7 @@ foreach ($result as $row) { if (is_numeric($row["datos"])) $data[7] = format_numeric($row["datos"]); else - $data[7] = "".substr(safe_output($row["datos"]),0,12).""; + $data[7] = "".substr(io_safe_output($row["datos"]),0,12).""; if ($row["module_interval"] > 0) $interval = $row["module_interval"]; diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index e737291fbb..e8ecff685e 100644 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -50,7 +50,7 @@ function print_cells_temp ($cells) { } if (isset($row["href"])) - echo ''.$row[1].''; + echo ''.$row[1].''; else echo ''.$row[1].''; } @@ -67,7 +67,7 @@ else { // Header ui_print_page_header (__("Tactical view"), "images/bricks.png", false, "", false, $updated_time ); -$data = get_group_stats(); +$data = reporting_get_group_stats(); echo '
'; // Monitor checks @@ -162,7 +162,7 @@ print_cells_temp ($cells); // Server performance // -------------------------------------------------------------------------- if($is_admin) { - $server_performance = get_server_performance(); + $server_performance = servers_get_performance(); echo ''.__('Server performance').''; $cells = array (); @@ -233,7 +233,7 @@ events_print_event_table ("WHERE estado<>1 ", 10, "100%"); // Server information // -------------------------------------------------------------------------- if($is_admin) { - $serverinfo = get_server_info (); + $serverinfo = servers_get_info (); $cells = array (); if ($serverinfo === false) { diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 302a865e5e..68464a19a3 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -159,7 +159,7 @@ if (is_ajax ()) { $result = array(); foreach($nameModules as $nameModule) { - $result[] = safe_output($nameModule['nombre']); + $result[] = io_safe_output($nameModule['nombre']); } echo json_encode($result); @@ -168,14 +168,14 @@ if (is_ajax ()) { if ($get_agent_modules_json) { $id_agent = (int) get_parameter ('id_agent'); - $filter = safe_output((string) get_parameter ('filter')); + $filter = io_safe_output((string) get_parameter ('filter')); $fields = (string) get_parameter ('fields'); $indexed = (bool) get_parameter ('indexed', true); $agentName = (string) get_parameter ('agent_name', null); if ($agentName != null) { $search = array(); - $search['name'] = safe_output($agentName); + $search['name'] = io_safe_output($agentName); } else $search = false; @@ -189,7 +189,7 @@ if (is_ajax ()) { ($filter != '' ? $filter : false), $indexed); foreach($agent_modules as $key => $module) { - $agent_modules[$key]['nombre'] = safe_output($module['nombre']); + $agent_modules[$key]['nombre'] = io_safe_output($module['nombre']); } //Hack to translate text "any" in PHP to javascript @@ -284,11 +284,11 @@ if (is_ajax ()) { echo html_print_image("images/brick.png", true) . ' '; echo ui_print_truncate_text($module['nombre'],25,false,true,false).''; echo ''.__('Type').': '; - $agentmoduletype = get_agentmodule_type ($module['id_agente_modulo']); - echo get_moduletype_name ($agentmoduletype).' '; - echo html_print_image("images/" . get_module_type_icon ($agentmoduletype), true) . '
'; + $agentmoduletype = modules_get_agentmodule_type ($module['id_agente_modulo']); + echo modules_get_moduletype_name ($agentmoduletype).' '; + echo html_print_image("images/" . modules_get_type_icon ($agentmoduletype), true) . '
'; echo ''.__('Module group').': '; - $modulegroup = get_modulegroup_name (get_agentmodule_modulegroup ($module['id_agente_modulo'])); + $modulegroup = modules_get_modulegroup_name (modules_get_agentmodule_modulegroup ($module['id_agente_modulo'])); if($modulegroup === false){ echo __('None').'
'; } @@ -296,7 +296,7 @@ if (is_ajax ()) { echo $modulegroup.'
'; } echo ''.__('Agent').': '; - echo ui_print_truncate_text(get_agentmodule_agent_name ($module['id_agente_modulo']),25,false,true,false).'
'; + echo ui_print_truncate_text(modules_get_agentmodule_agent_name ($module['id_agente_modulo']),25,false,true,false).'
'; return; } diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index da08fda4bc..b8cef62a9e 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -409,10 +409,10 @@ foreach ($result as $event) { $data[1] = ''; $data[1] .= ''; if (strlen ($event["evento"]) > 50) { - $data[1] .= mb_substr (safe_output($event["evento"]), 0, 50)."..."; + $data[1] .= mb_substr (io_safe_output($event["evento"]), 0, 50)."..."; } else { - $data[1] .= safe_output($event["evento"]); + $data[1] .= io_safe_output($event["evento"]); } $data[1] .= ''; @@ -520,7 +520,7 @@ foreach ($result as $event) { $string = ''; $string .= ''; $string .= ''; @@ -278,9 +278,9 @@ if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $conf echo '
'; $string .= '' . __('Event name') . ':'; - $string .= safe_output($event["evento"]); + $string .= io_safe_output($event["evento"]); $string .= '
'; $string .= '' . __('Severity') . ':'; diff --git a/pandora_console/operation/events/events_rss.php b/pandora_console/operation/events/events_rss.php index 916095dae3..cea5dcf260 100644 --- a/pandora_console/operation/events/events_rss.php +++ b/pandora_console/operation/events/events_rss.php @@ -55,7 +55,7 @@ function rss_error_handler ($errno, $errstr, $errfile, $errline) { $rss_feed .= 'Pandora RSS FeedLatest events on Pandora'; $rss_feed .= ''.date (DATE_RFC822, 0).''; $rss_feed .= ''.$url.''; //Link back to the main Pandora page - $rss_feed .= ''; //Alternative for Atom feeds. It's the same. + $rss_feed .= ''; //Alternative for Atom feeds. It's the same. $rss_feed .= ''.$url.'/index.php?sec=eventos&sec2=operation/events/eventsError creating feed'; $rss_feed .= 'There was an error creating the feed: '.$errno.' - '.$errstr.' in '.$errfile.' on line '.$errline.''; @@ -218,13 +218,13 @@ $rss_feed .= ''; $rss_feed .= 'Pandora RSS FeedLatest events on Pandora'; $rss_feed .= ''.date (DATE_RFC822, $lastbuild).''; //Last build date is the last event - that way readers won't mark it as having new posts $rss_feed .= ''.$url.''; //Link back to the main Pandora page -$rss_feed .= ''; //Alternative for Atom feeds. It's the same. +$rss_feed .= ''; //Alternative for Atom feeds. It's the same. if (empty ($result)) { $result = array(); - $rss_feed .= ''.safe_input ($url.'/index.php?sec=eventos&sec2=operation/events/events').'No results'; + $rss_feed .= ''.io_safe_input ($url.'/index.php?sec=eventos&sec2=operation/events/events').'No results'; $rss_feed .= 'There are no results. Click on the link to see all Pending events'; - $rss_feed .= ''.safe_input ($url.'/index.php?sec=eventos&sec2=operation/events/events').''; + $rss_feed .= ''.io_safe_input ($url.'/index.php?sec=eventos&sec2=operation/events/events').''; } foreach ($result as $row) { @@ -244,16 +244,16 @@ foreach ($result as $row) { //This is mandatory $rss_feed .= ''; - $rss_feed .= safe_input ($url . "/index.php?sec=eventos&sec2=operation/events/events&id_event=" . $row['event_id']); + $rss_feed .= io_safe_input ($url . "/index.php?sec=eventos&sec2=operation/events/events&id_event=" . $row['event_id']); $rss_feed .= ''; $rss_feed .= $agent_name; $rss_feed .= ''; - $rss_feed .= safe_input ($row['event_descr']); + $rss_feed .= io_safe_input ($row['event_descr']); if($row['validated'] == 1) { - $rss_feed .= safe_input ('

').'Validated by ' . safe_input ($row['validated_by']); + $rss_feed .= io_safe_input ('

').'Validated by ' . io_safe_input ($row['validated_by']); } $rss_feed .= '
'; - $rss_feed .= safe_input ($url . "/index.php?sec=eventos&sec2=operation/events/events&id_event=" . $row["event_id"]); + $rss_feed .= io_safe_input ($url . "/index.php?sec=eventos&sec2=operation/events/events&id_event=" . $row["event_id"]); $rss_feed .= ''; //The rest is optional diff --git a/pandora_console/operation/incidents/incident.download_file.php b/pandora_console/operation/incidents/incident.download_file.php index e280ef400f..5f9aa87859 100644 --- a/pandora_console/operation/incidents/incident.download_file.php +++ b/pandora_console/operation/incidents/incident.download_file.php @@ -25,7 +25,7 @@ $integria_api = $config['integria_url']."/include/api.php?return_type=csv&user=" $url = $integria_api."&op=download_file¶ms=".$id_file; // Call the integria API -$file = call_api($url); +$file = incidents_call_api($url); header("Content-type: binary"); header("Content-Disposition: attachment; filename=\"".$filename."\""); diff --git a/pandora_console/operation/incidents/incident.incident.php b/pandora_console/operation/incidents/incident.incident.php index 1962f16de3..39137ca02d 100644 --- a/pandora_console/operation/incidents/incident.incident.php +++ b/pandora_console/operation/incidents/incident.incident.php @@ -77,7 +77,7 @@ else { } $table->data[1][0] = "".__('Group')."
".html_print_select ($groups, 'group', $result['id_grupo'], '', '', 0, true, false, false); -$table->data[1][1] = "".__('Priority')."
".html_print_select (get_incidents_priorities (), 'priority', $result['prioridad'], '', '', 0, true, false, false); +$table->data[1][1] = "".__('Priority')."
".html_print_select (incidents_get_priorities (), 'priority', $result['prioridad'], '', '', 0, true, false, false); $table->data[1][2] = "".__('Creator')."
".$result['id_creator']; if(isset($result['id_incidencia'])) { diff --git a/pandora_console/operation/incidents/incident.list.php b/pandora_console/operation/incidents/incident.list.php index eb0a57d6ab..30e86cc5fa 100644 --- a/pandora_console/operation/incidents/incident.list.php +++ b/pandora_console/operation/incidents/incident.list.php @@ -122,10 +122,10 @@ foreach ($incidents as $row) { $data[0] = ''.$row["id_incidencia"].''; //$data[1] = ""; - $data[2] = ''.substr(safe_output($row["titulo"]),0,45).''; + $data[2] = ''.substr(io_safe_output($row["titulo"]),0,45).''; $data[3] = $groups[$row["id_grupo"]]; $data[4] = $status[$row["estado"]]."
".$resolutions[$row["resolution"]].""; - $data[5] = print_incidents_priority_img ($row["prioridad"], true); + $data[5] = incidents_print_priority_img ($row["prioridad"], true); $data[6] = ui_print_timestamp ($row["actualizacion"], true)."
" . ui_print_timestamp ($row["inicio"], true).""; $data[7] = $row["workunits_hours"]." ".__('Hours')."
".$row["workunits_count"]." ".__('Workunits'); $data[8] = $row["id_creator"]; diff --git a/pandora_console/operation/incidents/incident.php b/pandora_console/operation/incidents/incident.php index f021b39b08..d08b9903cc 100755 --- a/pandora_console/operation/incidents/incident.php +++ b/pandora_console/operation/incidents/incident.php @@ -76,9 +76,9 @@ $integria_api = $config['integria_url']."/include/api.php?return_type=xml&user=" if($update_incident == 1) { $values[0] = $id_incident; - $values[1] = str_replace(" ", "%20", safe_output(get_parameter('title'))); - $values[2] = str_replace(" ", "%20", safe_output(get_parameter('description'))); - $values[3] = str_replace(" ", "%20", safe_output(get_parameter('epilog'))); + $values[1] = str_replace(" ", "%20", io_safe_output(get_parameter('title'))); + $values[2] = str_replace(" ", "%20", io_safe_output(get_parameter('description'))); + $values[3] = str_replace(" ", "%20", io_safe_output(get_parameter('epilog'))); $values[4] = get_parameter('group'); $values[5] = get_parameter('priority'); $values[6] = get_parameter('source'); @@ -90,16 +90,16 @@ if($update_incident == 1) { $url = $integria_api."&op=update_incident&token=".$token."¶ms=".$params; // Call the integria API - $result = call_api($url); + $result = incidents_call_api($url); } $create_incident = get_parameter('create_incident', 0); if($create_incident == 1) { - $values[0] = str_replace(" ", "%20", safe_output(get_parameter('title'))); + $values[0] = str_replace(" ", "%20", io_safe_output(get_parameter('title'))); $values[1] = get_parameter('group'); $values[2] = get_parameter('priority'); - $values[3] = str_replace(" ", "%20", safe_output(get_parameter('description'))); + $values[3] = str_replace(" ", "%20", io_safe_output(get_parameter('description'))); $values[4] = $config['integria_inventory']; $params = implode($token, $values); @@ -107,7 +107,7 @@ if($create_incident == 1) { $url = $integria_api."&op=create_incident&token=".$token."¶ms=".$params; // Call the integria API - $result = call_api($url); + $result = incidents_call_api($url); } $attach_file = get_parameter('attach_file', 0); @@ -119,7 +119,7 @@ if($attach_file == 1) { $values[0] = $id_incident; $values[1] = $_FILES['new_file']['name']; $values[2] = $_FILES['new_file']['size']; - $values[3] = str_replace(" ", "%20", safe_output(get_parameter('description'), __('No description available'))); + $values[3] = str_replace(" ", "%20", io_safe_output(get_parameter('description'), __('No description available'))); $values[4] = base64_encode($file_content); @@ -128,7 +128,7 @@ if($attach_file == 1) { $url = $integria_api."&op=attach_file&token=".$token; // Call the integria API - $result = call_api($url, array('params' => $params)); + $result = incidents_call_api($url, array('params' => $params)); } else { switch ($_FILES['new_file']['error']) { @@ -153,7 +153,7 @@ if($delete_file != 0) { $url = $integria_api."&op=delete_file¶ms=".$delete_file; // Call the integria API - $result = call_api($url); + $result = incidents_call_api($url); } $delete_incident = get_parameter('delete_incident', 0); @@ -162,14 +162,14 @@ if($delete_incident != 0) { $url = $integria_api."&op=delete_incident¶ms=".$delete_incident; // Call the integria API - $result = call_api($url); + $result = incidents_call_api($url); } $create_workunit = get_parameter('create_workunit', 0); if($create_workunit == 1) { $values[0] = $id_incident; - $values[1] = str_replace(" ", "%20", safe_output(get_parameter('description'))); + $values[1] = str_replace(" ", "%20", io_safe_output(get_parameter('description'))); $values[2] = get_parameter('time_used'); $values[3] = get_parameter('have_cost'); $values[4] = get_parameter('public'); @@ -180,7 +180,7 @@ if($create_workunit == 1) { $url = $integria_api."&op=create_workunit&token=".$token."¶ms=".$params; // Call the integria API - $result = call_api($url); + $result = incidents_call_api($url); } // Set the url with parameters to call the api @@ -224,7 +224,7 @@ switch($tab) { if(isset($url)) { // Call the integria API - $xml = call_api($url); + $xml = incidents_call_api($url); } else { $xml = ""; @@ -232,24 +232,24 @@ else { // If is a valid XML, parse it if(xml_parse(xml_parser_create(), $xml)) { - $result = xml_to_array($xml); + $result = incidents_xml_to_array($xml); if($result == false) { $result = array(); } switch($tab) { case 'list': - $result_resolutions = xml_to_array(call_api($url_resolutions)); - $result_status = xml_to_array(call_api($url_status)); - $result_groups = xml_to_array(call_api($url_groups)); + $result_resolutions = incidents_xml_to_array(incidents_call_api($url_resolutions)); + $result_status = incidents_xml_to_array(incidents_call_api($url_status)); + $result_groups = incidents_xml_to_array(incidents_call_api($url_groups)); require_once('incident.list.php'); break; case 'editor': case 'incident': - $result_resolutions = xml_to_array(call_api($url_resolutions)); - $result_status = xml_to_array(call_api($url_status)); - $result_sources = xml_to_array(call_api($url_sources)); - $result_groups = xml_to_array(call_api($url_groups)); - $result_users = xml_to_array(call_api($url_users)); + $result_resolutions = incidents_xml_to_array(incidents_call_api($url_resolutions)); + $result_status = incidents_xml_to_array(incidents_call_api($url_status)); + $result_sources = incidents_xml_to_array(incidents_call_api($url_sources)); + $result_groups = incidents_xml_to_array(incidents_call_api($url_groups)); + $result_users = incidents_xml_to_array(incidents_call_api($url_users)); require_once('incident.incident.php'); break; diff --git a/pandora_console/operation/incidents/incident_detail.php b/pandora_console/operation/incidents/incident_detail.php index 67986f7279..8bfb809d63 100755 --- a/pandora_console/operation/incidents/incident_detail.php +++ b/pandora_console/operation/incidents/incident_detail.php @@ -63,7 +63,7 @@ if (isset ($_GET["id"])) { $id_nota = db_process_sql_insert('tnota', $values); if ($id_nota !== false) { - process_incidents_touch ($id_inc); + incidents_process_touch ($id_inc); } ui_print_result_message ($id_nota, __('Successfully added'), @@ -73,15 +73,15 @@ if (isset ($_GET["id"])) { // Delete note if (isset ($_POST["delete_nota"])) { $id_nota = get_parameter_post ("delete_nota", 0); - $note_user = get_incidents_notes_author ($id_nota); + $note_user = incidents_get_notes_author ($id_nota); if (((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($note_user == $config["id_user"])) OR ($id_owner == $config["id_user"])) { // Only admins (manage incident) or owners can modify // incidents notes. note authors are // able to delete their own notes - $result = delete_incidents_note ($id_nota); + $result = incidents_delete_note ($id_nota); if (!empty ($result)) { - process_incidents_touch ($id_inc); + incidents_process_touch ($id_inc); } ui_print_result_message ($id_nota, __('Successfully deleted'), @@ -98,7 +98,7 @@ if (isset ($_GET["id"])) { if (!empty ($result)) { unlink ($config["attachment_store"]."/pand".$file_id."_".$filename); - process_incidents_touch ($id_inc); + incidents_process_touch ($id_inc); } ui_print_result_message ($result, @@ -111,8 +111,8 @@ if (isset ($_GET["id"])) { $description = get_parameter_post ("file_description", __('No description available')); // Insert into database - $filename = safe_input ($_FILES['userfile']['name']); - $filesize = safe_input ($_FILES['userfile']['size']); + $filename = io_safe_input ($_FILES['userfile']['name']); + $filesize = io_safe_input ($_FILES['userfile']['size']); //The following is if you have clamavlib installed //(php5-clamavlib) and enabled in php.ini @@ -146,7 +146,7 @@ if (isset ($_GET["id"])) { if ($result !== false) { unlink ($_FILES['userfile']['tmp_name']); - process_incidents_touch ($id_inc); + incidents_process_touch ($id_inc); } else { db_process_sql_delete('tattachment', array('id_attachment' => $id_attachment)); @@ -241,10 +241,10 @@ if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $conf echo '
'.__('Status').''; if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) { - html_print_select (get_incidents_status (), "estado_form", $estado, '', '', '', false, false, false, 'w135'); + html_print_select (incidents_get_status (), "estado_form", $estado, '', '', '', false, false, false, 'w135'); } else { - html_print_select (get_incidents_status (), "estado_form", $estado, '', '', '', false, false, false, 'w135', true); + html_print_select (incidents_get_status (), "estado_form", $estado, '', '', '', false, false, false, 'w135', true); } echo '
'.__('Priority').''; if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) { - html_print_select (get_incidents_priorities (), "prioridad_form", $prioridad, '', '', '', false, false, false, 'w135'); + html_print_select (incidents_get_priorities (), "prioridad_form", $prioridad, '', '', '', false, false, false, 'w135'); } else { - html_print_select (get_incidents_priorities (), "prioridad_form", $prioridad, '', '', '', false, false, false, 'w135', true); + html_print_select (incidents_get_priorities (), "prioridad_form", $prioridad, '', '', '', false, false, false, 'w135', true); } echo ''.__('Creator').''; @@ -329,7 +329,7 @@ if (isset ($id_inc)) {
'; - $result = get_incidents_notes ($id_inc); + $result = incidents_get_notes ($id_inc); $table->cellpadding = 4; $table->cellspacing = 4; @@ -366,7 +366,7 @@ if (isset ($id_inc)) { // Files attached to this incident // ************************************************************ - $result = get_incidents_attach ($id_inc); + $result = incidents_get_attach ($id_inc); $table->cellpadding = 4; $table->cellspacing = 4; diff --git a/pandora_console/operation/integria_incidents/incident.download_file.php b/pandora_console/operation/integria_incidents/incident.download_file.php index e280ef400f..5f9aa87859 100644 --- a/pandora_console/operation/integria_incidents/incident.download_file.php +++ b/pandora_console/operation/integria_incidents/incident.download_file.php @@ -25,7 +25,7 @@ $integria_api = $config['integria_url']."/include/api.php?return_type=csv&user=" $url = $integria_api."&op=download_file¶ms=".$id_file; // Call the integria API -$file = call_api($url); +$file = incidents_call_api($url); header("Content-type: binary"); header("Content-Disposition: attachment; filename=\"".$filename."\""); diff --git a/pandora_console/operation/integria_incidents/incident.incident.php b/pandora_console/operation/integria_incidents/incident.incident.php index 1962f16de3..39137ca02d 100644 --- a/pandora_console/operation/integria_incidents/incident.incident.php +++ b/pandora_console/operation/integria_incidents/incident.incident.php @@ -77,7 +77,7 @@ else { } $table->data[1][0] = "".__('Group')."
".html_print_select ($groups, 'group', $result['id_grupo'], '', '', 0, true, false, false); -$table->data[1][1] = "".__('Priority')."
".html_print_select (get_incidents_priorities (), 'priority', $result['prioridad'], '', '', 0, true, false, false); +$table->data[1][1] = "".__('Priority')."
".html_print_select (incidents_get_priorities (), 'priority', $result['prioridad'], '', '', 0, true, false, false); $table->data[1][2] = "".__('Creator')."
".$result['id_creator']; if(isset($result['id_incidencia'])) { diff --git a/pandora_console/operation/integria_incidents/incident.list.php b/pandora_console/operation/integria_incidents/incident.list.php index 16c4cc2410..fe4666bc57 100644 --- a/pandora_console/operation/integria_incidents/incident.list.php +++ b/pandora_console/operation/integria_incidents/incident.list.php @@ -116,10 +116,10 @@ foreach ($incidents as $row) { $data[0] = ''.$row["id_incidencia"].''; //$data[1] = ""; - $data[2] = ''.substr(safe_output($row["titulo"]),0,45).''; + $data[2] = ''.substr(io_safe_output($row["titulo"]),0,45).''; $data[3] = $groups[$row["id_grupo"]]; $data[4] = $status[$row["estado"]]."
".$resolutions[$row["resolution"]].""; - $data[5] = print_incidents_priority_img ($row["prioridad"], true); + $data[5] = incidents_print_priority_img ($row["prioridad"], true); $data[6] = ui_print_timestamp ($row["actualizacion"], true)."
" . ui_print_timestamp ($row["inicio"], true).""; $data[7] = $row["workunits_hours"]." ".__('Hours')."
".$row["workunits_count"]." ".__('Workunits'); $data[8] = $row["id_creator"]; diff --git a/pandora_console/operation/integria_incidents/incident.php b/pandora_console/operation/integria_incidents/incident.php index f021b39b08..d08b9903cc 100755 --- a/pandora_console/operation/integria_incidents/incident.php +++ b/pandora_console/operation/integria_incidents/incident.php @@ -76,9 +76,9 @@ $integria_api = $config['integria_url']."/include/api.php?return_type=xml&user=" if($update_incident == 1) { $values[0] = $id_incident; - $values[1] = str_replace(" ", "%20", safe_output(get_parameter('title'))); - $values[2] = str_replace(" ", "%20", safe_output(get_parameter('description'))); - $values[3] = str_replace(" ", "%20", safe_output(get_parameter('epilog'))); + $values[1] = str_replace(" ", "%20", io_safe_output(get_parameter('title'))); + $values[2] = str_replace(" ", "%20", io_safe_output(get_parameter('description'))); + $values[3] = str_replace(" ", "%20", io_safe_output(get_parameter('epilog'))); $values[4] = get_parameter('group'); $values[5] = get_parameter('priority'); $values[6] = get_parameter('source'); @@ -90,16 +90,16 @@ if($update_incident == 1) { $url = $integria_api."&op=update_incident&token=".$token."¶ms=".$params; // Call the integria API - $result = call_api($url); + $result = incidents_call_api($url); } $create_incident = get_parameter('create_incident', 0); if($create_incident == 1) { - $values[0] = str_replace(" ", "%20", safe_output(get_parameter('title'))); + $values[0] = str_replace(" ", "%20", io_safe_output(get_parameter('title'))); $values[1] = get_parameter('group'); $values[2] = get_parameter('priority'); - $values[3] = str_replace(" ", "%20", safe_output(get_parameter('description'))); + $values[3] = str_replace(" ", "%20", io_safe_output(get_parameter('description'))); $values[4] = $config['integria_inventory']; $params = implode($token, $values); @@ -107,7 +107,7 @@ if($create_incident == 1) { $url = $integria_api."&op=create_incident&token=".$token."¶ms=".$params; // Call the integria API - $result = call_api($url); + $result = incidents_call_api($url); } $attach_file = get_parameter('attach_file', 0); @@ -119,7 +119,7 @@ if($attach_file == 1) { $values[0] = $id_incident; $values[1] = $_FILES['new_file']['name']; $values[2] = $_FILES['new_file']['size']; - $values[3] = str_replace(" ", "%20", safe_output(get_parameter('description'), __('No description available'))); + $values[3] = str_replace(" ", "%20", io_safe_output(get_parameter('description'), __('No description available'))); $values[4] = base64_encode($file_content); @@ -128,7 +128,7 @@ if($attach_file == 1) { $url = $integria_api."&op=attach_file&token=".$token; // Call the integria API - $result = call_api($url, array('params' => $params)); + $result = incidents_call_api($url, array('params' => $params)); } else { switch ($_FILES['new_file']['error']) { @@ -153,7 +153,7 @@ if($delete_file != 0) { $url = $integria_api."&op=delete_file¶ms=".$delete_file; // Call the integria API - $result = call_api($url); + $result = incidents_call_api($url); } $delete_incident = get_parameter('delete_incident', 0); @@ -162,14 +162,14 @@ if($delete_incident != 0) { $url = $integria_api."&op=delete_incident¶ms=".$delete_incident; // Call the integria API - $result = call_api($url); + $result = incidents_call_api($url); } $create_workunit = get_parameter('create_workunit', 0); if($create_workunit == 1) { $values[0] = $id_incident; - $values[1] = str_replace(" ", "%20", safe_output(get_parameter('description'))); + $values[1] = str_replace(" ", "%20", io_safe_output(get_parameter('description'))); $values[2] = get_parameter('time_used'); $values[3] = get_parameter('have_cost'); $values[4] = get_parameter('public'); @@ -180,7 +180,7 @@ if($create_workunit == 1) { $url = $integria_api."&op=create_workunit&token=".$token."¶ms=".$params; // Call the integria API - $result = call_api($url); + $result = incidents_call_api($url); } // Set the url with parameters to call the api @@ -224,7 +224,7 @@ switch($tab) { if(isset($url)) { // Call the integria API - $xml = call_api($url); + $xml = incidents_call_api($url); } else { $xml = ""; @@ -232,24 +232,24 @@ else { // If is a valid XML, parse it if(xml_parse(xml_parser_create(), $xml)) { - $result = xml_to_array($xml); + $result = incidents_xml_to_array($xml); if($result == false) { $result = array(); } switch($tab) { case 'list': - $result_resolutions = xml_to_array(call_api($url_resolutions)); - $result_status = xml_to_array(call_api($url_status)); - $result_groups = xml_to_array(call_api($url_groups)); + $result_resolutions = incidents_xml_to_array(incidents_call_api($url_resolutions)); + $result_status = incidents_xml_to_array(incidents_call_api($url_status)); + $result_groups = incidents_xml_to_array(incidents_call_api($url_groups)); require_once('incident.list.php'); break; case 'editor': case 'incident': - $result_resolutions = xml_to_array(call_api($url_resolutions)); - $result_status = xml_to_array(call_api($url_status)); - $result_sources = xml_to_array(call_api($url_sources)); - $result_groups = xml_to_array(call_api($url_groups)); - $result_users = xml_to_array(call_api($url_users)); + $result_resolutions = incidents_xml_to_array(incidents_call_api($url_resolutions)); + $result_status = incidents_xml_to_array(incidents_call_api($url_status)); + $result_sources = incidents_xml_to_array(incidents_call_api($url_sources)); + $result_groups = incidents_xml_to_array(incidents_call_api($url_groups)); + $result_users = incidents_xml_to_array(incidents_call_api($url_users)); require_once('incident.incident.php'); break; diff --git a/pandora_console/operation/integria_incidents/incident_detail.php b/pandora_console/operation/integria_incidents/incident_detail.php index 67986f7279..8bfb809d63 100755 --- a/pandora_console/operation/integria_incidents/incident_detail.php +++ b/pandora_console/operation/integria_incidents/incident_detail.php @@ -63,7 +63,7 @@ if (isset ($_GET["id"])) { $id_nota = db_process_sql_insert('tnota', $values); if ($id_nota !== false) { - process_incidents_touch ($id_inc); + incidents_process_touch ($id_inc); } ui_print_result_message ($id_nota, __('Successfully added'), @@ -73,15 +73,15 @@ if (isset ($_GET["id"])) { // Delete note if (isset ($_POST["delete_nota"])) { $id_nota = get_parameter_post ("delete_nota", 0); - $note_user = get_incidents_notes_author ($id_nota); + $note_user = incidents_get_notes_author ($id_nota); if (((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($note_user == $config["id_user"])) OR ($id_owner == $config["id_user"])) { // Only admins (manage incident) or owners can modify // incidents notes. note authors are // able to delete their own notes - $result = delete_incidents_note ($id_nota); + $result = incidents_delete_note ($id_nota); if (!empty ($result)) { - process_incidents_touch ($id_inc); + incidents_process_touch ($id_inc); } ui_print_result_message ($id_nota, __('Successfully deleted'), @@ -98,7 +98,7 @@ if (isset ($_GET["id"])) { if (!empty ($result)) { unlink ($config["attachment_store"]."/pand".$file_id."_".$filename); - process_incidents_touch ($id_inc); + incidents_process_touch ($id_inc); } ui_print_result_message ($result, @@ -111,8 +111,8 @@ if (isset ($_GET["id"])) { $description = get_parameter_post ("file_description", __('No description available')); // Insert into database - $filename = safe_input ($_FILES['userfile']['name']); - $filesize = safe_input ($_FILES['userfile']['size']); + $filename = io_safe_input ($_FILES['userfile']['name']); + $filesize = io_safe_input ($_FILES['userfile']['size']); //The following is if you have clamavlib installed //(php5-clamavlib) and enabled in php.ini @@ -146,7 +146,7 @@ if (isset ($_GET["id"])) { if ($result !== false) { unlink ($_FILES['userfile']['tmp_name']); - process_incidents_touch ($id_inc); + incidents_process_touch ($id_inc); } else { db_process_sql_delete('tattachment', array('id_attachment' => $id_attachment)); @@ -241,10 +241,10 @@ if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $conf echo ''.__('Status').''; if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) { - html_print_select (get_incidents_status (), "estado_form", $estado, '', '', '', false, false, false, 'w135'); + html_print_select (incidents_get_status (), "estado_form", $estado, '', '', '', false, false, false, 'w135'); } else { - html_print_select (get_incidents_status (), "estado_form", $estado, '', '', '', false, false, false, 'w135', true); + html_print_select (incidents_get_status (), "estado_form", $estado, '', '', '', false, false, false, 'w135', true); } echo ''; @@ -278,9 +278,9 @@ if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $conf echo ''.__('Priority').''; if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) { - html_print_select (get_incidents_priorities (), "prioridad_form", $prioridad, '', '', '', false, false, false, 'w135'); + html_print_select (incidents_get_priorities (), "prioridad_form", $prioridad, '', '', '', false, false, false, 'w135'); } else { - html_print_select (get_incidents_priorities (), "prioridad_form", $prioridad, '', '', '', false, false, false, 'w135', true); + html_print_select (incidents_get_priorities (), "prioridad_form", $prioridad, '', '', '', false, false, false, 'w135', true); } echo ''.__('Creator').''; @@ -329,7 +329,7 @@ if (isset ($id_inc)) {
'; - $result = get_incidents_notes ($id_inc); + $result = incidents_get_notes ($id_inc); $table->cellpadding = 4; $table->cellspacing = 4; @@ -366,7 +366,7 @@ if (isset ($id_inc)) { // Files attached to this incident // ************************************************************ - $result = get_incidents_attach ($id_inc); + $result = incidents_get_attach ($id_inc); $table->cellpadding = 4; $table->cellspacing = 4; diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 1c229207e8..844969de3e 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -110,7 +110,7 @@ if (check_acl ($config['id_user'], 0, "AR")) { if (! check_acl ($config["id_user"], $layout["id_group"], "AR")) { continue; } - $name = safe_output($layout['name']); + $name = io_safe_output($layout['name']); if (empty($name)) { $firstLetter = ''; } @@ -303,5 +303,5 @@ if (check_acl ($config['id_user'], 0, "AR")) { } -print_menu ($menu); +menu_print_menu ($menu); ?> diff --git a/pandora_console/operation/messages/message.php b/pandora_console/operation/messages/message.php index f8b0a94644..1351deda3e 100644 --- a/pandora_console/operation/messages/message.php +++ b/pandora_console/operation/messages/message.php @@ -37,7 +37,7 @@ else if (isset ($_POST["delete_message"])) { $id = (int) get_parameter_post ("delete_message"); - $result = delete_message ($id); //Delete message function will actually check the credentials + $result = messages_delete_message ($id); //Delete message function will actually check the credentials ui_print_result_message ($result, __('Successfully deleted'), @@ -46,7 +46,7 @@ if (isset ($_POST["delete_message"])) { if (!empty ($dest_user) && isset ($_GET["send_message"])) { // Create message - $return = create_message ($config["id_user"], $dest_user, $subject, $message); + $return = messages_create_message ($config["id_user"], $dest_user, $subject, $message); ui_print_result_message ($return, __('Message successfully sent to user %s', get_user_fullname ($dest_user)), __('Error sending message to user %s', get_user_fullname ($dest_user))); @@ -54,7 +54,7 @@ if (!empty ($dest_user) && isset ($_GET["send_message"])) { if (!empty ($dest_group) && isset ($_GET["send_message"])) { // Create message to groups - $return = create_message_group ($config["id_user"], $dest_group, $subject, $message); + $return = messages_create_group ($config["id_user"], $dest_group, $subject, $message); ui_print_result_message ($return, __('Message successfully sent'), __('Error sending message to group %s', groups_get_name ($dest_group))); @@ -65,10 +65,10 @@ if (isset ($_GET["mark_read"]) || isset ($_GET["mark_unread"])) { $id_u = (int) get_parameter ("mark_unread"); if (!empty ($id_r)) { //Set to read - process_message_read ($id_r); + messages_process_read ($id_r); } elseif (!empty ($id_u)) { //Set to unread - process_message_read ($id_u, 0); + messages_process_read ($id_u, 0); } } @@ -117,14 +117,14 @@ if (isset ($_GET["new_msg"])) { //create message // ui_print_page_header (__('Messages'). " » ".__('Read message'), "images/email.png", false, "", false, "" ); $message_id = (int) get_parameter ("read_message"); - $message = get_message ($message_id); + $message = messages_get_message ($message_id); if ($message == false) { echo '
'.__('This message does not exist in the system').'
'; return; //Move out of this page and go processing other pages } - process_message_read ($message_id); + messages_process_read ($message_id); echo '
@@ -171,12 +171,12 @@ if (isset ($_GET["read_message"]) || !isset ($_GET["new_msg"])) { // } //Get number of messages - $num_messages = get_message_count ($config["id_user"]); + $num_messages = messages_get_count ($config["id_user"]); $order = get_parameter ("msg_overview_order", "status"); $order_dir = get_parameter ("msg_overview_orddir", "ASC"); - $messages = get_message_overview ($order, $order_dir); + $messages = messages_get_overview ($order, $order_dir); if ($num_messages > 0 && empty ($config["pure"]) && !is_ajax ()) { echo '

'.__('You have').' '.$num_messages.' '.html_print_image ("images/email.png", true).' '.__('unread message(s)').'.

'; diff --git a/pandora_console/operation/reporting/custom_reporting.php b/pandora_console/operation/reporting/custom_reporting.php index 69fe34c350..3ed9156e47 100644 --- a/pandora_console/operation/reporting/custom_reporting.php +++ b/pandora_console/operation/reporting/custom_reporting.php @@ -26,7 +26,7 @@ enterprise_include ('operation/reporting/custom_reporting.php'); // Header ui_print_page_header (__('Reporting'). " » ".__('Custom reporting'), "images/reporting.png", false, "", false, "" ); -$reports = get_reports (); +$reports = reports_get_reports (); if (sizeof ($reports) == 0) { echo "
".__('There are no defined reportings')."
"; diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index 8744ec1492..cd3930054d 100644 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -156,7 +156,7 @@ foreach ($contents as $content) { $table->colspan = array (); $table->rowstyle = array (); - render_report_html_item ($content, $table, $report); + reporting_render_report_html_item ($content, $table, $report); html_print_table ($table); flush (); diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index 61f5bd5840..26b1acfcb3 100644 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -162,10 +162,10 @@ echo ''.$time.''; echo ''.date ("r",$time).''; $xml["id"] = $id_report; -$xml["name"] = safe_output_xml ($report['name']); -$xml["description"] = safe_output_xml($report['description']); +$xml["name"] = io_safe_output_xml ($report['name']); +$xml["description"] = io_safe_output_xml($report['description']); $xml["group"]["id"] = $report['id_group']; -$xml["group"]["name"] = safe_output_xml ($group_name); +$xml["group"]["name"] = io_safe_output_xml ($group_name); if ($contents === false) { $contents = array (); @@ -179,8 +179,8 @@ $counter = 0; foreach ($contents as $content) { echo ''; $data = array (); - $data["module"] = safe_output_xml (db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module'])); - $data["agent"] = safe_output_xml (get_agentmodule_agent_name ($content['id_agent_module'])); + $data["module"] = io_safe_output_xml (db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module'])); + $data["agent"] = io_safe_output_xml (modules_get_agentmodule_agent_name ($content['id_agent_module'])); $data["period"] = human_time_description_raw ($content['period']); $data["uperiod"] = $content['period']; $data["type"] = $content["type"]; @@ -267,11 +267,11 @@ foreach ($contents as $content) { foreach ($slas as $sla) { $sla_data = array (); - $sla_data["agent"] = get_agentmodule_agent_name ($sla['id_agent_module']); - $sla_data["module"] = get_agentmodule_name ($sla['id_agent_module']); + $sla_data["agent"] = modules_get_agentmodule_agent_name ($sla['id_agent_module']); + $sla_data["module"] = modules_get_agentmodule_name ($sla['id_agent_module']); $sla_data["max"] = $sla['sla_max']; $sla_data["min"] = $sla['sla_min']; - $sla_value = get_agentmodule_sla ($sla['id_agent_module'], $content['period'], $sla['sla_min'], $sla['sla_max'], $datetime, $content, $content['time_from'], $content['time_to']); + $sla_value = reporting_get_agentmodule_sla ($sla['id_agent_module'], $content['period'], $sla['sla_min'], $sla['sla_max'], $datetime, $content, $content['time_from'], $content['time_to']); if ($sla_value === false) { $sla_data["error"] = __('Unknown'); } else { @@ -286,7 +286,7 @@ foreach ($contents as $content) { case 6: case 'monitor_report': $data["title"] = __('Monitor report'); - $monitor_value = get_agentmodule_sla ($content['id_agent_module'], $content['period'], 1, false, $datetime); + $monitor_value = reporting_get_agentmodule_sla ($content['id_agent_module'], $content['period'], 1, false, $datetime); if ($monitor_value === false) { $monitor_value = __('Unknown'); } else { @@ -301,7 +301,7 @@ foreach ($contents as $content) { case 7: case 'avg_value': $data["title"] = __('Avg. Value'); - $data["objdata"] = get_agentmodule_data_average ($content['id_agent_module'], $content['period'], $datetime); + $data["objdata"] = reporting_get_agentmodule_data_average ($content['id_agent_module'], $content['period'], $datetime); if ($data["objdata"] === false) { $data["objdata"] = __('Unknown'); } else { @@ -311,7 +311,7 @@ foreach ($contents as $content) { case 8: case 'max_value': $data["title"] = __('Max. Value'); - $data["objdata"] = get_agentmodule_data_max ($content['id_agent_module'], $content['period'], $datetime); + $data["objdata"] = reporting_get_agentmodule_data_max ($content['id_agent_module'], $content['period'], $datetime); if ($data["objdata"] === false) { $data["objdata"] = __('Unknown'); } else { @@ -321,7 +321,7 @@ foreach ($contents as $content) { case 9: case 'min_value': $data["title"] = __('Min. Value'); - $data["objdata"] = get_agentmodule_data_min ($content['id_agent_module'], $content['period'], $datetime); + $data["objdata"] = reporting_get_agentmodule_data_min ($content['id_agent_module'], $content['period'], $datetime); if ($data["objdata"] === false) { $data["objdata"] = __('Unknown'); } else { @@ -331,7 +331,7 @@ foreach ($contents as $content) { case 10: case 'sumatory': $data["title"] = __('Sumatory'); - $data["objdata"] = get_agentmodule_data_sum ($content['id_agent_module'], $content['period'], $datetime); + $data["objdata"] = reporting_get_agentmodule_data_sum ($content['id_agent_module'], $content['period'], $datetime); if ($data["objdata"] === false) { $data["objdata"] = __('Unknown'); } else { @@ -364,7 +364,7 @@ foreach ($contents as $content) { case 'text': $data["title"] = __('Text'); $data["objdata"] = ""; break; case 'sql': @@ -420,7 +420,7 @@ foreach ($contents as $content) { $data['group'] = groups_get_name($content['id_agent']); $data["objdata"]["event_report_group"] = array(); - $events = get_group_detailed_event_reporting($content['id_agent'], $content['period'], $report["datetime"], true, false); + $events = reporting_get_group_detailed_event($content['id_agent'], $content['period'], $report["datetime"], true, false); foreach ($events->data as $eventRow) { $objdata = array(); @@ -436,7 +436,7 @@ foreach ($contents as $content) { $data["title"] = __('Agents detailed event'); $data["objdata"]["event_report_module"] = array(); - $events = get_module_detailed_event_reporting($content['id_agent_module'], $content['period'], $report["datetime"], true, false); + $events = reporting_get_module_detailed_event($content['id_agent_module'], $content['period'], $report["datetime"], true, false); foreach ($events->data as $eventRow) { $objdata = array(); @@ -453,7 +453,7 @@ foreach ($contents as $content) { $data["title"] = __('Alert report module'); $data["objdata"]["alert_report_module"] = array(); - $alerts = alert_reporting_module ($content['id_agent_module'], $content['period'], $report["datetime"], true, false); + $alerts = reporting_alert_reporting_module ($content['id_agent_module'], $content['period'], $report["datetime"], true, false); foreach ($alerts->data as $row) { $objdata = array(); @@ -489,7 +489,7 @@ foreach ($contents as $content) { case 'alert_report_agent': $data["title"] = __('Alert report agent'); - $alerts = alert_reporting_agent ($content['id_agent'], $content['period'], $report["datetime"], true, false); + $alerts = reporting_alert_reporting_agent ($content['id_agent'], $content['period'], $report["datetime"], true, false); $data["objdata"]["alert_report_agent"] = array(); foreach ($alerts->data as $row) { @@ -577,7 +577,7 @@ foreach ($contents as $content) { } break; case 'TTRT': - $ttr = get_agentmodule_ttr ($content['id_agent_module'], $content['period'], $report["datetime"]); + $ttr = reporting_get_agentmodule_ttr ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($ttr === false) { $ttr = __('Unknown'); } else if ($ttr != 0) { @@ -588,7 +588,7 @@ foreach ($contents as $content) { $data["objdata"] = $ttr; break; case 'TTO': - $tto = get_agentmodule_tto ($content['id_agent_module'], $content['period'], $report["datetime"]); + $tto = reporting_get_agentmodule_tto ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($tto === false) { $tto = __('Unknown'); } else if ($tto != 0) { @@ -599,7 +599,7 @@ foreach ($contents as $content) { $data["objdata"] = $tto; break; case 'MTBF': - $mtbf = get_agentmodule_mtbf ($content['id_agent_module'], $content['period'], $report["datetime"]); + $mtbf = reporting_get_agentmodule_mtbf ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($mtbf === false) { $mtbf = __('Unknown'); } else if ($mtbf != 0) { @@ -610,7 +610,7 @@ foreach ($contents as $content) { $data["objdata"] = $mtbf; break; case 'MTTR': - $mttr = get_agentmodule_mttr ($content['id_agent_module'], $content['period'], $report["datetime"]); + $mttr = reporting_get_agentmodule_mttr ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($mttr === false) { $mttr = __('Unknown'); } else if ($mttr != 0) { diff --git a/pandora_console/operation/search_agents.php b/pandora_console/operation/search_agents.php index 149b7e0d0c..2ba8720dcb 100755 --- a/pandora_console/operation/search_agents.php +++ b/pandora_console/operation/search_agents.php @@ -236,7 +236,7 @@ else { $table->data = array (); foreach ($agents as $agent) { - $agent_info = get_agent_module_info ($agent["id_agente"]); + $agent_info = reporting_get_agent_module_info ($agent["id_agente"]); $modulesCell = ''. $agent_info["modules"] . ''; if ($agent_info["monitor_alertsfired"] > 0) diff --git a/pandora_console/operation/search_alerts.php b/pandora_console/operation/search_alerts.php index a19cff2cb9..16afb5bcc1 100755 --- a/pandora_console/operation/search_alerts.php +++ b/pandora_console/operation/search_alerts.php @@ -172,7 +172,7 @@ if($searchAlerts) { foreach($alertsraw as $key => $alert){ $finded = false; $alerts[$key]['disabled'] = $alert['disabled']; - $alerts[$key]['id_agente'] = get_agentmodule_agent($alert['id_agent_module']); + $alerts[$key]['id_agente'] = modules_get_agentmodule_agent($alert['id_agent_module']); $alerts[$key]['agent_name'] = $alert['agent_name']; $alerts[$key]['module_name'] = $alert['agent_module_name']; $alerts[$key]['template_name'] = $alert['template_name']; diff --git a/pandora_console/operation/search_modules.php b/pandora_console/operation/search_modules.php index 2bc2613431..996cefd55e 100644 --- a/pandora_console/operation/search_modules.php +++ b/pandora_console/operation/search_modules.php @@ -211,7 +211,7 @@ else { $statusCell = ui_print_status_image(STATUS_MODULE_WARNING, __('WARNING').": ".$module["datos"], true); } else { - $last_status = get_agentmodule_last_status($module['id_agente_modulo']); + $last_status = modules_get_agentmodule_last_status($module['id_agente_modulo']); switch($last_status) { case 0: $statusCell = ui_print_status_image(STATUS_MODULE_OK, __('UNKNOWN')." - ".__('Last status')." ".__('NORMAL').": ".$module["datos"], true); @@ -230,7 +230,7 @@ else { $graph_type = return_graphtype ($module["id_tipo_modulo"]); - $name_module_type = get_moduletype_name ($module["id_tipo_modulo"]); + $name_module_type = modules_get_moduletype_name ($module["id_tipo_modulo"]); $handle = "stat" . $name_module_type . "_" . $module["id_agente_modulo"]; $url = 'include/procesos.php?agente=' . $module["id_agente_modulo"]; $win_handle = dechex(crc32($module["id_agente_modulo"] . $module["module_name"])); @@ -244,7 +244,7 @@ else { if (is_numeric($module["datos"])) $dataCell = format_numeric($module["datos"]); else - $dataCell = "".substr(safe_output($module["datos"]),0,12).""; + $dataCell = "".substr(io_safe_output($module["datos"]),0,12).""; if ($module['estado'] == 3){ $option = array ("html_attr" => 'class="redb"'); diff --git a/pandora_console/operation/search_reports.php b/pandora_console/operation/search_reports.php index d4a6c48d5e..67f36690a4 100755 --- a/pandora_console/operation/search_reports.php +++ b/pandora_console/operation/search_reports.php @@ -28,7 +28,7 @@ if (check_acl ($config['id_user'], 0, "IW")) { $reports = false; //Check ACL -$userreports = get_reports(); +$userreports = reports_get_reports(); $userreports_id = array(); foreach($userreports as $userreport) { diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index 3ad022f5aa..cb1623cccc 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -27,7 +27,7 @@ $searchMaps = $searchReports = $searchGraphs = check_acl($config["id_user"], 0, $arrayKeywords = explode(' ', $config['search_keywords']); $temp = array(); foreach ($arrayKeywords as $keyword) - array_push($temp, "%" . safe_input($keyword) . "%"); + array_push($temp, "%" . io_safe_input($keyword) . "%"); $stringSearchSQL = implode(" ",$temp); if ($config['search_category'] == "all") diff --git a/pandora_console/operation/servers/view_server.php b/pandora_console/operation/servers/view_server.php index 496adaf3f2..4754814916 100644 --- a/pandora_console/operation/servers/view_server.php +++ b/pandora_console/operation/servers/view_server.php @@ -34,7 +34,7 @@ if (! check_acl ($config['id_user'], 0, "AR")) { // Header ui_print_page_header (__("Pandora servers"), "images/server.png"); -$servers = get_server_info (); +$servers = servers_get_info (); if ($servers === false) { echo "
".__('There are no servers configured into the database')."
"; return; diff --git a/pandora_console/operation/servers/view_server_detail.php b/pandora_console/operation/servers/view_server_detail.php index 4887366ce1..2837a765bd 100644 --- a/pandora_console/operation/servers/view_server_detail.php +++ b/pandora_console/operation/servers/view_server_detail.php @@ -53,7 +53,7 @@ if (check_acl ($config['id_user'], 0, "PM")) { } } -$server_name = get_server_name ($id_server); +$server_name = servers_get_name ($id_server); $recon_tasks = db_get_all_rows_field_filter ("trecon_task", "id_recon_server", $id_server); // Show network tasks for Recon Server @@ -124,7 +124,7 @@ foreach ($recon_tasks as $task) { if ($task["id_recon_script"] == 0){ // Network recon task $data[5] = html_print_image ("images/network.png", true, array ("title" => __('Network recon task')))."  "; - $data[5] .= get_networkprofile_name ($task["id_network_profile"]); + $data[5] .= network_profiles_get_name ($task["id_network_profile"]); } else { // APP recon task