From 6af3133d4260ed147ce942c6cd3ea1b9c6be4dbf Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 8 May 2015 16:09:12 +0200 Subject: [PATCH] Fixed some error --- .../godmode/events/event_edit_filter.php | 8 +- pandora_console/install.php | 178 +++++++++--------- .../operation/events/events_list.php | 55 ++++-- 3 files changed, 127 insertions(+), 114 deletions(-) diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index 26ace9b051..7c624a7b13 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -73,7 +73,7 @@ else { $severity = ''; $status = ''; $search = ''; - $text_agent = __('All'); + $text_agent = ''; $pagination = ''; $event_view_hr = ''; $id_user_ack = ''; @@ -93,7 +93,7 @@ if($update || $create) { $severity = get_parameter('severity', ''); $status = get_parameter('status', ''); $search = get_parameter('search', ''); - $text_agent = get_parameter('text_agent', __('All')); + $text_agent = get_parameter('text_agent', ''); $pagination = get_parameter('pagination', ''); $event_view_hr = get_parameter('event_view_hr', ''); $id_user_ack = get_parameter('id_user_ack', ''); @@ -182,11 +182,11 @@ $table->data[0][0] = ''.__('Filter name').''; $table->data[0][1] = html_print_input_text ('id_name', $id_name, false, 20, 80, true); $table->data[1][0] = ''.__('Save in group').'' . ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true); -$table->data[1][1] = html_print_select_groups($config['id_user'], "ER", users_can_manage_group_all(), "id_group_filter", $id_group_filter, '', '', -1, true, false, false, '', false, '', false, false, 'id_group_filter', $strict_user); +$table->data[1][1] = html_print_select_groups($config['id_user'], "ER", users_can_manage_group_all(), "id_group_filter", $id_group_filter, '', '', -1, true, false, false, '', false, '', false, false, 'id_grupo', $strict_user); $table->data[2][0] = ''.__('Group').''; $table->data[2][1] = html_print_select_groups($config["id_user"], "ER", true, - 'id_group', $id_group, '', '', -1, true, false, false, '', false, false, false, false, 'id_group', $strict_user); + 'id_group', $id_group, '', '', -1, true, false, false, '', false, false, false, false, 'id_grupo', $strict_user); $types = get_event_types (); // Expand standard array to add not_normal (not exist in the array, used only for searches) diff --git a/pandora_console/install.php b/pandora_console/install.php index e544e781b7..3fba5c0376 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -62,8 +62,8 @@
' . PHP_EOL . PHP_EOL; + $config_new = ''; $step7 = fputs ($cfgout, $config_new); $step7 = $step7 + fputs ($cfgout, $config_contents); if ($step7 > 0) @@ -894,7 +882,8 @@ function install_step4() { check_generic ($step2, "Populating database"); - if (PHP_OS == "FreeBSD") { + if (PHP_OS == "FreeBSD") + { $step_freebsd = adjust_paths_for_freebsd ($engine, $connection); check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD"); } @@ -912,32 +901,32 @@ function install_step4() { $cfgout = fopen ($pandora_config,"w"); $config_contents = fread ($cfgin, filesize("include/config.inc.php")); $dbtype = 'oracle'; - $config_new = '' . PHP_EOL . PHP_EOL; + $config_new = ''; $step4 = fputs ($cfgout, $config_new); $step4 = $step4 + fputs ($cfgout, $config_contents); if ($step4 > 0) @@ -1011,7 +1000,8 @@ function install_step4() { check_generic ($step4, "Populating database"); - if (PHP_OS == "FreeBSD") { + if (PHP_OS == "FreeBSD") + { $step_freebsd = adjust_paths_for_freebsd ($engine, $connection); check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD"); } @@ -1111,32 +1101,32 @@ function install_step4() { $cfgout = fopen ($pandora_config,"w"); $config_contents = fread ($cfgin, filesize("include/config.inc.php")); $dbtype = 'postgresql'; - $config_new = '' . PHP_EOL . PHP_EOL; + $config_new = ''; $step7 = fputs ($cfgout, $config_new); $step7 = $step7 + fputs ($cfgout, $config_contents); if ($step7 > 0) diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index 76c6d30f59..8edde76cf3 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -141,7 +141,7 @@ $strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_use $tags = tags_get_user_tags($config['id_user'], 'ER'); -if ($id_agent == 0 && $text_agent != __('All')) { +if ($id_agent == 0 && !empty($text_agent)) { $id_agent = -1; } @@ -708,7 +708,7 @@ if ($group_rep == 0) { $set = array(); $set['limit'] = $pagination; $set['offset'] = $offset; - $sql = "SELECT *, 1 event_rep + $sql = "SELECT $event_table.*, 1 event_rep FROM $event_table WHERE 1=1 " . $sql_post . " ORDER BY utimestamp DESC"; @@ -735,12 +735,23 @@ if (!empty($result)) { WHERE 1=1 " . $sql_post; } else { - - $sql = "SELECT COUNT(1) - FROM (SELECT 1 - FROM $event_table - WHERE 1=1 " . $sql_post . " - GROUP BY evento, id_agentmodule) AS t"; + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + $sql = "SELECT COUNT(1) + FROM (SELECT 1 + FROM $event_table + WHERE 1=1 " . $sql_post . " + GROUP BY evento, id_agentmodule) t"; + break; + case "oracle": + $sql = "SELECT COUNT(1) + FROM (SELECT 1 + FROM $event_table + WHERE 1=1 " . $sql_post . " + GROUP BY to_char(evento), id_agentmodule) t"; + break; + } } $limit = (int) db_get_sql ($sql); @@ -762,7 +773,7 @@ if (!empty($result)) { $set = array(); $set['limit'] = $pagination; $set['offset'] = $offset; - $sql = "SELECT *, 1 event_rep + $sql = "SELECT $event_table.*, 1 event_rep FROM $event_table WHERE 1=1 " . $sql_post . " ORDER BY utimestamp DESC"; @@ -814,15 +825,27 @@ if (($config['dbtype'] == 'oracle') && ($result !== false)) { if ($group_rep == 0) { $sql = "SELECT COUNT(id_evento) - FROM $event_table - WHERE 1=1 " . $sql_post; + FROM $event_table + WHERE 1=1 $sql_post"; } else { - $sql = "SELECT COUNT(1) - FROM (SELECT 1 - FROM $event_table - WHERE 1=1 " . $sql_post . " - GROUP BY evento, id_agentmodule) AS t"; + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + $sql = "SELECT COUNT(1) + FROM (SELECT 1 + FROM $event_table + WHERE 1=1 $sql_post + GROUP BY evento, id_agentmodule) t"; + break; + case "oracle": + $sql = "SELECT COUNT(1) + FROM (SELECT 1 + FROM $event_table + WHERE 1=1 $sql_post + GROUP BY to_char(evento), id_agentmodule) t"; + break; + } }