diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 520c73c34c..cb1b044149 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,20 @@ +2014-07-24 Miguel de Dios + + * operation/snmpconsole/snmp_view.php, + operation/events/events_list.php, operation/incidents/incident.php, + extensions/files_repo.php, + extensions/files_repo/sql/files_repo.postgreSQL.sql, + extensions/files_repo/functions_files_repo.php, + extensions/files_repo/files_repo_list.php, + godmode/agentes/modificar_agente.php, + godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php, + include/functions_graph.php, include/functions_db.php, + include/db/postgresql.php, include/db/oracle.php, + include/db/mysql.php, include/functions_update_manager.php, + include/functions_events.php, include/graphs/functions_flot.php, + include/graphs/fgraph.php: tiny fixes for the improve the support of + postgreSQL databases. + 2014-07-23 Miguel de Dios * extensions/module_groups.php, extensions/agents_alerts.php, diff --git a/pandora_console/extensions/files_repo.php b/pandora_console/extensions/files_repo.php index 6132ed7d70..51719fade6 100644 --- a/pandora_console/extensions/files_repo.php +++ b/pandora_console/extensions/files_repo.php @@ -18,12 +18,14 @@ function pandora_files_repo_install () { global $config; + if (isset($config['files_repo_installed'])) { if ($config['files_repo_installed'] == 1) { return; } } - + + $full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/"; $full_sql_dir = $full_extensions_dir."files_repo/sql/"; @@ -40,6 +42,7 @@ function pandora_files_repo_install () { break; } + foreach ($sentences as $sentence) { if (trim ($sentence) == "") continue; @@ -61,22 +64,22 @@ function pandora_files_repo_uninstall () { switch ($config["dbtype"]) { case "mysql": - db_process_sql ('DROP TABLE `tfiles_repo_group`'); - db_process_sql ('DROP TABLE `tfiles_repo`'); - db_process_sql ('DELETE FROM `tconfig` - WHERE `token` LIKE "files_repo_%"'); + db_process_sql('DROP TABLE `tfiles_repo_group`'); + db_process_sql('DROP TABLE `tfiles_repo`'); + db_process_sql('DELETE FROM `tconfig` + WHERE `token` LIKE "files_repo_%"'); break; case "postgresql": - db_process_sql ('DROP TABLE `tfiles_repo_group`'); - db_process_sql ('DROP TABLE `tfiles_repo`'); - db_process_sql ('DELETE FROM "tconfig" - WHERE "token" LIKE \'files_repo_%\''); + db_process_sql('DROP TABLE "tfiles_repo_group"'); + db_process_sql('DROP TABLE "tfiles_repo"'); + db_process_sql('DELETE FROM "tconfig" + WHERE "token" LIKE \'files_repo_%\''); break; case "oracle": - db_process_sql ('DROP TABLE `tfiles_repo_group`'); - db_process_sql ('DROP TABLE `tfiles_repo`'); - db_process_sql ('DELETE FROM tconfig - WHERE token LIKE \'files_repo_%\''); + db_process_sql('DROP TABLE "tfiles_repo_group"'); + db_process_sql('DROP TABLE "tfiles_repo"'); + db_process_sql('DELETE FROM tconfig + WHERE token LIKE \'files_repo_%\''); break; } @@ -86,11 +89,11 @@ function pandora_files_repo_uninstall () { function pandora_files_repo_godmode () { global $config; - + if (!isset($config['files_repo_installed']) || !$config['files_repo_installed']) { ui_print_error_message(__('Extension not installed')); } - + // ACL Check check_login (); if (! check_acl ($config['id_user'], 0, "PM")) { @@ -98,37 +101,41 @@ function pandora_files_repo_godmode () { require ("general/noaccess.php"); return; } - + // Header tabs $godmode['text'] = '' . html_print_image ("images/setup.png", true, array ("title" => __('Administration view'))) . ""; $godmode['godmode'] = 1; $godmode['active'] = 1; - + $operation['text'] = '' . html_print_image ("images/operation.png", true, array ("title" => __('Operation view'))) . ""; $operation['operation'] = 1; - + $onheader = array('godmode' => $godmode, 'operation' => $operation); // Header ui_print_page_header (__("Files repository manager"), "images/extensions.png", false, "", true, $onheader); - + $full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/"; - require_once ($full_extensions_dir."files_repo/functions_files_repo.php"); - + require_once ($full_extensions_dir . "files_repo/functions_files_repo.php"); + // Directory files_repo check if (!files_repo_check_directory(true)) { return; } - + + $server_content_length = 0; + if (isset($_SERVER['CONTENT_LENGTH'])) + $server_content_length = $_SERVER['CONTENT_LENGTH']; + // Check for an anoying error that causes the $_POST and $_FILES arrays // were empty if the file is larger than the post_max_size - if (intval($_SERVER['CONTENT_LENGTH']) > 0 && empty($_POST)) { + if (intval($server_content_length) > 0 && empty($_POST)) { ui_print_error_message(__('The file exceeds the maximum size')); } - + // GET and POST parameters $file_id = (int) get_parameter ("file_id"); $add_file = (bool) get_parameter ("add_file"); @@ -144,7 +151,7 @@ function pandora_files_repo_godmode () { $description = mb_substr($description, 0, 200, "UTF-8"); } $description = io_safe_input($description); - + if ($add_file) { $result = files_repo_add_file("upfile", $description, $groups, $public); } elseif ($update_file) { @@ -163,7 +170,7 @@ function pandora_files_repo_godmode () { } $file_id = 0; } - + // FORM require ($full_extensions_dir."files_repo/files_repo_form.php"); if (!$file_id) { @@ -175,7 +182,7 @@ function pandora_files_repo_godmode () { function pandora_files_repo_operation () { global $config; - + // Header tabs $onheader = array(); if (check_acl($config['id_user'], 0, "PM")) { @@ -194,18 +201,19 @@ function pandora_files_repo_operation () { } // Header ui_print_page_header (__("Files repository"), "images/extensions.png", false, "", false, $onheader); - + $full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/"; require_once ($full_extensions_dir."files_repo/functions_files_repo.php"); - + // Directory files_repo check if (!files_repo_check_directory(true)) { return; } - + // LIST $full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/"; - require ($full_extensions_dir."files_repo/files_repo_list.php"); + + require ($full_extensions_dir . "files_repo/files_repo_list.php"); } extensions_add_operation_menu_option(__('Files repository'), null, null, "v1r1"); diff --git a/pandora_console/extensions/files_repo/files_repo_list.php b/pandora_console/extensions/files_repo/files_repo_list.php index 9acd6d01f0..8028deca85 100644 --- a/pandora_console/extensions/files_repo/files_repo_list.php +++ b/pandora_console/extensions/files_repo/files_repo_list.php @@ -17,16 +17,19 @@ global $config; -$full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/"; -require_once ($full_extensions_dir."files_repo/functions_files_repo.php"); +$full_extensions_dir = $config['homedir'] . "/" . EXTENSIONS_DIR . "/"; +require_once ($full_extensions_dir . + "files_repo/functions_files_repo.php"); $offset = (int) get_parameter('offset'); $filter = array(); $filter['limit'] = $config['block_size']; $filter['offset'] = $offset; $filter['order'] = array('field' => 'id', 'order' => 'DESC'); + $files = files_repo_get_files($filter); + if (!empty($files)) { echo "
"; diff --git a/pandora_console/extensions/files_repo/functions_files_repo.php b/pandora_console/extensions/files_repo/functions_files_repo.php index 54a9d9efd3..31aaf0c538 100644 --- a/pandora_console/extensions/files_repo/functions_files_repo.php +++ b/pandora_console/extensions/files_repo/functions_files_repo.php @@ -125,31 +125,33 @@ function files_repo_get_user_groups ($user_id) { function files_repo_get_files ($filter = false, $count = false) { global $config; - + // Don't use the realpath for the download links! $files_repo_path = io_safe_output($config['attachment_store'])."/files_repo"; - - $sql = "SELECT * FROM tfiles_repo " . db_format_array_where_clause_sql($filter, "AND", "WHERE"); + + $sql = "SELECT * + FROM tfiles_repo + " . db_format_array_where_clause_sql($filter, "AND", "WHERE"); $files = db_get_all_rows_sql($sql); - + if ($files === false) $files = array(); - + $user_groups = files_repo_get_user_groups($config['id_user']); - + $files_data = array(); foreach ($files as $file) { - + $file_groups = files_repo_get_file_groups($file['id']); $permission = files_repo_check_file_acl ($file['id'], $config['id_user'], $file_groups, $user_groups); if (!$permission) { continue; } - + $data = array(); $data['name'] = $file['name']; $data['description'] = $file['description']; - $data['location'] = $files_repo_path."/".$file['id']."_".$data['name']; + $data['location'] = $files_repo_path . "/" . $file['id']."_".$data['name']; // Size in bytes $data['size'] = filesize($data['location']); // Last modification time in unix timestamp @@ -158,7 +160,7 @@ function files_repo_get_files ($filter = false, $count = false) { $data['hash'] = $file['hash']; $files_data[$file['id']] = $data; } - + if ($count) { $files_data = count($files_data); } diff --git a/pandora_console/extensions/files_repo/sql/files_repo.postgreSQL.sql b/pandora_console/extensions/files_repo/sql/files_repo.postgreSQL.sql index 080a7ebe65..3f129e10cb 100644 --- a/pandora_console/extensions/files_repo/sql/files_repo.postgreSQL.sql +++ b/pandora_console/extensions/files_repo/sql/files_repo.postgreSQL.sql @@ -1,2 +1,2 @@ -CREATE TABLE IF NOT EXISTS "tfiles_repo" ("id" SERIAL NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "description" VARCHAR(500) NULL default '', "hash" VARCHAR(8) NULL default ''); -CREATE TABLE IF NOT EXISTS "tfiles_repo_group" ("id" SERIAL NOT NULL PRIMARY KEY, "id_file" INTEGER NOT NULL REFERENCES tfiles_repo("id") ON DELETE CASCADE, "id_group" INTEGER NOT NULL); +CREATE TABLE "tfiles_repo" ("id" SERIAL NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "description" VARCHAR(500) NULL default '', "hash" VARCHAR(8) NULL default ''); +CREATE TABLE "tfiles_repo_group" ("id" SERIAL NOT NULL PRIMARY KEY, "id_file" INTEGER NOT NULL REFERENCES tfiles_repo("id") ON DELETE CASCADE, "id_group" INTEGER NOT NULL); diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index b29abc7e66..bd460fea7f 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -161,6 +161,17 @@ echo ""; echo ""; +$order_collation = ""; +switch ($config["dbtype"]) { + case "mysql": + $order_collation = "COLLATE utf8_general_ci"; + break; + case "postgresql": + case "oracle": + $order_collation = ""; + break; +} + $selected = 'border: 1px solid black;'; $selectNameUp = ''; $selectNameDown = ''; @@ -173,14 +184,14 @@ switch ($sortField) { switch ($sort) { case 'up': $selectNameUp = $selected; - $order = array('field' => 'nombre COLLATE utf8_general_ci', - 'field2' => 'nombre COLLATE utf8_general_ci', + $order = array('field' => 'nombre ' . $order_collation, + 'field2' => 'nombre ' . $order_collation, 'order' => 'ASC'); break; case 'down': $selectNameDown = $selected; - $order = array('field' => 'nombre COLLATE utf8_general_ci', - 'field2' => 'nombre COLLATE utf8_general_ci', + $order = array('field' => 'nombre ' . $order_collation, + 'field2' => 'nombre ' . $order_collation, 'order' => 'DESC'); break; } @@ -190,13 +201,13 @@ switch ($sortField) { case 'up': $selectOsUp = $selected; $order = array('field' => 'id_os', - 'field2' => 'nombre COLLATE utf8_general_ci', + 'field2' => 'nombre ' . $order_collation, 'order' => 'ASC'); break; case 'down': $selectOsDown = $selected; $order = array('field' => 'id_os', - 'field2' => 'nombre COLLATE utf8_general_ci', + 'field2' => 'nombre ' . $order_collation, 'order' => 'DESC'); break; } @@ -206,13 +217,13 @@ switch ($sortField) { case 'up': $selectGroupUp = $selected; $order = array('field' => 'id_grupo', - 'field2' => 'nombre COLLATE utf8_general_ci', + 'field2' => 'nombre ' . $order_collation, 'order' => 'ASC'); break; case 'down': $selectGroupDown = $selected; $order = array('field' => 'id_grupo', - 'field2' => 'nombre COLLATE utf8_general_ci', + 'field2' => 'nombre ' . $order_collation, 'order' => 'DESC'); break; } @@ -224,13 +235,16 @@ switch ($sortField) { $selectOsDown = ''; $selectGroupUp = ''; $selectGroupDown = ''; - $order = array('field' => 'nombre COLLATE utf8_general_ci', 'field2' => 'nombre COLLATE utf8_general_ci', 'order' => 'ASC'); + $order = array('field' => 'nombre ' . $order_collation, + 'field2' => 'nombre ' . $order_collation, + 'order' => 'ASC'); break; } $search_sql = ''; if ($search != "") { - $search_sql = " AND ( nombre COLLATE utf8_general_ci LIKE '%$search%' OR direccion LIKE '%$search%') "; + $search_sql = " AND ( nombre " . $order_collation . " + LIKE '%$search%' OR direccion LIKE '%$search%') "; } // Show only selected groups diff --git a/pandora_console/godmode/db/db_info.php b/pandora_console/godmode/db/db_info.php index 37241ac6d4..0e81a7e679 100644 --- a/pandora_console/godmode/db/db_info.php +++ b/pandora_console/godmode/db/db_info.php @@ -79,7 +79,7 @@ asort ($count, SORT_NUMERIC); foreach ($count as $agent_id => $value) { $data = array (); - + //First row is a link to the agent $data[0] = ''.$agents[$agent_id].''; //Second row is a number of modules for the agent diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index 15172f14ab..0a7fdde0b0 100644 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -476,10 +476,11 @@ if ($multiple_delete) { $user_groups = users_get_groups($config['id_user'],"AR", true); $str_user_groups = ''; $i = 0; -foreach ($user_groups as $id=>$name) { +foreach ($user_groups as $id => $name) { if ($i == 0) { $str_user_groups .= $id; - } else { + } + else { $str_user_groups .= ','.$id; } $i++; @@ -895,6 +896,7 @@ else { $where_sql .= ' AND `priority` = ' . $priority_filter; } + $where_sql = ""; if (!empty($free_search)) { $where_sql .= " AND (`single_value` LIKE '%" . $free_search . "%' OR `_snmp_f10_` LIKE '%" . $free_search . "%' @@ -914,7 +916,8 @@ else { } $count = db_get_value_sql("SELECT COUNT(*) - FROM talert_snmp WHERE id_group IN ($str_user_groups) " . $where_sql); + FROM talert_snmp WHERE id_group IN ($str_user_groups) " . + $where_sql); $result = array(); diff --git a/pandora_console/include/db/mysql.php b/pandora_console/include/db/mysql.php index be2108dfba..b0c6de08bd 100644 --- a/pandora_console/include/db/mysql.php +++ b/pandora_console/include/db/mysql.php @@ -346,6 +346,18 @@ function mysql_escape_string_sql($string) { return $str; } +function mysql_encapsule_fields_with_same_name_to_instructions($field) { + $return = $field; + + if (is_string($return)) { + if ($return[0] !== '`') { + $return = '`' . $return . '`'; + } + } + + return $return; +} + /** * Get the first value of the first row of a table in the database from an * array with filter conditions. diff --git a/pandora_console/include/db/oracle.php b/pandora_console/include/db/oracle.php index 0461b145a7..1b3d3b8e38 100644 --- a/pandora_console/include/db/oracle.php +++ b/pandora_console/include/db/oracle.php @@ -448,6 +448,18 @@ function oracle_escape_string_sql($string) { return str_replace(array('"', "'", '\\'), array('\\"', '\\\'', '\\\\'), $string); } +function oracle_encapsule_fields_with_same_name_to_instructions($field) { + $return = $field; + + if (is_string($return)) { + if ($return[0] !== '"') { + $return = '"' . $return . '"'; + } + } + + return $return; +} + /** * Get the first value of the first row of a table in the database from an * array with filter conditions. diff --git a/pandora_console/include/db/postgresql.php b/pandora_console/include/db/postgresql.php index 3df090c0ec..2290ec790c 100644 --- a/pandora_console/include/db/postgresql.php +++ b/pandora_console/include/db/postgresql.php @@ -362,6 +362,18 @@ function postgresql_escape_string_sql($string) { return $str; } +function postgresql_encapsule_fields_with_same_name_to_instructions($field) { + $return = $field; + + if (is_string($return)) { + if ($return[0] !== '"') { + $return = '"' . $return . '"'; + } + } + + return $return; +} + /** * Get the first value of the first row of a table in the database from an * array with filter conditions. diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index a519b66717..8281264f65 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -109,6 +109,22 @@ function db_escape_string_sql($string) { } } +function db_encapsule_fields_with_same_name_to_instructions($field) { + global $config; + + switch ($config["dbtype"]) { + case "mysql": + return mysql_encapsule_fields_with_same_name_to_instructions($field); + break; + case "postgresql": + return postgresql_encapsule_fields_with_same_name_to_instructions($field); + break; + case "oracle": + return oracle_encapsule_fields_with_same_name_to_instructions($field); + break; + } +} + /** * Adds an audit log entry (new function in 3.0) * diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 53eb000da8..a1f0295957 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -162,7 +162,16 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met (SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp FROM $table te WHERE 1=1 " . $sql_post . " - GROUP BY estado, evento, id_agentmodule, id_evento, id_agente, id_usuario, id_grupo, estado, timestamp, utimestamp, event_type, id_alert_am, criticity, user_comment, tags, source, id_extra" . $groupby_extra . " + GROUP BY estado, evento, id_agentmodule, id_evento, + id_agente, id_usuario, id_grupo, estado, + timestamp, utimestamp, event_type, id_alert_am, + criticity, user_comment, tags, source, id_extra, + te.critical_instructions, + te.warning_instructions, + te.unknown_instructions, + te.owner_user, + te.ack_utimestamp, + te.custom_data " . $groupby_extra . " ORDER BY timestamp_rep DESC LIMIT " . $pagination . " OFFSET " . $offset; } break; diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 771f1e7a1c..fb3293afa2 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1796,6 +1796,7 @@ function graph_db_agentes_modulos($width, $height) { if ($modules === false) $modules = array (); + $data = array(); foreach ($modules as $module) { $agent_name = agents_get_name ($module['id_agente'], "none"); @@ -1816,7 +1817,8 @@ function graph_db_agentes_modulos($width, $height) { $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", 'url' => ui_get_full_url("/images/logo_vertical_water.png")); - return hbar_graph($config['flash_charts'], $data, $width, $height, array(), + return hbar_graph($config['flash_charts'], + $data, $width, $height, array(), array(), "", "", true, "", $water_mark, $config['fontpath'], $config['font_size'], false); diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php index b720b05a09..3814f55c8b 100755 --- a/pandora_console/include/functions_update_manager.php +++ b/pandora_console/include/functions_update_manager.php @@ -24,11 +24,17 @@ function update_manager_get_config_values() { global $build_version; global $pandora_version; - $license = db_get_value('`value`', 'tupdate_settings', '`key`', + $license = db_get_value( + db_encapsule_fields_with_same_name_to_instructions('value'), + 'tupdate_settings', + db_encapsule_fields_with_same_name_to_instructions('key'), 'customer_key'); if (enterprise_installed()) { - $current_update = db_get_value('`value`', 'tupdate_settings', '`key`', + $current_update = db_get_value( + db_encapsule_fields_with_same_name_to_instructions('value'), + 'tupdate_settings', + db_encapsule_fields_with_same_name_to_instructions('key'), 'current_package_enterprise'); $current_update = 0; @@ -36,7 +42,10 @@ function update_manager_get_config_values() { $current_update = $config['current_package_enterprise']; } else { - $current_update = db_get_value('`value`', 'tupdate_settings', '`key`', + $current_update = db_get_value( + db_encapsule_fields_with_same_name_to_instructions('value'), + 'tupdate_settings', + db_encapsule_fields_with_same_name_to_instructions('key'), 'current_package'); $current_update = 0; @@ -264,11 +273,13 @@ function update_manager_check_online_free_packages_available() { return false; } else { - if ($is_ajax) { - return true; + $result = json_decode($result, true); + + if (empty($result)) { + return false; } else { - return false; + return true; } } } diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 27b380e0ab..08b4769423 100755 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -398,11 +398,13 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array() setup_watermark($water_mark, $water_mark_file, $water_mark_url); if ($flash_chart) { - if ($return){ - return flot_hcolumn_chart ($chart_data, $width, $height, $water_mark_url); + if ($return) { + return flot_hcolumn_chart( + $chart_data, $width, $height, $water_mark_url); } - else{ - echo flot_hcolumn_chart ($chart_data, $width, $height, $water_mark_url); + else { + echo flot_hcolumn_chart( + $chart_data, $width, $height, $water_mark_url); } } else { @@ -422,7 +424,7 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array() $id_graph = serialize_in_temp($graph, null, $ttl); - return ""; + return ""; } } diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 6edb2e1a3d..be2a1034fc 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -442,6 +442,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark) { $max = 0; $i = count($graph_data); + $data = array(); foreach ($graph_data as $label => $values) { $labels[] = io_safe_output($label); $i--; diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index ff511bc6a2..85c1b63fa6 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -195,14 +195,14 @@ if (check_acl ($config["id_user"], 0, "EW") || check_acl ($config["id_user"], 0, $table->class = 'databox'; $table->styleTable = 'font-weight: bold; color: #555; text-align:left;'; $table->style[0] = 'width: 50%; width:50%;'; - + $data = array(); $table->rowid[0] = 'update_save_selector'; $data[0] = html_print_radio_button('filter_mode', 'new', '', true, true) . __('New filter') . '

'; $data[1] = html_print_radio_button('filter_mode', 'update', '', false, true) . __('Update filter') . '

'; $table->data[] = $data; $table->rowclass[] = ''; - + $data = array(); $table->rowid[1] = 'save_filter_row1'; $data[0] = __('Filter name') . '
'; @@ -212,7 +212,7 @@ if (check_acl ($config["id_user"], 0, "EW") || check_acl ($config["id_user"], 0, $data[1] .= html_print_select_groups($config["id_user"], "ER", users_can_manage_group_all(), 'id_group', $id_group, '', '', 0, true, false, false, 'w130'); $table->data[] = $data; $table->rowclass[] = ''; - + $data = array(); $table->rowid[2] = 'save_filter_row2'; $data[0] = html_print_submit_button (__('Save filter'), 'save_filter', false, 'class="sub upd"', true); @@ -220,18 +220,18 @@ if (check_acl ($config["id_user"], 0, "EW") || check_acl ($config["id_user"], 0, $table->cellstyle[2][0] = 'text-align:right;'; $table->data[] = $data; $table->rowclass[] = ''; - + $data = array(); $table->rowid[3] = 'update_filter_row1'; $data[0] = __("Overwrite filter") . '
'; # Fix : Only admin user can see filters of group ALL for update $_filters_update = events_get_event_filter_select(false); - + $data[0] .= html_print_select ($_filters_update, "overwrite_filter", '', '', '', 0, true); $data[1] = html_print_submit_button (__('Update filter'), 'update_filter', false, 'class="sub upd"', true); $table->data[] = $data; $table->rowclass[] = ''; - + html_print_table($table); unset($table); echo ''; @@ -536,9 +536,15 @@ if ($group_rep == 0) { //Extract the events by filter (or not) from db $result = db_get_all_rows_sql ($sql); + } else { - $result = events_get_events_grouped($sql_post, $offset, $pagination, $meta, $history); + $result = events_get_events_grouped( + $sql_post, + $offset, + $pagination, + $meta, + $history); } if (!empty($result)) { diff --git a/pandora_console/operation/incidents/incident.php b/pandora_console/operation/incidents/incident.php index f4921ba4bf..c4db705fb4 100755 --- a/pandora_console/operation/incidents/incident.php +++ b/pandora_console/operation/incidents/incident.php @@ -25,7 +25,8 @@ if (! check_acl ($config['id_user'], 0, "IR")) { } // Header -ui_print_page_header (__('Incident management'), "images/book_edit.png", false, "", false, ""); +ui_print_page_header (__('Incident management'), + "images/book_edit.png", false, "", false, ""); // Take input parameters @@ -197,7 +198,7 @@ switch ($config["dbtype"]) { ORDER BY actualizacion DESC OFFSET ".$offset." LIMIT ".$config["block_size"]; $count_sql = "SELECT count(*) FROM tincidencia WHERE id_grupo IN (".implode (",",array_keys ($groups)).")".$filter; - breka; + break; } $result = db_get_all_rows_sql ($sql); @@ -250,11 +251,14 @@ if ($agents_incidents === false){ $agents_incidents = array(); } -foreach ($agents_incidents as $agent_incident){ +$result_agent_incidents = array(); +foreach ($agents_incidents as $agent_incident) { $result_agent_incidents[$agent_incident['id_agente']] = $agent_incident['nombre']; } -html_print_select ($result_agent_incidents, "agent_search", $agent_search, 'javascript:this.form.submit();', __('All agents'), "", false, false, false, "w155"); +html_print_select ($result_agent_incidents, "agent_search", + $agent_search, 'javascript:this.form.submit();', __('All agents'), + "", false, false, false, "w155"); echo ''; diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index 97479097db..8e16bd4993 100644 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -48,7 +48,8 @@ $i = 0; foreach ($user_groups as $id=>$name) { if ($i == 0) { $str_user_groups .= $id; - } else { + } + else { $str_user_groups .= ','.$id; } $i++; @@ -336,8 +337,11 @@ $trap_types = array(-1 => __('None'), 0 => __('Cold start (0)'), 1 => __('Warm s $table->data[4][2] = html_print_select ($trap_types, 'trap_type', $trap_type, 'this.form.submit();', '', '', true, false, false); $table->data[3][3] = ''.__('Group by OID/IP').''; -$table->data[3][4] .= __('Yes').' '.html_print_radio_button ('group_by', 1, '', $group_by, true).'  '; -$table->data[3][4] .= __('No').' '.html_print_radio_button ('group_by', 0, '', $group_by, true); +$table->data[3][4] = __('Yes') . ' '. + html_print_radio_button ('group_by', 1, '', $group_by, true) . + '  '; +$table->data[3][4] .= __('No') . ' ' . + html_print_radio_button ('group_by', 0, '', $group_by, true); $filter = '
'; $filter .= html_print_table($table, true);