function lists_menu()
{
global $globals;
- $globals->menu->addPrivateEntry(XOM_SERVICES, 20, 'Listes de diffusion', 'listes/');
+ $globals->menu->addPrivateEntry(XOM_SERVICES, 20, 'Listes de diffusion', 'lists');
}
// }}}
require_once dirname(__FILE__).'/../classes/PLModule.php';
$platal = new Platal('auth', 'banana', 'carnet', 'email', 'events', 'geoloc',
- 'marketing', 'payment', 'platal', 'profile', 'register',
- 'search', 'stats', 'trezo');
+ 'lists', 'marketing', 'payment', 'platal', 'profile',
+ 'register', 'search', 'stats', 'trezo');
$platal->run();
?>
+++ /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 *
- ***************************************************************************/
-
-if (!$page) {
- require_once("xorg.inc.php");
- if (!Env::has('liste')) redirect('index.php');
- $liste = strtolower(Env::get('liste'));
- $domain = $globals->mail->domain;
-
- new_skinned_page('listes/admin.tpl', AUTH_MDP);
- require_once('lists.inc.php');
-
- $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
-}
-
-if (Env::has('add_member')) {
-
- require_once('user.func.inc.php');
- $members = explode(' ', Env::get('add_member'));
- if ($members) foreach ($members as $i => $alias) {
- if (($login = get_user_forlife($alias)) !== false) {;
- $members[$i] = $login;
- }
- }
-
- $arr = $client->mass_subscribe($liste, $members);
- if (is_array($arr)) {
- foreach($arr as $addr) {
- $page->trig("{$addr[0]} inscrit.");
- }
- }
-}
-
-if (Env::has('del_member')) {
- if (strpos(Env::get('del_member'), '@') === false) {
- $client->mass_unsubscribe($liste, Array(Env::get('del_member').'@'.$globals->mail->domain));
- } else {
- $client->mass_unsubscribe($liste, Array(Env::get('del_member')));
- }
- redirect("{$_SERVER['PHP_SELF']}?liste=$liste");
-}
-
-if (Env::has('add_owner')) {
- require_once('user.func.inc.php');
-
- $owners = explode(' ', Env::get('add_owner'));
-
- if ($owners) foreach ($owners as $alias) {
- if (($login = get_user_forlife($alias)) === false) {;
- $login = $alias;
- }
-
- if($client->add_owner($liste, $login)) {
- $page->trig($alias." ajouté aux modérateurs.");
- }
- }
-}
-
-if (Env::has('del_owner')) {
- if (strpos(Env::get('del_owner'), '@') === false) {
- $client->del_owner($liste, Env::get('del_owner').'@'.$globals->mail->domain);
- } else {
- $client->del_owner($liste, Env::get('del_owner'));
- }
- redirect("{$_SERVER['PHP_SELF']}?liste=$liste");
-}
-
-if(list($det,$mem,$own) = $client->get_members($liste)) {
-
- $membres = list_sort_members($mem, $tri_promo);
- $moderos = list_sort_owners($own, $tri_promo);
-
- $page->assign_by_ref('details', $det);
- $page->assign_by_ref('members', $membres);
- $page->assign_by_ref('owners', $moderos);
- $page->assign('np_m', count($mem));
-
-} else {
- $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer");
-}
-
-$page->run();
-?>
+++ /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 *
- ***************************************************************************/
-
-if (!$page) {
- require_once("xorg.inc.php");
- if (!Env::has('liste')) redirect('index.php');
- $liste = strtolower(Env::get('liste'));
- $domain = $globals->mail->domain;
-
- new_skinned_page('listes/archives.tpl', AUTH_COOKIE);
- require_once('lists.inc.php');
-
- $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
-}
-
-$page->addCssLink('css/lists.archives.css');
-if (list($det) = $client->get_members($liste)) {
- if ( substr($liste,0,5) != 'promo' && ( $det['ins'] || $det['priv'] ) && !$det['own'] && ($det['sub']<2) ) {
- $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter");
- } elseif (Get::has('file')) {
- $file = Get::get('file');
- $rep = Get::get('rep');
- if(strstr('/', $file)!==false || !preg_match(',^\d+/\d+$,', $rep)) {
- $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter");
- } else {
- $page->assign('archives', $globals->lists->spool."/{$domain}{$globals->lists->vhost_sep}$liste/$rep/$file");
- }
- } else {
- $archs = Array();
- foreach (glob($globals->lists->spool."/{$domain}{$globals->lists->vhost_sep}$liste/*/*") as $rep) {
- if (preg_match(",/(\d*)/(\d*)$,", $rep, $matches)) {
- $archs[intval($matches[1])][intval($matches[2])] = true;
- }
- }
- $page->assign('archs', $archs);
- $page->assign('range', range(1,12));
- }
-} else {
- $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter");
-}
-
-$page->run();
-?>
+++ /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 *
- ***************************************************************************/
-
-if (!$page) {
- require_once("xorg.inc.php");
- if (!Env::has('liste')) redirect('index.php');
- $liste = strtolower(Env::get('liste'));
-
- new_admin_page('listes/check.tpl');
- require_once('lists.inc.php');
-
- $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
-}
-
-if(Post::has('correct')) {
- $client->check_options($liste, true);
-}
-
-if(list($details,$options) = $client->check_options($liste)) {
- $page->assign_by_ref('details', $details);
- $page->assign_by_ref('options', $options);
-} else {
- $page->kill("La liste n'existe pas");
-}
-
-$page->run();
-?>
+++ /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 *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-new_skinned_page('listes/create.tpl', AUTH_MDP);
-
-$owners = preg_split("/[\s]+/", Post::get('owners'), -1, PREG_SPLIT_NO_EMPTY);
-$members = preg_split("/[\s]+/", Post::get('members'), -1, PREG_SPLIT_NO_EMPTY);
-
-// click on validate button 'add_owner_sub' or type <enter>
-if (Post::has('add_owner_sub') && Post::has('add_owner')) {
- require_once('user.func.inc.php');
- // if we want to add an owner and then type <enter>, then both add_owner_sub and add_owner are filled.
- if (Post::get('add_owner') != "") {
- if (($forlife = get_user_forlife(Post::get('add_owner'))) !== false) {
- $owners [] = $forlife;
- }
- // if we want to add a member and then type <enter>, then add_owner_sub is filled, whereas add_owner is empty.
- } else if (Post::has('add_member')) {
- if (($forlife = get_user_forlife(Post::get('add_member'))) !== false) {
- $members[] = $forlife;
- }
- }
-}
-
-// click on validate button 'add_member_sub'
-if (Post::has('add_member_sub') && Post::has('add_member')) {
- require_once('user.func.inc.php');
- if (($forlife = get_user_forlife(Post::get('add_member'))) !== false) {
- $members[] = $forlife;
- }
-}
-
-ksort($owners); array_unique($owners);
-ksort($members); array_unique($members);
-
-if (Post::has('submit')) {
-
- $liste = Post::get('liste');
-
- if(empty($liste)) {
- $page->trig('champs «addresse souhaitée» vide');
- }
- if(!preg_match("/^[a-zA-Z0-9\-]*$/", $liste)) {
- $page->trig('le nom de la liste ne doit contenir que des lettres, chiffres et tirets');
- }
-
- $res = $globals->xdb->query("SELECT COUNT(*) FROM aliases WHERE alias={?}", $liste);
- $n = $res->fetchOneCell();
-
- if($n) {
- $page->trig('cet alias est déjà pris');
- }
-
- if(!Post::get(desc)) {
- $page->trig('le sujet est vide');
- }
-
- if(!count($owners)) {
- $page->trig('pas de gestionnaire');
- }
-
- if(count($members)<4) {
- $page->trig('pas assez de membres');
- }
-
- if (!$page->nb_errs()) {
- $page->assign('created', true);
- require_once('validations.inc.php');
- $req = new ListeReq(Session::getInt('uid'), $liste, Post::get('desc'),
- Post::getInt('advertise'), Post::getInt('modlevel'), Post::getInt('inslevel'),
- $owners, $members);
- $req->submit();
- }
-}
-
-$page->assign('owners', join(' ', $owners));
-$page->assign('members', join(' ', $members));
-$page->run();
-?>
+++ /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 *
- ***************************************************************************/
-
-if (!$page) {
- require_once("xorg.inc.php");
- if (!Env::has('liste')) redirect('index.php');
- $liste = strtolower(Env::get('liste'));
-
- new_skinned_page('listes/delete.tpl', AUTH_MDP);
- require_once('lists.inc.php');
-
- $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
-}
-
-if ( Post::get('valid') == 'OUI' && $client->delete_list($liste, Post::getBool('del_archive')) ) {
- foreach (array('', '-owner', '-admin', '-bounces') as $app) {
- $globals->xdb->execute("DELETE FROM aliases
- WHERE type='liste' AND alias='{?}'",
- $ml.$app);
- }
- $page->assign('deleted', true);
-} elseif (list($details,$options) = $client->get_owner_options($liste)) {
- $page->assign_by_ref('details', $details);
- $page->assign_by_ref('options', $options);
- $page->assign('bogo_level', $client->get_bogo_level($liste));
-} else {
- $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer");
-}
-
-$page->run();
-?>
+++ /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 *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-new_skinned_page('listes/index.tpl', AUTH_MDP);
-$page->assign('xorg_title','Polytechnique.org - Listes de diffusion');
-require_once('lists.inc.php');
-
-$client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
-
-if(Get::has('del')) {
- $client->unsubscribe(Get::get('del'));
- redirect('index.php');
-}
-if(Get::has('add')) {
- $client->subscribe(Get::get('add'));
- redirect('index.php');
-}
-if(Post::has('promo_add')) {
- $promo = Post::getInt('promo_add');
- if ($promo>=1900 and $promo<2100) {
- $client->subscribe("promo$promo");
- } else {
- $page->trig("promo incorrecte, il faut une promo sur 4 chiffres.");
- }
-}
-$listes = $client->get_lists();
-$page->assign_by_ref('listes',$listes);
-$page->run();
-?>
+++ /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 *
- ***************************************************************************/
-
-if (!$page) {
- require_once("xorg.inc.php");
- if (!Env::has('liste')) redirect('index.php');
- $liste = strtolower(Env::get('liste'));
-
- new_skinned_page('listes/members.tpl', AUTH_COOKIE);
- require_once('lists.inc.php');
-
- $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
-}
-
-if(Get::has('del')) {
- $client->unsubscribe($liste);
- redirect("{$_SERVER['PHP_SELF']}?liste=$liste");
-}
-if(Get::has('add')) {
- $client->subscribe($liste);
- redirect("{$_SERVER['PHP_SELF']}?liste=$liste");
-}
-$members = $client->get_members($liste);
-
-$tri_promo = !Env::getBool('alpha');
-
-if(list($det,$mem,$own) = $members) {
- $membres = list_sort_members($mem, $tri_promo);
- $moderos = list_sort_owners($own, $tri_promo);
-
- $page->assign_by_ref('details', $det);
- $page->assign_by_ref('members', $membres);
- $page->assign_by_ref('owners', $moderos);
- $page->assign('nb_m', count($mem));
-
-} else {
- $page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails");
-}
-
-$page->run();
-?>
+++ /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 *
- ***************************************************************************/
-
-if (!$page) {
- require_once("xorg.inc.php");
- if (!Env::has('liste')) redirect('index.php');
- $liste = strtolower(Env::get('liste'));
- $domain = $globals->mail->domain;
-
- if (preg_match("!(?:[a-z0-9]+\\.)?{$domain}_(.*)!", $liste, $matches)) {
- redirect("{$_SERVER['PHP_SELF']}?liste={$matches[1]}");
- }
-
- new_skinned_page('listes/moderate.tpl', AUTH_MDP);
- require_once('lists.inc.php');
-
- $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
-}
-
-$page->register_modifier('qpd','quoted_printable_decode');
-
-if(Env::has('sadd')) {
- $client->handle_request($liste,Env::get('sadd'),4,''); /* 4 = SUBSCRIBE */
- redirect("{$_SERVER['PHP_SELF']}?liste=$liste");
-}
-
-if(Post::has('sdel')) {
- $client->handle_request($liste,Post::get('sdel'),2,Post::get('reason')); /* 2 = REJECT */
-}
-
-if(Env::has('mid')) {
- $mid = Env::get('mid');
- $mail = $client->get_pending_mail($liste, $mid);
- $reason = '';
-
- $prenom = Session::get('prenom');
- $nom = Session::get('nom');
-
-
- if (Env::has('mok')) {
- $action = 1; /** 2 = ACCEPT **/
- $subject = "Message accepté";
- $append .= "a été accepté par $prenom $nom.\n";
- } elseif (Env::has('mno')) {
- $action = 2; /** 2 = REJECT **/
- $subject = "Message refusé";
- $reason = Post::get('reason');
- $append = "a été refusé par $prenom $nom avec la raison :\n\n"
- . $reason;
- } elseif (Env::has('mdel')) {
- $action = 3; /** 3 = DISCARD **/
- $subject = "Message supprimé";
- $append = "a été supprimé par $prenom $nom.\n\n"
- . "Rappel: il ne faut utiliser cette opération que dans le cas de spams ou de virus !\n";
- }
-
- if (isset($action) && $client->handle_request($liste, $mid, $action, $reason)) {
- $texte = "le message suivant :\n\n"
- ." Auteur: {$mail['sender']}\n"
- ." Sujet : « {$mail['subj']} »\n"
- ." Date : ".strftime("le %d %b %Y à %H:%M:%S", (int)$mail['stamp'])."\n\n"
- .$append;
- require_once('diogenes/diogenes.hermes.inc.php');
- $mailer = new HermesMailer();
- $mailer->addTo("$liste-owner@{$domain}");
- $mailer->setFrom("$liste-bounces@{$domain}");
- $mailer->addHeader('Reply-To', "$liste-owner@{$domain}");
- $mailer->setSubject($subject);
- $mailer->setTxtBody(wordwrap($texte,72));
- $mailer->send();
- Get::kill('mid');
- }
-
- if(Get::has('mid') && is_array($mail)) {
- $msg = file_get_contents('/etc/mailman/fr/refuse.txt');
- $msg = str_replace("%(adminaddr)s","$liste-owner@{$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);
- $page->assign('msg', $msg);
-
- $page->changeTpl('listes/moderate_mail.tpl');
- $page->assign_by_ref('mail', $mail);
- $page->run();
- }
-
-} elseif (Env::has('sid')) {
-
- if(list($subs,$mails) = $client->get_pending_ops($liste)) {
- foreach($subs as $user) {
- if ($user['id'] == Env::get('sid')) {
- $page->changeTpl('listes/moderate_sub.tpl');
- $page->assign('del_user',$user);
- $page->run();
- }
- }
- }
-
-}
-
-if(list($subs,$mails) = $client->get_pending_ops($liste)) {
- $page->assign_by_ref('subs', $subs);
- $page->assign_by_ref('mails', $mails);
-} else {
- $page->kill("La liste n'existe pas ou tu n'as pas le droit de la modérer");
-}
-
-$page->run();
-?>
+++ /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 *
- ***************************************************************************/
-
-if (!$page) {
- require_once("xorg.inc.php");
- if (!Env::has('liste')) redirect('index.php');
- $liste = strtolower(Env::get('liste'));
-
- new_skinned_page('listes/options.tpl', AUTH_MDP);
- require_once('lists.inc.php');
-
- $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
-}
-
-if (Post::has('submit')) {
- $values = $_POST;
- $client->set_bogo_level($liste, intval($values['bogo_level']));
- switch($values['moderate']) {
- case '0':
- $values['generic_nonmember_action'] = 0;
- $values['default_member_moderation'] = 0;
- break;
- case '1':
- $values['generic_nonmember_action'] = 1;
- $values['default_member_moderation'] = 0;
- break;
- case '2':
- $values['generic_nonmember_action'] = 1;
- $values['default_member_moderation'] = 1;
- break;
- }
- unset($values['submit'], $values['bogo_level'], $values['moderate']);
- $values['send_goodbye_msg'] = !empty($values['send_goodbye_msg']);
- $values['admin_notify_mchanges'] = !empty($values['admin_notify_mchanges']);
- $values['subscribe_policy'] = empty($values['subscribe_policy']) ? 0 : 2;
- if (isset($values['subject_prefix'])) {
- $values['subject_prefix'] = trim($values['subject_prefix']).' ';
- }
- $client->set_owner_options($liste, $values);
-} elseif (isvalid_email(Post::get('atn_add'))) {
- $client->add_to_wl($liste, Post::get('atn_add'));
-} elseif (Get::has('atn_del')) {
- $client->del_from_wl($liste, Get::get('atn_del'));
- redirect("{$_SERVER['PHP_SELF']}?liste=$liste");
-}
-
-if(list($details,$options) = $client->get_owner_options($liste)) {
- $page->assign_by_ref('details', $details);
- $page->assign_by_ref('options', $options);
- $page->assign('bogo_level', $client->get_bogo_level($liste));
-} else {
- $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer");
-}
-
-$page->run();
-?>
+++ /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 *
- ***************************************************************************/
-
-if (!$page) {
- require_once("xorg.inc.php");
- if (!Env::has('liste')) redirect('index.php');
- $liste = strtolower(Env::get('liste'));
-
- new_admin_page('listes/soptions.tpl');
- require_once('lists.inc.php');
-
- $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
-}
-
-if(Post::has('submit')) {
- $values = $_POST;
- unset($values['submit']);
- $values['advertised'] = empty($values['advertised']) ? false : true;
- $values['archive'] = empty($values['archive']) ? false : true;
- $client->set_admin_options($liste, $values);
-}
-
-if(list($details,$options) = $client->get_admin_options($liste)) {
- $page->assign_by_ref('details', $details);
- $page->assign_by_ref('options', $options);
-} else {
- $page->kill("La liste n'existe pas");
-}
-
-$page->run();
-?>
+++ /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 *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-if (!Env::has('liste')) redirect('index.php');
-$liste = strtolower(Env::get('liste'));
-
-new_skinned_page('listes/trombi.tpl', AUTH_COOKIE);
-require_once("trombi.inc.php");
-require_once('lists.inc.php');
-
-$client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
-
-if(Get::has('del')) {
- $client->unsubscribe($liste);
- redirect("{$_SERVER['PHP_SELF']}?liste=$liste");
-}
-if(Get::has('add')) {
- $client->subscribe($liste);
- redirect("{$_SERVER['PHP_SELF']}?liste=$liste");
-}
-
-function getList($offset,$limit)
-{
- global $client, $globals;
- $liste = Env::get('liste');
- list($total,$members) = $client->get_members_limit($liste,$offset,$limit);
-
- $membres = Array();
- foreach ($members as $member) {
- list($m) = explode('@',$member[1]);
- $res = $globals->xdb->query("SELECT prenom,IF(nom_usage='', nom, nom_usage) AS nom, promo, a.alias AS forlife
- FROM auth_user_md5 AS u
- INNER JOIN aliases AS a ON u.user_id = a.id
- WHERE a.alias = {?}", $m);
- if ($tmp = $res->fetchOneAssoc()) {
- $membres[$tmp['nom']] = $tmp;
- } else {
- $membres[$member[0]] = Array('addr' => $member[0]);
- }
- }
- return Array($total,$membres);
-}
-
-$owners = $client->get_owners($liste);
-
-if(is_array($owners)) {
- $moderos = list_sort_owners($owners[1]);
-
- $page->assign_by_ref('details', $owners[0]);
- $page->assign_by_ref('owners', $moderos);
-
- $trombi = new Trombi('getList');
- $page->assign_by_ref('trombi',$trombi);
-} else {
- $page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails");
-}
-
-$page->run();
-?>
--- /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 ListsModule extends PLModule
+{
+ var $client;
+
+ function handlers()
+ {
+ return array(
+ 'lists' => $this->make_hook('lists', AUTH_MDP),
+ 'lists/create' => $this->make_hook('create', AUTH_MDP),
+
+ 'lists/members' => $this->make_hook('members', AUTH_COOKIE),
+ 'lists/trombi' => $this->make_hook('trombi', AUTH_COOKIE),
+ 'lists/archives' => $this->make_hook('archives', AUTH_COOKIE),
+
+ 'lists/moderate' => $this->make_hook('moderate', AUTH_MDP),
+ 'lists/admin' => $this->make_hook('admin', AUTH_MDP),
+ 'lists/options' => $this->make_hook('options', AUTH_MDP),
+ 'lists/delete' => $this->make_hook('delete', AUTH_MDP),
+
+ 'lists/soptions' => $this->make_hook('soptions', AUTH_MDP),
+ 'lists/check' => $this->make_hook('check', AUTH_MDP),
+ );
+ }
+
+ function prepare_client()
+ {
+ require_once 'lists.inc.php';
+
+ $this->client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'));
+ }
+
+ function handler_lists(&$page)
+ {
+ global $globals;
+
+ $this->prepare_client();
+
+ $page->changeTpl('listes/index.tpl');
+ $page->assign('xorg_title','Polytechnique.org - Listes de diffusion');
+
+
+ if (Get::has('del')) {
+ $this->client->unsubscribe(Get::get('del'));
+ redirect('lists');
+ }
+ if (Get::has('add')) {
+ $this->client->subscribe(Get::get('add'));
+ redirect('lists');
+ }
+ if (Post::has('promo_add')) {
+ $promo = Post::getInt('promo_add');
+ if ($promo >= 1900 and $promo < 2100) {
+ $this->client->subscribe("promo$promo");
+ } else {
+ $page->trig("promo incorrecte, il faut une promo sur 4 chiffres.");
+ }
+ }
+ $listes = $this->client->get_lists();
+ $page->assign_by_ref('listes', $listes);
+ }
+
+ function handler_create(&$page)
+ {
+ global $globals;
+ $page->changeTpl('listes/create.tpl');
+
+ $owners = preg_split("/[\s]+/", Post::get('owners'), -1, PREG_SPLIT_NO_EMPTY);
+ $members = preg_split("/[\s]+/", Post::get('members'), -1, PREG_SPLIT_NO_EMPTY);
+
+ // click on validate button 'add_owner_sub' or type <enter>
+ if (Post::has('add_owner_sub') && Post::has('add_owner')) {
+ require_once('user.func.inc.php');
+ // if we want to add an owner and then type <enter>, then both
+ // add_owner_sub and add_owner are filled.
+ if (Post::get('add_owner') != "") {
+ if (($forlife = get_user_forlife(Post::get('add_owner'))) !== false) {
+ $owners [] = $forlife;
+ }
+ // if we want to add a member and then type <enter>, then
+ // add_owner_sub is filled, whereas add_owner is empty.
+ } else if (Post::has('add_member')) {
+ if (($forlife = get_user_forlife(Post::get('add_member'))) !== false) {
+ $members[] = $forlife;
+ }
+ }
+ }
+
+ // click on validate button 'add_member_sub'
+ if (Post::has('add_member_sub') && Post::has('add_member')) {
+ require_once('user.func.inc.php');
+ if (($forlife = get_user_forlife(Post::get('add_member'))) !== false) {
+ $members[] = $forlife;
+ }
+ }
+
+ ksort($owners); array_unique($owners);
+ ksort($members); array_unique($members);
+
+ $page->assign('owners', join(' ', $owners));
+ $page->assign('members', join(' ', $members));
+
+ if (!Post::has('submit')) {
+ return;
+ }
+
+ $liste = Post::get('liste');
+
+ if (empty($liste)) {
+ $page->trig('champs «addresse souhaitée» vide');
+ }
+ if (!preg_match("/^[a-zA-Z0-9\-]*$/", $liste)) {
+ $page->trig('le nom de la liste ne doit contenir que des lettres, chiffres et tirets');
+ }
+
+ $res = $globals->xdb->query("SELECT COUNT(*) FROM aliases WHERE alias={?}", $liste);
+ $n = $res->fetchOneCell();
+
+ if ($n) {
+ $page->trig('cet alias est déjà pris');
+ }
+
+ if (!Post::get(desc)) {
+ $page->trig('le sujet est vide');
+ }
+
+ if (!count($owners)) {
+ $page->trig('pas de gestionnaire');
+ }
+
+ if (count($members)<4) {
+ $page->trig('pas assez de membres');
+ }
+
+ if (!$page->nb_errs()) {
+ $page->assign('created', true);
+ require_once 'validations.inc.php';
+ $req = new ListeReq(Session::getInt('uid'), $liste,
+ Post::get('desc'), Post::getInt('advertise'),
+ Post::getInt('modlevel'), Post::getInt('inslevel'),
+ $owners, $members);
+ $req->submit();
+ }
+ }
+
+ function handler_members(&$page, $liste = null)
+ {
+ global $globals;
+
+ if (is_null($liste)) {
+ return PL_NOT_FOUND;
+ }
+
+ $this->prepare_client();
+
+ $page->changeTpl('listes/members.tpl');
+
+ if (Get::has('del')) {
+ $this->client->unsubscribe($liste);
+ redirect($liste);
+ }
+
+ if (Get::has('add')) {
+ $this->client->subscribe($liste);
+ redirect($liste);
+ }
+
+ $members = $this->client->get_members($liste);
+
+ $tri_promo = !Env::getBool('alpha');
+
+ if (list($det,$mem,$own) = $members) {
+ $membres = list_sort_members($mem, $tri_promo);
+ $moderos = list_sort_owners($own, $tri_promo);
+
+ $page->assign_by_ref('details', $det);
+ $page->assign_by_ref('members', $membres);
+ $page->assign_by_ref('owners', $moderos);
+ $page->assign('nb_m', count($mem));
+ } else {
+ $page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails");
+ }
+ }
+
+ function _get_list($offset, $limit)
+ {
+ global $globals, $platal;
+ list($total, $members) = $this->client->get_members_limit($platal->argv[1], $offset, $limit);
+
+ $membres = Array();
+ foreach ($members as $member) {
+ list($m) = explode('@',$member[1]);
+ $res = $globals->xdb->query("SELECT prenom,if (nom_usage='', nom, nom_usage) AS nom,
+ promo, a.alias AS forlife
+ FROM auth_user_md5 AS u
+ INNER JOIN aliases AS a ON u.user_id = a.id
+ WHERE a.alias = {?}", $m);
+ if ($tmp = $res->fetchOneAssoc()) {
+ $membres[$tmp['nom']] = $tmp;
+ } else {
+ $membres[$member[0]] = array('addr' => $member[0]);
+ }
+ }
+ return array($total, $membres);
+ }
+
+ function handler_trombi(&$page, $liste = null)
+ {
+ global $globals;
+
+ if (is_null($liste)) {
+ return PL_NOT_FOUND;
+ }
+
+ $this->prepare_client();
+
+ $page->changeTpl('listes/trombi.tpl');
+
+ if (Get::has('del')) {
+ $this->client->unsubscribe($liste);
+ redirect($liste);
+ }
+ if (Get::has('add')) {
+ $this->client->subscribe($liste);
+ redirect($liste);
+ }
+
+ $owners = $this->client->get_owners($liste);
+
+ if (is_array($owners)) {
+ require_once 'trombi.inc.php';
+ $moderos = list_sort_owners($owners[1]);
+
+ $page->assign_by_ref('details', $owners[0]);
+ $page->assign_by_ref('owners', $moderos);
+
+ $trombi = new Trombi(array(&$this, '_get_list'));
+ $page->assign('trombi', $trombi);
+ } else {
+ $page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails");
+ }
+ }
+
+ function handler_archives(&$page, $liste = null)
+ {
+ global $globals;
+
+ if (is_null($liste)) {
+ return PL_NOT_FOUND;
+ }
+
+ $this->prepare_client();
+
+ $page->changeTpl('listes/archives.tpl');
+
+ $page->addCssLink('css/lists.archives.css');
+ if (list($det) = $this->client->get_members($liste)) {
+ if (substr($liste,0,5) != 'promo' && ($det['ins'] || $det['priv'])
+ && !$det['own'] && ($det['sub'] < 2))
+ {
+ $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter");
+ } elseif (Get::has('file')) {
+ $file = Get::get('file');
+ $rep = Get::get('rep');
+ if (strstr('/', $file)!==false || !preg_match(',^\d+/\d+$,', $rep)) {
+ $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter");
+ } else {
+ $page->assign('archives', $globals->lists->spool
+ ."/{$domain}{$globals->lists->vhost_sep}$liste/$rep/$file");
+ }
+ } else {
+ $archs = Array();
+ foreach (glob($globals->lists->spool
+ ."/{$domain}{$globals->lists->vhost_sep}$liste/*/*") as $rep)
+ {
+ if (preg_match(",/(\d*)/(\d*)$,", $rep, $matches)) {
+ $archs[intval($matches[1])][intval($matches[2])] = true;
+ }
+ }
+ $page->assign('archs', $archs);
+ $page->assign('range', range(1,12));
+ }
+ } else {
+ $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter");
+ }
+ }
+
+ function handler_moderate(&$page, $liste = null)
+ {
+ global $globals;
+
+ if (is_null($liste)) {
+ return PL_NOT_FOUND;
+ }
+
+ $this->prepare_client();
+
+ $page->changeTpl('listes/moderate.tpl');
+
+ $page->register_modifier('qpd', 'quoted_printable_decode');
+
+ if (Env::has('sadd')) { /* 4 = SUBSCRIBE */
+ $this->client->handle_request($liste,Env::get('sadd'),4,'');
+ redirect($liste);
+ }
+
+ if (Post::has('sdel')) { /* 2 = REJECT */
+ $this->client->handle_request($liste,Post::get('sdel'),2,Post::get('reason'));
+ }
+
+ if (Env::has('mid')) {
+ $mid = Env::get('mid');
+ $mail = $this->client->get_pending_mail($liste, $mid);
+ $reason = '';
+
+ $prenom = Session::get('prenom');
+ $nom = Session::get('nom');
+
+ if (Env::has('mok')) {
+ $action = 1; /** 2 = ACCEPT **/
+ $subject = "Message accepté";
+ $append .= "a été accepté par $prenom $nom.\n";
+ } elseif (Env::has('mno')) {
+ $action = 2; /** 2 = REJECT **/
+ $subject = "Message refusé";
+ $reason = Post::get('reason');
+ $append = "a été refusé par $prenom $nom avec la raison :\n\n"
+ . $reason;
+ } elseif (Env::has('mdel')) {
+ $action = 3; /** 3 = DISCARD **/
+ $subject = "Message supprimé";
+ $append = "a été supprimé par $prenom $nom.\n\n"
+ . "Rappel: il ne faut utiliser cette opération "
+ . "que dans le cas de spams ou de virus !\n";
+ }
+
+ if (isset($action) && $this->client->handle_request($liste, $mid, $action, $reason)) {
+ $texte = "le message suivant :\n\n"
+ ." Auteur: {$mail['sender']}\n"
+ ." Sujet : « {$mail['subj']} »\n"
+ ." Date : ".strftime("le %d %b %Y à %H:%M:%S", (int)$mail['stamp'])."\n\n"
+ .$append;
+ require_once 'diogenes/diogenes.hermes.inc.php';
+ $mailer = new HermesMailer();
+ $mailer->addTo("$liste-owner@{$domain}");
+ $mailer->setFrom("$liste-bounces@{$domain}");
+ $mailer->addHeader('Reply-To', "$liste-owner@{$domain}");
+ $mailer->setSubject($subject);
+ $mailer->setTxtBody(wordwrap($texte,72));
+ $mailer->send();
+ Get::kill('mid');
+ }
+
+ if (Get::has('mid') && is_array($mail)) {
+ $msg = file_get_contents('/etc/mailman/fr/refuse.txt');
+ $msg = str_replace("%(adminaddr)s", "$liste-owner@{$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);
+ $page->assign('msg', $msg);
+
+ $page->changeTpl('listes/moderate_mail.tpl');
+ $page->assign_by_ref('mail', $mail);
+ $page->run();
+ }
+
+ } elseif (Env::has('sid')) {
+
+ if (list($subs,$mails) = $this->client->get_pending_ops($liste)) {
+ foreach($subs as $user) {
+ if ($user['id'] == Env::get('sid')) {
+ $page->changeTpl('listes/moderate_sub.tpl');
+ $page->assign('del_user',$user);
+ $page->run();
+ }
+ }
+ }
+
+ }
+
+ if (list($subs,$mails) = $this->client->get_pending_ops($liste)) {
+ $page->assign_by_ref('subs', $subs);
+ $page->assign_by_ref('mails', $mails);
+ } else {
+ $page->kill("La liste n'existe pas ou tu n'as pas le droit de la modérer");
+ }
+ }
+
+ function handler_admin(&$page, $liste = null)
+ {
+ global $globals;
+
+ if (is_null($liste)) {
+ return PL_NOT_FOUND;
+ }
+
+ $this->prepare_client();
+
+ $page->changeTpl('listes/admin.tpl');
+
+ if (Env::has('add_member')) {
+
+ require_once('user.func.inc.php');
+ $members = explode(' ', Env::get('add_member'));
+ if ($members) foreach ($members as $i => $alias) {
+ if (($login = get_user_forlife($alias)) !== false) {;
+ $members[$i] = $login;
+ }
+ }
+
+ $arr = $this->client->mass_subscribe($liste, $members);
+ if (is_array($arr)) {
+ foreach($arr as $addr) {
+ $page->trig("{$addr[0]} inscrit.");
+ }
+ }
+ }
+
+ if (Env::has('del_member')) {
+ if (strpos(Env::get('del_member'), '@') === false) {
+ $this->client->mass_unsubscribe(
+ $liste, array(Env::get('del_member').'@'.$globals->mail->domain));
+ } else {
+ $this->client->mass_unsubscribe($liste, array(Env::get('del_member')));
+ }
+ redirect($liste);
+ }
+
+ if (Env::has('add_owner')) {
+ require_once('user.func.inc.php');
+
+ $owners = explode(' ', Env::get('add_owner'));
+
+ if ($owners) foreach ($owners as $alias) {
+ if (($login = get_user_forlife($alias)) === false) {;
+ $login = $alias;
+ }
+
+ if ($this->client->add_owner($liste, $login)) {
+ $page->trig($alias." ajouté aux modérateurs.");
+ }
+ }
+ }
+
+ if (Env::has('del_owner')) {
+ if (strpos(Env::get('del_owner'), '@') === false) {
+ $this->client->del_owner($liste, Env::get('del_owner').'@'.$globals->mail->domain);
+ } else {
+ $this->client->del_owner($liste, Env::get('del_owner'));
+ }
+ redirect($liste);
+ }
+
+ if (list($det,$mem,$own) = $this->client->get_members($liste)) {
+
+ $membres = list_sort_members($mem, $tri_promo);
+ $moderos = list_sort_owners($own, $tri_promo);
+
+ $page->assign_by_ref('details', $det);
+ $page->assign_by_ref('members', $membres);
+ $page->assign_by_ref('owners', $moderos);
+ $page->assign('np_m', count($mem));
+
+ } else {
+ $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer");
+ }
+ }
+
+ function handler_options(&$page, $liste = null)
+ {
+ global $globals;
+
+ if (is_null($liste)) {
+ return PL_NOT_FOUND;
+ }
+
+ $this->prepare_client();
+
+ $page->changeTpl('listes/options.tpl');
+
+ if (Post::has('submit')) {
+ $values = $_POST;
+ $this->client->set_bogo_level($liste, intval($values['bogo_level']));
+ switch($values['moderate']) {
+ case '0':
+ $values['generic_nonmember_action'] = 0;
+ $values['default_member_moderation'] = 0;
+ break;
+ case '1':
+ $values['generic_nonmember_action'] = 1;
+ $values['default_member_moderation'] = 0;
+ break;
+ case '2':
+ $values['generic_nonmember_action'] = 1;
+ $values['default_member_moderation'] = 1;
+ break;
+ }
+ unset($values['submit'], $values['bogo_level'], $values['moderate']);
+ $values['send_goodbye_msg'] = !empty($values['send_goodbye_msg']);
+ $values['admin_notify_mchanges'] = !empty($values['admin_notify_mchanges']);
+ $values['subscribe_policy'] = empty($values['subscribe_policy']) ? 0 : 2;
+ if (isset($values['subject_prefix'])) {
+ $values['subject_prefix'] = trim($values['subject_prefix']).' ';
+ }
+ $this->client->set_owner_options($liste, $values);
+ } elseif (isvalid_email(Post::get('atn_add'))) {
+ $this->client->add_to_wl($liste, Post::get('atn_add'));
+ } elseif (Get::has('atn_del')) {
+ $this->client->del_from_wl($liste, Get::get('atn_del'));
+ redirect("{$_SERVER['PHP_SELF']}?liste=$liste");
+ }
+
+ if (list($details,$options) = $this->client->get_owner_options($liste)) {
+ $page->assign_by_ref('details', $details);
+ $page->assign_by_ref('options', $options);
+ $page->assign('bogo_level', $this->client->get_bogo_level($liste));
+ } else {
+ $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer");
+ }
+ }
+
+ function handler_delete(&$page, $liste = null)
+ {
+ global $globals;
+
+ if (is_null($liste)) {
+ return PL_NOT_FOUND;
+ }
+
+ $this->prepare_client();
+
+ $page->changeTpl('listes/delete.tpl');
+
+ if (Post::get('valid') == 'OUI'
+ && $this->client->delete_list($liste, Post::getBool('del_archive')))
+ {
+ foreach (array('', '-owner', '-admin', '-bounces') as $app) {
+ $globals->xdb->execute("DELETE FROM aliases
+ WHERE type='liste' AND alias='{?}'",
+ $ml.$app);
+ }
+ $page->assign('deleted', true);
+ } elseif (list($details,$options) = $this->client->get_owner_options($liste)) {
+ $page->assign_by_ref('details', $details);
+ $page->assign_by_ref('options', $options);
+ $page->assign('bogo_level', $this->client->get_bogo_level($liste));
+ } else {
+ $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer");
+ }
+ }
+
+ function handler_soptions(&$page, $liste = null)
+ {
+ global $globals;
+
+ if (is_null($liste)) {
+ return PL_NOT_FOUND;
+ }
+
+ $this->prepare_client();
+
+ $page->changeTpl('listes/soptions.tpl');
+
+ if (Post::has('submit')) {
+ $values = $_POST;
+ unset($values['submit']);
+ $values['advertised'] = empty($values['advertised']) ? false : true;
+ $values['archive'] = empty($values['archive']) ? false : true;
+ $this->client->set_admin_options($liste, $values);
+ }
+
+ if (list($details,$options) = $this->client->get_admin_options($liste)) {
+ $page->assign_by_ref('details', $details);
+ $page->assign_by_ref('options', $options);
+ } else {
+ $page->kill("La liste n'existe pas");
+ }
+ }
+
+ function handler_check(&$page, $liste = null)
+ {
+ global $globals;
+
+ if (is_null($liste)) {
+ return PL_NOT_FOUND;
+ }
+
+ $this->prepare_client();
+
+ $page->changeTpl('listes/check.tpl');
+
+ if (Post::has('correct')) {
+ $this->client->check_options($liste, true);
+ }
+
+ if (list($details,$options) = $this->client->check_options($liste)) {
+ $page->assign_by_ref('details', $details);
+ $page->assign_by_ref('options', $options);
+ } else {
+ $page->kill("La liste n'existe pas");
+ }
+ }
+}
+
+?>
$mbox = $matches[2];
$fqdn = strtolower($matches[3]);
if ($fqdn == 'polytechnique.org') {
- header("Location: https://www.polytechnique.org/listes/$action.php?liste=$mbox");
+ header("Location: https://www.polytechnique.org/lists/$action/$mbox");
} else {
require("../include/xorg.inc.php");
$res = $globals->xdb->query("select diminutif from groupex.asso where mail_domain = {?}", $fqdn);
if ($gpx = $res->fetchOneCell()) {
- header("Location: http://www.polytechnique.net/$gpx/listes-$action.php?liste=$mbox");
+ header("Location: http://www.polytechnique.net/$gpx/lists/$action/$mbox");
}
}
}
{else}
{$x.l}
{/if}
- <a href='?liste={$smarty.get.liste}&del_owner={$x.l}'><img src='{rel}/images/retirer.gif' alt='retirer modérateur' title='retirer modérateur' /></a>
+ <a href='{rel}/{$platal->ns}lists/admin/{$platal->argv[1]}?del_owner={$x.l}'><img src='{rel}/images/retirer.gif' alt='retirer modérateur' title='retirer modérateur' /></a>
<br />
{/foreach}
</td>
{else}
{$x.l}
{/if}
- <a href='?liste={$smarty.get.liste}&del_member={$x.l}'><img src='{rel}/images/retirer.gif' alt='retirer membre' title='retirer membre' /></a>
+ <a href='{rel}/{$platal->ns}lists/admin/{$platal->argv[1]}?del_member={$x.l}'><img src='{rel}/images/retirer.gif' alt='retirer membre' title='retirer membre' /></a>
<br />
{/foreach}
</td>
{if $archs}
-<h1>Archives de la liste {$smarty.request.liste}</h1>
+<h1>Archives de la liste {$platal->argv[1]}</h1>
<h2>Triés par fils de discussion</h2>
{foreach from=$range item=i}
<td>
{if $m[$i]}
- <a href="?liste={$smarty.request.liste}&rep={$y}/{$i|string_format:"%02u"}&file=threads.html">{"0000-$i-01"|date_format:"%B"}</a>
+ <a href="{rel}/{$platal->ns}lists/archives/{$platal->argv[1]}?rep={$y}/{$i|string_format:"%02u"}&file=threads.html">{"0000-$i-01"|date_format:"%B"}</a>
{else}
{/if}
{foreach from=$range item=i}
<td>
{if $m[$i]}
- <a href="?liste={$smarty.request.liste}&rep={$y}/{$i|string_format:"%02u"}&file=dates.html">{"0000-$i-01"|date_format:"%B"}</a>
+ <a href="{rel}/{$platal->ns}lists/archives/{$platal->argv[1]}?rep={$y}/{$i|string_format:"%02u"}&file=dates.html">{"0000-$i-01"|date_format:"%B"}</a>
{else}
{/if}
</tr>
{/foreach}
</table>
-<form action='{$smarty.server.REQUEST_URI}' method='post'>
+<form action='{rel}/{$platal->ns}lists/check/{$platal->argv[1]}' method='post'>
<div class='center'>
<br />
<input type='submit' name='correct' value='Corriger les valeurs !' />
liste :
</p>
-<form action='{$smarty.server.PHP_SELF}' method='post'>
+<form action='{rel}/lists/create' method='post'>
<table class='bicol' cellspacing='0' cellpadding='2'>
<tr>
<th colspan='2'>Caractéristiques de la Liste</th>
Détruire la liste {$details.addr} ?
</h1>
-<form method='post' action='{$smarty.server.REQUEST_URI}'>
+<form method='post' action='{rel}/{$platal->ns}lists/delete/{$platal->argv[1]}'>
<table class='tinybicol' cellpadding='2' cellspacing='0'>
<tr class='impair'>
<td>
{* *}
{**************************************************************************}
-{if $it_is_xnet}
-{assign var=index value="listes.php"}
-{assign var=prefix value="listes-"}
-{else}
-{assign var=index value="index.php"}
-{assign var=prefix value=""}
-{/if}
-
<table>
<tr>
<td colspan='2'>
- [<a href='{$index}'>Voir toutes les listes</a>]
+ [<a href='{rel}/{$platal->ns}lists'>Voir toutes les listes</a>]
</td>
</tr>
<tr>
- <td><strong>Liste {$smarty.request.liste} :</strong></td>
+ <td><strong>Liste {$platal->argv[1]} :</strong></td>
<td>
{if $on neq members}
- [<a href='{$prefix}members.php?liste={$smarty.request.liste}'>liste des membres</a>]
+ [<a href='{rel}/{$platal->ns}lists/members/{$platal->argv[1]}'>liste des membres</a>]
{else}
[liste des membres]
{/if}
{if !$it_is_xnet}
{if $on neq trombi}
- [<a href='{$prefix}trombi.php?liste={$smarty.request.liste}'>trombinoscope</a>]
+ [<a href='{rel}/{$platal->ns}lists/trombi/{$platal->argv[1]}'>trombinoscope</a>]
{else}
[trombinoscope]
{/if}
{/if}
{if $on neq archives}
- [<a href='{$prefix}archives.php?liste={$smarty.request.liste}'>archives</a>]
+ [<a href='{rel}/{$platal->ns}lists/archives/{$platal->argv[1]}'>archives</a>]
{else}
[archives]
{/if}
<td><strong>Administrer la liste :</strong></td>
<td>
{if $on neq moderate}
- [<a href='{$prefix}moderate.php?liste={$smarty.get.liste}'>modération</a>]
+ [<a href='{rel}/{$platal->ns}lists/moderate/{$platal->argv[1]}'>modération</a>]
{else}
[modération]
{/if}
{if $on neq admin}
- [<a href='{$prefix}admin.php?liste={$smarty.get.liste}'>ajout/retrait de membres</a>]
+ [<a href='{rel}/{$platal->ns}lists/admin/{$platal->argv[1]}'>ajout/retrait de membres</a>]
{else}
[ajout/retrait de membres]
{/if}
{if $on neq options}
- [<a href='{$prefix}options.php?liste={$smarty.get.liste}'>options</a>]
+ [<a href='{rel}/{$platal->ns}lists/options/{$platal->argv[1]}'>options</a>]
{else}
[options]
{/if}
{if $on neq delete}
- [<a href='{$prefix}delete.php?liste={$smarty.get.liste}'>détruire</a>]
+ [<a href='{rel}/{$platal->ns}lists/delete/{$platal->argv[1]}'>détruire</a>]
{else}
[détruire liste]
{/if}
<td><strong>Administrer (avancé) :</strong></td>
<td>
{if $on neq soptions}
- [<a href='{$prefix}soptions.php?liste={$smarty.get.liste}'>options avancées</a>]
+ [<a href='{rel}/{$platal->ns}lists/soptions/{$platal->argv[1]}'>options avancées</a>]
{else}
[options avancées]
{/if}
{if $on neq check}
- [<a href='{$prefix}check.php?liste={$smarty.get.liste}'>vérifications</a>]
+ [<a href='{rel}/{$platal->ns}lists/check/{$platal->argv[1]}'>vérifications</a>]
{else}
[vérifications]
{/if}
<tr>
<td><strong>Synchroniser</strong></td>
{if $on neq sync}
- <td>[<a href="listes-sync.php?liste={$smarty.get.liste}">Synchroniser avec l'annuaire</a>]</td>
+ <td>[<a href="{rel}/{$platal->ns}lists/sync/{$platal->argv[1]}">Synchroniser avec l'annuaire</a>]</td>
{else}
<td>[Synchroniser avec l'annuaire]</td>
{/if}
<p>
Pour t'inscrire à une liste il suffit de cliquer sur l'icone
-<img src="{"images/ajouter.gif"|url}" alt="[ inscription ]" /> située en fin de ligne.
+<img src="{rel}/images/ajouter.gif" alt="[ inscription ]" /> située en fin de ligne.
</p>
<p>
Certaines listes sont à inscription modérée, l'inscription n'y est pas
immédiate. Il faut en effet l'action d'un modérateur de la liste pour valider
(ou éventuellement refuser) ta candidature. Ces listes apparaissent avec l'icone
-<img src="{"images/flag.png"|url}" alt="[ en cours ]" />.
+<img src="{rel}/images/flag.png" alt="[ en cours ]" />.
</p>
<p>
Pour se désinscrire, il suffit de la même manière de cliquer sur l'icone
-<img src="{"images/retirer.gif"|url}" alt="[ désinscription ]" />.
+<img src="{rel}/images/retirer.gif" alt="[ désinscription ]" />.
</p>
<h2>La diffusion sur une liste de diffusion</h2>
thématique particulière.
</p>
<p>
-Tu peux demander <a href='create.php'>la création</a> d'une liste de diffusion sur le thème de ton choix.
+Tu peux demander <a href='{rel}/lists/create'>la création</a>
+d'une liste de diffusion sur le thème de ton choix.
</p>
<br />
-<form method='post' action='{$smarty.server.REQUEST_URI}'>
+<form method='post' action='{rel}/lists'>
<table class='tinybicol' cellspacing='0' cellpadding='2'>
<tr>
<th colspan='2'>Inscription à une liste de diffusion promo</th>
{if $liste.priv eq $priv}
<tr class='{cycle values="impair,pair"}'>
<td>
- <a href='members.php?liste={$liste.list}'>{$liste.list}{if $liste.own} *{/if}</a>
+ <a href='{rel}/{$platal->ns}lists/members/{$liste.list}'>{$liste.list}{if $liste.own} *{/if}</a>
</td>
<td>{$liste.desc}</td>
<td class='center'>
<td class='right'>{$liste.nbsub}</td>
<td class='right'>
{if $liste.sub eq 2}
- <a href='{$smarty.server.PHP_SELF}?del={$liste.list}'>
- <img src="{"images/retirer.gif"|url}" alt="[ désinscription ]" title="me désinscrire de {$liste.list}" />
+ <a href='{rel}/{$platal->ns}lists?del={$liste.list}'>
+ <img src="{rel}/images/retirer.gif" alt="[ désinscription ]" title="me désinscrire de {$liste.list}" />
</a>
{elseif $liste.sub eq 1}
- <img src="{"images/flag.png"|url}" alt="[ en cours ]" title='inscription en attente de modération' />
+ <img src="{rel}/images/flag.png" alt="[ en cours ]" title='inscription en attente de modération' />
{else}
- <a href='{$smarty.server.PHP_SELF}?add={$liste.list}'>
- <img src="{"images/ajouter.gif"|url}" alt="[ inscription ]" title="m'inscrire sur {$liste.list}" />
+ <a href='{rel}/{$platal->ns}lists?add={$liste.list}'>
+ <img src="{rel}/images/ajouter.gif" alt="[ inscription ]" title="m'inscrire sur {$liste.list}" />
</a>
{/if}
</td>
{include file="listes/header_listes.tpl" on=members}
<h1>
- Liste {$smarty.request.liste}
+ Liste {$platal->argv[1]}
</h1>
<table class='tinybicol' cellpadding='0' cellspacing='0'>
{if $details.sub>1}
Tu es inscrit sur la liste.<br />
Te désinscrire :
- <a href='?liste={$smarty.request.liste}&del=1'><img src="{rel}/images/retirer.gif" alt="[me désinsiscrire]" /></a>
+ <a href='{rel}/{$platal->ns}lists/members/{$platal->argv[1]}?del=1'><img src="{rel}/images/retirer.gif" alt="[me désinsiscrire]" /></a>
{elseif $details.sub eq 1}
Ta demande d'inscription est en cours de validation.
{else}
Tu n'es pas inscrit.<br />
Demander ton inscription :
- <a href="?liste={$smarty.request.liste}&add=1"><img src="{rel}/images/ajouter.gif" alt="[demander mon inscription]" /></a>
+ <a href="{rel}/{$platal->ns}lists/members/{$platal->argv[1]}?add=1"><img src="{rel}/images/ajouter.gif" alt="[demander mon inscription]" /></a>
{/if}
</td>
</tr>
<h1>
membres de la liste
{if $smarty.get.alpha}
- (<a href='?liste={$smarty.request.liste}'>trier par promo</a>)
+ (<a href='{rel}/{$platal->ns}lists/members/{$platal->argv[1]}'>trier par promo</a>)
{else}
- (<a href='?liste={$smarty.request.liste}&alpha=1'>trier par nom</a>)
+ (<a href='{rel}/{$platal->ns}lists/members/{$platal->argv[1]}?alpha=1'>trier par nom</a>)
{/if}
</h1>
<td>
{foreach from=$xs item=x}
{if $promo}
- <a href="{"fiche.php"|url}?user={$x.l}" class="popup2">{$x.n}</a><br />
+ <a href="{rel}/profile/{$x.l}" class="popup2">{$x.n}</a><br />
{else}
{$x.l}<br />
{/if}
</td>
<td>{$s.addr}</td>
<td class='action'>
- <a href='?liste={$smarty.request.liste}&sadd={$s.id}'>ajouter</a>
- <a href='?liste={$smarty.request.liste}&sid={$s.id}'>refuser</a>
+ <a href='{rel}/{$platal->ns}lists/moderate/{$platal->argv[1]}?sadd={$s.id}'>ajouter</a>
+ <a href='{rel}/{$platal->ns}lists/moderate/{$platal->argv[1]}?sid={$s.id}'>refuser</a>
</td>
</tr>
{/foreach}
<strong>détruire:</strong> le mail est effacé sans autre forme de procès.
N'utiliser <strong>QUE</strong> pour les virus et les courriers indésirables. <br/>
S'il y a trop d'indésirables, il est probablement plus rapide pour la suite de les
- {if $it_is_xnet}
- {assign var=prefix value="listes-"}
- {else}
- {assign var=prefix value=""}
- {/if}
- <a href="{$prefix}options.php?liste={$smarty.request.liste}#antispam">jeter directement</a> et non de les modérer.
+ <a href="{rel}/{$platal->ns}lists/options/{$platal->argv[1]}#antispam">jeter directement</a> et non de les modérer.
</li>
</ul>
<td class='right'>{$m.size}o</td>
<td class='right'>{$m.stamp|date_format:"%X<br />%x"}</td>
<td class='action'>
- <a href='?liste={$smarty.request.liste}&mid={$m.id}'>voir</a><br/>
- <a href='?liste={$smarty.request.liste}&mid={$m.id}&mok=1'>accepter</a> <a href='?liste={$smarty.request.liste}&mid={$m.id}&mdel=1'>détruire</a></td>
+ <a href='{rel}/{$platal->ns}lists/moderate/{$platal->argv[1]}?mid={$m.id}'>voir</a><br/>
+ <a href='{rel}/{$platal->ns}lists/moderate/{$platal->argv[1]}?mid={$m.id}&mok=1'>accepter</a> <a href='{rel}/{$platal->ns}lists/moderate/{$platal->argv[1]}?mid={$m.id}&mdel=1'>détruire</a></td>
</tr>
{/foreach}
</table>
<br />
{/if}
-<form method='post' action='?liste={$smarty.request.liste}'>
+<form method='post' action='{rel}/{$platal->ns}lists/moderate/{$platal->argv[1]}'>
<table class='tinybicol' cellpadding='0' cellspacing='0'>
<tr>
<th class='titre'>Modérer le mail</th>
Refuser l'inscription d'un utilisateur
</h1>
-<form method='post' action='?liste={$smarty.request.liste}'>
+<form method='post' action='{rel}/{$platal->ns}lists/moderate/{$platal->argv[1]}'>
<table class='tinybicol' cellpadding='0' cellspacing='0'>
<tr>
<th class='titre'>refuser l'inscription de :</th>
Changer les options de la liste {$details.addr}
</h1>
-<form method='post' action='{$smarty.server.REQUEST_URI}'>
+<form method='post' action='{rel}/{$platal->ns}lists/options/{$platal->argv[1]}'>
<table class='bicol' cellpadding='2' cellspacing='0'>
<tr><th colspan='2'>Options de la liste {$details.addr}</th></tr>
<tr class='impair'>
redirection en mode 'inactif'. le logiciel de mailing list saura se débrouiller tout seul.
</p>
-<form method='post' action='{$smarty.server.REQUEST_URI}'>
+<form method='post' action='{rel}/{$platal->ns}lists/options/{$platal->argv[1]}'>
<table class='tinybicol' cellpadding='2' cellspacing='0'>
<tr><th>Addresses non modérées</th></tr>
<tr>
<td>
{if $options.accept_these_nonmembers|@count}
{foreach from=$options.accept_these_nonmembers item=addr}
- {$addr}<a href='?liste={$smarty.get.liste}&atn_del={$addr}'>
+ {$addr}<a href='{rel}/{$platal->ns}lists/options/{$platal->argv[1]}&atn_del={$addr}'>
<img src='{"images/retirer.gif"|url}' alt='retirer de la whitelist' title="retirer {$addr} de la whitelist" />
</a><br />
{/foreach}
Changer les options de la liste {$details.addr}
</h1>
-<form method='post' action='{$smarty.server.REQUEST_URI}'>
+<form method='post' action='{rel}/{$platal->ns}lists/soptions/{$platal->argv[1]}'>
<table class='bicol' cellpadding='2' cellspacing='0'>
<tr><th colspan='2'>Options de la liste {$details.addr}</th></tr>
<tr class='impair'>
{include file="listes/header_listes.tpl" on=trombi}
<h1>
- Liste {$smarty.request.liste}
+ Liste {$platal->argv[1]}
</h1>
<table class='tinybicol' cellpadding='0' cellspacing='0'>
{if $details.sub>1}
Tu es inscrit sur la liste.<br />
Te désinscrire :
- <a href='?liste={$smarty.request.liste}&del=1'><img src="{rel}/images/retirer.gif" alt="[me désinsiscrire]" /></a>
+ <a href='{rel}/{$platal->ns}trombi/{$platal->argv[1]}?del=1'><img src="{rel}/images/retirer.gif" alt="[me désinsiscrire]" /></a>
{elseif $details.sub eq 1}
Ta demande d'inscription est en cours de validation.
{else}
Tu n'es pas inscrit.<br />
Demander ton inscription :
- <a href="?liste={$smarty.request.liste}&add=1"><img src="{rel}/images/ajouter.gif" alt="[demander mon inscription]" /></a>
+ <a href="{rel}/{$platal->ns}trombi/{$platal->argv[1]}?add=1"><img src="{rel}/images/ajouter.gif" alt="[demander mon inscription]" /></a>
{/if}
</td>
</tr>