Bugfix
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Mon, 29 Jun 2009 13:08:59 +0000 (15:08 +0200)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Mon, 29 Jun 2009 13:29:08 +0000 (15:29 +0200)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
include/emails.inc.php
modules/axletter/axletter.inc.php

index 9905a73..d6e885f 100644 (file)
@@ -109,8 +109,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 +141,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
index 27b1d46..e238c41 100644 (file)
@@ -205,7 +205,12 @@ class AXLetter extends MassMailer
             require_once("emails.inc.php");
             $ids = ids_from_mails($this->_subset_to);
             $ids_list = implode(',', $ids);
-            $where[] = "ni.user_id IN ($ids_list)";
+            if(count($ids_list) > 0) {
+                $where[] = "ni.user_id IN ($ids_list)";
+            } else {
+                // No valid email
+                $where[] = "0";
+            }
         }
         return implode(' AND ', $where);
     }