Fix calls to NewsLetter class
[platal.git] / include / emails.inc.php
index 9905a73..cd7e0a0 100644 (file)
@@ -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);
     }
@@ -109,8 +112,7 @@ function ids_from_mails(array $emails)
 
     // Look up user ids for addresses in domain
     if (count($domain_mails)) {
-        $domain_users = array();
-        $domain_users = array_map('XDB::escape', array_keys($domain_mails));
+        $domain_users = array_map(array('XDB', 'escape'), array_keys($domain_mails));
         $list = implode(',', $domain_users);
         $res = XDB::query("SELECT   alias, id
                              FROM   aliases
@@ -142,8 +144,7 @@ function ids_from_mails(array $emails)
 
     // Look up user ids for other addresses in the email redirection list
     if (count($other_mails)) {
-        $other_users = array();
-        $other_users = array_map('XDB::escape', $other_mails);
+        $other_users = array_map(array('XDB', 'escape'), $other_mails);
         $list = implode(',', $other_users);
         $res = XDB::query("SELECT   email, uid
                              FROM   emails