diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 722e30ae21..bff8f3dd25 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2009-12-14 Miguel de Dios + + * include/fgraph.php: fix in the function "grafico_modulo_boolean" for + show correct graph, and clean source code. + * include/functions_extensions.php: change include_once to require_once for + more security. + Fixes: 2883786 + 2009-12-15 Ramon Novoa * include/functions_fsgraph.php: Fixed bug #2913813. diff --git a/pandora_console/include/fgraph.php b/pandora_console/include/fgraph.php index e359b4c2e6..ade8d8f9d6 100644 --- a/pandora_console/include/fgraph.php +++ b/pandora_console/include/fgraph.php @@ -1300,9 +1300,8 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event, foreach ($result as $row) { $utimestamp = $row['utimestamp']; for ($i = 0; $i <= $resolution; $i++) { - if ($utimestamp <= $data[$i]['timestamp_top'] && $utimestamp >= $data[$i]['timestamp_bottom']) { + if ($utimestamp <= $data[$i]['timestamp_top'] && $utimestamp >= $data[$i]['timestamp_bottom']) $data['events']++; - } } } } @@ -1316,15 +1315,14 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event, 'order' => 'utimestamp ASC'), array ('datos', 'utimestamp')); - if ($all_data === false) { + if ($all_data === false) $all_data = array (); - } foreach ($all_data as $module_data) { $real_data = intval ($module_data["datos"]) ? 1 : 0; $utimestamp = $module_data["utimestamp"]; for ($i = 0; $i <= $resolution; $i++) { - if ($utimestamp <= $data[$i]['timestamp_top'] && $utimestamp >= $data[$i]['timestamp_bottom']) { + if ($utimestamp <= $data[$i]['timestamp_top'] || $utimestamp >= $data[$i]['timestamp_bottom']) { $data[$i]['sum'] += $real_data; $data[$i]['count']++; @@ -1360,30 +1358,32 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event, } $grafica = array (); - foreach ($data as $d) { + foreach ($data as $d) $grafica[$d['timestamp_bottom']] = $d['sum']; - } if ($period <= 3600) { $title_period = __('Last hour'); $time_format = 'G:i:s'; - } elseif ($period <= 86400) { + } + elseif ($period <= 86400) { $title_period = __('Last day'); $time_format = 'G:i'; - } elseif ($period <= 604800) { + } + elseif ($period <= 604800) { $title_period = __('Last week'); $time_format = 'M j'; - } elseif ($period <= 2419200) { + } + elseif ($period <= 2419200) { $title_period = __('Last month'); $time_format = 'M j'; - } else { + } + else { $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); $time_format = 'M j'; } - if (! $graphic_type) { + if (! $graphic_type) return fs_module_chart ($data, $width, $height, $avg_only, $resolution / 10, $time_format); - } $engine = get_graph_engine ($period); diff --git a/pandora_console/include/functions_extensions.php b/pandora_console/include/functions_extensions.php index 0434eace43..53175bd598 100644 --- a/pandora_console/include/functions_extensions.php +++ b/pandora_console/include/functions_extensions.php @@ -139,7 +139,7 @@ function load_extensions ($extensions) { foreach ($extensions as $extension) { $extension_file = $extension['file']; - include_once (realpath ($extension['dir']."/".$extension_file)); + require_once (realpath ($extension['dir']."/".$extension_file)); } }