Code

Fixed template handling for mail accounts
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 27 Aug 2010 15:09:15 +0000 (15:09 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 27 Aug 2010 15:09:15 +0000 (15:09 +0000)
-Do not accept spaces or special chars in mail addresses

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

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

index 1cf306a63fe880d45b601ca281c63f9920870ae0..09de8c346ad553f5a918196c9bbe7c356996fbc7 100644 (file)
@@ -1114,11 +1114,17 @@ class mailAccount extends plugin
               $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
             }
           }
+          $value = iconv('UTF-8', 'US-ASCII//TRANSLIT', $value);
+          $value = preg_replace('/[^(\x20-\x7F)]*/','',$value);
+          $value = preg_replace("/[ ]/","", $value);
           array_push($this->$val, strtolower(rewrite($value)));
         }
       }
     }
     $this->mail= strtolower(rewrite($this->mail));
+    $this->mail= iconv('UTF-8', 'US-ASCII//TRANSLIT', $this->mail);
+    $this->mail= preg_replace('/[^(\x20-\x7F)]*/','',$this->mail);
+    $this->mail= preg_replace("/[ ]/","", $this->mail);
 
     // Fix mail address when using templates
     if($this->is_account && $this->mailMethod->domainSelectionEnabled()){