Code

Apply fix for #3105
authorpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Sep 2010 09:07:16 +0000 (09:07 +0000)
committerpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Sep 2010 09:07:16 +0000 (09:07 +0000)
Properly transcode special invalid characters in the 'invalid' stock
error message, fix an additonal exclamation mark when additionally
example input is presented and use already translated field names for
Product-ID and Vendor-ID in the hotplug management.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@19543 594d385d-05f5-0310-b6e9-bd551577e9d8

trunk/gosa-core/include/utils/class_msgPool.inc
trunk/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc

index 0111b6f4829787585fe7625e4e5254ec55ccd856..af83edf03fc4563dc62c89680553950840600443 100644 (file)
@@ -284,20 +284,20 @@ class msgPool
     if ($regex) {
       $result= "";
       $mismatch= "";
-      foreach (str_split($data) as $currentChar){
+      foreach (preg_split("//u", $data) as $currentChar){
         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;'>".htmlentities($currentChar, ENT_COMPAT, "UTF-8")."</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:"), htmlentities($mismatch, ENT_COMPAT, "UTF-8")):sprintf(_("'%s' are not allowed!"), htmlentities($mismatch, ENT_COMPAT, "UTF-8"))).
         "<br><br> \"$result\"$example";
     } else {
-      return sprintf(_("The Field '%s' contains invalid characters!"), $name)."!$example";
+      return sprintf(_("The Field '%s' contains invalid characters!"), $name)."$example";
     }
   }
 
index b8b91e2ccc2f94b2d0f734980dd1bcd9addaaf8b..d4d5043cae7c2040b2abd65134ad9782fd7fc7ec 100644 (file)
@@ -100,10 +100,10 @@ class deviceGeneric extends plugin
       $message[]= msgPool::required(_("iSerial"));
     }
     if(empty($this->serial) || !$this->is_2byteHex($this->serial)){
-      $message[]= msgPool::invalid(_("Product ID"),"","","0x1234");
+      $message[]= msgPool::invalid(_("Product-ID"),"","","0x1234");
     }
     if(empty($this->vendor) || !$this->is_2byteHex($this->vendor)){
-      $message[]= msgPool::invalid(_("Vendor ID"),"","","0x1234");
+      $message[]= msgPool::invalid(_("Vendor-ID"),"","","0x1234");
     }
     /* Convert vendorId and productId to lower case */
     $this->serial = strtolower($this->serial);