2 /***************************************************************************
3 * Copyright (C) 2003-2007 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
24 class ListeReq
extends Validate
38 public $rules = "Refuser les listes de binets si elles ne sont pas datées (oui : apv2002@, non : apv@).
39 Refuser également des listes qui pourraient nous servir (admin, postmaster,...)";
43 public function __construct($_uid, $_liste, $_desc, $_advertise, $_modlevel,
44 $_inslevel, $_owners, $_members, $_stamp=0)
46 parent
::__construct($_uid, false
, 'liste', $_stamp);
48 $this->liste
= $_liste;
50 $this->advertise
= $_advertise;
51 $this->modlevel
= $_modlevel;
52 $this->inslevel
= $_inslevel;
53 $this->owners
= $_owners;
54 $this->members
= $_members;
58 // {{{ function formu()
60 public function formu()
62 return 'include/form.valid.listes.tpl';
66 // {{{ function editor()
68 public function editor()
70 return 'include/form.valid.edit-listes.tpl';
74 // {{{ function handle_editor()
76 protected function handle_editor()
78 if (Env
::has('listname')) {
79 $this->liste
= trim(Env
::v('listname'));
85 // {{{ function _mail_subj
87 protected function _mail_subj()
89 return "[Polytechnique.org/LISTES] Demande de la liste {$this->liste}";
93 // {{{ function _mail_body
95 protected function _mail_body($isok)
98 return " La mailing list {$this->liste} que tu avais demandée vient d'être créée.";
100 return " La demande que tu avais faite pour la mailing list {$this->liste} a été refusée.";
105 // {{{ function commit()
107 public function commit()
109 $list = new MMList(S
::v('uid'), S
::v('password'));
110 $ret = $list->create_list($this->liste
, utf8_decode($this->desc
), $this->advertise
,
111 $this->modlevel
, $this->inslevel
,
112 $this->owners
, $this->members
);
113 $liste = strtolower($this->liste
);
115 foreach(Array($liste, $liste."-owner", $liste."-admin", $liste."-bounces") as $l) {
116 XDB
::execute("INSERT INTO aliases (alias,type) VALUES({?}, 'liste')", $l);
127 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: