From 6f32b047f316c9d93c00738b11e2aa2a06bdc063 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 21 May 2024 12:43:56 +0200 Subject: [PATCH] #13737 Events - url on comments and event custom id --- pandora_console/include/functions_events.php | 7 ++-- pandora_console/include/functions_ui.php | 35 +++++++++++--------- pandora_console/operation/events/events.php | 24 ++++++++------ 3 files changed, 38 insertions(+), 28 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index ae5a814a3a..9d52b3c1fe 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -5343,8 +5343,11 @@ function events_page_comments($event, $groupedComments=[], $filter=null) '

%s', date($config['date_format'], $comm['utimestamp']) ); - - $data[1] = '

'.stripslashes(str_replace(['\n', '\r'], '
', $comm['comment'])).'

'; + if (isset($config['events_format_urls']) === true && (bool) $config['events_format_urls'] === true) { + $data[1] = io_safe_output($comm['comment']); + } else { + $data[1] = '

'.stripslashes(str_replace(['\n', '\r'], '
', $comm['comment'])).'

'; + } $table_comments->data[] = $data; } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index eed4eb8fbd..b4b1593597 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -7270,24 +7270,27 @@ function ui_print_comments($comment, $truncate_limit=255) $short_comment = substr($comment['comment'], 0, 20); $comentario = $comment['comment']; + if (isset($config['events_format_urls']) === true && (bool) $config['events_format_urls'] === true) { + $comentario = ''.ui_print_timestamp($comment['utimestamp'], true, ['style' => 'font-size: 10px; display: contents;', 'prominent' => 'compact']).' ('.$comment['id_user'].'): '.$comment['comment'].''; + } else { + if (strlen($comentario) >= $truncate_limit) { + $comentario = ui_print_truncate_text( + $comentario, + $truncate_limit, + false, + true, + false, + '…', + true, + true, + ); + } - if (strlen($comentario) >= $truncate_limit) { - $comentario = ui_print_truncate_text( - $comentario, - $truncate_limit, - false, - true, - false, - '…', - true, - true, - ); - } + $comentario = ''.ui_print_timestamp($comment['utimestamp'], true, ['style' => 'font-size: 10px; display: contents;', 'prominent' => 'compact']).' ('.$comment['id_user'].'): '.$comment['comment'].''; - $comentario = ''.ui_print_timestamp($comment['utimestamp'], true, ['style' => 'font-size: 10px; display: contents;', 'prominent' => 'compact']).' ('.$comment['id_user'].'): '.$comment['comment'].''; - - if (strlen($comentario) > '200px' && $truncate_limit >= 255) { - $comentario = ''.ui_print_timestamp($comment['utimestamp'], true, ['style' => 'font-size: 10px; display: contents;', 'prominent' => 'compact']).' ('.$comment['id_user'].'): '.$short_comment.'...'; + if (strlen($comentario) > '200px' && $truncate_limit >= 255) { + $comentario = ''.ui_print_timestamp($comment['utimestamp'], true, ['style' => 'font-size: 10px; display: contents;', 'prominent' => 'compact']).' ('.$comment['id_user'].'): '.$short_comment.'...'; + } } return $comentario; diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 563472ce31..06262cae22 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -560,16 +560,20 @@ if (is_ajax() === true) { } if (empty($tmp->event_custom_id) === false) { - $tmp->event_custom_id = ui_print_truncate_text( - $tmp->event_custom_id, - 30, - false, - true, - false, - '…', - true, - true, - ); + if (isset($config['events_format_urls']) === true && (bool) $config['events_format_urls'] === true) { + $tmp->event_custom_id = io_safe_output($tmp->event_custom_id); + } else { + $tmp->event_custom_id = ui_print_truncate_text( + $tmp->event_custom_id, + 30, + false, + true, + false, + '…', + true, + true, + ); + } } if (empty($tmp->module_custom_id) === false) {