From df3a5ede461722d8df7ab14c381ea7286ba7f309 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Mon, 13 Jun 2011 16:55:19 +0000 Subject: [PATCH] 2011-06-13 Sergio Martin * include/functions_graph.php include/graphs/functions_pchart.php include/graphs/fgraph.php include/graphs/functions_utils.php: Added time to live to area graphs in pdf calls * operation/reporting/reporting_xml.php: Fixed bad characteres in xml git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4440 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 +++++++++++ pandora_console/include/functions_graph.php | 7 ++++--- pandora_console/include/graphs/fgraph.php | 6 +++--- pandora_console/include/graphs/functions_pchart.php | 4 +++- pandora_console/include/graphs/functions_utils.php | 2 +- pandora_console/operation/reporting/reporting_xml.php | 3 +-- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 996546dbf5..98add0155e 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2011-06-13 Sergio Martin + + * include/functions_graph.php + include/graphs/functions_pchart.php + include/graphs/fgraph.php + include/graphs/functions_utils.php: Added time to live to + area graphs in pdf calls + + * operation/reporting/reporting_xml.php: Fixed bad characteres in + xml + 2011-06-13 Javier Lanz * images/mult.png, images/subs.png, images/div.png: Added png images diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 6de26c6531..0bf46c0206 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -29,7 +29,8 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, $width, $height , $title = '', $unit_name = null, $show_alerts = false, $avg_only = 0, $pure = false, $date = 0, $unit = '', $baseline = 0, $return_data = 0, $show_title = true, - $only_image = false, $homeurl = '') { + $only_image = false, $homeurl = '', $ttl = 1) { + global $config; global $graphic_type; @@ -306,11 +307,11 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, if ($flash_chart) { include_flash_chart_script($homeurl); } - + return area_graph($flash_chart, $chart, $width, $height, $color,$legend, $long_index, "images/image_problem.opaque.png", "", "", $homeurl, $config['homedir'] . "/images/logo_vertical_water.png", - $config['fontpath'], $config['font_size'], $unit); + $config['fontpath'], $config['font_size'], $unit, $ttl); } /** diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index b9b3673ae3..5b8061a39a 100755 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -189,7 +189,7 @@ function threshold_graph($flash_chart, $chart_data, $width, $height) { function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homedir="", - $water_mark = "", $font = '', $font_size = '', $unit) { + $water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1) { if (empty($chart_data)) { return ''; @@ -211,9 +211,9 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $graph['font'] = $font; $graph['font_size'] = $font_size; - $id_graph = serialize_in_temp($graph); + $id_graph = serialize_in_temp($graph, null, $ttl); - return ""; + return ""; } } diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index 61decd6ae4..b21c1be136 100755 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -53,7 +53,9 @@ if (!$id_graph) { exit; } -$graph = unserialize_in_temp($id_graph); +$ttl = get_parameter('ttl', 1); + +$graph = unserialize_in_temp($id_graph, true, $ttl); if (!isset($graph)) { exit; diff --git a/pandora_console/include/graphs/functions_utils.php b/pandora_console/include/graphs/functions_utils.php index 4db58b8ac1..b0792398d5 100644 --- a/pandora_console/include/graphs/functions_utils.php +++ b/pandora_console/include/graphs/functions_utils.php @@ -55,7 +55,7 @@ function unserialize_in_temp($serial_id = null, $delete = true, $ttl = 1) { unlink($file_path); } else { - $next_volume = $volume++; + $next_volume = $volume + 1; rename($file_path, sys_get_temp_dir()."/pandora_serialize_".$serial_id."__".$next_volume."__".$ttl); } } diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index e004e13ea8..ef94f594ba 100644 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -195,10 +195,9 @@ foreach ($contents as $content) { $img = grafico_modulo_sparse2($content['id_agent_module'], $content['period'], 0, 720, 230, '', null, false, true, false, $datetime, '', 0, 0, true, true); - preg_match("/src='(.*)'/", $img, $matches); $url = $matches[1]; - + $url = ""; $data["objdata"]["img"] = $url; break;