From 809cd8407bd6efbfe5b72704069a8f5a65b2877e Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 7 Feb 2013 10:57:52 +0000 Subject: [PATCH] 2013-02-07 Miguel de Dios * godmode/users/user_list.php, godmode/users/profile_list.php, godmode/users/configure_user.php, godmode/users/configure_profile.php, godmode/db/db_audit.php, include/functions_reporting.php: cleaned source code style. * include/functions_graph.php: fixed the default parameter $adapt_Key in the function "grafico_modulo_string". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7601 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 ++++ pandora_console/godmode/db/db_audit.php | 2 +- .../godmode/users/configure_profile.php | 4 +- .../godmode/users/configure_user.php | 8 +-- .../godmode/users/profile_list.php | 6 +-- pandora_console/godmode/users/user_list.php | 6 +-- pandora_console/include/functions_graph.php | 54 +++++++++---------- .../include/functions_reporting.php | 2 +- 8 files changed, 51 insertions(+), 41 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 93d7634e0a..de274a66b1 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2013-02-07 Miguel de Dios + + * godmode/users/user_list.php, godmode/users/profile_list.php, + godmode/users/configure_user.php, + godmode/users/configure_profile.php, godmode/db/db_audit.php, + include/functions_reporting.php: cleaned source code style. + + * include/functions_graph.php: fixed the default parameter + $adapt_Key in the function "grafico_modulo_string". + 2013-02-06 Sergio Martin * include/functions_users.php diff --git a/pandora_console/godmode/db/db_audit.php b/pandora_console/godmode/db/db_audit.php index d184e99ee2..ae9ca97b71 100644 --- a/pandora_console/godmode/db/db_audit.php +++ b/pandora_console/godmode/db/db_audit.php @@ -84,7 +84,7 @@ echo ""; echo "".__('First date').""; echo "".$result["first_date"].""; -echo ""; +echo ""; echo "".__('Latest date').""; echo "".$result["latest_date"].""; echo ""; diff --git a/pandora_console/godmode/users/configure_profile.php b/pandora_console/godmode/users/configure_profile.php index 31c6a155c2..5fa319e394 100644 --- a/pandora_console/godmode/users/configure_profile.php +++ b/pandora_console/godmode/users/configure_profile.php @@ -49,8 +49,8 @@ if (!defined('METACONSOLE')) { } else { - user_meta_print_header(); - $sec2 = 'advanced'; + user_meta_print_header(); + $sec2 = 'advanced'; } diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index eee447f7da..96c2297e74 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -77,8 +77,8 @@ else { 'active' => false, 'text' => '' . html_print_image ("images/profiles.png", true, array ("title" => __('Profile management'))) .'')); - - $buttons[$tab]['active'] = true; + + $buttons[$tab]['active'] = true; ui_print_page_header (__('User detail editor'), "images/god3.png", false, "", true, $buttons); $sec = 'gusuarios'; @@ -202,7 +202,7 @@ if ($create_user) { $result = db_process_sql('/INSERT INTO tusuario (fullname, firstname, lastname, email, phone, comments, is_admin, language, id_skin, block_size, flash_chart, id_user, password, last_connect, registered) VALUES (\'' . $values['fullname'] . '\',\'\',\'\',\'\',\'\',\'\',' . $values['is_admin'] . ',\'' . $values['language'] .'\',' . $values['id_skin'] . ',' . $values['block_size'] . ',' . $values['flash_chart'] . ',\'' . $id . '\',\'' . $password_new . '\',0,\'' . get_system_time () . '\')'); if ($result) { - $res = db_process_sql('/INSERT INTO tpassword_history (id_user, password, date_begin) VALUES (\'' . $id . '\',\'' . md5($password_new) . '\',\'' . date ("Y/m/d H:i:s", get_system_time()) . '\')'); + $res = db_process_sql('/INSERT INTO tpassword_history (id_user, password, date_begin) VALUES (\'' . $id . '\',\'' . md5($password_new) . '\',\'' . date ("Y/m/d H:i:s", get_system_time()) . '\')'); } break; } @@ -323,7 +323,7 @@ if ($update_user) { if ($status != -1) { ui_print_result_message ($status, __('User info successfully updated'), - __('Error updating user info (no change?)')); + __('Error updating user info (no change?)')); } if ($add_profile) { diff --git a/pandora_console/godmode/users/profile_list.php b/pandora_console/godmode/users/profile_list.php index 950fdf54a0..e9f9dc0d83 100644 --- a/pandora_console/godmode/users/profile_list.php +++ b/pandora_console/godmode/users/profile_list.php @@ -48,7 +48,7 @@ if (!defined('METACONSOLE')) { $buttons[$tab]['active'] = true; - ui_print_page_header (__('User management').' » '.__('Profiles defined in Pandora'), "images/god3.png", false, "profile", true, $buttons); + ui_print_page_header (__('User management').' » '.__('Profiles defined in Pandora'), "images/god3.png", false, "profile", true, $buttons); $sec = 'gusuarios'; } else { @@ -92,7 +92,7 @@ if($create_profile || $update_profile) { $incident_management = (bool) get_parameter ("incident_management"); $agent_view = (bool) get_parameter ("agent_view"); $agent_edit = (bool) get_parameter ("agent_edit"); - $alert_edit = (bool) get_parameter ("alert_edit"); + $alert_edit = (bool) get_parameter ("alert_edit"); $user_management = (bool) get_parameter ("user_management"); $db_management = (bool) get_parameter ("db_management"); $alert_management = (bool) get_parameter ("alert_management"); @@ -248,7 +248,7 @@ foreach ($profiles as $profile) { $data[16] = ($profile["event_management"] ? $img : ''); $data[17] = ($profile["pandora_management"] ? $img : ''); $data[18] = ''. html_print_image('images/config.png', true, array('title' => __('Edit'))) .''; - $data[18] .= '  '. html_print_image("images/cross.png", true) . ''; + $data[18] .= '  '. html_print_image("images/cross.png", true) . ''; array_push ($table->data, $data); } diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index fcc967e3d7..9bea8f0450 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -113,9 +113,9 @@ else { 'active' => false, 'text' => '' . html_print_image ("images/profiles.png", true, array ("title" => __('Profile management'))) .'')); - - ui_print_page_header (__('User management').' » '.__('Users defined in Pandora'), "images/god3.png", false, "", true, $buttons); - + + ui_print_page_header (__('User management').' » '.__('Users defined in Pandora'), "images/god3.png", false, "", true, $buttons); + $sec = 'gusuarios'; } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index b4d5e09b1e..2e3fb674ef 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2713,7 +2713,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, } grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $unit_name, $show_alerts, $avg_only, $date, '', '', $show_unknown); - + if ($compare === 'overlapped') { $i = 0; foreach($chart as $k=>$v) { @@ -2730,26 +2730,26 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", 'url' => ui_get_full_url("/images/logo_vertical_water.png")); - + if ($compare === 'separated') { return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend, - $long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, - $water_mark, - $config['fontpath'], $config['font_size'], $unit, 1, $series_type, - $chart_extra_data, 0, 0, $adapt_key, false, $series_suffix_str). - '
'. - area_graph($flash_chart, $chart_prev, $width, $height/2, $color_prev, $legend_prev, - $long_index_prev, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, - $water_mark, - $config['fontpath'], $config['font_size'], $unit, 1, $series_type_prev, - $chart_extra_data_prev, 0, 0, $adapt_key, false, $series_suffix_str); + $long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, + $water_mark, + $config['fontpath'], $config['font_size'], $unit, 1, $series_type, + $chart_extra_data, 0, 0, $adapt_key, false, $series_suffix_str). + '
'. + area_graph($flash_chart, $chart_prev, $width, $height/2, $color_prev, $legend_prev, + $long_index_prev, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, + $water_mark, + $config['fontpath'], $config['font_size'], $unit, 1, $series_type_prev, + $chart_extra_data_prev, 0, 0, $adapt_key, false, $series_suffix_str); } else { return area_graph($flash_chart, $chart, $width, $height, $color, $legend, - $long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, - $water_mark, - $config['fontpath'], $config['font_size'], $unit, 1, $series_type, - $chart_extra_data, 0, 0, $adapt_key, false, $series_suffix_str); + $long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, + $water_mark, + $config['fontpath'], $config['font_size'], $unit, 1, $series_type, + $chart_extra_data, 0, 0, $adapt_key, false, $series_suffix_str); } } @@ -2956,11 +2956,11 @@ function graph_netflow_aggregate_pie ($data, $aggregate, $ttl = 1, $only_image = */ function grafico_modulo_string ($agent_module_id, $period, $show_events, $width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure=0, - $date = 0, $only_image = false, $homeurl = '', $adapt_key, $ttl = 1) { + $date = 0, $only_image = false, $homeurl = '', $adapt_key = '', $ttl = 1) { global $config; global $graphic_type; global $max_value; - + // Set variables if ($date == 0) $date = get_system_time(); @@ -3110,9 +3110,9 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, // Data in the interval //The order in chart array is very important!!!! - $chart[$timestamp]['event'] = $event_value; - $chart[$timestamp]['alert'] = $alert_value; - $chart[$timestamp]['max'] = 0; + $chart[$timestamp]['event'] = $event_value; + $chart[$timestamp]['alert'] = $alert_value; + $chart[$timestamp]['max'] = 0; if ($count > 0) { $chart[$timestamp]['sum'] = $count; @@ -3125,9 +3125,9 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, $chart[$timestamp]['min'] = 0; } - + $graph_stats = get_statwin_graph_statistics($chart); - + // Fix event and alert scale $event_max = 2 + (float)$max_value * 1.05; foreach ($chart as $timestamp => $chart_data) { @@ -3176,9 +3176,9 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, $legend['alert'] = __('Alerts'); } - $legend['max'] = __('Max').': '.__('Last').': '.$graph_stats['max']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['max']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['max']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['max']['min'].' '.$unit; + $legend['max'] = __('Max').': '.__('Last').': '.$graph_stats['max']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['max']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['max']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['max']['min'].' '.$unit; $legend['sum'] = __('Data').': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit; - $legend['min'] = __('Min').': '.__('Last').': '.$graph_stats['min']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['min']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['min']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['min']['min'].' '.$unit; + $legend['min'] = __('Min').': '.__('Last').': '.$graph_stats['min']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['min']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['min']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['min']['min'].' '.$unit; $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", @@ -3335,8 +3335,8 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu ///Functions for the LOG4X graphs function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event, - $width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0, - $date = 0) { + $width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0, + $date = 0) { grafico_modulo_log4x_trace("
");
 	
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index f9a308fcb6..bdff7d5ce5 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -52,7 +52,7 @@ function reporting_get_agentmodule_data_average ($id_agent_module, $period, $dat
 	// Initialize variables
 	if (empty ($date)) $date = get_system_time ();
 	if ((empty ($period)) OR ($period == 0)) $period = $config["sla_period"];
-	$datelimit = $date - $period;	
+	$datelimit = $date - $period;
 	
 	$id_module_type = modules_get_agentmodule_type ($id_agent_module);
 	$module_type = modules_get_moduletype_name ($id_module_type);