the wiki now works, remove that useless pile of cruft.
[platal.git] / modules / core.php
CommitLineData
b62f8858 1<?php
2/***************************************************************************
3 * Copyright (C) 2003-2006 Polytechnique.org *
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
22class CoreModule extends PLModule
23{
b62f8858 24 function handlers()
25 {
26 return array(
4a5fb34b 27 '403' => $this->make_hook('403', AUTH_PUBLIC),
28 '404' => $this->make_hook('404', AUTH_PUBLIC),
29 'exit' => $this->make_hook('exit', AUTH_PUBLIC),
b62f8858 30 );
31 }
32
4a5fb34b 33 function handler_exit(&$page, $level = null)
b62f8858 34 {
4a5fb34b 35 if (Session::has('suid')) {
36 if (Session::has('suid')) {
37 $a4l = Session::get('forlife');
38 $suid = Session::getMixed('suid');
39 $log = Session::getMixed('log');
40 $log->log("suid_stop", Session::get('forlife') . " by " . $suid['forlife']);
41 $_SESSION = $suid;
42 Session::kill('suid');
43 redirect($globals->baseurl.'/admin/utilisateurs.php?login='.$a4l);
44 } else {
45 redirect("login.php");
46 }
47 }
48
49 if ($level == 'forget' || $level == 'forgetall') {
50 setcookie('ORGaccess', '', time() - 3600, '/', '', 0);
51 Cookie::kill('ORGaccess');
52 if (isset($_SESSION['log']))
53 $_SESSION['log']->log("cookie_off");
54 }
55
56 if ($level == 'forgetuid' || $level == 'forgetall') {
57 setcookie('ORGuid', '', time() - 3600, '/', '', 0);
58 Cookie::kill('ORGuid');
59 setcookie('ORGdomain', '', time() - 3600, '/', '', 0);
60 Cookie::kill('ORGdomain');
61 }
62
63 if (isset($_SESSION['log'])) {
64 $ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
65 $_SESSION['log']->log('deconnexion',$ref);
66 }
67
68 XorgSession::destroy();
69
70 if (Get::has('redirect')) {
71 redirect(rawurldecode(Get::get('redirect')));
72 } else {
73 $page->changeTpl('exit.tpl');
74 }
b62f8858 75 return PL_OK;
76 }
77
78 function handler_403(&$page)
79 {
80 header('HTTP/1.0 403 Forbidden');
81 $page->changeTpl('403.tpl');
82 return PL_OK;
83 }
84
85 function handler_404(&$page)
86 {
87 header('HTTP/1.0 404 Not Found');
88 $page->changeTpl('404.tpl');
89 return PL_OK;
90 }
91}
92
93?>