mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Fixed meta event table in cli and api functions
This commit is contained in:
parent
d65ad2693e
commit
bec023dc4d
@ -9062,8 +9062,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
|
* 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) {
|
function api_set_add_event_comment($id, $thrash2, $other, $thrash3) {
|
||||||
|
$meta = false;
|
||||||
if (defined ('METACONSOLE')) {
|
if (defined ('METACONSOLE')) {
|
||||||
return;
|
$meta = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['type'] == 'string') {
|
if ($other['type'] == 'string') {
|
||||||
@ -9072,11 +9073,9 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3) {
|
|||||||
}
|
}
|
||||||
else if ($other['type'] == 'array') {
|
else if ($other['type'] == 'array') {
|
||||||
$comment = io_safe_input($other['data'][0]);
|
$comment = io_safe_input($other['data'][0]);
|
||||||
$meta = $other['data'][1];
|
|
||||||
$history = $other['data'][2];
|
$history = $other['data'][2];
|
||||||
|
|
||||||
$status = events_comment($id, $comment, 'Added comment', $meta,
|
$status = events_comment($id, $comment, 'Added comment', $meta, $history);
|
||||||
$history);
|
|
||||||
if (is_error($status)) {
|
if (is_error($status)) {
|
||||||
returnError('error_add_event_comment',
|
returnError('error_add_event_comment',
|
||||||
__('Error adding event comment.'));
|
__('Error adding event comment.'));
|
||||||
|
@ -3212,8 +3212,13 @@ sub cli_get_event_info () {
|
|||||||
exist_check($event_name,'event',$id_event);
|
exist_check($event_name,'event',$id_event);
|
||||||
|
|
||||||
$csv_separator = '|' unless defined($csv_separator);
|
$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.
|
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.
|
"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($$) {
|
sub pandora_get_event_name($$) {
|
||||||
my ($dbh,$id_event) = @_;
|
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;
|
return defined ($event_name) ? $event_name : -1;
|
||||||
}
|
}
|
||||||
@ -4571,7 +4581,12 @@ sub pandora_get_event_name($$) {
|
|||||||
sub pandora_update_event_from_hash ($$$$) {
|
sub pandora_update_event_from_hash ($$$$) {
|
||||||
my ($parameters, $where_column, $where_value, $dbh) = @_;
|
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;
|
return $event_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4582,7 +4597,12 @@ sub pandora_update_event_from_hash ($$$$) {
|
|||||||
sub pandora_get_event_comment($$) {
|
sub pandora_get_event_comment($$) {
|
||||||
my ($dbh,$id_event) = @_;
|
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;
|
return defined ($event_name) ? $event_name : -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user