From 3750c7fc460b1d6add24bb447cceb2dd801087ae Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 4 Feb 2013 09:21:27 +0000 Subject: [PATCH] 2013-02-04 Miguel de Dios * godmode/alerts/alert_list.list.php, godmode/reporting/graph_builder.php, godmode/setup/news.php, godmode/setup/setup_general.php, godmode/netflow/nf_edit_form.php, godmode/db/db_purge.php, godmode/db/db_main.php, godmode/extensions.php, include/functions_reporting.php, operation/reporting/reporting_viewer.php: improved the source code style. * operation/reporting/reporting_xml.php, include/functions_xml.php: fixed the output of xml when have some html entities that is not as hexadecimal entities. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7564 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 14 +++ .../godmode/alerts/alert_list.list.php | 6 +- pandora_console/godmode/db/db_main.php | 2 +- pandora_console/godmode/db/db_purge.php | 112 +++++++++++++----- pandora_console/godmode/extensions.php | 69 ++++++----- .../godmode/netflow/nf_edit_form.php | 34 +++--- .../godmode/reporting/graph_builder.php | 14 +-- pandora_console/godmode/setup/news.php | 6 +- .../godmode/setup/setup_general.php | 20 ++-- .../include/functions_reporting.php | 22 ++-- pandora_console/include/functions_xml.php | 32 ++--- .../operation/reporting/reporting_viewer.php | 9 +- .../operation/reporting/reporting_xml.php | 17 ++- 13 files changed, 218 insertions(+), 139 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index dbf4eb3266..a2f9f2301a 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,17 @@ +2013-02-04 Miguel de Dios + + * godmode/alerts/alert_list.list.php, + godmode/reporting/graph_builder.php, godmode/setup/news.php, + godmode/setup/setup_general.php, godmode/netflow/nf_edit_form.php, + godmode/db/db_purge.php, godmode/db/db_main.php, + godmode/extensions.php, include/functions_reporting.php, + operation/reporting/reporting_viewer.php: improved the source code + style. + + * operation/reporting/reporting_xml.php, include/functions_xml.php: + fixed the output of xml when have some html entities that is not + as hexadecimal entities. + 2013-02-04 Junichi Satoh * include/help/ja/help_events_replication.php: Added more info as diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 0844310fc8..463d3faaed 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -53,9 +53,9 @@ $arrayAgents = array(); # Avoid empty arrays, warning messages are UGLY ! if ($temp){ - foreach ($temp as $agentElement) { - $arrayAgents[$agentElement['id_agente']] = $agentElement['nombre']; - } + foreach ($temp as $agentElement) { + $arrayAgents[$agentElement['id_agente']] = $agentElement['nombre']; + } } $form_filter .= "".__('Agents').""; diff --git a/pandora_console/godmode/db/db_main.php b/pandora_console/godmode/db/db_main.php index f7e7a61e65..482c1e3c94 100644 --- a/pandora_console/godmode/db/db_main.php +++ b/pandora_console/godmode/db/db_main.php @@ -79,7 +79,7 @@ echo ''; echo ''; echo __('Max. time before compact data'); echo ''; -echo $config['days_compact'].' '.__('days'); +echo $config['days_compact'] . ' ' . __('days'); echo ''; echo ''; diff --git a/pandora_console/godmode/db/db_purge.php b/pandora_console/godmode/db/db_purge.php index 70d0f0b775..891eb56d4f 100644 --- a/pandora_console/godmode/db/db_purge.php +++ b/pandora_console/godmode/db/db_purge.php @@ -178,37 +178,93 @@ else { $query = ""; } -$data["1day"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1day"], $query)); -$data["3day"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["3day"], $query)); -$data["1week"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1week"], $query)); -$data["2week"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["2week"], $query)); -$data["1month"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1month"], $query)); -$data["3month"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["3month"], $query)); -$data["total"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE 1=1 %s", $query)); +$data["1day"] = db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos + WHERE utimestamp > %d %s", $time["1day"], $query)); +$data["3day"] = db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos + WHERE utimestamp > %d %s", $time["3day"], $query)); +$data["1week"] = db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos + WHERE utimestamp > %d %s", $time["1week"], $query)); +$data["2week"] = db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos + WHERE utimestamp > %d %s", $time["2week"], $query)); +$data["1month"] = db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos + WHERE utimestamp > %d %s", $time["1month"], $query)); +$data["3month"] = db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos + WHERE utimestamp > %d %s", $time["3month"], $query)); +$data["total"] = db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos + WHERE 1=1 %s", $query)); -$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["1day"], $query)); -$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["3day"], $query)); -$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["1week"], $query)); -$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["2week"], $query)); -$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["1month"], $query)); -$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["3month"], $query)); -$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE 1=1 %s", $query)); +$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_inc + WHERE utimestamp > %d %s", $time["1day"], $query)); +$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_inc + WHERE utimestamp > %d %s", $time["3day"], $query)); +$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_inc + WHERE utimestamp > %d %s", $time["1week"], $query)); +$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_inc + WHERE utimestamp > %d %s", $time["2week"], $query)); +$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_inc + WHERE utimestamp > %d %s", $time["1month"], $query)); +$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_inc + WHERE utimestamp > %d %s", $time["3month"], $query)); +$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_inc + WHERE 1=1 %s", $query)); -$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1day"], $query)); -$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["3day"], $query)); -$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1week"], $query)); -$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["2week"], $query)); -$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1month"], $query)); -$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["3month"], $query)); -$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE 1=1 %s", $query)); +$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_string + WHERE utimestamp > %d %s", $time["1day"], $query)); +$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_string + WHERE utimestamp > %d %s", $time["3day"], $query)); +$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_string + WHERE utimestamp > %d %s", $time["1week"], $query)); +$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_string + WHERE utimestamp > %d %s", $time["2week"], $query)); +$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_string + WHERE utimestamp > %d %s", $time["1month"], $query)); +$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_string + WHERE utimestamp > %d %s", $time["3month"], $query)); +$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_string + WHERE 1=1 %s", $query)); -$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1day"], $query)); -$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["3day"], $query)); -$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1week"], $query)); -$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["2week"], $query)); -$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1month"], $query)); -$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["3month"], $query)); -$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE 1=1 %s", $query)); +$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_log4x + WHERE utimestamp > %d %s", $time["1day"], $query)); +$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_log4x + WHERE utimestamp > %d %s", $time["3day"], $query)); +$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_log4x + WHERE utimestamp > %d %s", $time["1week"], $query)); +$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_log4x + WHERE utimestamp > %d %s", $time["2week"], $query)); +$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_log4x + WHERE utimestamp > %d %s", $time["1month"], $query)); +$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_log4x + WHERE utimestamp > %d %s", $time["3month"], $query)); +$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*) + FROM tagente_datos_log4x + WHERE 1=1 %s", $query)); $table->width = '98%'; $table->border = 0; diff --git a/pandora_console/godmode/extensions.php b/pandora_console/godmode/extensions.php index e4691e8a95..04430715f9 100644 --- a/pandora_console/godmode/extensions.php +++ b/pandora_console/godmode/extensions.php @@ -42,14 +42,12 @@ $disabled = get_parameter("disabled", ""); if ($delete != ""){ if ($enterprise) { - if (!file_exists($config["homedir"]."/enterprise/extensions/ext_backup")) - { + if (!file_exists($config["homedir"]."/enterprise/extensions/ext_backup")) { mkdir($config["homedir"]."/enterprise/extensions/ext_backup"); } } else { - if (!file_exists($config["homedir"]."/extensions/ext_backup")) - { + if (!file_exists($config["homedir"]."/extensions/ext_backup")) { mkdir($config["homedir"]."/extensions/ext_backup"); } } @@ -62,7 +60,7 @@ if ($delete != ""){ $source = $config["homedir"]."/extensions/" . $delete; $endFile = $config["homedir"]."/extensions/ext_backup/" . $delete; } - + rename($source, $endFile); @@ -103,14 +101,12 @@ if ($enabled != '') { if ($disabled != '') { if ($enterprise) { - if (!file_exists($config["homedir"]."/enterprise/extensions/disabled")) - { + if (!file_exists($config["homedir"]."/enterprise/extensions/disabled")) { mkdir($config["homedir"]."/enterprise/extensions/disabled"); } } else { - if (!file_exists($config["homedir"]."/extensions/disabled")) - { + if (!file_exists($config["homedir"]."/extensions/disabled")) { mkdir($config["homedir"]."/extensions/disabled"); } } @@ -123,7 +119,7 @@ if ($disabled != '') { $source = $config["homedir"]."/extensions/" . $disabled; $endFile = $config["homedir"]."/extensions/disabled/" . $disabled; } - + rename($source, $endFile); @@ -191,42 +187,43 @@ foreach ($extensions as $file => $extension) { $on = html_print_image("images/dot_green.disabled.png", true); $off = html_print_image("images/dot_red.disabled.png", true); $data[] = '' . $file . ''; - + //Get version of this extensions if ($config['extensions'][$file]['operation_menu']) { $data[] = $config['extensions'][$file]['operation_menu']['version']; } - + if ($config['extensions'][$file]['godmode_menu']) { - + $data[] = $config['extensions'][$file]['godmode_menu']['version']; } - - if ($config['extensions'][$file]['extension_ope_tab']) { - $data[] = $config['extensions'][$file]['extension_ope_tab']['version']; - } else if ($config['extensions'][$file]['extension_god_tab']) { - $data[] = $config['extensions'][$file]['extension_god_tab']['version']; - } - - + + if ($config['extensions'][$file]['extension_ope_tab']) { + $data[] = $config['extensions'][$file]['extension_ope_tab']['version']; + } + else if ($config['extensions'][$file]['extension_god_tab']) { + $data[] = $config['extensions'][$file]['extension_god_tab']['version']; + } + + } else { $data[] = $file; - + //Get version of this extension - if ($config['extensions'][$file]['operation_menu']) { - $data[] = $config['extensions'][$file]['operation_menu']['version']; - } - else if ($config['extensions'][$file]['godmode_menu']) { - $data[] = $config['extensions'][$file]['godmode_menu']['version']; - } - else if (isset($config['extensions'][$file]['extension_ope_tab'])) { - $data[] = $config['extensions'][$file]['extension_ope_tab']['version']; - } - else if ($config['extensions'][$file]['extension_god_tab']) { - $data[] = $config['extensions'][$file]['extension_god_tab']['version']; - } - + if ($config['extensions'][$file]['operation_menu']) { + $data[] = $config['extensions'][$file]['operation_menu']['version']; + } + else if ($config['extensions'][$file]['godmode_menu']) { + $data[] = $config['extensions'][$file]['godmode_menu']['version']; + } + else if (isset($config['extensions'][$file]['extension_ope_tab'])) { + $data[] = $config['extensions'][$file]['extension_ope_tab']['version']; + } + else if ($config['extensions'][$file]['extension_god_tab']) { + $data[] = $config['extensions'][$file]['extension_god_tab']['version']; + } + } if ($extension['enterprise']) { @@ -293,7 +290,7 @@ foreach ($extensions as $file => $extension) { $data[] = '' . html_print_image("images/cross.png", true) . '' . ' ' . html_print_image("images/lightbulb.png", true) . ''; } - + $table->data[] = $data; } html_print_table ($table); diff --git a/pandora_console/godmode/netflow/nf_edit_form.php b/pandora_console/godmode/netflow/nf_edit_form.php index b5032b9d64..04a448ceb8 100644 --- a/pandora_console/godmode/netflow/nf_edit_form.php +++ b/pandora_console/godmode/netflow/nf_edit_form.php @@ -38,14 +38,14 @@ $create = (string)get_parameter('create', 0); $pure = get_parameter('pure', 0); -if ($id){ +if ($id) { $permission = netflow_check_filter_group ($id); if (!$permission) { //no tiene permisos para acceder a un filtro require ($config['homedir'] . "/general/noaccess.php"); return; } } - + //Header if (! defined ('METACONSOLE')) { $buttons['edit'] = '' @@ -55,13 +55,14 @@ if (! defined ('METACONSOLE')) { $buttons['add'] = '' . html_print_image ("images/add.png", true, array ("title" => __('Add filter'))) . ''; - + ui_print_page_header (__('Netflow Filter'), "images/networkmap/so_cisco_new.png", false, "", true, $buttons); -} else { +} +else { $nav_bar = array(array('link' => 'index.php?sec=main', 'text' => __('Main')), - array('link' => 'index.php?sec=netf&sec2=' . $config['homedir'] . '/godmode/netflow/nf_edit', 'text' => __('Netflow filters')), - array('link' => 'index.php?sec=netf&sec2=' . $config['homedir'] . '/godmode/netflow/nf_edit_form', 'text' => __('Add filter'))); - + array('link' => 'index.php?sec=netf&sec2=' . $config['homedir'] . '/godmode/netflow/nf_edit', 'text' => __('Netflow filters')), + array('link' => 'index.php?sec=netf&sec2=' . $config['homedir'] . '/godmode/netflow/nf_edit_form', 'text' => __('Add filter'))); + ui_meta_print_page_header($nav_bar); ui_meta_print_header(__("Netflow filters")); @@ -141,16 +142,15 @@ if ($create) { $advanced_filter = (string) get_parameter('advanced_filter', ''); $values = array ( - 'id_name'=>$name, - 'id_group' => $assign_group, - 'ip_dst'=>$ip_dst, - 'ip_src'=>$ip_src, - 'dst_port'=>$dst_port, - 'src_port'=>$src_port, - 'aggregate'=>$aggregate, - 'advanced_filter'=>$advanced_filter, - 'output'=>$output - ); + 'id_name'=>$name, + 'id_group' => $assign_group, + 'ip_dst'=>$ip_dst, + 'ip_src'=>$ip_src, + 'dst_port'=>$dst_port, + 'src_port'=>$src_port, + 'aggregate'=>$aggregate, + 'advanced_filter'=>$advanced_filter, + 'output'=>$output); // Save filter args $values['filter_args'] = netflow_get_filter_arguments ($values); diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 51fb47d11f..a3f6aa4b54 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -141,21 +141,21 @@ if ($add_module) { $id_modules = get_parameter('module'); $id_agents = get_parameter('id_agents'); $weight = get_parameter('weight'); - + //Id modules has double entities conversion //Safe output remove all entities - io_safe_output_array($id_modules, ""); - + io_safe_output_array($id_modules, ""); + //We need to put the entities again //to browse in db io_safe_input_array($id_modules); - + $id_agent_modules = db_get_all_rows_sql("SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN (". implode(',', $id_agents). ") AND nombre IN ('". implode("','", $id_modules). "')"); - + if (count($id_agent_modules) > 0 && $id_agent_modules != '') { foreach($id_agent_modules as $id_agent_module) $result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight)); @@ -189,9 +189,9 @@ if ($edit_graph) { 'text' => '' . html_print_image("images/chart_curve.png", true, array ("title" => __('View graph'))) .'') ); - + $buttons[$active_tab]['active'] = true; - + $graphInTgraph = db_get_row_sql("SELECT name FROM tgraph WHERE id_graph = " . $id_graph); $name = $graphInTgraph['name']; } diff --git a/pandora_console/godmode/setup/news.php b/pandora_console/godmode/setup/news.php index 195989f364..b8af39bad8 100644 --- a/pandora_console/godmode/setup/news.php +++ b/pandora_console/godmode/setup/news.php @@ -99,7 +99,7 @@ if ((isset ($_GET["form_add"])) || (isset ($_GET["form_edit"]))) { // Create news - echo ''; + echo '
'; echo ''; if ($creation_mode == 1) echo ""; @@ -119,7 +119,7 @@ if ((isset ($_GET["form_add"])) || (isset ($_GET["form_edit"]))) { '; - echo ''; + echo ''; echo "
"; echo ""; echo ""; echo ""; - + $color = 1; foreach ($rows as $row) { diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 3fa38f6320..78e68db268 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -108,8 +108,8 @@ if ($config["integria_enabled"]) { $bad_input = true; } - $inventories = array(); - // Right connection but theres is no inventories + $inventories = array(); + // Right connection but theres is no inventories if ($invent == 'false') { unset($invent); $invent = array(); @@ -178,7 +178,7 @@ if ($zone_selected == "") { $timezones = timezone_identifiers_list(); foreach ($timezones as $timezone) { if (strpos($timezone, $zone_selected) !== false) { - $timezone_n[$timezone] = $timezone; + $timezone_n[$timezone] = $timezone; } } @@ -292,12 +292,14 @@ $(document).ready (function () { $("#zone").attr("disabled", true); $("#timezone").attr("disabled", true); - $("input[name='acl_enterprise']").click(function(){ - flag = $(this).is(':checked'); - if (flag == true){ - - } - }); + $("input[name='acl_enterprise']").click(function() { + flag = $(this).is(':checked'); + if (flag == true) { + + } + }); $("#change_timezone").click(function () { diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 6a10afb614..f97e3c2276 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2507,24 +2507,26 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data = array (); -$moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($content['id_agent_module'])); - + $moduletype_name = modules_get_moduletype_name( + modules_get_agentmodule_type( + $content['id_agent_module'])); + if (preg_match ("/string/", $moduletype_name)) { - + $urlImage = ui_get_full_url(false, false, false, false); - + $data[0] = grafico_modulo_string ($content['id_agent_module'], $content['period'], false, $sizgraph_w, $sizgraph_h, '', '', false, 1, false, $report["datetime"], true, $urlImage); - - } + + } else { - + $data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'], false, $sizgraph_w, $sizgraph_h, '', '', false, true, true, $report["datetime"], '', 0, 0, true, true, ui_get_full_url(false) . '/'); } - + array_push ($table->data, $data); break; case 'projection_graph': @@ -2631,7 +2633,7 @@ $moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($c $data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'], false, $sizgraph_w, $sizgraph_h, '', '', false, true, true, $report["datetime"], '', true, 0, true, true, ui_get_full_url(false) . '/'); - + /*$data[0] = graphic_combined_module( $modules, $weights, @@ -2644,7 +2646,7 @@ $moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($c 0, $graph["stacked"], $report["datetime"]); */ - + array_push ($table->data, $data); break; diff --git a/pandora_console/include/functions_xml.php b/pandora_console/include/functions_xml.php index 81b309e791..f9540baae0 100644 --- a/pandora_console/include/functions_xml.php +++ b/pandora_console/include/functions_xml.php @@ -108,17 +108,17 @@ function xml_file_agent_conf ($modules = array(), $file_temp, $position = 0, $id function xml_file_event ($events = array(), $file_temp, $position = 0, $id_agent) { $file = fopen($file_temp, 'a+'); - + foreach ($events as $event) { $content_report = " \n"; - $content_report .= " ".$event['evento']."\n"; - $content_report .= " ".$event['event_type']."\n"; - $content_report .= " ".get_priority_name($event['criticity'])."\n"; - $content_report .= " ".$event['count_rep']."\n"; - $content_report .= " ".$event['time2']."\n"; - $content_report .= " ".modules_get_agentmodule_name ($event['id_agentmodule'])."\n"; - $content_report .= " ".agents_get_name ($id_agent)."\n"; + $content_report .= " " . io_safe_output($event['evento']) . "\n"; + $content_report .= " " . $event['event_type'] . "\n"; + $content_report .= " " . get_priority_name($event['criticity']) . "\n"; + $content_report .= " " . $event['count_rep'] . "\n"; + $content_report .= " " . $event['time2'] . "\n"; + $content_report .= " " . io_safe_output(modules_get_agentmodule_name ($event['id_agentmodule'])) . "\n"; + $content_report .= " " . io_safe_output(agents_get_name ($id_agent)) . "\n"; if ($event['estado'] == 0) $status = __('New'); @@ -128,13 +128,13 @@ function xml_file_event ($events = array(), $file_temp, $position = 0, $id_agent $status = __('In process'); else $status = ""; - - $content_report .= " ".$status."\n"; - $content_report .= " ".$event['user_comment']."\n"; - $content_report .= " ".$event['tags']."\n"; - $content_report .= " ".$event['source']."\n"; - $content_report .= " ".$event['id_extra']."\n"; - $content_report .= " ".$event['owner_user']."\n"; + + $content_report .= " ".$status."\n"; + $content_report .= " ".$event['user_comment']."\n"; + $content_report .= " ".$event['tags']."\n"; + $content_report .= " ".$event['source']."\n"; + $content_report .= " ".$event['id_extra']."\n"; + $content_report .= " ".$event['owner_user']."\n"; $content_report .= " \n"; $result = fwrite($file, $content_report); @@ -149,7 +149,7 @@ function xml_file_event ($events = array(), $file_temp, $position = 0, $id_agent function xml_file_graph ($data_module = array(), $file_temp, $position = 0) { $file = fopen($file_temp, 'a+'); - + foreach ($data_module as $data_m) { $content_report = " \n"; diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index 2ea1658e6a..4b116bfe31 100644 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -191,7 +191,7 @@ $(document).ready (function () { minuteText: '', secondText: '', currentText: '', - closeText: ''}); + closeText: ''}); $('[id^=text-date_init]').datepicker ({changeMonth: true, changeYear: true, showAnim: "slideDown"}); @@ -225,7 +225,10 @@ if ($datetime === false || $datetime == -1) { return; } -// TODO: Evaluate if it's better to render blocks when are calculated (enabling realtime flush) or if it's better to wait report to be finished before showing anything (this could break the execution by overflowing the running PHP memory on HUGE reports). +// TODO: Evaluate if it's better to render blocks when are calculated +// (enabling realtime flush) or if it's better to wait report to be +// finished before showing anything (this could break the execution +// by overflowing the running PHP memory on HUGE reports). $table->size = array (); @@ -267,7 +270,7 @@ foreach ($contents as $content) { if ($datetime_init >= $datetime) { $datetime_init = $date_init_less; } - $new_interval = $report['datetime'] - $datetime_init; + $new_interval = $report['datetime'] - $datetime_init; $content['period'] = $new_interval; } diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index 9df7647c4f..7e30df722a 100644 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -612,12 +612,17 @@ foreach ($contents as $content) { $result = fwrite($file, $content_report); fclose($file); - $sql = sprintf ('SELECT evento, event_type, criticity, count(*) as count_rep, - max(timestamp) AS time2, id_agentmodule, estado, user_comment, tags, source, id_extra, owner_user - FROM tevento - WHERE id_agente = %d AND utimestamp > %d AND utimestamp <= %d - GROUP BY id_agentmodule, evento - ORDER BY time2 DESC', $content['id_agent'], $datelimit, $date); + $sql = sprintf (' + SELECT evento, event_type, criticity, + count(*) AS count_rep, max(timestamp) AS time2, + id_agentmodule, estado, user_comment, tags, + source, id_extra, owner_user + FROM tevento + WHERE id_agente = %d AND utimestamp > %d + AND utimestamp <= %d + GROUP BY id_agentmodule, evento + ORDER BY time2 DESC', $content['id_agent'], + $datelimit, $date); $events = db_get_all_rows_sql ($sql); xml_file_event ($events, $temp_file,0, $content['id_agent']);
"; @@ -145,7 +145,7 @@ else { echo "".__('Timestamp')."".__('Delete')."