Code

Fixed problem with spaces and special chars in mail tempalte replacements
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 27 Aug 2010 14:43:17 +0000 (14:43 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 27 Aug 2010 14:43:17 +0000 (14:43 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19480 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/mail/personal/mail/class_mailAccount.inc

index dca67b879afac7d5b64a2fed31010bab4e0ae09b..e3eb64223d19bfebfd986b221b70c8836df629bc 100644 (file)
@@ -1113,12 +1113,24 @@ class mailAccount extends plugin
               $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
             }
           }
+            
+            // Remove non ASCII charcters
+          $value = iconv('UTF-8', 'US-ASCII//TRANSLIT', $value);
+
+            // No spaces are allowed here
+          $value = preg_replace("/[ ]/","", $value);
           array_push($this->$val, strtolower(rewrite($value)));
         }
       }
     }
     $this->mail= strtolower(rewrite($this->mail));
 
+    // Remove non ASCII charcters
+    $this->mail= iconv('UTF-8', 'US-ASCII//TRANSLIT', $this->mail);
+
+    // No spaces are allowed here
+    $this->mail = preg_replace("/[ ]/","", $this->mail);
+
     // Fix mail address when using templates
     if($this->is_account && $this->mailMethod->domainSelectionEnabled()){
       $this->mailDomainPart = preg_replace("/^[^@]*+@/","",$this->mail);