From b064082064ff18793ffa8dbc7f77ac773c5b608a Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 13 May 2013 10:52:51 +0000 Subject: [PATCH] 2013-05-13 Miguel de Dios * include/functions_graph.php: fixed PHP warnings. * godmode/agentes/modificar_agente.php, include/functions_agents.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8124 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 ++++++ .../godmode/agentes/modificar_agente.php | 14 +++++------ pandora_console/include/functions_agents.php | 2 +- pandora_console/include/functions_graph.php | 24 ++++++++++--------- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 5078bd4e4a..c7c54fa57e 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2013-05-13 Miguel de Dios + + * include/functions_graph.php: fixed PHP warnings. + + * godmode/agentes/modificar_agente.php, + include/functions_agents.php: cleaned source code style. + 2013-05-10 Miguel de Dios * operation/snmpconsole/snmp_browser.php: fixed the url to pure. diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 56dd46b111..48a71845d1 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -87,12 +87,12 @@ if ($agent_to_delete) { // Check if the remote config file still exist if (isset ($config["remote_config"])) { - $agent_md5 = md5 (agents_get_name($id_agente, ""), FALSE); - - if (file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5") || - file_exists ($config["remote_config"]."/conf/".$agent_md5.".conf")) { - ui_print_error_message(__('Maybe the files conf or md5 could not be deleted')); - } + $agent_md5 = md5 (agents_get_name($id_agente, ""), FALSE); + + if (file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5") || + file_exists ($config["remote_config"]."/conf/".$agent_md5.".conf")) { + ui_print_error_message(__('Maybe the files conf or md5 could not be deleted')); + } } } @@ -253,7 +253,7 @@ if ($ag_group > 0) { %s', $ag_group, $search_sql); $total_agents = db_get_sql ($sql); - + $ag_groups = array(); $ag_groups = (array)$ag_group; if ($recursion) { diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index b0ace4b7a6..0373be2b10 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1758,7 +1758,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) { // db_process_delete_temp ("tagente_modulo", "id_agente", $id_agent); db_process_sql_update ('tagente_modulo', - array ('delete_pending' => 1, 'disabled' => 1, 'nombre' => 'pendingdelete'), + array ('delete_pending' => 1, 'disabled' => 1, 'nombre' => 'pendingdelete'), 'id_agente = '. $id_agent); // Access entries diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 94f45cbaf2..799ae5d192 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2641,8 +2641,10 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $k++; } - if($is_unknown) { - $unknown_value++; + if (isset($is_unknown)) { + if ($is_unknown) { + $unknown_value++; + } } // Set the title and time format @@ -2799,15 +2801,15 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, ': ' . $graph_stats['sum']['avg'] . ' ' . __('Min. Value').$series_suffix_str . ': ' . $graph_stats['sum']['min'] . ' ' . __('Units').$series_suffix_str . ': ' . $unit; ///////////////////////////////////////////////////////////////////////////////////////// - if($show_events) { + if ($show_events) { $legend['event'.$series_suffix] = __('Events').$series_suffix_str; $chart_extra_data['legend_events'] = $legend['event'.$series_suffix]; } - if($show_alerts) { + if ($show_alerts) { $legend['alert'.$series_suffix] = __('Alerts').$series_suffix_str; $chart_extra_data['legend_alerts'] = $legend['alert'.$series_suffix]; } - if($show_unknown) { + if ($show_unknown) { $legend['unknown'.$series_suffix] = __('Unknown').$series_suffix_str; $chart_extra_data['legend_unknown'] = $legend['unknown'.$series_suffix]; } @@ -2825,13 +2827,13 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } //$legend['baseline'.$series_suffix] = __('Baseline').$series_suffix_str; ///////////////////////////////////////////////////////////////////////////////////////// - if($show_events) { + if ($show_events) { $color['event'.$series_suffix] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50); } - if($show_alerts) { + if ($show_alerts) { $color['alert'.$series_suffix] = array('border' => '#ff7f00', 'color' => '#ff7f00', 'alpha' => 50); } - if($show_unknown) { + if ($show_unknown) { $color['unknown'.$series_suffix] = array('border' => '#999999', 'color' => '#999999', 'alpha' => 50); } $color['max'.$series_suffix] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50); @@ -2872,7 +2874,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-$period, $series_suffix, $series_suffix_str, $show_unknown); - switch($compare) { + switch ($compare) { case 'separated': // Store the chart calculated $chart_prev = $chart; @@ -2889,7 +2891,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, $legend_prev = $legend; $series_type_prev = $series_type; $color_prev = $color; - foreach($color_prev as $k => $col) { + foreach ($color_prev as $k => $col) { $color_prev[$k]['color'] = '#'.get_complementary_rgb($color_prev[$k]['color']); } break; @@ -2900,7 +2902,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, if ($compare === 'overlapped') { $i = 0; - foreach($chart as $k=>$v) { + foreach ($chart as $k=>$v) { $chart[$k] = array_merge($v,$chart_prev[$i]); $i++; }