From: Raphaël Barrois Date: Sun, 23 Oct 2011 13:43:27 +0000 (+0200) Subject: When adding members to a list, make sure to always pass a list of unique values. X-Git-Tag: xorg/1.1.4~73 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=03558f195dd4a351e99de0bc8d313504acedc606;p=platal.git When adding members to a list, make sure to always pass a list of unique values. Signed-off-by: Raphaël Barrois --- diff --git a/include/validations/listes.inc.php b/include/validations/listes.inc.php index 1897b05..ef19a21 100644 --- a/include/validations/listes.inc.php +++ b/include/validations/listes.inc.php @@ -139,6 +139,11 @@ class ListeReq extends Validate $owners = User::getBulkForlifeEmails($this->owners, true, array('ListsModule', 'no_login_callback')); $list = new MMList(S::user(), $this->domain); + + // Make sure we send a list (array_values) of unique (array_unique) + // emails. + $owners = array_values(array_unique($owners)); + $members = array_values(array_unique($members)); $success = $list->create_list($this->liste, utf8_decode($this->desc), $this->advertise, $this->modlevel, $this->inslevel, $owners, $members); diff --git a/modules/lists.php b/modules/lists.php index 546b572..e53ea7a 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -644,6 +644,10 @@ class ListsModule extends PLModule $members = User::getBulkForlifeEmails(Env::v('add_member'), true, array('ListsModule', 'no_login_callback')); + // Make sure we send a list (array_values) of unique (array_unique) + // emails. + $members = array_values(array_unique($members)); + $arr = $this->client->mass_subscribe($liste, $members); if (is_array($arr)) { foreach($arr as $addr) { @@ -662,6 +666,10 @@ class ListsModule extends PLModule $members = User::getBulkForlifeEmails($upload->getContents(), true, array('ListsModule', 'no_login_callback')); + // Make sure we send a list (array_values) of unique (array_unique) + // emails. + $members = array_values(array_unique($members)); + $arr = $this->client->mass_subscribe($liste, $members); if (is_array($arr)) { foreach($arr as $addr) {