Merge branch '1108-bad-api-and-cli-request-in-meta-with-events-dev' into 'develop'
Fixed meta event table in cli and api functions See merge request !665
This commit is contained in:
commit
901a163c84
|
@ -9112,8 +9112,9 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
|
|||
* http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_event_comment&id=event_id&other=string|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_add_event_comment($id, $thrash2, $other, $thrash3) {
|
||||
$meta = false;
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
$meta = true;
|
||||
}
|
||||
|
||||
if ($other['type'] == 'string') {
|
||||
|
@ -9122,11 +9123,9 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3) {
|
|||
}
|
||||
else if ($other['type'] == 'array') {
|
||||
$comment = io_safe_input($other['data'][0]);
|
||||
$meta = $other['data'][1];
|
||||
$history = $other['data'][2];
|
||||
|
||||
$status = events_comment($id, $comment, 'Added comment', $meta,
|
||||
$history);
|
||||
$status = events_comment($id, $comment, 'Added comment', $meta, $history);
|
||||
if (is_error($status)) {
|
||||
returnError('error_add_event_comment',
|
||||
__('Error adding event comment.'));
|
||||
|
|
|
@ -3212,8 +3212,13 @@ sub cli_get_event_info () {
|
|||
exist_check($event_name,'event',$id_event);
|
||||
|
||||
$csv_separator = '|' unless defined($csv_separator);
|
||||
|
||||
my $event_table = "tevento";
|
||||
if (is_metaconsole($conf) == 1) {
|
||||
$event_table = "tmetaconsole_event";
|
||||
}
|
||||
|
||||
my $query = "SELECT * FROM tevento where id_evento=".$id_event;
|
||||
my $query = "SELECT * FROM " . $event_table . " where id_evento=" . $id_event;
|
||||
|
||||
my $header = "Event ID".$csv_separator."Event name".$csv_separator."Agent ID".$csv_separator."User ID".$csv_separator.
|
||||
"Group ID".$csv_separator."Status".$csv_separator."Timestamp".$csv_separator."Event type".$csv_separator.
|
||||
|
@ -4560,7 +4565,12 @@ sub cli_set_event_storm_protection () {
|
|||
sub pandora_get_event_name($$) {
|
||||
my ($dbh,$id_event) = @_;
|
||||
|
||||
my $event_name = get_db_value($dbh, 'SELECT evento FROM tevento WHERE id_evento = ?',$id_event);
|
||||
my $event_table = "tevento";
|
||||
if (is_metaconsole($conf) == 1) {
|
||||
$event_table = "tmetaconsole_event";
|
||||
}
|
||||
|
||||
my $event_name = get_db_value($dbh, 'SELECT evento FROM ' . $event_table . ' WHERE id_evento = ?',$id_event);
|
||||
|
||||
return defined ($event_name) ? $event_name : -1;
|
||||
}
|
||||
|
@ -4571,7 +4581,12 @@ sub pandora_get_event_name($$) {
|
|||
sub pandora_update_event_from_hash ($$$$) {
|
||||
my ($parameters, $where_column, $where_value, $dbh) = @_;
|
||||
|
||||
my $event_id = db_process_update($dbh, 'tevento', $parameters, {$where_column => $where_value});
|
||||
my $event_table = "tevento";
|
||||
if (is_metaconsole($conf) == 1) {
|
||||
$event_table = "tmetaconsole_event";
|
||||
}
|
||||
|
||||
my $event_id = db_process_update($dbh, $event_table, $parameters, {$where_column => $where_value});
|
||||
return $event_id;
|
||||
}
|
||||
|
||||
|
@ -4582,7 +4597,12 @@ sub pandora_update_event_from_hash ($$$$) {
|
|||
sub pandora_get_event_comment($$) {
|
||||
my ($dbh,$id_event) = @_;
|
||||
|
||||
my $event_name = get_db_value($dbh, 'SELECT user_comment FROM tevento WHERE id_evento = ?',$id_event);
|
||||
my $event_table = "tevento";
|
||||
if (is_metaconsole($conf) == 1) {
|
||||
$event_table = "tmetaconsole_event";
|
||||
}
|
||||
|
||||
my $event_name = get_db_value($dbh, 'SELECT user_comment FROM ' . $event_table . ' WHERE id_evento = ?',$id_event);
|
||||
|
||||
return defined ($event_name) ? $event_name : -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue