From 860400fa9c0a2e6260b05e2ae6be0378d79ff56f Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 8 Mar 2022 16:42:19 +0100 Subject: [PATCH] #8339 added macros _customdata_json_ and _customdata_text_ --- pandora_console/include/functions_events.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 26f41a2589..d4ffb6094a 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4166,11 +4166,24 @@ function events_get_response_target( } // Parse the event custom data. - if (!empty($event['custom_data'])) { + if (empty($event['custom_data']) === false) { $custom_data = json_decode(base64_decode($event['custom_data'])); foreach ($custom_data as $key => $value) { $target = str_replace('_customdata_'.$key.'_', $value, $target); } + + if (strpos($target, '_customdata_json_') !== false) { + $target = str_replace('_customdata_json_', json_encode($custom_data), $target); + } + + if (strpos($target, '_customdata_text_') !== false) { + $text = ''; + foreach ($custom_data as $key => $value) { + $text .= $key.': '.$value.PHP_EOL; + } + + $target = str_replace('_customdata_text_', $text, $target); + } } // This will replace the macro with the current logged user.