0337d704 |
1 | <?php |
2 | /*************************************************************************** |
5ddeb07c |
3 | * Copyright (C) 2003-2007 Polytechnique.org * |
0337d704 |
4 | * http://opensource.polytechnique.org/ * |
5 | * * |
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. * |
10 | * * |
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. * |
15 | * * |
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 * |
18 | * Foundation, Inc., * |
19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
20 | ***************************************************************************/ |
21 | |
22 | // {{{ class ListeReq |
23 | |
24 | class ListeReq extends Validate |
25 | { |
26 | // {{{ properties |
27 | |
28 | var $liste; |
29 | var $desc; |
30 | |
31 | var $advertise; |
32 | var $modlevel; |
33 | var $inslevel; |
34 | |
35 | var $owners; |
36 | var $members; |
37 | |
a7de4ef7 |
38 | var $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,...)"; |
0337d704 |
40 | // }}} |
41 | // {{{ constructor |
42 | |
a3a049fc |
43 | function ListeReq($_uid, $_liste, $_desc, $_advertise, $_modlevel, |
44 | $_inslevel, $_owners, $_members, $_stamp=0) |
0337d704 |
45 | { |
0337d704 |
46 | $this->Validate($_uid, true, 'liste', $_stamp); |
47 | |
48 | $this->liste = $_liste; |
49 | $this->desc = $_desc; |
50 | $this->advertise = $_advertise; |
51 | $this->modlevel = $_modlevel; |
52 | $this->inslevel = $_inslevel; |
53 | $this->owners = $_owners; |
54 | $this->members = $_members; |
55 | } |
56 | |
57 | // }}} |
58 | // {{{ function formu() |
59 | |
60 | function formu() |
61 | { return 'include/form.valid.listes.tpl'; } |
62 | |
63 | // }}} |
e2a78862 |
64 | // {{{ function editor() |
65 | |
66 | function editor() |
67 | { |
68 | return 'include/form.valid.edit-listes.tpl'; |
69 | } |
70 | |
71 | // }}} |
72 | // {{{ function handle_editor() |
73 | |
74 | function handle_editor() |
75 | { |
76 | if (Env::has('listname')) { |
77 | $this->liste = trim(Env::v('listname')); |
78 | } |
79 | return true; |
80 | } |
81 | |
82 | // }}} |
0337d704 |
83 | // {{{ function _mail_subj |
84 | |
85 | function _mail_subj() |
86 | { |
87 | return "[Polytechnique.org/LISTES] Demande de la liste {$this->liste}"; |
88 | } |
89 | |
90 | // }}} |
91 | // {{{ function _mail_body |
92 | |
93 | function _mail_body($isok) |
94 | { |
95 | if ($isok) { |
a7de4ef7 |
96 | return " La mailing list {$this->liste} que tu avais demandée vient d'être créée."; |
0337d704 |
97 | } else { |
a7de4ef7 |
98 | return " La demande que tu avais faite pour la mailing list {$this->liste} a été refusée."; |
0337d704 |
99 | } |
100 | } |
101 | |
102 | // }}} |
103 | // {{{ function commit() |
9bb8bf21 |
104 | |
0337d704 |
105 | function commit() |
106 | { |
917c4d11 |
107 | $list = new MMList(S::v('uid'), S::v('password')); |
9bb8bf21 |
108 | $ret = $list->create_list($this->liste, $this->desc, $this->advertise, |
109 | $this->modlevel, $this->inslevel, |
110 | $this->owners, $this->members); |
0337d704 |
111 | $liste = strtolower($this->liste); |
112 | if ($ret) { |
113 | foreach(Array($liste, $liste."-owner", $liste."-admin", $liste."-bounces") as $l) { |
08cce2ff |
114 | XDB::execute("INSERT INTO aliases (alias,type) VALUES({?}, 'liste')", $l); |
0337d704 |
115 | } |
116 | } |
117 | return $ret; |
118 | } |
119 | |
120 | // }}} |
121 | } |
122 | |
123 | // }}} |
124 | |
a7de4ef7 |
125 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: |
0337d704 |
126 | ?> |