Redefine DirEnum API, factor some code
[platal.git] / include / emails.inc.php
index 084d25b..b7caf73 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2009 Polytechnique.org                              *
+ *  Copyright (C) 2003-2010 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -55,8 +55,11 @@ function valide_email($str)
     $em = trim(rtrim($str));
     $em = str_replace('<', '', $em);
     $em = str_replace('>', '', $em);
+    if (strpos($em, '@') === false) {
+        return;
+    }
     list($ident, $dom) = explode('@', $em);
-    if ($dom == $globals->mail->domain or $dom == $globals->mail->domain2) {
+    if ($dom == $globals->mail->domain || $dom == $globals->mail->domain2) {
         list($ident1) = explode('_', $ident);
         list($ident) = explode('+', $ident1);
     }