From db7eaaaf20406ec71ce966c71c5c846100c9530e Mon Sep 17 00:00:00 2001 From: marcos Date: Mon, 13 Apr 2020 10:36:23 +0200 Subject: [PATCH 1/3] created function to get id_event from tmetaconsole_even api --- pandora_console/include/functions_api.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 37ead3a465..f9d0111919 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -15990,3 +15990,22 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access='A return false; } + + +function api_get_event_mcid($server_id, $console_event_id, $trash2, $returnType) +{ + global $config; + + if (is_metaconsole()) { + $mc_event_id = db_get_all_rows_sql("SELECT id_evento FROM tmetaconsole_event WHERE id_source_event = $console_event_id AND server_id = $server_id "); + if ($mc_event_id !== false) { + $query = "SELECT id_evento FROM tmetaconsole_event WHERE id_source_event = $console_event_id AND server_id = $server_id "; + returnData($returnType, ['type' => 'string', 'data' => $mc_event_id]); + } else { + returnError('id_not_found', $console_event_id.' on '.$server_id); + } + } else { + returnError('forbidden', 'string'); + return; + } +} From 045f115d950b7a45434ed4bcd7f5c3e21d0b4026 Mon Sep 17 00:00:00 2001 From: marcos Date: Mon, 13 Apr 2020 10:54:37 +0200 Subject: [PATCH 2/3] documented api function --- pandora_console/include/functions_api.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index f9d0111919..c0e671e8d1 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -15992,6 +15992,19 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access='A } +/** + * Function for get event id and node id, then we get in return the Metaconsole event ID. + * + * @param [string] $server_id id server (Node) + * @param [string] $console_event_id console Id node event in tmetaconsole_event + * @param [string] $trash2 don't use + * @param [string] $returnType + * + * Example + * api.php?op=get&op2=event_mcid&return_type=json&id=0&id2=0&apipass=1234&user=admin&pass=pandora + * + * @return void + */ function api_get_event_mcid($server_id, $console_event_id, $trash2, $returnType) { global $config; From d5a7d751699b7300a986dc25aba78a2f2dcc9bcb Mon Sep 17 00:00:00 2001 From: marcos Date: Mon, 13 Apr 2020 11:00:11 +0200 Subject: [PATCH 3/3] update function get id_event from meta api --- pandora_console/include/functions_api.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index c0e671e8d1..8eadcdb624 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -16012,10 +16012,9 @@ function api_get_event_mcid($server_id, $console_event_id, $trash2, $returnType) if (is_metaconsole()) { $mc_event_id = db_get_all_rows_sql("SELECT id_evento FROM tmetaconsole_event WHERE id_source_event = $console_event_id AND server_id = $server_id "); if ($mc_event_id !== false) { - $query = "SELECT id_evento FROM tmetaconsole_event WHERE id_source_event = $console_event_id AND server_id = $server_id "; returnData($returnType, ['type' => 'string', 'data' => $mc_event_id]); } else { - returnError('id_not_found', $console_event_id.' on '.$server_id); + returnError('id_not_found', 'string'); } } else { returnError('forbidden', 'string');