From 18e859b96a785614c5d99784b04b1c37c52ab112 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 28 Feb 2012 12:05:41 +0000 Subject: [PATCH] 2012-02-28 Miguel de Dios * godmode/alerts/configure_alert_action.php, godmode/alerts/configure_alert_template.php, godmode/modules/manage_network_components_form.php, godmode/users/configure_user.php, include/functions_forecast.php, mobile/operation/agents/monitor_status.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5661 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 +++++++++- .../godmode/alerts/configure_alert_action.php | 12 +++++++----- .../godmode/alerts/configure_alert_template.php | 17 ++++++++++------- .../modules/manage_network_components_form.php | 6 ++++-- .../godmode/users/configure_user.php | 10 ++++++---- pandora_console/include/functions_forecast.php | 10 +++++++--- .../mobile/operation/agents/monitor_status.php | 2 +- 7 files changed, 44 insertions(+), 23 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index a18f08eada..37e8ee8acd 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,4 +1,12 @@ -2012-02-27 Miguel de Dios +2012-02-28 Miguel de Dios + + * godmode/alerts/configure_alert_action.php, + godmode/alerts/configure_alert_template.php, + godmode/modules/manage_network_components_form.php, + godmode/users/configure_user.php, include/functions_forecast.php, + mobile/operation/agents/monitor_status.php: cleaned source code style. + +2012-02-28 Miguel de Dios * operation/integria_incidents/incident.php: added error message when Pandora have a bad conf for the Integria API. And cleaned source code style. diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index 31bb45635f..efbc2b4c37 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -41,11 +41,12 @@ if ($al_action !== false){ "Trying to access Alert Management"); require ("general/noaccess.php"); exit; - }else + } + else // Header ui_print_page_header (__('Alerts').' » '.__('Configure alert action'), "images/god2.png", false, "", true); - // If user tries to edit an action of others groups - }else{ + } // If user tries to edit an action of others groups + else { $own_info = get_user_info ($config['id_user']); if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) $own_groups = array_keys(users_get_groups($config['id_user'], "LM")); @@ -56,14 +57,15 @@ if ($al_action !== false){ if ($is_in_group) // Header ui_print_page_header (__('Alerts').' » '.__('Configure alert action'), "images/god2.png", false, "", true); - else{ + else { db_pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; } } -}else +} +else // Header ui_print_page_header (__('Alerts').' » '.__('Configure alert action'), "images/god2.png", false, "", true); diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index ae3f240af6..41008de6ab 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -35,11 +35,12 @@ $id = (int) get_parameter ('id'); if ($duplicate_template) { $source_id = (int) get_parameter ('source_id'); $a_template = alerts_get_alert_template($source_id); -}else{ +} +else { $a_template = alerts_get_alert_template($id); } -if ($a_template !== false){ +if ($a_template !== false) { // If user tries to duplicate/edit a template with group=ALL if ($a_template['id_group'] == 0){ // then must have "PM" access privileges @@ -48,11 +49,13 @@ if ($a_template !== false){ "Trying to access Alert Management"); require ("general/noaccess.php"); exit; - }else + } + else // Header ui_print_page_header (__('Alerts').' » '.__('Configure alert template'), "", false, "", true); - // If user tries to duplicate/edit a template of others groups - }else{ + + } // If user tries to duplicate/edit a template of others groups + else { $own_info = get_user_info ($config['id_user']); if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) $own_groups = array_keys(users_get_groups($config['id_user'], "LM")); @@ -63,7 +66,7 @@ if ($a_template !== false){ if ($is_in_group) // Header ui_print_page_header (__('Alerts').' » '.__('Configure alert template'), "", false, "", true); - else{ + else { db_pandora_audit("ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); @@ -71,7 +74,7 @@ if ($a_template !== false){ } } // This prevents to duplicate the header in case duplicate/edit_template action is performed -}else +} else // Header ui_print_page_header (__('Alerts').' » '.__('Configure alert template'), "", false, "", true); diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index ff989eb4fa..b41d23ce54 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -154,7 +154,8 @@ if ($id) { html_print_input_hidden ('update_component', 1); html_print_input_hidden ('id', $id); html_print_submit_button (__('Update'), 'upd', false, 'class="sub upd"'); -} else { +} +else { html_print_input_hidden ('create_component', 1); html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"'); } @@ -436,7 +437,8 @@ $(document).ready (function () { $("input[name=active_snmp_v3]").val(1); $("input[name=snmp_community]").css({backgroundColor: '#ddd'}); $("input[name=snmp_community]").attr("disabled",true); - }else{ + } + else { $("input[name=snmp3_auth_user]").val(""); $("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_auth_user]").attr("disabled", true); diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index b457683208..4fe6bb7e79 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -354,7 +354,7 @@ $own_info = get_user_info ($config['id_user']); if ($config['admin_can_make_admin']) { $table->data[6][0] = __('Global Profile'); $table->data[6][1] = ''; - if ($own_info['is_admin'] || $user_info['is_admin']){ + if ($own_info['is_admin'] || $user_info['is_admin']) { $table->data[6][1] = html_print_radio_button ('is_admin', 1, '', $user_info['is_admin'], true); $table->data[6][1] .= __('Administrator'); $table->data[6][1] .= ui_print_help_tip (__("This user has permissions to manage all. This is admin user and overwrites all permissions given in profiles/groups"), true); @@ -384,10 +384,11 @@ if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) else $display_all_group = false; -if ($new_user){ +if ($new_user) { $usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group)); $id_usr = $config['id_user']; -}else{ +} +else { $usr_groups = (users_get_groups($id, 'AR', $display_all_group)); $id_usr = $id; } @@ -420,7 +421,8 @@ if ($new_user) { html_print_input_hidden ('create_user', 1); html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"'); } -} else { +} +else { if ($config['user_can_update_info']) { html_print_input_hidden ('update_user', 1); html_print_submit_button (__('Update'), 'uptbutton', false, 'class="sub upd"'); diff --git a/pandora_console/include/functions_forecast.php b/pandora_console/include/functions_forecast.php index 27dfee3d97..8af6f943cc 100644 --- a/pandora_console/include/functions_forecast.php +++ b/pandora_console/include/functions_forecast.php @@ -44,7 +44,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe return array(); } // Prevents bad behaviour over image error - else if (!is_array($module_data) and preg_match('/^ $row) { - if ($utimestamp == '') { continue; } + if ($utimestamp == '') { + continue; + } + $data[0] = ''; $data[1] = $cont; $data[2] = date('d M Y H:i:s', $utimestamp); @@ -75,7 +78,8 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe $data[7] = $row['sum'] * $row['sum']; if ($cont == 1){ $data[8] = 0; - }else{ + } + else { $data[8] = $utimestamp - $last_timestamp; } diff --git a/pandora_console/mobile/operation/agents/monitor_status.php b/pandora_console/mobile/operation/agents/monitor_status.php index 00f001afe5..109d9d92f5 100644 --- a/pandora_console/mobile/operation/agents/monitor_status.php +++ b/pandora_console/mobile/operation/agents/monitor_status.php @@ -187,7 +187,7 @@ class MonitorStatus { $data = array(); - if($row['utimestamp'] == 0 && (($row['module_type'] < 21 || $row['module_type'] > 23) && $row['module_type'] != 100)){ + if($row['utimestamp'] == 0 && (($row['module_type'] < 21 || $row['module_type'] > 23) && $row['module_type'] != 100)) { $statusImg = ui_print_status_image(STATUS_MODULE_NO_DATA, __('NOT INIT'), true); } elseif ($row["estado"] == 0) {