Also default to S::user().
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
public $domain; // domain for the list
protected $mmclient; // The XML-RPC client for Mailman requests
- public function __construct($mbox, $domain, $user, $pass='')
+ public function __construct($mbox, $domain, $user=null)
{
$this->mbox = $mbox;
$this->domain = $domain;
$this->address = "$mbox@$domain";
- if ($user instanceof PlUser) {
- $this->mmclient = new MMList($user, $this->domain);
- } else {
- $this->mmclient = new MMList($user, $pass, $this->domain);
+ if (is_null($user)) {
+ $user = S::user();
}
+ $this->mmclient = new MMList($user, $this->domain);
}
/** Instantiate a MailingList from its address.
- *
- * $user and $pass are connection parameters for MailMan.
*/
- public static function fromAddress($address, $user, $pass='')
+ public static function fromAddress($address, $user=null)
{
if (strstr($address, '@') !== false) {
list($mbox, $domain) = explode('@', $address);
$mbox = $address;
$domain = $globals->mail->domain;
}
- return new MailingList($mbox, $domain, $user, $pass);
+ return new MailingList($mbox, $domain, $user);
}
/** Retrieve the MailingList associated with a given promo.
- *
- * $user and $pass are connection parameters for MailMan.
*/
- public static function promo($promo, $user, $pass='')
+ public static function promo($promo, $user=null)
{
global $globals;
$mail_domain = $globals->mail->domain;
- return new MailingList('promo', "$promo.$mail_domain", $user, $pass);
+ return new MailingList('promo', "$promo.$mail_domain", $user);
}
const KIND_BOUNCE = 'bounces';
S::i('uid'));
while (list($sub, $domain) = $res->next()) {
if (array_shift($subs) == "$sub@$domain") {
- $mlist = new MailingList($sub, $domain, S::user());
+ $mlist = new MailingList($sub, $domain);
$mlist->subscribe();
}
}
S::i('uid'));
$lists = array();
while (list($sub, $domain) = $res->next()) {
- $mlist = new MailingList($sub, $domain, S::user());
+ $mlist = new MailingList($sub, $domain);
list($details, ) = $mlist->getMembers();
$lists["$sub@$domain"] = $details;
}
FROM groups
WHERE diminutif = {?}',
$user->id(), $user->profile()->yearPromo());
- $mlist = MailingList::promo($user->profile()->yearPromo(), $user);
+ $mlist = MailingList::promo($user->profile()->yearPromo());
$mlist->subscribe():
$this->UpdateOnYes();
Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
}
if ($mlCount == 0) {
- $mlist = MailingList::promo($user->profile()->yearPromo(), $user);
+ $mlist = MailingList::promo($user->profile()->yearPromo());
try {
$mlist->getMembersLimit(0, 0);
} catch (Exception $e) {
$owners = array_values(array_unique($owners));
$members = array_values(array_unique($members));
- $list = new MailingList($this->liste, $this->domain, S::user());
+ $list = new MailingList($this->liste, $this->domain);
$success = $list->create($this->desc, $this->advertise,
$this->modlevel, $this->inslevel,
$owners, $members);
/** Prepare a MailingList from its mailbox
*/
- protected function prepare_list($mbox, $user=null)
+ protected function prepare_list($mbox)
{
// Required: modules/xnetlists.php uses it too.
Platal::load('lists', 'lists.inc.php');
- if (is_null($user)) {
- $user = S::user();
- }
- return new MailingList($mbox, $this->get_lists_domain(), $user);
+ return new MailingList($mbox, $this->get_lists_domain());
}
/** Ensure the current user is an administrator of the group.
$promo = Post::i('promo_add');
if ($promo >= 1900 and $promo < 2100) {
- $mlist = MailingList::promo($promo, S::user());
+ $mlist = MailingList::promo($promo);
$mlist->subscribe();
} else {
$page->trigError("promo incorrecte, il faut une promo sur 4 chiffres.");