From eca5d69f20424f28404acb73992a7ea4bd474197 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sun, 15 Jun 2008 18:52:38 +0200 Subject: [PATCH] Not groups managers on member unsubscription (Closes #807) Signed-off-by: Florent Bruneau --- configs/mails.conf | 3 ++ modules/xnetgrp.php | 17 +++++++++++ templates/xnetgrp/unsubscription-notif.mail.tpl | 39 +++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 templates/xnetgrp/unsubscription-notif.mail.tpl diff --git a/configs/mails.conf b/configs/mails.conf index ebe4725..3f75eac 100644 --- a/configs/mails.conf +++ b/configs/mails.conf @@ -51,3 +51,6 @@ from="Carnet Polytechnicien " [googleapps] from="Polytechnique.org" cc=validation+googleapps@polytechnique.org + +[xnet_unsubscription] +from="Gestion des groupes X sur Polytechnique.net" diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 0a18d0f..01f3bb1 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -771,6 +771,23 @@ class XnetGrpModule extends PLModule "DELETE FROM groupex.membres WHERE uid={?} AND asso_id={?}", $user['uid'], $globals->asso('id')); + $mailer = new PlMailer('xnetgrp/unsubscription-notif.mail.tpl'); + $res = XDB::iterRow("SELECT a.alias, u.prenom, IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom + FROM groupex.membres AS m + INNER JOIN aliases AS a ON (m.uid = a.id AND FIND_IN_SET('bestalias', a.flags)) + INNER JOIn auth_user_md5 AS u ON (u.user_id = a.id) + WHERE m.asso_id = {?} AND m.perms = 'admin'", + $globals->asso('id')); + while (list($alias, $prenom, $nom) = $res->next()) { + $mailer->addTo("\"$prenom $nom\" <$alias@{$globals->mail->domain}>"); + } + $mailer->assign('group', $globals->asso('nom')); + $mailer->assign('prenom', $user['prenom']); + $mailer->assign('nom', $user['nom']); + $mailer->assign('mail', $user['email2']); + $mailer->assign('selfdone', $user['uid'] == S::i('uid')); + $mailer->send(); + $user_same_email = get_infos($user['email']); $domain = $globals->asso('mail_domain'); diff --git a/templates/xnetgrp/unsubscription-notif.mail.tpl b/templates/xnetgrp/unsubscription-notif.mail.tpl new file mode 100644 index 0000000..6067133 --- /dev/null +++ b/templates/xnetgrp/unsubscription-notif.mail.tpl @@ -0,0 +1,39 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2008 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 *} +{* *} +{**************************************************************************} + +{config_load file="mails.conf" section="xnet_unsubscription"} +{if $mail_part eq 'head'} +{from full=#from#} +{subject text="[`$group`] Désinscription de `$prenom` `$nom`"} +{elseif $mail_part eq 'wiki'} +Chers animateurs du groupe {$group}, + +{if $selfdone} +{$prenom} {$nom} ({$mail}) vient de se désinscrire du groupe. +{else} +{$prenom} {$nom} ({$mail}) vient d'être désinscrit du groupe par {$smarty.session.prenom} {$smarty.session.nom}. +{/if} + +Cordialement,\\ +L'Equipe de Polytechnique.org +{/if} +{* vim:set et sw=2 sts=2 sws=2: *} -- 2.1.4