simplify auth mechanism a bit more
[platal.git] / include / xnet / page.inc.php
CommitLineData
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
22require_once('platal/page.inc.php');
23require_once('xnet/smarty.plugins.inc.php');
24
25// {{{ class XnetPage
26
27class 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();
045a1522 62 $sub['accueil'] = '';
71fe935c 63 $sub['liste des groupes'] = 'plan';
cab08090 64 if (S::logged()) {
65 if (S::has_perms()) {
d55888e6 66 $sub['admin X.net'] = 'admin';
0337d704 67 }
71fe935c 68 $sub['déconnexion'] = 'exit';
0337d704 69 }
70 $menu["Menu Principal"] = $sub;
71
cab08090 72 if (S::logged() && (is_member() || may_update())) {
0337d704 73 $sub = array();
74 $dim = $globals->asso('diminutif');
ae7bb180 75 $sub['présentation'] = "$dim/";
2b105fb6 76 if (may_update() || $globals->asso('pub') == 'public') {
2e94d2b8 77 $sub['annuaire du groupe'] = "$dim/annuaire";
2b105fb6 78 if ($globals->xnet->geoloc)
79 $sub['carte'] = "$dim/geoloc.php";
80 }
0337d704 81 if ($globals->asso('mail_domain')) {
80f44cfe 82 $sub['listes de diffusion'] = "$dim/lists";
0337d704 83 }
4f10a058 84 $sub['événement'] = "$dim/events";
0337d704 85 if (false) {
86 $sub['carnet'] = "$dim/carnet.php";
87 }
75687bb9 88 $sub['télépaiement'] = "$dim/paiement";
0337d704 89
90 $menu[$globals->asso('nom')] = $sub;
91 }
92
cab08090 93 if (S::logged() && may_update()) {
0337d704 94 $sub = array();
2e94d2b8 95 $sub['modifier l\'accueil'] = "$dim/edit";
0337d704 96 if ($globals->asso('mail_domain')) {
479d2787 97 $sub['envoyer un mail'] = "$dim/mail";
80f44cfe 98 $sub['créer une liste'] = "$dim/lists/create";
d1fcf09c 99 $sub['créer un alias'] = "$dim/alias/create";
0337d704 100 }
101 $menu['Administrer Groupe'] = $sub;
102 }
103
104 $this->assign('menu', $menu);
105 }
106
107 // }}}
108 // {{{ function doAuth()
109
2bd5b7f8 110 function doAuth($force = false)
0337d704 111 {
112 $this->register_function('list_all_my_groups', 'list_all_my_groups');
113 $this->register_modifier('cat_pp', 'cat_pp');
114 $this->assign('it_is_xnet', true);
cab08090 115 if (!S::logged() && $force) {
b0b937fd 116 XnetSession::doAuth();
2bd5b7f8 117 }
cab08090 118 if (!S::logged() && Get::has('auth')) {
b0b937fd 119 XnetSession::doAuthX();
0337d704 120 }
121 }
122
123 // }}}
b0b937fd 124
125 function doLogin()
126 {
127 redirect(S::v('loginX'));
128 }
0337d704 129}
130
131// }}}
0337d704 132// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
133?>