2011-05-09 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* 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
This commit is contained in:
juanmanuelr 2011-05-09 17:30:55 +00:00
parent 3abfc12c33
commit a23c412b98
124 changed files with 1121 additions and 902 deletions

View File

@ -1,3 +1,135 @@
2011-05-09 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* 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 <rnovoa@artica.es>
* operation/agentes/estado_agente.php: Replaced a call to the old

View File

@ -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 "<td style='text-align: center; background-color: #DDD;'>";
$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 '<a href="javascript:'.$link.'">';

View File

@ -34,13 +34,13 @@ function createXMLData($agent, $agentModule, $time, $data) {
</module>
</agent_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 {

View File

@ -39,12 +39,12 @@ if (is_ajax ()) {
echo '<strong>' . __('Number fired of alerts').': </strong> ' . $alert["times_fired"] . '<br />';
$agent = db_get_row('tagente', 'id_agente', $module['id_agente']);
echo '<strong>' . __('Agent').': </strong>';
echo safe_output($agent['nombre']) . '<br />';
echo io_safe_output($agent['nombre']) . '<br />';
echo '<strong>' . __('Module') . ': </strong>';
echo safe_output($module['nombre']) . '<br />';
echo io_safe_output($module['nombre']) . '<br />';
$template = db_get_row('talert_templates', 'id' , $alert['id_alert_template']);
echo '<strong>' . __('Alert template') . ': </strong>';
echo safe_output($template['name']) . '<br />';
echo io_safe_output($template['name']) . '<br />';
$sql = 'SELECT *
FROM talert_template_module_actions AS t1

View File

@ -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"],

View File

@ -91,17 +91,17 @@ function output_xml_report($id) {
echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
echo "<report>\n";
echo "<name><![CDATA[" . safe_output($report['name']) . "]]></name>\n";
echo "<name><![CDATA[" . io_safe_output($report['name']) . "]]></name>\n";
if (isset($report['description']))
echo "<description><![CDATA[" . safe_output($report['description']) . "]]></description>\n";
echo "<description><![CDATA[" . io_safe_output($report['description']) . "]]></description>\n";
$group = db_get_value('nombre', 'tgrupo', 'id_grupo', $report['id_group']);
echo "<group><![CDATA[" . safe_output($group) . "]]></group>\n";
echo "<group><![CDATA[" . io_safe_output($group) . "]]></group>\n";
$items = db_get_all_rows_field_filter('treport_content', 'id_report', $report['id_report']);
foreach ($items as $item) {
echo "<item>\n";
echo "<type>" . safe_output($item['type']) . "</type>\n";
echo "<description>" . safe_output($item['description']) . "</description>\n";
echo "<period>" . safe_output($item['period']) . "</period>\n";
echo "<type>" . io_safe_output($item['type']) . "</type>\n";
echo "<description>" . io_safe_output($item['description']) . "</description>\n";
echo "<period>" . io_safe_output($item['period']) . "</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 "<module><![CDATA[" . safe_output($module) . "]]></module>\n";
echo "<module><![CDATA[" . io_safe_output($module) . "]]></module>\n";
}
if (isset($agent))
echo "<agent><![CDATA[" . $agent . "]]></agent>\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 "<graph><![CDATA[" . safe_output($graph) . "]]></graph>\n";
echo "<graph><![CDATA[" . io_safe_output($graph) . "]]></graph>\n";
break;
case 3:
case 'SLA':
@ -148,7 +148,7 @@ function output_xml_report($id) {
$agent = get_agent_name($item['id_agent']);
echo "<sla>";
echo "<agent><![CDATA[" . $agent . "]]></agent>\n";
echo "<module><![CDATA[" . safe_output($module) . "]]></module>\n";
echo "<module><![CDATA[" . io_safe_output($module) . "]]></module>\n";
echo "<sla_max>" . $sla['sla_max'] . "</sla_max>\n";
echo "<sla_min>" . $sla['sla_min'] . "</sla_min>\n";
echo "<sla_limit>" . $sla['sla_limit'] . "</sla_limit>\n";
@ -174,33 +174,33 @@ function output_xml_report($id) {
case 'event_report_agent':
break;
case 'text':
echo "<text><![CDATA[" . safe_output($item['text']) . "]]></text>\n";
echo "<text><![CDATA[" . io_safe_output($item['text']) . "]]></text>\n";
break;
case 'sql':
echo "<header_definition><![CDATA[" . safe_output($item['header_definition']) . "]]></header_definition>\n";
echo "<header_definition><![CDATA[" . io_safe_output($item['header_definition']) . "]]></header_definition>\n";
if (!empty($item['external_source'])) {
echo "<sql><![CDATA[" . safe_output($item['external_source']) . "]]></sql>\n";
echo "<sql><![CDATA[" . io_safe_output($item['external_source']) . "]]></sql>\n";
}
else {
$sql = db_get_value('sql', 'treport_custom_sql', 'id', $item['treport_custom_sql_id']);
echo "<sql>" . safe_output($sql) . "</sql>\n";
echo "<sql>" . io_safe_output($sql) . "</sql>\n";
}
break;
case 'sql_graph_pie':
case 'sql_graph_vbar':
case 'sql_graph_hbar':
echo "<header_definition>" . safe_output($item['header_definition']) . "</header_definition>\n";
echo "<header_definition>" . io_safe_output($item['header_definition']) . "</header_definition>\n";
if (!empty($item['external_source'])) {
echo "<sql>" . safe_output($item['external_source']) . "</sql>\n";
echo "<sql>" . io_safe_output($item['external_source']) . "</sql>\n";
}
else {
$sql = db_get_value('sql', 'treport_custom_sql', 'id', $item['treport_custom_sql_id']);
echo "<sql>" . safe_output($sql) . "</sql>\n";
echo "<sql>" . io_safe_output($sql) . "</sql>\n";
}
break;
case 'event_report_group':
$group = db_get_value('nombre', 'tgrupo', 'id_grupo', $item['id_agent']);
echo "<group><![CDATA[" . safe_output($group) . "]]></group>\n";
echo "<group><![CDATA[" . io_safe_output($group) . "]]></group>\n";
break;
case 'event_report_module':
break;
@ -209,12 +209,12 @@ function output_xml_report($id) {
case 'alert_report_agent':
break;
case 'url':
echo "<url><![CDATA[" . safe_output($values["external_source"]) . "]]></url>";
echo "<url><![CDATA[" . io_safe_output($values["external_source"]) . "]]></url>";
break;
case 'database_serialized':
echo "<header_definition><![CDATA[" . safe_output($item["header_definition"]) . "]]></header_definition>";
echo "<line_separator><![CDATA[" . safe_output($item["line_separator"]) . "]]></line_separator>";
echo "<column_separator><![CDATA[" . safe_output($item["header_definition"]) . "]]></column_separator>";
echo "<header_definition><![CDATA[" . io_safe_output($item["header_definition"]) . "]]></header_definition>";
echo "<line_separator><![CDATA[" . io_safe_output($item["line_separator"]) . "]]></line_separator>";
echo "<column_separator><![CDATA[" . io_safe_output($item["header_definition"]) . "]]></column_separator>";
break;
case 'TTRT':
break;
@ -235,21 +235,21 @@ function output_xml_visual_console($id) {
echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
echo "<visual_map>\n";
echo "<name><![CDATA[" . safe_output($visual_map['name']) . "]]></name>\n";
echo "<name><![CDATA[" . io_safe_output($visual_map['name']) . "]]></name>\n";
if ($visual_map['id_group'] != 0) {
$group = db_get_value('nombre', 'tgrupo', 'id_grupo', $visual_map['id_group']);
echo "<group><![CDATA[" . safe_output($group) . "]]></group>\n";
echo "<group><![CDATA[" . io_safe_output($group) . "]]></group>\n";
}
echo "<background><![CDATA[" . safe_output($visual_map['background']) . "]]></background>\n";
echo "<height>" . safe_output($visual_map['height']) . "</height>\n";
echo "<width>" . safe_output($visual_map['width']) . "</width>\n";
echo "<background><![CDATA[" . io_safe_output($visual_map['background']) . "]]></background>\n";
echo "<height>" . io_safe_output($visual_map['height']) . "</height>\n";
echo "<width>" . io_safe_output($visual_map['width']) . "</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 "<item>\n";
echo "<other_id>" . $item['id'] . "</other_id>\n"; //OLD ID USE FOR parent item
if (!empty($item['label'])) {
echo "<label><![CDATA[" . safe_output($item['label']) . "]]></label>\n";
echo "<label><![CDATA[" . io_safe_output($item['label']) . "]]></label>\n";
}
echo "<x>" . $item['pos_x'] . "</x>\n";
echo "<y>" . $item['pos_y'] . "</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 "<module><![CDATA[" . safe_output($module) . "]]></module>\n";
echo "<module><![CDATA[" . io_safe_output($module) . "]]></module>\n";
}
}
if (!empty($agent)) {

View File

@ -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,

View File

@ -46,7 +46,7 @@ $msg_cnt = 0;
<?php
if ($config["metaconsole"] == 0){
$msg_cnt = get_message_count ($config["id_user"]);
$msg_cnt = messages_get_count ($config["id_user"]);
if ($msg_cnt > 0) {
echo '<div id="dialog_messages" style="display: none"></div>';
@ -71,7 +71,7 @@ $msg_cnt = 0;
echo '<a class="white_bold" href="index.php?sec=estado_server&amp;sec2=operation/servers/view_server&amp;refr=60">';
$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

View File

@ -67,7 +67,7 @@ echo '</div>';
// Site stats (global!)
// ---------------------------------------------------------------------------
echo '<div style="width:300px; float:left; padding-left: 30px;" id="rightcolumn">';
$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);
}

View File

@ -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":

View File

@ -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

View File

@ -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] = '';
}

View File

@ -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 '<h3 class="error">'.__('There was a problem adding module').'</h3>';
@ -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);

View File

@ -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] = '<strong>'.get_modulegroup_name ($last_modulegroup).'</strong>';
$data[0] = '<strong>'.modules_get_modulegroup_name ($last_modulegroup).'</strong>';
$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)

View File

@ -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'];

View File

@ -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] = '<span id="component_group" class="left">';
$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] = '<em>'.get_moduletype_description ($id_module_type).'</em>';
$table_simple->data[1][1] = '<em>'.modules_get_moduletype_description ($id_module_type).'</em>';
}
else {
if (isset($id_module_type)) {

View File

@ -412,7 +412,7 @@ foreach ($simple_alerts as $alert) {
$data[1] .= '</form>';
if (! $id_agente) {
$id_agent = get_agentmodule_agent ($alert['id_agent_module']);
$id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']);
$data[2] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agent.'">';
if ($alert['disabled'])
$data[2] .= '<span style="font-style: italic; color: #aaaaaa;">';
@ -421,7 +421,7 @@ foreach ($simple_alerts as $alert) {
$data[2] .= '</span>';
$data[2] .= '</a>';
}
$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] = ' <a class="template_details"
href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">' .
html_print_image("images/zoom.png", true, array("id" => 'template-details-'.$alert['id_alert_template'], "class" => "img_help")) . '</a> ';

View File

@ -153,7 +153,7 @@ ui_require_javascript_file ('pandora_alerts');
$(document).ready (function () {
<?php if ($id_command) : ?>
original_command = "<?php $command = get_alert_command_command ($id_command);
$command = safe_output($command);
$command = io_safe_output($command);
echo addslashes($command);
?>";
render_command_preview ();

View File

@ -479,7 +479,7 @@ if ($step == 2) {
$nameAgent = get_agent_name($idAgent);
$data[1] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $idAgent . '">' . $nameAgent . '</a>';
$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] = '<a href="#" class="add_alert" id="add-'.$alert['id'].'" />';
$data[0] .= html_print_image('images/add.png', true);
$data[0] .= '</a>';
$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);

View File

@ -83,7 +83,7 @@ foreach ($count as $agent_id => $value) {
//First row is a link to the agent
$data[0] = '<strong><a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$agent_id.'">'.$agents[$agent_id].'</a></strong>';
//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;

View File

@ -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 "<br />";
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

View File

@ -53,7 +53,7 @@ if ((isset ($_GET["operacion"])) && (!isset ($_POST["update_agent"]))) {
// Copy
foreach ($origen_modulo as $id_agentemodulo) {
echo "<br /><br />".__('Filtering data module')."<b> [".get_agentmodule_name ($id_agentemodulo)."]</b>";
echo "<br /><br />".__('Filtering data module')."<b> [".modules_get_agentmodule_name ($id_agentemodulo)."]</b>";
$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);
}

View File

@ -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'];
}
}

View File

@ -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 ++;

View File

@ -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'];
}
}

View File

@ -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 '<h3 class="error">'.__('There was an error deleting the modules, the operation has been cancelled').'</h3>';
echo '<h4>'.__('Could not delete modules').'</h4>';
@ -126,7 +126,7 @@ $table->data[2][0] = __('Agent');
$table->data[2][0] .= '<span id="agent_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
$table->data[2][0] .= '</span>';
$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'));

View File

@ -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);
}

View File

@ -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

View File

@ -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] .= '<br /><em>'.__('Max.').'</em>';
$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');

View File

@ -246,5 +246,5 @@ if (check_acl ($config['id_user'], 0, "PM")) {
}
}
print_menu ($menu);
menu_print_menu ($menu);
?>

View File

@ -118,7 +118,7 @@ foreach ($groups as $group) {
$data[0] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups&id='.$group['id_sg'].'">'.$group['name'].'</a>';
$data[1] = get_network_component_group_name ($group['parent']);
$data[1] = network_components_get_group_name ($group['parent']);
$data[2] = '<form method="post" onsubmit="if (! confirm (\''.__('Are you sure?').'\')) return false">';
$data[2] .= html_print_input_hidden ('delete', 1, true);

View File

@ -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 '<form method="post" action="index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups">';

View File

@ -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] = '<a style="display: inline; float: left" href="' . $url . '&search_id_group=' . $search_id_group .

View File

@ -27,7 +27,7 @@ if (! check_acl ($config['id_user'], 0, "PM")) {
$id_component_type = (int) get_parameter ('id_component_type');
if (isset ($id)) {
$component = get_network_component ((int) $id);
$component = network_components_get_network_component ((int) $id);
if ($component !== false) {
$id_component_type = $component['id_modulo'];
$name = $component["name"];

View File

@ -62,7 +62,7 @@ $table->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, '',

View File

@ -90,7 +90,7 @@ echo '<td class="datos2"><input type="text" name="name" size="25" value="' . $na
echo '<td class="datos2">' . __('Module type') . '</td>';
echo '<td class="datos2">';
echo '<select name="tipo">';
echo '<option value="' . $type . '">' . get_moduletype_name ($type);
echo '<option value="' . $type . '">' . modules_get_moduletype_name ($type);
$rows = db_get_all_rows_sql('SELECT id_tipo, nombre
FROM ttipo_modulo WHERE categoria IN (0,1,2) ORDER BY nombre;');
@ -108,7 +108,7 @@ echo '<tr>';
// Component group
echo '<td class="datos">' . __('Group') . '</td>';
echo '<td class="datos">';
html_print_select (get_network_component_groups (),
html_print_select (network_components_get_groups (),
'id_group', $id_group, '', '', '', false, false, false);
// Module group
@ -116,7 +116,7 @@ echo '<td class="datos">' . __('Module group') . '</td>';
echo '<td class="datos">';
echo '<select name="id_module_group">';
if ($id) {
echo '<option value="' . $id_module_group . '">' . get_modulegroup_name($id_module_group);
echo '<option value="' . $id_module_group . '">' . modules_get_modulegroup_name($id_module_group);
}
$rows = db_get_all_rows_in_table('tmodule_group');

View File

@ -38,7 +38,7 @@ $export_profile = (bool) get_parameter ('export_profile');
if ($delete_profile) { // if delete
$id = (int) get_parameter ('delete_profile');
$result = delete_network_profile ($id);
$result = network_profiles_delete_network_profile ($id);
ui_print_result_message ($result,
__('Template successfully deleted'),
__('Error deleting template'));
@ -46,7 +46,7 @@ if ($delete_profile) { // if delete
if ($export_profile) {
$id = (int) get_parameter("export_profile");
$profile_info = get_network_profile ($id);
$profile_info = network_profiles_get_network_profile ($id);
if (empty ($profile_info)) {
ui_print_error_message (__('This template does not exist'));
@ -152,8 +152,8 @@ $table->data = array ();
foreach ($result as $row) {
$data = array ();
$data[0] = '<a href="index.php?sec=gmodules&amp;sec2=godmode/modules/manage_network_templates_form&amp;id_np='.$row["id_np"].'">'. safe_output($row["name"]).'</a>';
$data[1] = ui_print_truncate_text(safe_output($row["description"]), 70, true, true, true, true);
$data[0] = '<a href="index.php?sec=gmodules&amp;sec2=godmode/modules/manage_network_templates_form&amp;id_np='.$row["id_np"].'">'. io_safe_output($row["name"]).'</a>';
$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;'));

View File

@ -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);
}

View File

@ -95,7 +95,7 @@ if(count($module_array) > 0){
echo "<tr><td class='$tdcolor'>" . $agent_array[$a] . "</td>";
echo "<td class='$tdcolor'>";
echo get_agentmodule_name ($module_array[$a])."</td>";
echo modules_get_agentmodule_name ($module_array[$a])."</td>";
echo "<td class='$tdcolor' align='center'>";
echo "<table><tr>";
$new_weight = $weight_array[$a]-0.125;

View File

@ -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'];

View File

@ -44,7 +44,7 @@ switch ($action) {
ui_print_page_header (__('Reporting').' &raquo; '.__('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);

View File

@ -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 '<div style = "overflow:auto;">';
html_print_table ($table);
echo "</div>";

View File

@ -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')))."&nbsp;&nbsp;";
$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). "&nbsp;&nbsp;";

View File

@ -82,7 +82,7 @@ else {
}
}
$servers = get_server_info ();
$servers = servers_get_info ();
if ($servers !== false) {
$table->width = "90%";
$table->class = "databox";

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -42,8 +42,8 @@ $table->data = array();
foreach ($osList as $os) {
$data = array();
$data[] = ui_print_os_icon($os['id_os'], false, true);
$data[] = '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&action=edit&tab=builder&id_os=' . $os['id_os'] . '">' . safe_output($os['name']) . '</a>';
$data[] = ui_print_truncate_text(safe_output($os['description']), 25, true, true);
$data[] = '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&action=edit&tab=builder&id_os=' . $os['id_os'] . '">' . io_safe_output($os['name']) . '</a>';
$data[] = ui_print_truncate_text(io_safe_output($os['description']), 25, true, true);
if ($os['id_os'] > 13) {
$data[] = '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&action=delete&tab=list&id_os=' . $os['id_os'] . '">' . html_print_image("images/cross.png", true) . '</a>';
}

View File

@ -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) {

View File

@ -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,

View File

@ -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'),

View File

@ -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;

View File

@ -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;
}

View File

@ -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";
}
}
?>

View File

@ -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'] = '<option value="0">--</option>';
foreach ($modules as $id => $name) {
$elementFields['modules_html'] .= '<option value="' . $id . '">' . safe_output($name) . '</option>';
$elementFields['modules_html'] .= '<option value="' . $id . '">' . io_safe_output($name) . '</option>';
}
}
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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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")) {

View File

@ -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) {
</module>
</agent_data>";
$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 {

View File

@ -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,

View File

@ -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'] = '<h4 class="suc">'.__('Created directory').'</h4>';
@ -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']);

View File

@ -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);

View File

@ -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 = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' >';
//$output .= safe_input ($value);
//$output .= io_safe_input ($value);
$output .= ($value);
$output .= '</textarea>';
@ -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 = '<img src="'.safe_input ($src).'" '; //safe input necessary to strip out html entities correctly
$output = '<img src="'.io_safe_input ($src).'" '; //safe input necessary to strip out html entities correctly
$style = '';
if (!empty ($options)) {
@ -1180,7 +1180,7 @@ function html_print_image ($src, $return = false, $options = false, $return_src
foreach ($attrs as $attribute) {
if (isset ($options[$attribute])) {
$output .= $attribute.'="'.safe_input_html ($options[$attribute]).'" ';
$output .= $attribute.'="'.io_safe_input_html ($options[$attribute]).'" ';
}
}
} else {
@ -1188,7 +1188,7 @@ function html_print_image ($src, $return = false, $options = false, $return_src
}
if (!isset ($options["alt"]) && isset ($options["title"])) {
$options["alt"] = safe_input_html($options["title"]); //Set alt to title if it's not set
$options["alt"] = io_safe_input_html($options["title"]); //Set alt to title if it's not set
} elseif (!isset ($options["alt"])) {
$options["alt"] = "";
}
@ -1197,7 +1197,7 @@ function html_print_image ($src, $return = false, $options = false, $return_src
$output .= 'style="'.$style.'" ';
}
$output .= 'alt="'.safe_input_html ($options['alt']).'" />';
$output .= 'alt="'.io_safe_input_html ($options['alt']).'" />';
if (!$return) {
echo $output;

View File

@ -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);
}

View File

@ -1,4 +1,24 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage Io
*/
/**
* Safe input function for array.
*
@ -6,8 +26,8 @@
*
* @return void
*/
function safe_input_array(&$item) {
$item = safe_input($item);
function io_safe_input_array(&$item) {
$item = io_safe_input($item);
}
/**
@ -19,7 +39,7 @@ function safe_input_array(&$item) {
*
* @return mixed The cleaned string or array.
*/
function safe_input($value) {
function io_safe_input($value) {
//Stop!! Are you sure to modify this critical code? Because the older
//versions are serius headache in many places of Pandora.
@ -27,7 +47,7 @@ function safe_input($value) {
return $value;
if (is_array($value)) {
array_walk($value, "safe_input_array");
array_walk($value, "io_safe_input_array");
return $value;
}
@ -57,7 +77,7 @@ function safe_input($value) {
//Replace some characteres for html entities
for ($i=0;$i<33;$i++) {
$valueHtmlEncode = str_ireplace(chr($i),ascii_to_html($i), $valueHtmlEncode);
$valueHtmlEncode = str_ireplace(chr($i),io_ascii_to_html($i), $valueHtmlEncode);
}
return $valueHtmlEncode;
@ -72,7 +92,7 @@ function safe_input($value) {
*
* @return mixed The cleaned string or array.
*/
function safe_input_html($value) {
function io_safe_input_html($value) {
//Stop!! Are you sure to modify this critical code? Because the older
//versions are serius headache in many places of Pandora.
@ -80,7 +100,7 @@ function safe_input_html($value) {
return $value;
if (is_array($value)) {
array_walk($value, "safe_input");
array_walk($value, "io_safe_input");
return $value;
}
@ -102,7 +122,7 @@ function safe_input_html($value) {
*
* @return string String of html entitie
*/
function ascii_to_html($num) {
function io_ascii_to_html($num) {
if ($num <= 15) {
return "&#x0".dechex($num).";";
@ -118,7 +138,7 @@ function ascii_to_html($num) {
*
* @return string String with char
*/
function html_to_ascii($hex) {
function io_html_to_ascii($hex) {
$dec = hexdec($hex);
@ -136,13 +156,13 @@ function html_to_ascii($hex) {
*
* @return unknown_type
*/
function safe_output($value, $utf8 = true)
function io_safe_output($value, $utf8 = true)
{
if (is_numeric($value))
return $value;
if (is_array($value)) {
array_walk($value, "safe_output");
array_walk($value, "io_safe_output");
return $value;
}
@ -170,7 +190,7 @@ function safe_output($value, $utf8 = true)
//Revert html entities to chars
for ($i=0;$i<33;$i++) {
$valueHtmlEncode = str_ireplace("&#x".dechex($i).";",html_to_ascii(dechex($i)), $valueHtmlEncode);
$valueHtmlEncode = str_ireplace("&#x".dechex($i).";",io_html_to_ascii(dechex($i)), $valueHtmlEncode);
}
return $valueHtmlEncode;
@ -187,13 +207,13 @@ function safe_output($value, $utf8 = true)
*
* @return unknown_type
*/
function safe_output_html($value, $utf8 = true)
function io_safe_output_html($value, $utf8 = true)
{
if (is_numeric($value))
return $value;
if (is_array($value)) {
array_walk($value, "safe_output");
array_walk($value, "io_safe_output");
return $value;
}
@ -211,20 +231,20 @@ function safe_output_html($value, $utf8 = true)
//Revert html entities to chars
for ($i=0;$i<33;$i++) {
$value = str_ireplace("&#x".dechex($i).";",html_to_ascii(dechex($i)), $value);
$value = str_ireplace("&#x".dechex($i).";",io_html_to_ascii(dechex($i)), $value);
}
return $value;
}
/**
* Use to clean HTML entities when get_parameter or safe_input functions dont work
* Use to clean HTML entities when get_parameter or io_safe_input functions dont work
*
* @param string String to be cleaned
*
* @return string Cleaned string
*/
function salida_limpia ($string) {
function io_salida_limpia ($string) {
$quote_style = ENT_QUOTES;
static $trans;
if (! isset ($trans)) {
@ -247,12 +267,12 @@ function salida_limpia ($string) {
*
* @return mixed The cleaned string or array.
*/
function safe_output_xml ($string) {
function io_safe_output_xml ($string) {
if (is_numeric ($string))
return $string;
if (is_array ($string)) {
array_walk ($string, 'safe_output_xml');
array_walk ($string, 'io_safe_output_xml');
return $string;
}
@ -280,7 +300,7 @@ function safe_output_xml ($string) {
*
* @param string Text string to be stripped of magic_quotes protection
*/
function unsafe_string ($string) {
function io_unsafe_string ($string) {
if (get_magic_quotes_gpc ())
return stripslashes ($string);
return $string;

View File

@ -24,7 +24,7 @@
*
* @param array Menu structure to print.
*/
function print_menu (&$menu) {
function menu_print_menu (&$menu) {
global $config;
static $idcounter = 0;

View File

@ -28,12 +28,12 @@ require_once ($config['homedir'].'/include/functions_groups.php');
* @param string $usuario_origen The sender of the message
* @param string $usuario_destino The receiver of the message
* @param string $subject Subject of the message (much like E-Mail)
* @param string $mensaje The actual message. This message will be cleaned by safe_input
* @param string $mensaje The actual message. This message will be cleaned by io_safe_input
* (html is allowed but loose html chars will be translated)
*
* @return bool true when delivered, false in case of error
*/
function create_message ($usuario_origen, $usuario_destino, $subject, $mensaje) {
function messages_create_message ($usuario_origen, $usuario_destino, $subject, $mensaje) {
$users = get_users_info ();
if (!array_key_exists ($usuario_origen, $users) || !array_key_exists ($usuario_destino, $users)) {
@ -62,12 +62,12 @@ function create_message ($usuario_origen, $usuario_destino, $subject, $mensaje)
* @param string The sender of the message
* @param string The receivers (group) of the message
* @param string Subject of the message (much like E-Mail)
* @param string The actual message. This message will be cleaned by safe_input
* @param string The actual message. This message will be cleaned by io_safe_input
* (html is allowed but loose html chars will be translated)
*
* @return bool true when delivered, false in case of error
*/
function create_message_group ($usuario_origen, $dest_group, $subject, $mensaje) {
function messages_create_group ($usuario_origen, $dest_group, $subject, $mensaje) {
$users = get_users_info ();
$group_users = groups_get_users ($dest_group);
@ -83,7 +83,7 @@ function create_message_group ($usuario_origen, $dest_group, $subject, $mensaje)
db_process_sql_begin ();
foreach ($group_users as $user) {
$return = create_message ($usuario_origen, get_user_id ($user), $subject, $mensaje);
$return = messages_create_message ($usuario_origen, get_user_id ($user), $subject, $mensaje);
if ($return === false) {
//Error sending message, rollback and return false
db_process_sql_rollback ();
@ -104,7 +104,7 @@ function create_message_group ($usuario_origen, $dest_group, $subject, $mensaje)
*
* @return bool true when deleted, false in case of error
*/
function delete_message ($id_message) {
function messages_delete_message ($id_message) {
global $config;
$where = array(
@ -121,7 +121,7 @@ function delete_message ($id_message) {
*
* @return bool true when marked, false in case of error
*/
function process_message_read ($message_id, $read = true) {
function messages_process_read ($message_id, $read = true) {
if (empty ($read)) {
$read = 0;
}
@ -141,7 +141,7 @@ function process_message_read ($message_id, $read = true) {
*
* @return mixed False if it doesn't exist or a filled array otherwise
*/
function get_message ($message_id) {
function messages_get_message ($message_id) {
global $config;
$sql = sprintf("SELECT id_usuario_origen, subject, mensaje, timestamp
@ -169,7 +169,7 @@ function get_message ($message_id) {
*
* @return int The number of messages this user has
*/
function get_message_count ($user = false, $incl_read = false) {
function messages_get_count ($user = false, $incl_read = false) {
if (empty ($user)) {
global $config;
$user = $config["id_user"];
@ -194,7 +194,7 @@ function get_message_count ($user = false, $incl_read = false) {
*
* @return int The number of messages this user has
*/
function get_message_overview ($order = "status", $order_dir = "ASC") {
function messages_get_overview ($order = "status", $order_dir = "ASC") {
global $config;
switch ($order) {

View File

@ -34,10 +34,10 @@ include_once($config['homedir'] . '/include/functions_users.php');
* @return New agent module id on success. Existing module id if it already exists.
* False on error.
*/
function copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent, $forced_name = false) {
function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent, $forced_name = false) {
global $config;
$module = get_agentmodule ($id_agent_module);
$module = modules_get_agentmodule ($id_agent_module);
if ($module === false)
return false;
@ -145,13 +145,13 @@ function copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent, $force
*
* @return True if the module was deleted. False if not.
*/
function delete_agent_module ($id_agent_module) {
function modules_delete_agent_module ($id_agent_module) {
if(!$id_agent_module)
return false;
$where = array ('id_agent_module' => $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 <br> to create a "similar" output to
// information recolected in logs.
$data2 = preg_replace ("/\\n/", "<br>", $data);
return "<span style='font-size:10px;'>" . $data2 . "</span>";
}
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

View File

@ -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:
* <code>
* $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'));
* </code>
* @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);
}
?>

View File

@ -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);
}

View File

@ -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 = '<TR><TD>' . html_print_image("images/networkmap/pandora_node.png", true) . '</TD></TR>';
$name = '<TR><TD BGCOLOR="#FFFFFF">'.$name.'</TD></TR>';
$label = '<TABLE BORDER="0">'.$img.$name.'</TABLE>';
@ -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',

View File

@ -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 .= '<strong>'.__('Total monitors').': '.count ($monitors).'</strong><br />';
$output .= '<strong>'.__('Monitors down on period').': '.count ($monitors_down).'</strong><br />';
$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 = '<strong>'.__('Agents in group').': '.count ($agents).'</strong><br />';
@ -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 .= '<div class="agent_reporting">';
$output .= '<h3 style="text-decoration: underline">'.__('Agent').' - '.get_agent_name ($id_agent).'</h3>';
$output .= '<h4>'.__('Modules').'</h3>';
$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 .= '<h4>'.__('Alerts').'</h4>';
@ -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 .= '</div>';
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] .= "<br>";
$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] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
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 .= "<td style='text-align: center; background-color: #DDD;'>";
$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);

View File

@ -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;

View File

@ -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];
}

View File

@ -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 = '<span title="'.safe_input($string2).'">'.mb_substr ($string2, 0, $cutoff, "UTF-8").$string3.'</span>';
$string = '<span title="'.io_safe_input($string2).'">'.mb_substr ($string2, 0, $cutoff, "UTF-8").$string3.'</span>';
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";
}

View File

@ -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;

View File

@ -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 '<div id="layout_map"
@ -433,7 +433,7 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
if ($layout_datas !== false) {
foreach ($layout_datas as $layout_data) {
$layout_data['label'] = safe_output($layout_data['label']);
$layout_data['label'] = io_safe_output($layout_data['label']);
// ****************************************************************
// Get parent status (Could be an agent, module, map, others doesnt have parent info)
// ****************************************************************
@ -452,7 +452,7 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
// Module
if ($id_agent_module_parent != 0) {
$status_parent = get_agentmodule_status ($id_agent_module_parent);
$status_parent = modules_get_agentmodule_status ($id_agent_module_parent);
// Agent
}
elseif ($id_agent_parent != 0) {
@ -485,7 +485,7 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
} elseif ($layout_data["type"] == 0) {
// Status for a simple module
if ($layout_data['id_agente_modulo'] != 0) {
$status = get_agentmodule_status ($layout_data['id_agente_modulo']);
$status = modules_get_agentmodule_status ($layout_data['id_agente_modulo']);
$id_agent = db_get_value ("id_agente", "tagente_estado", "id_agente_modulo", $layout_data['id_agente_modulo']);
// Status for a whole agent, if agente_modulo was == 0
@ -944,7 +944,7 @@ function get_layout_status ($id_layout = 0, $depth = 0) {
$status = get_layout_status ($data["id_layout_linked"], $depth);
// Module
} elseif ($data["id_agente_modulo"] != 0) {
$status = get_agentmodule_status ($data["id_agente_modulo"]);
$status = modules_get_agentmodule_status ($data["id_agente_modulo"]);
// Agent
} else {
$status = get_agent_status ($data["id_agent"]);
@ -1009,7 +1009,7 @@ function createInternalNameItem($label = null, $type, $image, $agent = null, $id
if (!empty($agent)) {
$text .= " (" . ui_print_truncate_text($agent, 10, false);
$moduleName = safe_output(db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_module));
$moduleName = io_safe_output(db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_module));
if (!empty($moduleName)) {
$text .= " - " . ui_print_truncate_text($moduleName, 10, false);
}
@ -1035,7 +1035,7 @@ function get_items_parents($idVisual) {
foreach ($items as $item) {
$agent = null;
if ($item['id_agent'] != 0) {
$agent = safe_output(get_agent_name($item['id_agent']));
$agent = io_safe_output(get_agent_name($item['id_agent']));
}
$return[$item['id']] = createInternalNameItem($item['label'],

View File

@ -35,7 +35,7 @@ switch($graph_type) {
$width = get_parameter('width');
$height = get_parameter('height');
$font = get_parameter('font');
$data = json_decode(safe_output(get_parameter('data')), true);
$data = json_decode(io_safe_output(get_parameter('data')), true);
$max = get_parameter('max');
$title = get_parameter('title');

View File

@ -59,7 +59,7 @@ class GroupView {
$iterator++;
if ($idGroup == 0) continue; //avoid the all group
$groupData = get_group_stats($idGroup);
$groupData = reporting_get_group_stats($idGroup);
if ($groupData['total_agents'] == 0) continue; //avoid the empty groups

View File

@ -200,7 +200,7 @@ class MonitorStatus {
$statusImg = 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:
$statusImg = ui_print_status_image(STATUS_MODULE_OK, __('UNKNOWN')." - ".__('Last status')." ".__('NORMAL').": ".$row["datos"], true);
@ -222,7 +222,7 @@ class MonitorStatus {
if (is_numeric($row["datos"]))
$data[] = format_numeric($row["datos"]);
else
$data[] = "<span title='".$row['datos']."' style='white-space: nowrap;'>".substr(safe_output($row["datos"]),0,12)."</span>";
$data[] = "<span title='".$row['datos']."' style='white-space: nowrap;'>".substr(io_safe_output($row["datos"]),0,12)."</span>";
$data[] = ui_print_timestamp ($row["utimestamp"], true, array('units' => 'tiny'));

View File

@ -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 "<h3 class='title_h3_server'>" . __('Server performance') . "</h3>";
$server_performance = get_server_performance();
$server_performance = servers_get_performance();
$table = null;
//$table->width = '100%';

View File

@ -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', '<img'),
@ -300,7 +300,7 @@ class ViewAgent {
$salida = format_numeric($module["datos"]);
}
else {
$salida = "<span title='".$module['datos']."' style='white-space: nowrap;'>".substr(safe_output($module["datos"]),0,12)."</span>";
$salida = "<span title='".$module['datos']."' style='white-space: nowrap;'>".substr(io_safe_output($module["datos"]),0,12)."</span>";
}
}
$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 "<h3 class='title_h3'><a href='index.php?page=agent&id=" . $this->agentModule['id_agente'] . "'>" . get_agentmodule_agent_name($this->idAgentModule)."</a> / ".safe_output($this->agentModule['nombre']) . "</h3>";
echo "<h3 class='title_h3'><a href='index.php?page=agent&id=" . $this->agentModule['id_agente'] . "'>" . modules_get_agentmodule_agent_name($this->idAgentModule)."</a> / ".io_safe_output($this->agentModule['nombre']) . "</h3>";
echo "<h3 class='title_h3'>" . __('Graph') . "</h3>";
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 "<h3 class='title_h3'>" . __('Data') . "</h3>";
@ -425,7 +425,7 @@ class viewGraph {
echo html_print_extended_select_for_time ($intervals, 'period', $this->period, 'this.form.submit();', '', '0', 5) . __(" secs");
echo "</form><br />";
$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")
);
}

View File

@ -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[] = '<a href="index.php?page=agent&id=' . $idAgent . '">' . ui_print_truncate_text(get_agentmodule_name($alert["id_agent_module"]), 20, true, true) . '</a>';
$template = safe_output(alerts_get_alert_template ($alert['id_alert_template']));
$data[] = ui_print_truncate_text(safe_output($template['name']), 20, true, true);
$data[] = '<a href="index.php?page=agent&id=' . $idAgent . '">' . ui_print_truncate_text(modules_get_agentmodule_name($alert["id_agent_module"]), 20, true, true) . '</a>';
$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;

View File

@ -24,7 +24,7 @@ class ViewServers {
}
public function show() {
$servers = get_server_info ();
$servers = servers_get_info ();
if ($servers === false) $servers = array();

View File

@ -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 .= "<br><br>" . __("From the last") . " " . human_time_description_raw ($period);
echo "<h3>".$header_title. "</h3>";

View File

@ -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 ();

View File

@ -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] .= '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente='.$id_agente.'&amp;tab=module&amp;id_agent_module='.$module["id_agente_modulo"].'&amp;edit_module='.$module["id_modulo"].'">' . html_print_image("images/config.png", true, array("alt" => '0', "border" => "")) . '</a>';
@ -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"]));

View File

@ -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 "<tr><td class='datos3' align='center' colspan='".$colspan."'>
@ -303,7 +303,7 @@ foreach ($modules as $module) {
echo "<td></td>";
}
}
$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) {
<b>".$nombre_grupomodulo."</b></td>";
}
}
$nombre_tipo_modulo = get_moduletype_name ($module["id_tipo_modulo"]);
echo "<td class='".$tdcolor."_id' title='".safe_output($module["nombre"])."'>";
$nombre_tipo_modulo = modules_get_moduletype_name ($module["id_tipo_modulo"]);
echo "<td class='".$tdcolor."_id' title='".io_safe_output($module["nombre"])."'>";
ui_print_string_substr ($module["nombre"]);
echo "</td><td class='".$tdcolor."'> ";
@ -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 "</td><td class='".$tdcolor."f9' title='".safe_output($module["descripcion"])."'>";
echo safe_output(substr($module["descripcion"],0,32));
echo "</td><td class='".$tdcolor."f9' title='".io_safe_output($module["descripcion"])."'>";
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 "<td class='".$tdcolor."f9' colspan='2' title='".$module["datos"]."'>";
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 "<td class='".$tdcolor."f9' colspan='" . $colspan . "' title='".safe_output($module["datos"])."'>";
echo substr(safe_output($module["datos"]),0,42);
echo "<td class='".$tdcolor."f9' colspan='" . $colspan . "' title='".io_safe_output($module["datos"])."'>";
echo substr(io_safe_output($module["datos"]),0,42);
}
echo "</td>";
@ -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 "<td class=".$tdcolor." width='78'>";
$graph_label = safe_output($module["nombre"]);
$graph_label = io_safe_output($module["nombre"]);
echo "<a href='javascript:winopeng(\"operation/agentes/stat_win.php?type=$graph_type&period=2419200&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=180000\", \"month_".$win_handle."\")'>" . html_print_image('images/grafica_m.png' , true, array("border" => '0', "alt" => '')) . "</a>&nbsp;";

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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'));

View File

@ -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'];

View File

@ -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'));

View File

@ -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 {

View File

@ -48,7 +48,7 @@ if ($refresh > 0) {
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pandora FMS Graph (<?php echo get_agentmodule_agent_name ($id) . ' - ' . $label; ?>)</title>
<title>Pandora FMS Graph (<?php echo modules_get_agentmodule_agent_name ($id) . ' - ' . $label; ?>)</title>
<link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />
<script type='text/javaScript' src='../../include/javascript/calendar.js'></script>
<script type='text/javascript' src='../../include/javascript/x_core.js'></script>

View File

@ -418,9 +418,9 @@ foreach ($result as $row) {
$data[1] .= substr ($row["agent_name"], 0, 25);
$data[1] .= '</a></strong>';
$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] = "<span title='".$row['datos']."' style='white-space: nowrap;'>".substr(safe_output($row["datos"]),0,12)."</span>";
$data[7] = "<span title='".$row['datos']."' style='white-space: nowrap;'>".substr(io_safe_output($row["datos"]),0,12)."</span>";
if ($row["module_interval"] > 0)
$interval = $row["module_interval"];

View File

@ -50,7 +50,7 @@ function print_cells_temp ($cells) {
}
if (isset($row["href"]))
echo '<td class="'.$class.'" style="text-align:right;"><a class="big_data" href="'.safe_input ($row["href"]).'" style="color: '.$row["color"].';">'.$row[1].'</a></td></tr>';
echo '<td class="'.$class.'" style="text-align:right;"><a class="big_data" href="'.io_safe_input ($row["href"]).'" style="color: '.$row["color"].';">'.$row[1].'</a></td></tr>';
else
echo '<td class="'.$class.'" style="text-align:right;"><a class="big_data" style="color: '.$row["color"].';">'.$row[1].'</a></td></tr>';
}
@ -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 '<div style="width:20%; float:left; padding-right: 5%;" id="leftcolumn">';
// 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 '<tr><th colspan="2">'.__('Server performance').'</th></tr>';
$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) {

View File

@ -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) . '&nbsp;';
echo ui_print_truncate_text($module['nombre'],25,false,true,false).'</h3>';
echo '<strong>'.__('Type').':</strong> ';
$agentmoduletype = get_agentmodule_type ($module['id_agente_modulo']);
echo get_moduletype_name ($agentmoduletype).'&nbsp;';
echo html_print_image("images/" . get_module_type_icon ($agentmoduletype), true) . '<br />';
$agentmoduletype = modules_get_agentmodule_type ($module['id_agente_modulo']);
echo modules_get_moduletype_name ($agentmoduletype).'&nbsp;';
echo html_print_image("images/" . modules_get_type_icon ($agentmoduletype), true) . '<br />';
echo '<strong>'.__('Module group').':</strong> ';
$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').'<br />';
}
@ -296,7 +296,7 @@ if (is_ajax ()) {
echo $modulegroup.'<br />';
}
echo '<strong>'.__('Agent').':</strong> ';
echo ui_print_truncate_text(get_agentmodule_agent_name ($module['id_agente_modulo']),25,false,true,false).'<br />';
echo ui_print_truncate_text(modules_get_agentmodule_agent_name ($module['id_agente_modulo']),25,false,true,false).'<br />';
return;
}

Some files were not shown because too many files have changed in this diff Show More