Fixed some error

This commit is contained in:
Alejandro Gallardo Escobar 2015-05-08 16:09:12 +02:00
parent f93e861369
commit 6af3133d42
3 changed files with 127 additions and 114 deletions

View File

@ -73,7 +73,7 @@ else {
$severity = ''; $severity = '';
$status = ''; $status = '';
$search = ''; $search = '';
$text_agent = __('All'); $text_agent = '';
$pagination = ''; $pagination = '';
$event_view_hr = ''; $event_view_hr = '';
$id_user_ack = ''; $id_user_ack = '';
@ -93,7 +93,7 @@ if($update || $create) {
$severity = get_parameter('severity', ''); $severity = get_parameter('severity', '');
$status = get_parameter('status', ''); $status = get_parameter('status', '');
$search = get_parameter('search', ''); $search = get_parameter('search', '');
$text_agent = get_parameter('text_agent', __('All')); $text_agent = get_parameter('text_agent', '');
$pagination = get_parameter('pagination', ''); $pagination = get_parameter('pagination', '');
$event_view_hr = get_parameter('event_view_hr', ''); $event_view_hr = get_parameter('event_view_hr', '');
$id_user_ack = get_parameter('id_user_ack', ''); $id_user_ack = get_parameter('id_user_ack', '');
@ -182,11 +182,11 @@ $table->data[0][0] = '<b>'.__('Filter name').'</b>';
$table->data[0][1] = html_print_input_text ('id_name', $id_name, false, 20, 80, true); $table->data[0][1] = html_print_input_text ('id_name', $id_name, false, 20, 80, true);
$table->data[1][0] = '<b>'.__('Save in group').'</b>' . ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true); $table->data[1][0] = '<b>'.__('Save in group').'</b>' . 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] = '<b>'.__('Group').'</b>'; $table->data[2][0] = '<b>'.__('Group').'</b>';
$table->data[2][1] = html_print_select_groups($config["id_user"], "ER", true, $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 (); $types = get_event_types ();
// Expand standard array to add not_normal (not exist in the array, used only for searches) // Expand standard array to add not_normal (not exist in the array, used only for searches)

View File

@ -62,8 +62,8 @@
<body> <body>
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '6.0dev'; $version = '6.0dev';
$build = '150504'; $build = '150504';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);
@ -722,18 +722,6 @@ function install_step3() {
function install_step4() { function install_step4() {
$pandora_config = "include/config.php"; $pandora_config = "include/config.php";
if (!defined('PHP_EOL')) {
switch (strtoupper(substr(PHP_OS, 0, 3))) {
// Windows
case 'WIN':
define('PHP_EOL', "\r\n");
break;
// Unix
default:
define('PHP_EOL', "\n");
}
}
if ( (! isset($_POST["user"])) || (! isset($_POST["dbname"])) || (! isset($_POST["host"])) || if ( (! isset($_POST["user"])) || (! isset($_POST["dbname"])) || (! isset($_POST["host"])) ||
(! isset($_POST["pass"])) || (!isset($_POST['engine'])) || (! isset($_POST["db_action"])) ) { (! isset($_POST["pass"])) || (!isset($_POST['engine'])) || (! isset($_POST["db_action"])) ) {
$dbpassword = ""; $dbpassword = "";
@ -830,32 +818,32 @@ function install_step4() {
$cfgout = fopen ($pandora_config,"w"); $cfgout = fopen ($pandora_config,"w");
$config_contents = fread ($cfgin, filesize("include/config.inc.php")); $config_contents = fread ($cfgin, filesize("include/config.inc.php"));
$dbtype = 'mysql'; $dbtype = 'mysql';
$config_new = '<?php' . PHP_EOL $config_new = '<?php
. '// Begin of automatic config file' . PHP_EOL // Begin of automatic config file
. '$config["dbtype"] = "' . $dbtype . '"; //DB type (mysql, oracle, postgresql)' . PHP_EOL $config["dbtype"] = "' . $dbtype . '"; //DB type (mysql, postgresql...in future others)
. '$config["dbname"]="' . $dbname . '"; // DataBase name' . PHP_EOL $config["dbname"]="'.$dbname.'"; // MySQL DataBase name
. '$config["dbuser"]="pandora"; // DB User' . PHP_EOL $config["dbuser"]="pandora"; // DB User
. '$config["dbpass"]="' . $random_password . '"; // DB Password' . PHP_EOL $config["dbpass"]="'.$random_password.'"; // DB Password
. '$config["dbhost"]="' . $dbhost . '"; // DB Host' . PHP_EOL $config["dbhost"]="'.$dbhost.'"; // DB Host
. '$config["homedir"]="' . $path . '"; // Config homedir' . PHP_EOL $config["homedir"]="'.$path.'"; // Config homedir
. '/*' . PHP_EOL /*
. '----------Attention--------------------' . PHP_EOL ----------Attention--------------------
. 'Please note that in certain installations:' . PHP_EOL Please note that in certain installations:
. ' - reverse proxy.' . PHP_EOL - reverse proxy.
. ' - web server in other ports.' . PHP_EOL - web server in other ports.
. ' - https' . PHP_EOL - https
. PHP_EOL
. 'This variable might be dynamically altered.' . PHP_EOL This variable might be dynamically altered.
. PHP_EOL
. 'But it is save as backup in the' . PHP_EOL But it is save as backup in the
. '$config["homeurl_static"]' . PHP_EOL $config["homeurl_static"]
. 'for expecial cases.' . PHP_EOL for expecial needs.
. '----------Attention--------------------' . PHP_EOL ----------Attention--------------------
. '*/' . PHP_EOL */
. '$config["homeurl"]="'.$url.'"; // Base URL' . PHP_EOL $config["homeurl"]="'.$url.'"; // Base URL
. '$config["homeurl_static"]="'.$url.'"; // Don\'t delete' . PHP_EOL $config["homeurl_static"]="'.$url.'"; // Don\'t delete
. '// End of automatic config file' . PHP_EOL // End of automatic config file
. '?>' . PHP_EOL . PHP_EOL; ?>';
$step7 = fputs ($cfgout, $config_new); $step7 = fputs ($cfgout, $config_new);
$step7 = $step7 + fputs ($cfgout, $config_contents); $step7 = $step7 + fputs ($cfgout, $config_contents);
if ($step7 > 0) if ($step7 > 0)
@ -894,7 +882,8 @@ function install_step4() {
check_generic ($step2, "Populating database"); check_generic ($step2, "Populating database");
if (PHP_OS == "FreeBSD") { if (PHP_OS == "FreeBSD")
{
$step_freebsd = adjust_paths_for_freebsd ($engine, $connection); $step_freebsd = adjust_paths_for_freebsd ($engine, $connection);
check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD"); check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD");
} }
@ -912,32 +901,32 @@ function install_step4() {
$cfgout = fopen ($pandora_config,"w"); $cfgout = fopen ($pandora_config,"w");
$config_contents = fread ($cfgin, filesize("include/config.inc.php")); $config_contents = fread ($cfgin, filesize("include/config.inc.php"));
$dbtype = 'oracle'; $dbtype = 'oracle';
$config_new = '<?php' . PHP_EOL $config_new = '<?php
. '// Begin of automatic config file' . PHP_EOL // Begin of automatic config file
. '$config["dbtype"] = "' . $dbtype . '"; //DB type (mysql, oracle, postgresql)' . PHP_EOL $config["dbtype"] = "' . $dbtype . '"; //DB type (mysql, postgresql, oracle)
. '$config["dbname"]="' . $dbname . '"; // DataBase name' . PHP_EOL $config["dbname"]="' . $dbname . '"; // Oracle DataBase name
. '$config["dbuser"]="' . $dbuser . '"; // DB User' . PHP_EOL $config["dbuser"]="' . $dbuser . '"; // DB User
. '$config["dbpass"]="' . $dbpassword . '"; // DB Password' . PHP_EOL $config["dbpass"]="' . $dbpassword . '"; // DB Password
. '$config["dbhost"]="' . $dbhost . '"; // DB Host' . PHP_EOL $config["dbhost"]="' . $dbhost . '"; // DB Host
. '$config["homedir"]="' . $path . '"; // Config homedir' . PHP_EOL $config["homedir"]="' . $path . '"; // Config homedir
. '/*' . PHP_EOL /*
. '----------Attention--------------------' . PHP_EOL ----------Attention--------------------
. 'Please note that in certain installations:' . PHP_EOL Please note that in certain installations:
. ' - reverse proxy.' . PHP_EOL - reverse proxy.
. ' - web server in other ports.' . PHP_EOL - web server in other ports.
. ' - https' . PHP_EOL - https
. PHP_EOL
. 'This variable might be dynamically altered.' . PHP_EOL This variable might be dynamically altered.
. PHP_EOL
. 'But it is save as backup in the' . PHP_EOL But it is save as backup in the
. '$config["homeurl_static"]' . PHP_EOL $config["homeurl_static"]
. 'for expecial cases.' . PHP_EOL for expecial cases.
. '----------Attention--------------------' . PHP_EOL ----------Attention--------------------
. '*/' . PHP_EOL */
. '$config["homeurl"]="'.$url.'"; // Base URL' . PHP_EOL $config["homeurl"]="' . $url . '"; // Base URL
. '$config["homeurl_static"]="'.$url.'"; // Don\'t delete' . PHP_EOL $config["homeurl_static"]="'.$url.'"; // Don\'t delete
. '// End of automatic config file' . PHP_EOL // End of automatic config file
. '?>' . PHP_EOL . PHP_EOL; ?>';
$step4 = fputs ($cfgout, $config_new); $step4 = fputs ($cfgout, $config_new);
$step4 = $step4 + fputs ($cfgout, $config_contents); $step4 = $step4 + fputs ($cfgout, $config_contents);
if ($step4 > 0) if ($step4 > 0)
@ -1011,7 +1000,8 @@ function install_step4() {
check_generic ($step4, "Populating database"); check_generic ($step4, "Populating database");
if (PHP_OS == "FreeBSD") { if (PHP_OS == "FreeBSD")
{
$step_freebsd = adjust_paths_for_freebsd ($engine, $connection); $step_freebsd = adjust_paths_for_freebsd ($engine, $connection);
check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD"); check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD");
} }
@ -1111,32 +1101,32 @@ function install_step4() {
$cfgout = fopen ($pandora_config,"w"); $cfgout = fopen ($pandora_config,"w");
$config_contents = fread ($cfgin, filesize("include/config.inc.php")); $config_contents = fread ($cfgin, filesize("include/config.inc.php"));
$dbtype = 'postgresql'; $dbtype = 'postgresql';
$config_new = '<?php' . PHP_EOL $config_new = '<?php
. '// Begin of automatic config file' . PHP_EOL // Begin of automatic config file
. '$config["dbtype"] = "'.$dbtype.'"; //DB type (mysql, oracle, postgresql...)' . PHP_EOL $config["dbtype"] = "' . $dbtype . '"; //DB type (mysql, postgresql...in future others)
. '$config["dbname"]="'.$dbname.'"; // DataBase name' . PHP_EOL $config["dbname"]="'.$dbname.'"; // MySQL DataBase name
. '$config["dbuser"]="pandora"; // DB User' . PHP_EOL $config["dbuser"]="pandora"; // DB User
. '$config["dbpass"]="'.$random_password.'"; // DB Password' . PHP_EOL $config["dbpass"]="'.$random_password.'"; // DB Password
. '$config["dbhost"]="'.$dbhost.'"; // DB Host' . PHP_EOL $config["dbhost"]="'.$dbhost.'"; // DB Host
. '$config["homedir"]="'.$path.'"; // Config homedir' . PHP_EOL $config["homedir"]="'.$path.'"; // Config homedir
. '/*' . PHP_EOL /*
. '----------Attention--------------------' . PHP_EOL ----------Attention--------------------
. 'Please note that in certain installations:' . PHP_EOL Please note that in certain installations:
. ' - reverse proxy.' . PHP_EOL - reverse proxy.
. ' - web server in other ports.' . PHP_EOL - web server in other ports.
. ' - https' . PHP_EOL - https
. PHP_EOL
. 'This variable might be dynamically altered.' . PHP_EOL This variable might be dynamically altered.
. PHP_EOL
. 'But it is save as backup in the' . PHP_EOL But it is save as backup in the
. '$config["homeurl_static"]' . PHP_EOL $config["homeurl_static"]
. 'for expecial cases.' . PHP_EOL for expecial cases.
. '----------Attention--------------------' . PHP_EOL ----------Attention--------------------
. '*/' . PHP_EOL */
. '$config["homeurl"]="'.$url.'"; // Base URL' . PHP_EOL $config["homeurl"]="'.$url.'"; // Base URL
. '$config["homeurl_static"]="'.$url.'"; // Don\'t delete' . PHP_EOL $config["homeurl_static"]="'.$url.'"; // Don\'t delete
. '// End of automatic config file' . PHP_EOL // End of automatic config file
. '?>' . PHP_EOL . PHP_EOL; ?>';
$step7 = fputs ($cfgout, $config_new); $step7 = fputs ($cfgout, $config_new);
$step7 = $step7 + fputs ($cfgout, $config_contents); $step7 = $step7 + fputs ($cfgout, $config_contents);
if ($step7 > 0) if ($step7 > 0)

View File

@ -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'); $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; $id_agent = -1;
} }
@ -708,7 +708,7 @@ if ($group_rep == 0) {
$set = array(); $set = array();
$set['limit'] = $pagination; $set['limit'] = $pagination;
$set['offset'] = $offset; $set['offset'] = $offset;
$sql = "SELECT *, 1 event_rep $sql = "SELECT $event_table.*, 1 event_rep
FROM $event_table FROM $event_table
WHERE 1=1 " . $sql_post . " WHERE 1=1 " . $sql_post . "
ORDER BY utimestamp DESC"; ORDER BY utimestamp DESC";
@ -735,12 +735,23 @@ if (!empty($result)) {
WHERE 1=1 " . $sql_post; WHERE 1=1 " . $sql_post;
} }
else { else {
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql = "SELECT COUNT(1) $sql = "SELECT COUNT(1)
FROM (SELECT 1 FROM (SELECT 1
FROM $event_table FROM $event_table
WHERE 1=1 " . $sql_post . " WHERE 1=1 " . $sql_post . "
GROUP BY evento, id_agentmodule) AS t"; 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); $limit = (int) db_get_sql ($sql);
@ -762,7 +773,7 @@ if (!empty($result)) {
$set = array(); $set = array();
$set['limit'] = $pagination; $set['limit'] = $pagination;
$set['offset'] = $offset; $set['offset'] = $offset;
$sql = "SELECT *, 1 event_rep $sql = "SELECT $event_table.*, 1 event_rep
FROM $event_table FROM $event_table
WHERE 1=1 " . $sql_post . " WHERE 1=1 " . $sql_post . "
ORDER BY utimestamp DESC"; ORDER BY utimestamp DESC";
@ -815,14 +826,26 @@ if (($config['dbtype'] == 'oracle') && ($result !== false)) {
if ($group_rep == 0) { if ($group_rep == 0) {
$sql = "SELECT COUNT(id_evento) $sql = "SELECT COUNT(id_evento)
FROM $event_table FROM $event_table
WHERE 1=1 " . $sql_post; WHERE 1=1 $sql_post";
} }
else { else {
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql = "SELECT COUNT(1) $sql = "SELECT COUNT(1)
FROM (SELECT 1 FROM (SELECT 1
FROM $event_table FROM $event_table
WHERE 1=1 " . $sql_post . " WHERE 1=1 $sql_post
GROUP BY evento, id_agentmodule) AS t"; 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;
}
} }