X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fmmlist.php;h=efd40679f210fc597918d079118f433c46083cae;hb=feb45d1d9fc152beff746c83048ff7704cc27ea2;hp=63fec4d46b02cb9f7af36347e20947cc2c1289d2;hpb=2b1ee50b0196216dbe4f37e3b039469d6003ca23;p=platal.git diff --git a/classes/mmlist.php b/classes/mmlist.php index 63fec4d..efd4067 100644 --- a/classes/mmlist.php +++ b/classes/mmlist.php @@ -1,6 +1,6 @@ id(); + $pass = $user->password(); + } else { + $uid = $user; + } $dom = is_null($fqdn) ? $globals->mail->domain : $fqdn; $url = "http://$uid:$pass@{$globals->lists->rpchost}:{$globals->lists->rpcport}/$dom"; parent::__construct($url); - if ($globals->debug & 1) { + if ($globals->debug & DEBUG_BT) { $this->bt = new PlBacktrace('MMList'); - } + } } - public function __call($method, $args) - { - return parent::__call($method, $args); + /** + * Replace email in all lists where user has subscribe + * @param $old_email old email address used in mailing lits + * @param $new_email new email to use in place of the old one + * @return number of mailing lists changed + */ + public function replace_email_in_all($old_email, $new_email) { + $all_lists = $this->get_lists($old_email); + if (!$all_lists) { + return 0; + } + $changed_lists = 0; + foreach ($all_lists as $list) { + if ($list->sub) { + $this->replace_email($list->list, $old_email, $new_email); + $changed_lists++; + } + } + return $changed_lists; } }