From 6ce419887e7acfa690264a4d11df2c9d66d16099 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Mon, 28 Nov 2011 19:44:20 -0500 Subject: Fixes #4139 if no mbstring extension we strip characters for display with search --- mod/search/pages/search/index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'mod/search/pages/search/index.php') diff --git a/mod/search/pages/search/index.php b/mod/search/pages/search/index.php index c4e8d2219..efa3ec037 100644 --- a/mod/search/pages/search/index.php +++ b/mod/search/pages/search/index.php @@ -19,7 +19,12 @@ $query = stripslashes(get_input('q', get_input('tag', ''))); // @todo - create function for sanitization of strings for display in 1.8 // encode <,>,&, quotes and characters above 127 -$display_query = mb_convert_encoding($query, 'HTML-ENTITIES', 'UTF-8'); +if (function_exists('mb_convert_encoding')) { + $display_query = mb_convert_encoding($query, 'HTML-ENTITIES', 'UTF-8'); +} else { + // if no mbstring extension, we just strip characters + $display_query = preg_replace("/[^\x01-\x7F]/", "", $query); +} $display_query = htmlspecialchars($display_query, ENT_QUOTES, 'UTF-8', false); // check that we have an actual query -- cgit v1.2.3