diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 9a340b7fae..3ed2c539b8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2013-06-05 Miguel de Dios + + * operation/snmpconsole/snmp_view.php: fixed the pagination. + + Fixes: #2255 + + * godmode/groups/group_list.php, godmode/agentes/agent_manager.php: + cleaned source code style. + 2013-06-04 Miguel de Dios * godmode/agentes/agent_manager.php, godmode/menu.php, diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index f79a74ac4c..b3ee562368 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -243,14 +243,19 @@ $table->data[0][0] = __('Custom ID'); $table->data[0][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true); // Learn mode / Normal mode -$table->data[1][0] = __('Module definition').ui_print_help_icon("module_definition", true); -$table->data[1][1] = __('Learning mode').' '.html_print_radio_button_extended ("modo", 1, '', $modo, false, '', 'style="margin-right: 40px;"', true); -$table->data[1][1] .= __('Normal mode').' '.html_print_radio_button_extended ("modo", 0, '', $modo, false, '', 'style="margin-right: 40px;"', true); +$table->data[1][0] = __('Module definition') . + ui_print_help_icon("module_definition", true); +$table->data[1][1] = __('Learning mode') . ' ' . + html_print_radio_button_extended ("modo", 1, '', $modo, false, '', 'style="margin-right: 40px;"', true); +$table->data[1][1] .= __('Normal mode') . ' ' . + html_print_radio_button_extended ("modo", 0, '', $modo, false, '', 'style="margin-right: 40px;"', true); // Status (Disabled / Enabled) $table->data[2][0] = __('Status'); -$table->data[2][1] = __('Disabled').' '.html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true); -$table->data[2][1] .= __('Active').' '.html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true); +$table->data[2][1] = __('Disabled') . ' ' . + html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true); +$table->data[2][1] .= __('Active') . ' ' . + html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true); // Remote configuration $table->data[3][0] = __('Remote configuration'); @@ -261,7 +266,8 @@ if (!$new_agent) { // Delete remote configuration $table->data[3][1] .= ''; $table->data[3][1] .= html_print_image ("images/cross.png", true, array ('title' => __('Delete remote configuration file'), 'style' => 'vertical-align: middle;')).''; - $table->data[3][1] .= ''.ui_print_help_tip (__('Delete this conf file implies that for restore you must reactive remote config in the local agent.'), true); + $table->data[3][1] .= '' . + ui_print_help_tip (__('Delete this conf file implies that for restore you must reactive remote config in the local agent.'), true); } else $table->data[3][1] = '' . __('Not available') . ''; @@ -354,7 +360,7 @@ if (!empty($fields)) { ui_toggle(html_print_table ($table, true), __('Custom fields')); } -echo '
'; +echo '
'; if ($id_agente) { html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"'); html_print_input_hidden ('update_agent', 1); diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 256739b4eb..44177296d3 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -188,7 +188,7 @@ if ($update_group) { $other = (string) get_parameter ('other'); /*Check if name field is empty*/ - if( $name != "") { + if ( $name != "") { switch ($config["dbtype"]) { case "mysql": $sql = sprintf ('UPDATE tgrupo SET nombre = "%s", diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index 7d238d40d9..a8e3b0d401 100644 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -59,7 +59,7 @@ ui_print_page_header (__("SNMP Console"), "images/op_snmp.png", false, "", false // OPERATIONS // Delete SNMP Trap entry Event (only incident management access). -if (isset ($_GET["delete"])){ +if (isset ($_GET["delete"])) { $id_trap = (int) get_parameter_get ("delete", 0); if ($id_trap > 0 && check_acl ($config['id_user'], 0, "IM")) { @@ -124,17 +124,28 @@ if (isset ($_POST["updatebt"])) { switch ($config["dbtype"]) { case "mysql": - $sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC LIMIT %d,%d",$offset,$pagination); + $sql = sprintf (" + SELECT * + FROM ttrap + ORDER BY timestamp DESC + LIMIT %d,%d",$offset,$pagination); break; case "postgresql": - $sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC LIMIT %d OFFSET %d", $pagination, $offset); + $sql = sprintf (" + SELECT * + FROM ttrap + ORDER BY timestamp DESC + LIMIT %d OFFSET %d", $pagination, $offset); break; case "oracle": $set = array(); $set['limit'] = $pagination; $set['offset'] = $offset; - $sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC"); - $sql = oracle_recode_query ($sql, $set); + $sql = sprintf (" + SELECT * + FROM ttrap + ORDER BY timestamp DESC"); + $sql = oracle_recode_query ($sql, $set); break; } $traps = db_get_all_rows_sql ($sql); @@ -143,7 +154,7 @@ $all_traps = db_get_all_rows_sql ("SELECT * FROM ttrap"); if (($config['dbtype'] == 'oracle') && ($traps !== false)) { for ($i=0; $i < count($traps); $i++) { - unset($traps[$i]['rnum']); + unset($traps[$i]['rnum']); } } @@ -176,13 +187,24 @@ foreach ($all_traps as $trap) { //Make query to extract traps of DB. switch ($config["dbtype"]) { case "mysql": - $sql = "SELECT * FROM ttrap %s ORDER BY timestamp DESC LIMIT %d,%d"; + $sql = " + SELECT * + FROM ttrap %s + ORDER BY timestamp DESC + LIMIT %d,%d"; break; case "postgresql": - $sql = "SELECT * FROM ttrap %s ORDER BY timestamp DESC LIMIT %d OFFSET %d"; + $sql = " + SELECT * + FROM ttrap %s + ORDER BY timestamp DESC + LIMIT %d OFFSET %d"; break; case "oracle": - $sql = "SELECT * FROM ttrap %s ORDER BY timestamp DESC"; + $sql = " + SELECT * + FROM ttrap %s + ORDER BY timestamp DESC"; break; } $whereSubquery = 'WHERE 1=1'; @@ -297,7 +319,7 @@ switch ($config["dbtype"]) { $set = array(); $set['limit'] = $pagination; $set['offset'] = $offset; - $sql = oracle_recode_query ($sql, $set); + $sql = oracle_recode_query ($sql, $set); break; } @@ -305,7 +327,7 @@ $traps = db_get_all_rows_sql($sql); if (($config['dbtype'] == 'oracle') && ($traps !== false)) { for ($i=0; $i < count($traps); $i++) { - unset($traps[$i]['rnum']); + unset($traps[$i]['rnum']); } } @@ -366,12 +388,25 @@ ui_toggle($filter, __('Toggle filter(s)')); unset ($table); // Prepare index for pagination -$trapcount = db_get_sql ("SELECT COUNT(id_trap) FROM ttrap " . $whereSubquery); +$trapcount = db_get_sql (" + SELECT COUNT(id_trap) + FROM ttrap " . + $whereSubquery); -$urlPagination = "index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_agent=" . $filter_agent - . "&filter_oid=" . $filter_oid . "&filter_severity=" . $filter_severity - . "&filter_fired=" . $filter_fired . "&filter_status=" . $filter_status - . "&search_string=" . $search_string . "&pagination=".$pagination."&offset=".$offset."&refr=".((int)get_parameter('refr', 0))."&pure=".$config["pure"]; +$urlPagination = "index.php?" . + "sec=estado&" . + "sec2=operation/snmpconsole/snmp_view&" . + "filter_agent=" . $filter_agent . "&" . + "filter_oid=" . $filter_oid . "&" . + "filter_severity=" . $filter_severity . "&" . + "filter_fired=" . $filter_fired . "&" . + "filter_status=" . $filter_status . "&" . + "search_string=" . $search_string . "&" . + "pagination=" . $pagination . "&" . + "offset=" . $offset . "&" . + "refr=" . ((int)get_parameter('refr', 0)) . "&" . + "pure=" . $config["pure"] . "&" . + "search_string=" . $search_string; ui_pagination ($trapcount, $urlPagination, $offset, $pagination); echo '
';