diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php
index b8e23d235e..3a6c8b8b60 100644
--- a/pandora_console/include/ajax/events.php
+++ b/pandora_console/include/ajax/events.php
@@ -136,7 +136,7 @@ if ($get_comments === true) {
// Default grouped message filtering (evento and estado).
$whereGrouped = sprintf(
'`evento` = "%s" AND `estado` = "%s"',
- io_safe_output($event['evento']),
+ $event['evento'],
$event['estado']
);
// If id_agente is reported, filter the messages by them as well.
diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php
index 0c8e35b844..b444244626 100644
--- a/pandora_console/include/functions_events.php
+++ b/pandora_console/include/functions_events.php
@@ -2299,6 +2299,7 @@ function events_comment(
$comments_format = 'new';
} else {
// If comments are not stored in json, the format is old.
+ $event_comments[0]['user_comment'] = str_replace(["\n", '
'], '
', $event_comments[0]['user_comment']);
$event_comments_array = json_decode($event_comments[0]['user_comment']);
if (empty($event_comments_array) === true) {
@@ -5229,6 +5230,8 @@ function events_page_comments($event, $ajax=false, $groupedComments=[])
$comm = $comm['user_comment'];
}
+ $comm = str_replace(["\n", '
'], '
', $comm);
+
$comments_array[] = io_safe_output(json_decode($comm, true));
}