Code

Updated utils/msgPool
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Feb 2010 15:12:07 +0000 (15:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Feb 2010 15:12:07 +0000 (15:12 +0000)
-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

index 8dea7c25f2b3498323cf08da28db8e14ecbe6cbe..d58debb985a72f289e719db93d7c86aaf1e4f1cb 100644 (file)
@@ -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.= "<font style='color:red;text-decoration:underline;'>".htmlentities($currentChar)."</font>";
+          $result.= "<font style='color:red;text-decoration:underline;'>".($currentChar)."</font>";
           $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)).
         "<br><br> \"$result\"$example";
     } else {
       return sprintf(_("The Field '%s' contains invalid characters!"), $name)."!$example";