From ab639804b15f276943e5d61feb8e584e7d309690 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 15 Feb 2010 15:12:07 +0000 Subject: [PATCH] Updated utils/msgPool -msgPool::invalid is now able to handle regex with special chars git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15627 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/utils/class_msgPool.inc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gosa-core/include/utils/class_msgPool.inc b/gosa-core/include/utils/class_msgPool.inc index 8dea7c25f..d58debb98 100644 --- a/gosa-core/include/utils/class_msgPool.inc +++ b/gosa-core/include/utils/class_msgPool.inc @@ -280,17 +280,20 @@ class msgPool if ($regex) { $result= ""; $mismatch= ""; - foreach (str_split($data) as $currentChar){ + + mb_internal_encoding('UTF-8'); + for($i=0; $i<=mb_strlen($data);$i++){ + $currentChar= mb_substr($data, $i,1); if (preg_match("$regex", $currentChar)){ $result.= $currentChar; } else { - $result.= "".htmlentities($currentChar).""; + $result.= "".($currentChar).""; $mismatch.= $currentChar; } } return sprintf(_("The Field '%s' contains invalid characters"), $name).". ". - (strlen($mismatch)==1?sprintf(_("'%s' is not allowed:"), htmlentities($mismatch)):sprintf(_("'%s' are not allowed!"), htmlentities($mismatch))). + (strlen($mismatch)==1?sprintf(_("'%s' is not allowed:"), $mismatch):sprintf(_("'%s' are not allowed!"), $mismatch)). "

\"$result\"$example"; } else { return sprintf(_("The Field '%s' contains invalid characters!"), $name)."!$example"; -- 2.30.2