+ // Required: modules/xnetlists.php uses it too.
+ Platal::load('lists', 'lists.inc.php');
+
+ return new MailingList($mbox, $this->get_lists_domain());
+ }
+
+ /** Ensure the current user is an administrator of the group.
+ */
+ protected function is_group_admin($page)
+ {
+ $force_rights = false;
+ if ($GLOBALS['IS_XNET_SITE']) {
+ $perms = S::v('perms');
+ if (is_object($perms) && $perms->hasFlag('groupadmin')) {
+ $force_rights = true;
+ }
+ }
+ $page->assign('group_admin', $force_rights);
+
+ return $force_rights;
+ }
+
+ /** Ensure the current user owns the given MailingList.
+ */
+ protected function verify_list_owner($page, $mlist)
+ {
+ if (list(, , $owners) = $mlist->getMembers()) {
+ if (!(in_array(S::user()->forlifeEmail(), $owners) || S::admin())) {
+ $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer.");
+ }
+ } else {
+ $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer.<br />"
+ . " Si tu penses qu'il s'agit d'une erreur, "
+ . "<a href='mailto:support@polytechnique.org'>contact le support</a>.");
+ }
+ }
+
+ /** Fetch pending operations on a MailingList instance.
+ */
+ protected function get_pending_ops($mlist)
+ {
+ list($subs, $mails) = $mlist->getPendingOps();