From e2c6686186b625e9887f9f9774b7d83409d194da Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Fri, 27 Jul 2012 09:01:12 +0000 Subject: [PATCH] 2012-07-27 Miguel de Dios * godmode/gis_maps/index.php, godmode/groups/group_list.php, godmode/db/db_main.php, godmode/agentes/agent_manager.php, godmode/agentes/module_manager_editor_common.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6821 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 ++++ .../godmode/agentes/agent_manager.php | 34 ++++++++------- .../agentes/module_manager_editor_common.php | 42 ++++++++++--------- pandora_console/godmode/db/db_main.php | 9 ++-- pandora_console/godmode/gis_maps/index.php | 7 ++-- pandora_console/godmode/groups/group_list.php | 39 +++++++++-------- 6 files changed, 79 insertions(+), 59 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 86c85f6e6b..effd7aaaf8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2012-07-27 Miguel de Dios + + * godmode/gis_maps/index.php, godmode/groups/group_list.php, + godmode/db/db_main.php, godmode/agentes/agent_manager.php, + godmode/agentes/module_manager_editor_common.php: cleaned source + code style. + 2012-07-27 Miguel de Dios * include/Image/Graph/*, include/Image/Graph.php, diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 2cb5527b5e..1d74198f47 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -296,7 +296,7 @@ if (!$new_agent) { } else $table->data[3][1] = ''.__('Not available').''; - + $listIcons = gis_get_array_list_icons(); $arraySelectIcon = array(); @@ -322,18 +322,23 @@ else { $path_warning = $path . $icon_path . ".warning.png"; } -$table->data[4][1] = html_print_select($arraySelectIcon, "icon_path", $icon_path, "changeIcons();", __('None'), '', true) . - - ' ' . html_print_image($path_ok, true, array("id" => "icon_ok", "style" => "display:".$display_icons.";")) . - - ' ' . html_print_image($path_bad, true, array("id" => "icon_bad", "style" => "display:".$display_icons.";")) . - - ' ' . html_print_image($path_warning, true, array("id" => "icon_warning", "style" => "display:".$display_icons.";")); +$table->data[4][1] = html_print_select($arraySelectIcon, "icon_path", + $icon_path, "changeIcons();", __('None'), '', true) . + ' ' . html_print_image($path_ok, true, + array("id" => "icon_ok", "style" => "display:".$display_icons.";")) . + ' ' . html_print_image($path_bad, true, + array("id" => "icon_bad", "style" => "display:".$display_icons.";")) . + ' ' . html_print_image($path_warning, true, + array("id" => "icon_warning", "style" => "display:".$display_icons.";")); if ($config['activate_gis']) { $table->data[5][0] = __('Ignore new GIS data:'); - $table->data[5][1] = __('Disabled').' '.html_print_radio_button_extended ("update_gis_data", 1, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true); - $table->data[5][1] .= __('Enabled').' '.html_print_radio_button_extended ("update_gis_data", 0, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true); + $table->data[5][1] = __('Disabled') . ' ' . + html_print_radio_button_extended ("update_gis_data", 1, '', + $update_gis_data, false, '', 'style="margin-right: 40px;"', true); + $table->data[5][1] .= __('Enabled') . ' ' . + html_print_radio_button_extended ("update_gis_data", 0, '', + $update_gis_data, false, '', 'style="margin-right: 40px;"', true); } $table->data[6][0] = __('Url address:'); @@ -378,7 +383,8 @@ if ($id_agente) { html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"'); html_print_input_hidden ('update_agent', 1); html_print_input_hidden ('id_agente', $id_agente); -} else { +} +else { html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"'); html_print_input_hidden ('create_agent', 1); } @@ -390,11 +396,11 @@ ui_require_jquery_file ('bgiframe'); ?> + \ No newline at end of file diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 8ed9ee933b..42cd8ded19 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -286,32 +286,34 @@ if ($__code_from == 'modules') { $__id_where = 'b.id_agente_modulo'; $__id = (int)$id_agent_module; // Code comes from policy module editor -}else { +} +else { global $__id_pol_mod; $__table_modules= 'ttag_policy_module'; $__id_where = 'b.id_policy_module'; $__id = $__id_pol_mod; } -$table_advanced->data[6][1] = html_print_select_from_sql ("SELECT id_tag, name - FROM ttag - WHERE id_tag NOT IN ( - SELECT a.id_tag - FROM ttag a, $__table_modules b - WHERE a.id_tag = b.id_tag AND $__id_where = $__id ) - ORDER BY name", - 'id_tag_available[]', $id_tag, '','','', true, true, false, false, 'width: 200px', '5'); +$table_advanced->data[6][1] = html_print_select_from_sql ( + "SELECT id_tag, name + FROM ttag + WHERE id_tag NOT IN ( + SELECT a.id_tag + FROM ttag a, $__table_modules b + WHERE a.id_tag = b.id_tag AND $__id_where = $__id ) + ORDER BY name", 'id_tag_available[]', $id_tag, '','','', + true, true, false, false, 'width: 200px', '5'); $table_advanced->data[6][2] = html_print_image('images/darrowright.png', true, array('id' => 'right', 'title' => __('Add tags to module'))); //html_print_input_image ('add', 'images/darrowright.png', 1, '', true, array ('title' => __('Add tags to module'))); $table_advanced->data[6][2] .= '



' . html_print_image('images/darrowleft.png', true, array('id' => 'left', 'title' => __('Delete tags to module'))); //html_print_input_image ('add', 'images/darrowleft.png', 1, '', true, array ('title' => __('Delete tags to module'))); - -$table_advanced->data[6][3] = '' . __('Tags selected') . ''; -$table_advanced->data[6][4] = html_print_select_from_sql ("SELECT a.id_tag, name - FROM ttag a, $__table_modules b - WHERE a.id_tag = b.id_tag AND $__id_where = $__id - ORDER BY name", - 'id_tag_selected[]', $id_tag, '','','', true, true, false, false, 'width: 200px', '5'); -//$table_advanced->data[6][4] .= html_print_input_hidden('id_tag_serialize', ''); +$table_advanced->data[6][3] = '' . __('Tags selected') . ''; +$table_advanced->data[6][4] = html_print_select_from_sql ( + "SELECT a.id_tag, name + FROM ttag a, $__table_modules b + WHERE a.id_tag = b.id_tag AND $__id_where = $__id + ORDER BY name", + 'id_tag_selected[]', $id_tag, '','','', true, true, false, + false, 'width: 200px', '5'); ?> + \ No newline at end of file diff --git a/pandora_console/godmode/db/db_main.php b/pandora_console/godmode/db/db_main.php index 23b14b57ea..f7e7a61e65 100644 --- a/pandora_console/godmode/db/db_main.php +++ b/pandora_console/godmode/db/db_main.php @@ -179,15 +179,16 @@ echo ''; echo __('Last time on DB maintance'); echo ''; -if (!isset($config['db_maintance'])){ +if (!isset($config['db_maintance'])) { echo "".__("Never").""; -} else { +} +else { $seconds = time()-$config['db_maintance']; if ($seconds > 90000) //(1,1 days) echo ""; else echo ""; - + echo human_time_description_raw($seconds); echo " *"; } @@ -199,4 +200,4 @@ echo '


'; echo '(*) '.__('Please check your Pandora Server setup and be sure that database maintenance daemon is running. It\'s very important to keep up-to-date database to get the best performance and results in Pandora'); echo '
'; echo ''; -?> +?> \ No newline at end of file diff --git a/pandora_console/godmode/gis_maps/index.php b/pandora_console/godmode/gis_maps/index.php index 933b43ed7a..3cd3c3e72b 100644 --- a/pandora_console/godmode/gis_maps/index.php +++ b/pandora_console/godmode/gis_maps/index.php @@ -112,10 +112,11 @@ if ($maps){ $table->data[] = $table_info; } } - + if (!empty ($table->data)) { html_print_table($table); -} else { +} +else { echo '
'.('No maps defined').'
'; } @@ -162,4 +163,4 @@ function setDefault(id_tgis_map) { }); } } - + \ No newline at end of file diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index b4cb81859f..f254999ffc 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -165,17 +165,19 @@ $check = db_get_value('nombre', 'tgrupo', 'nombre', $name); $result = db_process_sql_insert('tgrupo', $values); if ($result) { echo "

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

"; - } else { + } + else { echo "

".__('There was a problem creating group')."

"; } - } else { + } + else { echo "

".__('Each group must have a different name')."

"; } - } else { + } + else { //$result = false; echo "

".__('Group must have a name')."

"; } - } /* Update group */ @@ -188,32 +190,34 @@ if ($update_group) { $custom_id = (string) get_parameter ('custom_id'); $propagate = (bool) get_parameter('propagate'); $skin = (string) get_parameter ('skin'); - + /*Check if name field is empty*/ if( $name != "") { switch ($config["dbtype"]) { case "mysql": $sql = sprintf ('UPDATE tgrupo SET nombre = "%s", - icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d - WHERE id_grupo = %d', - $name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $id_group); + icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d + WHERE id_grupo = %d', + $name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $id_group); break; case "postgresql": case "oracle": $sql = sprintf ('UPDATE tgrupo SET nombre = \'%s\', - icon = \'%s\', disabled = %d, parent = %d, custom_id = \'%s\', propagate = %d, id_skin = %d - WHERE id_grupo = %d', - $name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $id_group); + icon = \'%s\', disabled = %d, parent = %d, custom_id = \'%s\', propagate = %d, id_skin = %d + WHERE id_grupo = %d', + $name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $id_group); break; - } + } $result = db_process_sql ($sql); - } else { + } + else { $result = false; } if ($result !== false) { echo "

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

"; - } else { + } + else { echo "

".__('There was a problem modifying group')."

"; } } @@ -221,7 +225,7 @@ if ($update_group) { /* Delete group */ if ($delete_group) { $id_group = (int) get_parameter ('id_group'); - + $usedGroup = groups_check_used($id_group); if (!$usedGroup['return']) { @@ -245,13 +249,12 @@ if ($delete_group) { else { echo "

".__('There was a problem deleting group')."

"; } - } db_clean_cache(); $groups = users_get_groups_tree ($config['id_user'], "AR", true); $table->width = '98%'; -if(!empty($groups)) { +if (!empty($groups)) { $table->head = array (); $table->head[0] = __('Name'); $table->head[1] = __('ID'); @@ -262,7 +265,7 @@ if(!empty($groups)) { $table->align[2] = 'center'; $table->align[4] = 'center'; $table->data = array (); - + $iterator = 0; foreach ($groups as $id_group => $group) {