Fix ids_from_emails to ignore case in submitted emails
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Thu, 10 Jun 2010 13:53:39 +0000 (15:53 +0200)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Thu, 10 Jun 2010 13:53:39 +0000 (15:53 +0200)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
include/emails.inc.php

index f40dbe4..4fdbacf 100644 (file)
@@ -147,12 +147,16 @@ function ids_from_mails(array $emails)
 
     // Look up user ids for other addresses in the email redirection list
     if (count($other_mails)) {
+        $lowerupper = array();
+        foreach ($other_mails as $mail) {
+            $lowerupper[strtolower($mail)] = $mail;
+        }
         $res = XDB::query("SELECT   email, uid
                              FROM   emails
                             WHERE   email IN {?}", $other_mails);
         foreach ($res->fetchAllRow() as $row) {
             list ($email, $uid) = $row;
-            $uids[$email] = $uid;
+            $uids[$lowerupper[strtolower($email)]] = $uid;
         }
     }