From 03558f195dd4a351e99de0bc8d313504acedc606 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Sun, 23 Oct 2011 15:43:27 +0200 Subject: [PATCH] When adding members to a list, make sure to always pass a list of unique values. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- include/validations/listes.inc.php | 5 +++++ modules/lists.php | 8 ++++++++ 2 files changed, 13 insertions(+) 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) { -- 2.1.4