diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 916adc18a8..3cc3c55be1 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2013-02-07 Miguel de Dios + + * godmode/db/db_refine.php, godmode/servers/plugin.php: improved + the code style. + + * include/functions_reporting.php: fixed the SLA when it is the + equal to limit. + + Fixes: #3602722 + 2013-02-07 Miguel de Dios * godmode/modules/manage_network_components_form_common.php: fixed diff --git a/pandora_console/godmode/db/db_refine.php b/pandora_console/godmode/db/db_refine.php index 1a30c8f007..ded0f58052 100644 --- a/pandora_console/godmode/db/db_refine.php +++ b/pandora_console/godmode/db/db_refine.php @@ -18,7 +18,7 @@ // Load global vars global $config; -check_login (); +check_login (); if (! check_acl ($config['id_user'], 0, "DM")) { db_pandora_audit("ACL Violation","Trying to access Database Debug Admin section"); diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 8c0774ab49..07e1ace789 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -19,9 +19,9 @@ if (is_ajax ()) { $id_plugin = get_parameter('id_plugin'); $description = db_get_value_filter('description', 'tplugin', array('id' => $id_plugin)); - $preload = io_safe_output($description); + $preload = io_safe_output($description); $preload = str_replace ("\n", "
", $preload); - + echo $preload; return; } @@ -90,7 +90,7 @@ if (($create != "") OR ($view != "")) { $table->style[0] = 'font-weight: bold'; $table->style[2] = 'font-weight: bold'; $table->data = array (); - + $data = array(); $data[0] = __('Name'); $data[1] = ''; @@ -123,14 +123,14 @@ if (($create != "") OR ($view != "")) { echo ''; $table->data = array(); - + $plugin_id = get_parameter ("view", 0); $locked = true; // If we have plugin id (update mode) and this plugin used by any module or component // The command configuration will be locked - if($plugin_id > 0) { + if ($plugin_id > 0) { $modules_using_plugin = db_get_value_filter('count(*)','tagente_modulo', array('delete_pending' => 0, 'id_plugin' => $plugin_id)); $components_using_plugin = db_get_value_filter('count(*)','tnetwork_component', array('id_plugin' => $plugin_id)); if(($components_using_plugin + $modules_using_plugin) == 0) { @@ -140,16 +140,16 @@ if (($create != "") OR ($view != "")) { else { $locked = false; } - + $disabled = ''; - if($locked) { + if ($locked) { $disabled = 'readonly="readonly"'; } $data = array(); $data[0] = __('Plugin command'); $data[1] = ''; - if($locked) { + if ($locked) { $data[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf')); } $table->data['plugin_command'] = $data; @@ -157,7 +157,7 @@ if (($create != "") OR ($view != "")) { $data = array(); $data[0] = __('Plug-in parameters').ui_print_help_icon ('plugin_parameters', true); $data[1] = ''; - if($locked) { + if ($locked) { $data[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf')); } $table->data['plugin_parameters'] = $data; @@ -180,7 +180,7 @@ if (($create != "") OR ($view != "")) { // The next row number is plugin_9 $next_name_number = 9; $i = 1; - while(1) { + while (1) { // Always print at least one macro if((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) { break; @@ -239,7 +239,7 @@ if (($create != "") OR ($view != "")) { $i++; } - if(!$locked) { + if (!$locked) { $datam = array (); $datam[0] = ''.__('Add macro').' '.html_print_image('images/add.png',true).''; $datam[0] .= ''; @@ -286,7 +286,7 @@ else { $plugin_execute = get_parameter ("form_execute", ""); $plugin_plugin_type = get_parameter ("form_plugin_type", "0"); $parameters = get_parameter ("form_parameters", ""); - + // Get macros $i = 1; $macros = array(); @@ -299,16 +299,16 @@ else { $desc = (string)get_parameter ('field'.$i.'_desc'); $help = (string)get_parameter ('field'.$i.'_help'); $value = (string)get_parameter ('field'.$i.'_value'); - + $macros[$i]['macro'] = $macro; $macros[$i]['desc'] = $desc; $macros[$i]['help'] = $help; $macros[$i]['value'] = $value; $i++; } - + $macros = json_encode($macros); - + $values = array( 'name' => $plugin_name, 'description' => $plugin_description, @@ -330,7 +330,7 @@ else { echo "

".__('Plugin updated successfully')."

"; } } - + // Create plugin if (isset($_GET["create_plugin"])){ $plugin_name = get_parameter ("form_name", ""); @@ -344,7 +344,7 @@ else { // Get macros $i = 1; $macros = array(); - while(1) { + while (1) { $macro = (string)get_parameter ('field'.$i.'_macro'); if($macro == '') { break; @@ -353,14 +353,14 @@ else { $desc = (string)get_parameter ('field'.$i.'_desc'); $help = (string)get_parameter ('field'.$i.'_help'); $value = (string)get_parameter ('field'.$i.'_value'); - + $macros[$i]['macro'] = $macro; $macros[$i]['desc'] = $desc; $macros[$i]['help'] = $help; $macros[$i]['value'] = $value; $i++; } - + $macros = json_encode($macros); $values = array( @@ -378,29 +378,31 @@ else { $result = db_process_sql_insert('tplugin', $values); if (! $result) { - echo "

".__('Problem creating plugin')."

"; + echo "

" . + __('Problem creating plugin') . "

"; } else { - echo "

".__('Plugin created successfully')."

"; + echo "

" . + __('Plugin created successfully') . "

"; } } - - if (isset($_GET["kill_plugin"])){ // if delete alert + + if (isset($_GET["kill_plugin"])) { // if delete alert $plugin_id = get_parameter ("kill_plugin", 0); $result = db_process_sql_delete('tplugin', array('id' => $plugin_id)); - if (! $result){ + if (! $result) { echo "

".__('Problem deleting plugin')."

"; } else { echo "

".__('Plugin deleted successfully')."

"; } - if ($plugin_id != 0){ + if ($plugin_id != 0) { $result = db_process_sql_delete('tagente_modulo', array('id_plugin' => $plugin_id)); } } - + // If not edition or insert, then list available plugins $rows = db_get_all_rows_sql('SELECT * FROM tplugin ORDER BY name'); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index bdff7d5ce5..500f1bf8ec 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2790,15 +2790,15 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $sla['sla_min'], $sla['sla_max'], $report['datetime'], $content, $content['time_from'], $content['time_to']); - if($data_sla == false) { + if ($data_sla == false) { $data_sla = array(); } //Get the sla_value in % and store it on $sla_value $data_total = 0; $data_pass = 0; - foreach($data_sla as $d) { - switch($d['data']) { + foreach ($data_sla as $d) { + switch ($d['data']) { case 1: $data_pass += $d['utimestamp']; $data_total += $d['utimestamp']; @@ -2824,11 +2824,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f } //Do not show right modules if 'only_display_wrong' is active - if ($content['only_display_wrong'] == 1 && $sla_value >= $sla['sla_limit']) continue; + if ($content['only_display_wrong'] == 1 && $sla_value >= $sla['sla_limit']) + continue; // Calculate general pie graph data - foreach($data_sla as $d) { - switch($d['data']) { + foreach ($data_sla as $d) { + switch ($d['data']) { case 1: $data_graph[__('Inside limits')] += $d['utimestamp']; break; @@ -2914,7 +2915,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data[5] = ''; $data[6] = ''; - if ($sla_value > $sla['sla_limit']) { + if ($sla_value >= $sla['sla_limit']) { $data[4] = ''; $data[5] = ''.__('OK').''; } @@ -2925,10 +2926,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f } // Print icon with status including edge - if ($sla_value > $sla['sla_limit']+$edge_interval) { + if ($sla_value > ($sla['sla_limit'] + $edge_interval)) { $data[6] = html_print_image('images/status_sets/default/severity_normal.png',true,array('title'=>__('Inside limits'))); } - elseif ($sla_value <= $sla['sla_limit']+$edge_interval && $sla_value >= $sla['sla_limit']-$edge_interval) { + elseif (($sla_value <= $sla['sla_limit'] + $edge_interval) + && ($sla_value >= $sla['sla_limit'] - $edge_interval)) { $data[6] = html_print_image('images/status_sets/default/severity_warning.png',true,array('title'=>__('On the edge'))); } else {