--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 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 *
+ ***************************************************************************/
+
+// {{{ function lists_subscribe()
+
+function &lists_subscribe($forlife, $uid, $promo, $password, &$result)
+{
+ require_once('lists.inc.php');
+
+ global $globals;
+ // récupération de l'id de la liste promo
+ $client =& lists_xmlrpc($uid, $pass);
+ $client->subscribe("promo$promo");
+}
+
+// }}}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+?>
function &newsletter_subscribe($forlife, $uid, $promo, $password, &$result)
{
- global $globals;
require_once('newsletter.inc.php');
- subscribe_nl();
+ subscribe_nl(true,$uid);
return ($result = true);
}
$hook->subscribe($forlife, $uid, $promo, $password, true);
start_connexion($uid,false);
- /****************** inscription à la liste promo +nl ****************/
- $inspromo = inscription_listes_base($uid,$password,$promo);
} else
$page->assign('error',ERROR_REF);
require_once("xorg.inc.php");
new_skinned_page('listes/admin.tpl', AUTH_MDP);
-require_once('xml-rpc-client.inc.php');
+require_once('lists.inc.php')
$err = Array();
-
-$client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
+$client =& lists_xmlrpc($_SESSION['uid'], $_SESSION['password']);
if(isset($_REQUEST['add_member'])) {
$arr = $client->mass_subscribe($liste, Array($_REQUEST['add_member']));
if(list($det,$mem,$own) = $client->get_members($liste)) {
$membres = Array();
foreach($mem as $member) {
- if(preg_match('/^([^.]*\.([^.]*)\.\d\d\d\d)@polytechnique.org$/', $member[1], $matches)) {
+ if(preg_match('/^([^.]*\.([^.]*)\.\d\d\d\d)@'.$globals->mail->domain.'$/', $member[1], $matches)) {
$key = strtoupper($matches[2]{0});
$membres[$key][$matches[2]] = Array('n' => $member[0], 'l' => $matches[1], 'a' => $member[1]);
} else {
require_once("xorg.inc.php");
new_skinned_page('listes/archives.tpl', AUTH_COOKIE, 'listes/archives.head.tpl');
-require_once('xml-rpc-client.inc.php');
+require_once('lists.inc.php')
-$client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
+$client =& lists_xmlrpc($_SESSION['uid'], $_SESSION['password']);
if (list($det) = $client->get_members($liste)) {
if ( substr($liste,0,5) != 'promo' && ( $det['ins'] || $det['priv'] ) && !$det['own'] && ($det['sub']<2) ) {
if(strstr('/', $file)!==false || !preg_match(',^\d+/\d+$,', $_GET['rep'])) {
$page->assign('no_list',true);
} else {
- $page->assign('url', $globals->lists->spool."/polytechnique.org-$liste/$rep/$file");
+ $page->assign('url', $globals->lists->spool."/{$globals->mail->domain}-$liste/$rep/$file");
}
} else {
$archs = Array();
- foreach (glob($globals->lists->spool."/polytechnique.org-$liste/*/*") as $rep) {
+ foreach (glob($globals->lists->spool."/{$globals->mail->domain}-$liste/*/*") as $rep) {
if (preg_match(",/(\d*)/(\d*)$,", $rep, $matches)) {
$archs[intval($matches[1])][intval($matches[2])] = true;
}
require_once("xorg.inc.php");
new_admin_page('listes/check.tpl');
-require_once('xml-rpc-client.inc.php');
+require_once('lists.inc.php')
-$client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
+$client =& lists_xmlrpc($_SESSION['uid'], $_SESSION['password']);
if(isset($_POST['correct'])) { $client->check_options($liste, true); }
require_once("xorg.inc.php");
new_skinned_page('listes/delete.tpl', AUTH_MDP);
-require_once('xml-rpc-client.inc.php');
+require_once('lists.inc.php')
-$client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
+$client =& lists_xmlrpc($_SESSION['uid'], $_SESSION['password']);
if ( isset($_POST['valid']) && ($_POST['valid'] == 'OUI')
&& $client->delete_list($liste,!empty($_POST['del_archive'])) ) {
require_once("xorg.inc.php");
new_skinned_page('listes/index.tpl', AUTH_MDP);
-require_once('xml-rpc-client.inc.php');
+require_once('lists.inc.php')
+
+$client =& lists_xmlrpc($_SESSION['uid'], $_SESSION['password']);
-$client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
if(isset($_GET['del'])) {
$client->unsubscribe($_GET['del']);
header('Location: index.php');
require_once("xorg.inc.php");
new_skinned_page('listes/members.tpl', AUTH_COOKIE);
-require_once('xml-rpc-client.inc.php');
+require_once('lists.inc.php')
+
+$client =& lists_xmlrpc($_SESSION['uid'], $_SESSION['password']);
-$client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
if(isset($_GET['del'])) {
$client->unsubscribe($liste);
header("Location: ?liste=$liste");
if(empty($_REQUEST['liste'])) header('Location: index.php');
$liste = strtolower($_REQUEST['liste']);
-if(preg_match('!(?:[a-z0-9]+\.)?polytechnique\.org-(.*)!', $liste,$matches)) {
+if(preg_match("!(?:[a-z0-9]+\\.)?{$globals->mail->domain}-(.*)!", $liste,$matches)) {
header('Location: ?liste='.$matches[1]);
}
require_once("xorg.inc.php");
new_skinned_page('listes/moderate.tpl', AUTH_MDP);
-require_once('xml-rpc-client.inc.php');
+require_once('lists.inc.php')
-$client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
+$client =& lists_xmlrpc($_SESSION['uid'], $_SESSION['password']);
if(isset($_REQUEST['sadd'])) {
$client->handle_request($liste,$_REQUEST['sadd'],4,'');
$mid = $_REQUEST['mid'];
require_once('diogenes.hernes.inc.php');
$mailer = new HermesMailer();
- $mailer->addTo("$liste-owner@polytechnique.org");
- $mailer->setFrom("$liste-bounces@polytechnique.org");
- $mailer->addHeader('Reply-To', "$liste-owner@polytechnique.org");
+ $mailer->addTo("$liste-owner@{$globals->mail->domain}");
+ $mailer->setFrom("$liste-bounces@{$globals->mail->domain}");
+ $mailer->addHeader('Reply-To', "$liste-owner@{$globals->mail->domain}");
$mail = $client->get_pending_mail($liste, $mid);
$h = fopen($fname,'r');
$msg = fread($h, filesize($fname));
fclose($h);
- $msg = str_replace("%(adminaddr)s","$liste-owner@polytechnique.org", $msg);
+ $msg = str_replace("%(adminaddr)s","$liste-owner@{$globals->mail->domain}", $msg);
$msg = str_replace("%(request)s","<< SUJET DU MAIL >>", $msg);
$msg = str_replace("%(reason)s","<< TON EXPLICATION >>", $msg);
$msg = str_replace("%(listname)s","$liste", $msg);
require_once("xorg.inc.php");
new_skinned_page('listes/options.tpl', AUTH_MDP);
-require_once('xml-rpc-client.inc.php');
+require_once('lists.inc.php')
-$client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
+$client =& lists_xmlrpc($_SESSION['uid'], $_SESSION['password']);
if(isset($_POST['submit'])) {
$values =array_map('stripslashes',$_POST);
require_once("xorg.inc.php");
new_admin_page('listes/soptions.tpl');
-require_once('xml-rpc-client.inc.php');
+require_once('lists.inc.php')
-$client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
+$client =& lists_xmlrpc($_SESSION['uid'], $_SESSION['password']);
if(isset($_POST['submit'])) {
$values = array_map('stripslashes', $_POST);
require_once("xorg.inc.php");
new_skinned_page('listes/trombi.tpl', AUTH_COOKIE);
-require_once('xml-rpc-client.inc.php');
require_once("trombi.inc.php");
+require_once('lists.inc.php')
+
+$client =& lists_xmlrpc($_SESSION['uid'], $_SESSION['password']);
-$client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
if(isset($_GET['del'])) {
$client->unsubscribe($liste);
header("Location: ?liste=$liste");
$publicite = array_chunk( $publicite , $pub_nbLig , true ) ;
$page->assign_by_ref('publicite', $publicite);
-
// affichage des evenements
// annonces promos triées par présence d'une limite sur les promos
// puis par dates croissantes d'expiration
class ListsConfig
{
var $rpchost = 'localhost';
- var $rpcport = 119;
+ var $rpcport = 4949;
var $spool = '/var/spool/platal/archives/';
}
--- /dev/null
+<?php
+$this->addPrivateEntry(XOM_SERVICES, 20, 'Listes de diffusion', 'listes/');
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 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 SkinConfig
+
+class MailConfig
+{
+ var $domain = 'polytechnique.org';
+}
+
+// }}}
+
+$this->mail = new MailConfig;
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+?>
$this->addPrivateEntry(XOM_CUSTOM, 50, 'Mes préférences', 'preferences.php');
$this->addPrivateEntry(XOM_SERVICES, 00, 'Envoyer un mail', 'sendmail.php');
-$this->addPrivateEntry(XOM_SERVICES, 20, 'Listes de diffusion', 'listes/');
$this->addPrivateEntry(XOM_SERVICES, 30, 'Envoyer un mail', 'sendmail.php');
$this->addPrivateEntry(XOM_SERVICES, 40, 'Patte cassée', 'pattecassee.php');
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 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 *
+ ***************************************************************************/
+
+// {{{ import class definitions
+
+require_once("xml-rpc-client.inc.php");
+
+// }}}
+// {{{ function lists_xmlrpc
+
+function &lists_xmlrpc($uid, $pass, $fqdn=null)
+{
+ global $globals;
+
+ $dom = empty($fqdn) ? $globals->mail->domain;
+ $url = "http://$uid:$pass/{$globals->lists->rpchost}:{$globals->lists->rpcport}/$dom";
+ $client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
+ return $client;
+}
+
+// }}}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+?>
$mailer = new HermesMailer();
$mailer->setFrom($globals->newsletter->from);
$mailer->setSubject($this->title());
- $mailer->addTo("\"$prenom $nom\" <$login@polytechnique.org>");
+ $mailer->addTo("\"$prenom $nom\" <$login@{$globals->mail->domain}>");
if (!empty($globals->newsletter->replyto)) {
$mailer->addHeader('Reply-To',$globals->newsletter->replyto);
}
$globals->db->query("DELETE FROM newsletter_ins WHERE user_id={$_SESSION['uid']}");
}
-function subscribe_nl($html=true)
+function subscribe_nl($html=true, $uid=-1)
{
global $globals;
+ $user = $uid == -1 ? $_SESSION['uid'] : $uid;
$format = $html ? 'html' : 'text';
$globals->db->query("REPLACE INTO newsletter_ins (user_id,last,pref)
- SELECT {$_SESSION['uid']}, MAX(id), '$format'
+ SELECT '$user', MAX(id), '$format'
FROM newsletter WHERE bits!='new'");
}
$globals->db->query("delete from user_changes where user_id=$uid");
$globals->db->query("delete from watch_sub where uid=$uid");
- require_once('xml-rpc-client.inc.php');
- $client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
- $client->kill($alias, $really_del);
-}
-
-// }}}
-// {{{ function inscription_listes_base()
-
-/** inscrit l'uid donnée à la promo
- * @param $uid UID
- * @param $promo promo
- * @return reponse MySQL
- * @see admin/RegisterNewUser.php
- * @see step4.php
- */
-function inscription_listes_base($uid,$pass,$promo)
-{
- require_once('xml-rpc-client.inc.php');
- global $globals;
- // récupération de l'id de la liste promo
- $client = new xmlrpc_client("http://$uid:$pass@localhost:4949/polytechnique.org");
- $client->subscribe("promo$promo");
+ include_once('lists.inc.php');
+ if (function_exists(lists_xmlrpc)) {
+ $client =& lists_xmlrpc($_SESSION['uid'], $_SESSION['password']);
+ $client->kill($alias, $really_del);
+ }
}
// }}}
- Notes for the skin module for plat/al
+ Notes for the banana module for plat/al
STATUS
--- /dev/null
+
+ Notes for the lists module for plat/al
+
+
+CONFIG OPTIONS
+--------------
+
+ All settings of the module are shown here with their default and meaning
+
+ [lists]
+
+ rpchost = "localhost" ; the host that runs the xml-rpc
+ rpcport = 4949 ; the port for the xml-rpc server
+
+ spool = "/var/spool/platal/archives/"
+ ; the directory that holds mhonarc archives
+
+MAILMAN CONFIG
+--------------
+
+add in /etc/mailman/mm_cfg.py
+
+ MYSQL_USER = <your mysql user here>
+ MYSQL_PASS = <your mysql pass here>
+ ADMIN_ML_OWNER = <the owner of admin ML's>
+ SENDER_HEADERS = ('X-Org-Mail', 'from', None, 'reply-to', 'sender')
+
+
+BUGS
+----
+
+ http://trackers.polytechnique.org/index.php?cat=15
+
+
+DEPENDS
+-------
+
+ platal, mail
+ + mailman
+ + python-mysql
+ + mhonarc
+
-bin/mailman/foreach_template.py
-bin/mailman/mailman-rpc.py
-bin/mailman/mhonarc_by_month.pl
-bin/mailman/mhonarc_pipe.sh
+bin/lists.mhonarc_by_month.pl
+bin/lists.mhonarc_pipe.sh
+bin/lists.rpc.py
+hooks/core/lists.inc.php
htdocs/admin/lists.php
htdocs/images/lists_date.png
htdocs/images/lists_firstia.png
htdocs/listes/options.php
htdocs/listes/soptions.php
htdocs/listes/trombi.php
+include/conf.d/lists.globals.inc.php
+include/conf.d/lists.menu.inc.php
+include/lists.inc.php
include/validations/listes.inc.php
templates/admin/lists.tpl
templates/include/form.valid.listes.tpl
templates/include/form.valid.ml.tpl
templates/listes/admin.tpl
+templates/listes/archives.head.tpl
templates/listes/archives.tpl
templates/listes/check.tpl
templates/listes/create.tpl
</LITemplate>
-<!-- vim:set syntax=mhonarc:sw=2: -->
-
<!-- ------------------------------------------------------------------------ -->
-<!-- vim:set syntax=mhonarc:sw=2: -->
bin/devel/modules_status
bin/devel/tplgettext.php
+bin/devel/lists.foreach_template.py
bin/xhtml/get_classes.pl
bin/xhtml/validate.pl
</h1>
{dynamic}
-{if !$smarty.post}
+{if !$smarty.post.action}
<p class="normal">
Tu peux régler quelques paramètres qui apparaîtront sur les messages lorsque
<h1>
Lettre de Polytechnique.org
</h1>
-<p>
-Tu trouveras ici les archives de la lettre d'information de Polytechnique.org. Pour t'abonner à
-cette lettre, il te suffit de te <a href="{"listes/"|url}">rendre sur la page des listes</a>.
-</p>
<p>
<strong>Pour demander l'ajout d'une annonce dans la prochaine lettre mensuelle</strong>,
echo "BE CAREFUL :
* scripts/ is now essentially in bin/
- (with for this release, the inner path unchanged)
--> have to modify crons
--> have to modify xml-rpc path in the daemontools