From 7225a9cf5a8a65c141cc4d511bb2eb9ab36e2f5e Mon Sep 17 00:00:00 2001 From: Esteban Sanchez Date: Mon, 8 Jun 2009 13:42:13 +0000 Subject: [PATCH] 2009-06-08 Esteban Sanchez * include/functions.php: Added encoding checking on safe_input(). Fixes #2797399. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1731 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++++ pandora_console/include/functions.php | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 8464aa70f7..4531327f65 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2009-06-08 Esteban Sanchez + + * include/functions.php: Added encoding checking on safe_input(). + Fixes #2797399. + 2009-06-08 Esteban Sanchez * godmode/reporting/reporting_builder.php: Replaced SQL with pandora diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index c4779b09d9..5c3707f770 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -41,7 +41,9 @@ function safe_input ($value) { } if (version_compare (PHP_VERSION, '5.2.3') === 1) { - return htmlentities (utf8_encode ($value), ENT_QUOTES, "UTF-8", false); + if (! mb_check_encoding ($value, 'UTF-8')) + $value = utf8_encode ($value); + return htmlentities ($value, ENT_QUOTES, "UTF-8", false); } else { $translation_table = get_html_translation_table (HTML_ENTITIES, ENT_QUOTES); $translation_table[chr(38)] = '&';