From 84d1863854bfa9d37cc8b5db7f51a0411e0df644 Mon Sep 17 00:00:00 2001 From: guruevi Date: Wed, 21 Jan 2009 18:55:29 +0000 Subject: [PATCH] 2009-01-21 Evi Vanoost * include/functions_db.php: Removed auth init because I fixed stat_win.php * include/functions_html.php: Added border and onclick. Fixed double quote * reporting/fgraph.php: Fixed some minor bugs * reporting/stat_win.php: Added authentication there too git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1387 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 + pandora_console/include/functions_db.php | 6 - pandora_console/include/functions_html.php | 9 +- pandora_console/reporting/fgraph.php | 12 +- pandora_console/reporting/stat_win.php | 336 +++++++++------------ 5 files changed, 168 insertions(+), 205 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4d595bf5b6..ff3982a218 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2009-01-21 Evi Vanoost + + * include/functions_db.php: Removed auth init because I fixed stat_win.php + + * include/functions_html.php: Added border and onclick. Fixed double quote + + * reporting/fgraph.php: Fixed some minor bugs + + * reporting/stat_win.php: Added authentication there too + 2009-01-21 Esteban Sanchez * godmode/agentes/alert_manager.php: Fixed a little bug that avoids diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 66bb7cb39a..717fea16dd 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -17,12 +17,6 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -if (!isset ($config["auth"])) { - require_once ($config["homedir"]."/include/auth/mysql.php"); -} else { - require_once ($config["homedir"]."/include/auth/".$config["auth"]["scheme"].".php"); -} - /** * Check if login session variables are set. * diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index c831814cf3..202e905cc0 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -686,12 +686,15 @@ function print_help_tip ($text, $return = false) { * @return string HTML code if return parameter is true. */ function print_image ($src, $return = false, $options = false) { - $output = ' %d', $id_agente, $fechatope); $eventos = get_db_all_rows_sql ($sql); + if ($eventos === false) { + $eventos = array (); + } + foreach ($eventos as $row) { $utimestamp = $row[0]; for ($i = 0; $i <= $resolution; $i++) { diff --git a/pandora_console/reporting/stat_win.php b/pandora_console/reporting/stat_win.php index 18db5017de..2b63adfae8 100644 --- a/pandora_console/reporting/stat_win.php +++ b/pandora_console/reporting/stat_win.php @@ -18,6 +18,12 @@ // Global & session management require_once ('../include/config.php'); +if (!isset ($config["auth"])) { + require_once ($config["homedir"]."/include/auth/mysql.php"); +} else { + require_once ($config["homedir"]."/include/auth/".$config["auth"]["scheme"].".php"); +} + if (! isset($_SESSION["id_user"])) { session_start(); session_write_close(); @@ -29,18 +35,69 @@ require_once ('../include/functions_db.php'); check_login (); // Parsing the refresh before sending any header -$refresh = get_parameter ("refresh", -1); -if ($refresh != -1) - header( 'refresh: ' . $_GET['refresh'] ); +$refresh = (int) get_parameter ("refresh", -1); +if ($refresh > 0) { + header('Refresh: '.$refresh); +} -echo ' -Pandora FMS Graph -'; -echo ""; -echo ""; +?> + + + + +Pandora FMS Graph + + + + + + + +".__('There was a problem locating the source of the graph').""; @@ -48,36 +105,6 @@ if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) { } $period = get_parameter ( "period", 3600); - -switch ($period) { - case 3600: $period_label = __('1 hour'); - break; - case 7200: $period_label = __('2 hours'); - break; - case 21600: $period_label = __('6 hours'); - break; - case 43200: $period_label = __('12 hours'); - break; - case 86400: $period_label = __('1 day'); - break; - case 172800: $period_label = __('2 days'); - break; - case 432000: $period_label = __('5 days'); - break; - case 604800: $period_label = __('1 week'); - break; - case 1296000: $period_label = __('15 days'); - break; - case 2592000: $period_label = __('1 month'); - break; - case 5184000: $period_label = __('2 months'); - break; - case 15552000: $period_label = __('6 months'); - break; - default: $period_label = human_time_description_raw ($period); -} - - $draw_alerts = get_parameter("draw_alerts", 0); $avg_only = get_parameter ("avg_only", 0); $period = get_parameter ("period", 86400); @@ -89,173 +116,94 @@ $start_date = get_parameter ("start_date", date("Y-m-d")); $draw_events = get_parameter ("draw_events", 0); $graph_type = get_parameter ("type", "sparse"); $zoom = get_parameter ("zoom", 1); -if ($zoom > 1){ - $height=$height*($zoom/2.1); - $width=$width*($zoom/1.4); -} if ($zoom > 1) { - echo " - - "; + $height = $height * ($zoom / 2.1); + $width = $width * ($zoom / 1.4); + + echo ""; } -$current = date("Y-m-d"); +$utime = get_system_time (); +$current = date("Y-m-d", $utime); +$image = "fgraph.php?tipo=".$graph_type."&draw_alerts=".$draw_alerts."&draw_events=".$draw_events."&id=".$id."&zoom=".$zoom."&label=".$label."&height=".$height."&width=".$width."&period=".$period."&avg_only=".$avg_only; + if ($start_date != $current){ - $utime = strtotime ($start_date); - echo ""; -} else - echo ""; - - echo ""; - echo ""; - echo "
"; - echo __('Max. Value')." : ". format_for_graph(get_agentmodule_data_max ($id, $period)); - echo ""; - echo __('Avg. Value')." : ". format_for_graph(get_agentmodule_data_average ($id, $period)); - echo ""; - echo __('Min. Value')." : ". format_for_graph(get_agentmodule_data_min ($id, $period)); - echo "
"; - -?> - - - - - - - + echo ''; + echo '
'.__('Max. Value').': '.format_for_graph (get_agentmodule_data_max ($id, $period)); + echo ''.__('Avg. Value').': '.format_for_graph (get_agentmodule_data_average ($id, $period)); + echo ''.__('Min. Value').': '.format_for_graph (get_agentmodule_data_min ($id, $period)); + echo '
'; +} -