From b7aca968a37dd68325d05d117ed22bcdcc023505 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Fri, 1 Apr 2022 14:06:51 +0200 Subject: [PATCH] minor change --- pandora_console/include/ajax/events.php | 4 +++- pandora_console/include/functions_events.php | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 71e0783c51..a218a6d25e 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -894,7 +894,9 @@ function save_update_filter() { "id_extra": $("#text-id_extra").val(), "user_comment": $("#text-user_comment").val(), "id_source_event": $("#text-id_source_event").val(), - "server_id": $("#server_id").val() + "server_id": $("#server_id").val(), + "custom_data": $("#text-custom_data").val(), + "custom_data_filter_type": $("#custom_data_filter_type").val() }, function (data) { diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index c666b54b32..38752bfb72 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1126,15 +1126,15 @@ function events_get_all( if (empty($filter['custom_data']) === false) { if ($filter['custom_data_filter_type'] === '1') { $sql_filters[] = sprintf( - ' AND JSON_VALID(custom_data) = 1 AND JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") ', - $filter['custom_data'], - $filter['custom_data'] + ' AND JSON_VALID(custom_data) = 1 + AND (JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) ', + io_safe_output($filter['custom_data']) ); } else { $sql_filters[] = sprintf( - ' AND JSON_VALID(custom_data) = 1 AND JSON_KEYS(custom_data) REGEXP "%s" ', - $filter['custom_data'], - $filter['custom_data'] + ' AND JSON_VALID(custom_data) = 1 + AND (JSON_SEARCH(JSON_KEYS(custom_data), "all", lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) IS NOT NULL) ', + io_safe_output($filter['custom_data']) ); } }