--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2006 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+class MMList extends XmlrpcClient
+{
+ function __construct($uid, $pass, $fqdn = null)
+ {
+ global $globals;
+
+ $dom = is_null($fqdn) ? $globals->mail->domain : $fqdn;
+ $url = "http://$uid:$pass@{$globals->lists->rpchost}:{$globals->lists->rpcport}/$dom";
+ parent::__construct($url);
+ }
+
+ function __call($method, $args)
+ {
+ return parent::__call($method, $args);
+ }
+}
+
+?>
XDB::execute("DELETE FROM requests WHERE user_id={?}", $uid);
XDB::execute("DELETE FROM user_changes WHERE user_id={?}", $uid);
XDB::execute("DELETE FROM watch_sub WHERE uid={?}", $uid);
-
- include_once('lists.inc.php');
- if (function_exists(lists_xmlrpc)) {
- $client =& lists_xmlrpc(S::v('id'), S::v('password'));
- $client->kill($alias, $really_del);
- }
+
+ $mmlist = new MMList(S::v('id'), S::v('password'));
+ $mmlist->kill($alias, $really_del);
}
// }}}
// }}}
// {{{ function commit()
-
+
function commit()
{
- require_once 'lists.inc.php';
-
- $client =& lists_xmlrpc(S::v('uid'), S::v('password'));
- $ret = $client->create_list($this->liste, $this->desc,
- $this->advertise, $this->modlevel, $this->inslevel,
- $this->owners, $this->members);
+ $list = new List(S::v('uid'), S::v('password'));
+ $ret = $list->create_list($this->liste, $this->desc, $this->advertise,
+ $this->modlevel, $this->inslevel,
+ $this->owners, $this->members);
$liste = strtolower($this->liste);
if ($ret) {
foreach(Array($liste, $liste."-owner", $liste."-admin", $liste."-bounces") as $l) {
{
global $globals;
- require_once 'lists.inc.php';
-
$cle = $globals->core->econfiance;
if (S::v('chall') && $_GET['PASS'] == md5(S::v('chall').$cle)) {
$res = XDB::query("SELECT password FROM auth_user_md5 WHERE user_id=10154");
$pass = $res->fetchOneCell();
- $client =& lists_xmlrpc(10154, $pass, "x-econfiance.polytechnique.org");
- $members = $client->get_members('membres');
+ $list = new MMList(10154, $pass, "x-econfiance.polytechnique.org");
+ $members = $list->get_members('membres');
if (is_array($members)) {
$membres = Array();
foreach($members[1] as $member) {
{
global $globals;
- require_once 'lists.inc.php';
+ require_once dirname(__FILE__).'/lists/lists.inc.php';
- $this->client =& lists_xmlrpc(S::v('uid'), S::v('password'));
+ $this->client = new MMList(S::v('uid'), S::v('password'));
return $globals->mail->domain;
}
}
if (list($det,$mem,$own) = $this->client->get_members($liste)) {
-
$membres = list_sort_members($mem, $tri_promo);
$moderos = list_sort_owners($own, $tri_promo);
function handler_admin_all(&$page) {
$page->changeTpl('listes/admin_all.tpl');
$page->assign('xorg_title','Polytechnique.org - Administration - Mailing lists');
- require_once 'lists.inc.php';
-
- $client =& lists_xmlrpc(S::v('uid'), S::v('password'));
+
+ $client = new MMList(S::v('uid'), S::v('password'));
$listes = $client->get_all_lists();
- $page->assign_by_ref('listes',$listes);
+ $page->assign_by_ref('listes', $listes);
}
-
}
?>
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-// {{{ function lists_xmlrpc
-
-function &lists_xmlrpc($uid, $pass, $fqdn=null)
-{
- global $globals;
-
- $dom = is_null($fqdn) ? $globals->mail->domain : $fqdn;
- $url = "http://$uid:$pass@{$globals->lists->rpchost}:{$globals->lists->rpcport}/$dom";
- $client = new XmlrpcClient($url);
- return $client;
-}
-
-// }}}
// {{{ function list_sort_owners
function list_sort_owners(&$members, $tri_promo = true) {
}
// }}}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
?>
XDB::execute('REPLACE INTO groupex.membres (uid,asso_id)
VALUES ({?}, {?})',
S::v('uid'), $asso_id);
- require_once 'lists.inc.php';
- $client =& lists_xmlrpc(S::v('uid'), S::v('password'));
- $client->subscribe("promo".S::v('promo'));
+ $mmlist = new MMList(S::v('uid'), S::v('password'));
+ $mmlist->subscribe("promo".S::v('promo'));
}
if (is_ax_key_missing()) {
WHERE alias LIKE {?}', '%@'.$domain);
$page->trig('suppression des alias mails');
- require_once('lists.inc.php');
- $client =& lists_xmlrpc(S::v('uid'), S::v('password'), $domain);
- if ($listes = $client->get_lists()) {
+ $mmlist = new MMList(S::v('uid'), S::v('password'), $domain);
+ if ($listes = $mmlist->get_lists()) {
foreach ($listes as $l) {
- $client->delete_list($l['list'], true);
+ $mmlist->delete_list($l['list'], true);
}
$page->trig('mail lists surpprimées');
}
{
global $globals;
- require_once 'lists.inc.php';
-
new_groupadmin_page('xnet/groupe/mail.tpl');
- $client =& lists_xmlrpc(S::v('uid'),
- S::v('password'),
- $globals->asso('mail_domain'));
- $page->assign('listes', $client->get_lists());
+ $mmlist = new MMList(S::v('uid'), S::v('password'),
+ $globals->asso('mail_domain'));
+ $page->assign('listes', $mmlist->get_lists());
if (Post::has('send')) {
$from = Post::v('from');
$mls = array_keys(Env::v('ml', array()));
require_once 'xnet/mail.inc.php';
- $tos = get_all_redirects(Post::has('membres'), $mls, $client);
+ $tos = get_all_redirects(Post::has('membres'), $mls, $mmlist);
send_xnet_mails($from, $sujet, $body, $tos, Post::v('replyto'));
$page->kill("Mail envoyé !");
$page->assign('sent', true);
{
global $globals;
- require_once 'lists.inc.php';
require_once 'xnet/mail.inc.php';
new_groupadmin_page('xnet/groupe/annuaire-admin.tpl');
- $client =& lists_xmlrpc(S::v('uid'), S::v('password'),
- $globals->asso('mail_domain'));
- $lists = $client->get_lists();
+ $mmlist = new MMList(S::v('uid'), S::v('password'),
+ $globals->asso('mail_domain'));
+ $lists = $mmlist->get_lists();
if (!$lists) $lists = array();
$listes = array_map(create_function('$arr', 'return $arr["list"];'), $lists);
$subscribers = array();
foreach ($listes as $list) {
- list(,$members) = $client->get_members($list);
+ list(,$members) = $mmlist->get_members($list);
$mails = array_map(create_function('$arr', 'return $arr[1];'), $members);
$subscribers = array_unique(array_merge($subscribers, $mails));
}
if (($domain = $globals->asso('mail_domain')) && empty($user_same_email)) {
- require 'lists.inc.php';
- $client =& lists_xmlrpc(S::v('uid'), S::v('password'), $domain);
- $listes = $client->get_lists($user['email2']);
+ $mmlist = new MMList(S::v('uid'), S::v('password'), $domain);
+ $listes = $mmlist->get_lists($user['email2']);
foreach ($listes as $liste) {
if ($liste['sub'] == 2) {
- $client->mass_unsubscribe($liste['list'], Array($user['email2']));
+ $mmlist->mass_unsubscribe($liste['list'], Array($user['email2']));
$page->trig("{$user['prenom']} {$user['nom']} a été"
." désinscrit de {$liste['list']}");
} elseif ($liste['sub']) {
return PL_NOT_FOUND;
}
- require 'lists.inc.php';
- $client =& lists_xmlrpc(S::v('uid'), S::v('password'),
- $globals->asso('mail_domain'));
+ $mmlist = new MMList(S::v('uid'), S::v('password'),
+ $globals->asso('mail_domain'));
if (Post::has('change')) {
if ($user['origine'] != 'X') {
."actuellement une demande d'inscription en "
."cours sur <strong>$ml@</strong> !!!");
} elseif ($ask) {
- $client->mass_subscribe($ml, Array($user['email2']));
+ $mmlist->mass_subscribe($ml, Array($user['email2']));
$page->trig("{$user['prenom']} {$user['nom']} a été abonné à $ml@");
} else {
- $client->mass_unsubscribe($ml, Array($user['email2']));
+ $mmlist->mass_unsubscribe($ml, Array($user['email2']));
$page->trig("{$user['prenom']} {$user['nom']} a été désabonné de $ml@");
}
}
}
$page->assign('user', $user);
- $listes = $client->get_lists($user['email2']);
+ $listes = $mmlist->get_lists($user['email2']);
$page->assign('listes', $listes);
$res = XDB::query(
{
global $globals;
- require_once 'lists.inc.php';
+ require_once dirname(__FILE__).'/lists/lists.inc.php';
- $this->client =& lists_xmlrpc(S::v('uid'), S::v('password'),
- $globals->asso('mail_domain'));
+ $this->client = new MMList(S::v('uid'), S::v('password'),
+ $globals->asso('mail_domain'));
$page->useMenu();
$page->assign('asso', $globals->asso());
return;
}
- require_once 'lists.inc.php';
$ret = $this->client->create_list(
$liste, Post::v('desc'), Post::v('advertise'),
Post::v('modlevel'), Post::v('inslevel'),