From 3652f31a1879f18d4ef94e3eccbdc734cf9413d4 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 5 Dec 2019 17:06:58 +0100 Subject: [PATCH] Code reset and solved other issues with comments --- pandora_console/include/ajax/events.php | 2 +- pandora_console/include/functions_events.php | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index af3388ffbf..f61ac850d9 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -128,7 +128,7 @@ if ($get_comments) { ); if ($events !== false) { - $event = $events[0]; + $event = $events; } } diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 78770840f1..6fa2a6533f 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1262,6 +1262,11 @@ function events_get_all( unset($fields[$idx]); } } + } else { + $idx = array_search('te.user_comment', $fields); + if ($idx !== false) { + $fields[$idx] = 'te.user_comment AS comments'; + } } $sql = sprintf( @@ -4604,12 +4609,12 @@ function events_page_comments($event, $ajax=false) continue; } - $comments_array[] = json_decode(io_safe_output($comm), true); + $comments_array[] = io_safe_output(json_decode($comm, true)); } } else { $comments = str_replace(["\n", ' '], '
', $comments); // If comments are not stored in json, the format is old. - $comments_array[] = json_decode(io_safe_output($comments), true); + $comments_array[] = io_safe_output(json_decode($comments, true)); } foreach ($comments_array as $comm) {