From 4e94976b9d678c42f4811a3e130e3f24b8972ba8 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 22 Nov 2022 13:24:26 +0100 Subject: [PATCH] #9494 Fixed custom data search --- pandora_console/include/functions_events.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 7f5e09d8e4..0ebe7ffcc6 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1102,27 +1102,27 @@ function events_get_all( $sql_filters[] = sprintf( ' AND JSON_VALID(custom_data) = 1 AND (JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) ', - $filter['custom_data'] + io_safe_output($filter['custom_data']) ); } else { $sql_filters[] = sprintf( ' AND JSON_VALID(custom_data) = 1 AND (JSON_SEARCH(JSON_KEYS(custom_data), "all", lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) IS NOT NULL) ', - $filter['custom_data'] + io_safe_output($filter['custom_data']) ); } } else { 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 cast(JSON_EXTRACT(custom_data, "$.*") as CHAR) LIKE lower("%%%s%%") ', + 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 cast(JSON_KEYS(custom_data) as CHAR) REGEXP "%s" ', + io_safe_output($filter['custom_data']) ); } }