0337d704 |
1 | <?php |
2 | /*************************************************************************** |
2b105fb6 |
3 | * Copyright (C) 2003-2006 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 | require_once('platal/page.inc.php'); |
23 | require_once('xnet/smarty.plugins.inc.php'); |
24 | |
25 | // {{{ class XnetPage |
26 | |
27 | class XnetPage extends PlatalPage |
28 | { |
29 | // {{{ function XnetPage() |
30 | |
31 | function XnetPage($tpl, $type=SKINNED) |
32 | { |
33 | $this->PlatalPage($tpl, $type); |
34 | } |
35 | |
36 | // }}} |
37 | // {{{ function run() |
38 | |
39 | function run() |
40 | { |
41 | $this->_run('xnet/skin.tpl'); |
42 | } |
43 | |
44 | // }}} |
45 | // {{{ function setType |
46 | |
47 | function setType($type) |
48 | { |
49 | $this->assign('xnet_type', strtolower($type)); |
50 | } |
51 | |
52 | // }}} |
53 | // {{{ function useMenu |
54 | |
55 | function useMenu() |
56 | { |
57 | global $globals; |
58 | |
59 | $menu = array(); |
60 | |
61 | $sub = array(); |
62 | $sub['accueil'] = 'index.php'; |
63 | $sub['liste des groupes'] = 'plan.php'; |
64 | if (logged()) { |
65 | if (has_perms()) { |
66 | $sub['admin X.net'] = 'admin.php'; |
67 | } |
68 | $sub['déconnexion'] = 'deconnexion.php'; |
69 | } |
70 | $menu["Menu Principal"] = $sub; |
71 | |
72 | if (logged() && (is_member() || may_update())) { |
73 | $sub = array(); |
74 | $dim = $globals->asso('diminutif'); |
75 | $sub['présentation'] = "$dim/asso.php"; |
2b105fb6 |
76 | if (may_update() || $globals->asso('pub') == 'public') { |
0337d704 |
77 | $sub['annuaire du groupe'] = "$dim/annuaire.php"; |
2b105fb6 |
78 | if ($globals->xnet->geoloc) |
79 | $sub['carte'] = "$dim/geoloc.php"; |
80 | } |
0337d704 |
81 | if ($globals->asso('mail_domain')) { |
82 | $sub['listes de diffusion'] = "$dim/listes.php"; |
83 | } |
84 | $sub['événement'] = "$dim/evenements.php"; |
85 | if (false) { |
86 | $sub['carnet'] = "$dim/carnet.php"; |
87 | } |
88 | $sub['télépaiement'] = "$dim/telepaiement.php"; |
89 | |
90 | $menu[$globals->asso('nom')] = $sub; |
91 | } |
92 | |
93 | if (logged() && may_update()) { |
94 | $sub = array(); |
95 | $sub['modifier l\'accueil'] = "$dim/edit.php"; |
0df3edb9 |
96 | if ($globals->wiki->wikidir && $globals->xnet->wiki) |
97 | $sub['wiki'] = "$dim/Accueil"; |
0337d704 |
98 | if ($globals->asso('mail_domain')) { |
99 | $sub['envoyer un mail'] = "$dim/mail.php"; |
100 | $sub['créer une liste'] = "$dim/listes-create.php"; |
101 | $sub['créer un alias'] = "$dim/alias-create.php"; |
102 | } |
103 | $menu['Administrer Groupe'] = $sub; |
104 | } |
105 | |
106 | $this->assign('menu', $menu); |
107 | } |
108 | |
109 | // }}} |
110 | // {{{ function doAuth() |
111 | |
112 | function doAuth() |
113 | { |
114 | $this->register_function('list_all_my_groups', 'list_all_my_groups'); |
115 | $this->register_modifier('cat_pp', 'cat_pp'); |
116 | $this->assign('it_is_xnet', true); |
117 | if (!logged() && Get::has('auth')) { |
118 | $_SESSION['session']->doAuthX($this); |
119 | } |
120 | } |
121 | |
122 | // }}} |
123 | } |
124 | |
125 | // }}} |
126 | // {{{ class XnetAuth |
127 | |
128 | /** Une classe pour les pages nécessitant l'authentification. |
129 | * (equivalent de controlauthentification.inc.php) |
130 | */ |
131 | class XnetAuth extends XnetPage |
132 | { |
133 | // {{{ function XnetAuth() |
134 | |
135 | function XnetAuth($tpl, $type=SKINNED) |
136 | { |
137 | $this->XnetPage($tpl, $type); |
138 | } |
139 | |
140 | // }}} |
141 | // {{{ function doAuth() |
142 | |
143 | function doAuth() |
144 | { |
145 | parent::doAuth(); |
146 | $_SESSION['session']->doAuth($this); |
147 | } |
148 | |
149 | // }}} |
150 | } |
151 | |
152 | // }}} |
153 | // {{{ class XnetAdmin |
154 | |
155 | /** Une classe pour les pages réservées aux admins (authentifiés!). |
156 | */ |
157 | class XnetAdmin extends XnetAuth |
158 | { |
159 | // {{{ function XnetAdmin() |
160 | |
161 | function XnetAdmin($tpl, $type=SKINNED) |
162 | { |
163 | global $globals; |
164 | |
165 | $this->XnetAuth($tpl, $type); |
166 | check_perms(); |
167 | |
168 | $this->useMenu(); |
169 | if ($globals->asso('cat')) { |
170 | $this->assign('asso', $globals->asso()); |
171 | $this->setType($globals->asso('cat')); |
172 | } |
173 | } |
174 | |
175 | // }}} |
176 | } |
177 | |
178 | // }}} |
179 | // {{{ class XnetGroupPage |
180 | |
181 | /** Une classe pour les pages réservées aux admins (authentifiés!). |
182 | */ |
183 | class XnetGroupPage extends XnetAuth |
184 | { |
185 | // {{{ function XnetAdmin() |
186 | |
187 | function XnetGroupPage($tpl, $type=SKINNED) |
188 | { |
189 | global $globals; |
190 | |
191 | $this->XnetAuth($tpl, $type); |
192 | if (!is_member() && !has_perms()) { |
193 | $this->kill("You have not sufficient credentials"); |
194 | } |
195 | |
196 | $this->useMenu(); |
197 | $this->assign('asso', $globals->asso()); |
198 | $this->setType($globals->asso('cat')); |
199 | } |
200 | |
201 | // }}} |
202 | } |
203 | |
204 | // }}} |
205 | // {{{ class XnetGroupAdmin |
206 | |
207 | /** Une classe pour les pages réservées aux admins (authentifiés!). |
208 | */ |
209 | class XnetGroupAdmin extends XnetAuth |
210 | { |
211 | // {{{ function XnetAdmin() |
212 | |
213 | function XnetGroupAdmin($tpl, $type=SKINNED) |
214 | { |
215 | global $globals; |
216 | |
217 | $this->XnetAuth($tpl, $type); |
218 | if (!may_update()) { |
219 | $this->kill("You have not sufficient credentials"); |
220 | } |
221 | |
222 | $this->useMenu(); |
223 | $this->assign('asso', $globals->asso()); |
224 | $this->setType($globals->asso('cat')); |
225 | } |
226 | |
227 | // }}} |
228 | } |
229 | |
230 | // }}} |
231 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker: |
232 | ?> |