2012-10-30 Sergio Martin <sergio.martin@artica.es>

* include/functions_events.php
	include/ajax/events.php
	include/functions_api.php
	godmode/alerts/alert_commands.php: Fix some
	event viewer bugs and command editor little
	aesthetic issues

	* pandoradb.sql
	pandoradb.postgreSQL.sql
	pandoradb.oracle.sql: Delete ttag_event table




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7113 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2012-10-30 11:48:28 +00:00
parent 36c30c2f73
commit f5d4cd70fc
8 changed files with 29 additions and 70 deletions

View File

@ -1,3 +1,16 @@
2012-10-30 Sergio Martin <sergio.martin@artica.es>
* include/functions_events.php
include/ajax/events.php
include/functions_api.php
godmode/alerts/alert_commands.php: Fix some
event viewer bugs and command editor little
aesthetic issues
* pandoradb.sql
pandoradb.postgreSQL.sql
pandoradb.oracle.sql: Delete ttag_event table
2012-10-30 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_reporting.php: Changed format of agent

View File

@ -42,15 +42,15 @@ if (is_ajax ()) {
// Get the html rows of the fields form
// Descriptions are stored in json
$fields_descriptions = empty($command['fields_descriptions']) ? '' : json_decode($command['fields_descriptions'], true);
$fields_descriptions = empty($command['fields_descriptions']) ? '' : json_decode(io_safe_output($command['fields_descriptions']), true);
// Fields values are stored in json
$fields_values = empty($command['fields_values']) ? '' : json_decode($command['fields_values'], true);
$fields_values = empty($command['fields_values']) ? '' : json_decode(io_safe_output($command['fields_values']), true);
$fields_rows = array();
for($i=1;$i<=10;$i++) {
if(!empty($fields_descriptions[$i-1])) {
$fdesc = $fields_descriptions[$i-1].' <span style="font-size:xx-small; font-weight:normal;">('.sprintf(__('Field %s'), $i).')</span>';
$fdesc = $fields_descriptions[$i-1].' <br><span style="font-size:xx-small; font-weight:normal;">'.sprintf(__('Field %s'), $i).'</span>';
}
else {
$fdesc = sprintf(__('Field %s'), $i);

View File

@ -151,9 +151,8 @@ if($dialogue_event_response) {
if($add_comment) {
$comment = get_parameter ('comment');
$event_id = get_parameter ('event_id');
$similars = true;
$return = events_comment_event ($event_id, $similars, $comment);
$return = events_comment ($event_id, $comment);
if ($return)
echo 'comment_ok';
@ -213,7 +212,6 @@ if($get_extended_event) {
$similar_ids = get_parameter('similar_ids', $event_id);
$group_rep = get_parameter('group_rep',false);
$event_rep = get_parameter('event_rep',1);
$user_comment = base64_decode(get_parameter('user_comment',false));
$timestamp_first = get_parameter('timestamp_first', $event['utimestamp']);
$timestamp_last = get_parameter('timestamp_last', $event['utimestamp']);
@ -221,11 +219,7 @@ if($get_extended_event) {
$event['timestamp_first'] = $timestamp_first;
$event['timestamp_last'] = $timestamp_last;
$event['event_rep'] = $event_rep;
if($user_comment !== false) {
$event['user_comment'] = $user_comment;
}
// Check ACLs
if (is_user_admin ($config["id_user"])) {
//Do nothing if you're admin, you get full access

View File

@ -5646,7 +5646,7 @@ function api_set_validate_event_by_id ($id, $trash1, $trash2, $returnType) {
} else {
$ack_utimestamp = time();
events_comment_event($id, '', '', "Change status to validated");
events_comment($id, '', "Change status to validated");
$values = array(
'ack_utimestamp' => $ack_utimestamp,

View File

@ -242,7 +242,7 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1) {
break;
}
events_comment_event($id_event, $similars, '', "Change status to $status_string");
events_comment($id_event, '', "Change status to $status_string");
db_process_sql_begin ();
@ -426,7 +426,7 @@ function events_comment ($id_event, $comment = '', $action = 'Added comment') {
// If the event hasn't owner, assign the user as owner
events_change_owner ($id_event, $similars);
// Give old ugly format to comment. TODO: Change this method for aux table or json
$comment = str_replace(array("\r\n", "\r", "\n"), '<br>', $comment);
@ -437,16 +437,14 @@ function events_comment ($id_event, $comment = '', $action = 'Added comment') {
$commentbox = '';
}
$comment = '<b>-- '.$action.' by '.$config['id_user'].' '.'['.date ($config["date_format"]).'] --</b><br>'.$commentbox;
$comment = '<b>-- ' . $action . ' by '.$config['id_user'].' '.'['.date ($config["date_format"]).'] --</b><br>'.$commentbox.'<br>';
// Update comment
switch ($config['dbtype']) {
// Oldstyle SQL to avoid innecesary PHP foreach
case 'mysql':
$sql_validation = "UPDATE tevento
SET estado = " . $new_status .",
id_usuario = '" . $config['id_user'] . "',
user_comment = concat(user_comment, '" . $comment . "')
SET user_comment = concat('" . $comment . "', user_comment)
WHERE id_evento in (" . implode(',', $id_event) . ")";
$ret = db_process_sql($sql_validation);
@ -454,9 +452,7 @@ function events_comment ($id_event, $comment = '', $action = 'Added comment') {
case 'postgresql':
case 'oracle':
$sql_validation = "UPDATE tevento
SET estado = " . $new_status . ",
id_usuario = '" . $config['id_user'] . "',
user_comment=user_comment || '" . $comment . "')
SET user_comment='" . $comment . "' || user_comment)
WHERE id_evento in (" . implode(',', $id_event) . ")";
$ret = db_process_sql($sql_validation);
@ -1735,19 +1731,9 @@ function events_page_general ($event) {
$data[0] = __('Tags');
if ($event["tags"] != '') {
$tag_array = explode(',', $event["tags"]);
$data[1] = '';
foreach ($tag_array as $tag_element){
$blank_char_pos = strpos($tag_element, ' ');
$tag_name = substr($tag_element, 0, $blank_char_pos);
$tag_url = substr($tag_element, $blank_char_pos + 1);
$data[1] .= ' ' .$tag_name;
if (!empty($tag_url)){
$data[1] .= ' <a href="javascript: openURLTagWindow(\'' . $tag_url . '\');">' . html_print_image('images/lupa.png', true, array('title' => __('Click here to open a popup window with URL tag'))) . '</a> ';
}
$data[1] .= ',';
}
$data[1] = rtrim($table_general, ',');
$tags = str_replace(' ','',$event["tags"]);
$tags = str_replace(',',' , ',$tags);
$data[1] = $tags;
}
else {
$data[1] = '<i>' . __('N/A') . '</i>';
@ -1776,6 +1762,7 @@ function events_page_comments ($event) {
// Split comments and put in table
$col = 0;
$data = array();
foreach($comments_array as $c) {
switch($col) {
case 0:

View File

@ -1626,18 +1626,6 @@ CREATE TABLE ttag_policy_module (
CREATE INDEX ttag_poli_mod_id_pol_mo_idx ON ttag_policy_module(id_policy_module);
-- -----------------------------------------------------
-- Table "ttag_event"
-- -----------------------------------------------------
CREATE TABLE ttag_event (
id_tag NUMBER(10, 0) NOT NULL,
id_evento NUMBER(19, 0) DEFAULT 0 NOT NULL,
PRIMARY KEY (id_tag, id_evento)
);
CREATE INDEX ttag_event_id_evento_idx ON ttag_event(id_evento);
-- -----------------------------------------------------
-- Table "tnetflow_filter"
-- -----------------------------------------------------

View File

@ -1378,18 +1378,6 @@ CREATE TABLE "ttag_policy_module" (
CREATE INDEX "ttag_poli_mod_id_pol_mo_idx" ON "ttag_policy_module"("id_policy_module");
-- -----------------------------------------------------
-- Table "ttag_event"
-- -----------------------------------------------------
CREATE TABLE "ttag_event" (
id_tag INTEGER NOT NULL,
id_evento BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY (id_tag, id_evento)
);
CREATE INDEX "ttag_event_id_evento_idx" ON "ttag_event"("id_evento");
-- -----------------------------------------------------
-- Table `tnetflow_filter`
-- -----------------------------------------------------

View File

@ -1547,17 +1547,6 @@ CREATE TABLE IF NOT EXISTS `ttag_policy_module` (
KEY `idx_id_policy_module` (`id_policy_module`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `ttag_event`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ttag_event` (
`id_tag` int(10) NOT NULL,
`id_evento` bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (id_tag, id_evento),
KEY `idx_id_evento` (`id_evento`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `tnetflow_filter`
-- -----------------------------------------------------