b6d4b5531d8ee8e2e51a12d743077de670f73d2c
1 <?php
2 /*
3 This code is part of GOsa (https://gosa.gonicus.de)
4 Copyright (C) 2003 Cajus Pollmeier
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
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
21 /* Basic setup, remove eventually registered sessions */
22 require_once ("../include/php_setup.inc");
23 require_once ("functions.inc");
24 header("Content-type: text/html; charset=UTF-8");
26 /* try to start session, so we can remove userlocks,
27 if the old session is still available */
28 @session_start();
29 if(isset($_SESSION['ui'])){
31 /* Get config & ui informations */
32 $ui= $_SESSION["ui"];
34 /* config used for del_user_locks & some lines below to detect the language */
35 $config= $_SESSION["config"];
37 /* Remove all locks of this user */
38 del_user_locks($ui->dn);
40 /* Write something to log */
41 new log("security","logout","",array(),"User \"".$ui->username."\" logged out") ;
42 }
44 /* If GET request is posted, the logout was forced by pressing the link */
45 if (isset($_GET['request'])){
47 /* destroy old session */
48 @session_unset ();
49 @session_destroy ();
51 /* Go back to the base via header */
52 header ("Location: index.php");
53 exit();
55 }else{ // The logout wasn't forced, so the session is invalid
57 /* Language setup */
58 if ((!isset($config))||(empty($config->data['MAIN']['LANG']))){
59 $lang= get_browser_language();
60 } else {
61 $lang= $config->data['MAIN']['LANG'];
62 }
64 $lang.=".UTF-8";
65 putenv("LANGUAGE=");
66 putenv("LANG=$lang");
67 setlocale(LC_ALL, $lang);
68 $GLOBALS['t_language']= $lang;
69 $GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/';
71 /* Set the text domain as 'messages' */
72 $domain = 'messages';
73 bindtextdomain($domain, "$BASE_DIR/locale");
74 textdomain($domain);
76 /* Create smarty & Set template compile directory */
77 $smarty= new smarty();
78 if (isset ($config->data['MAIN']['COMPILE'])){
79 $smarty->compile_dir= $config->data['MAIN']['COMPILE'];
80 } else {
81 $smarty->compile_dir= '/var/spool/gosa/';
82 }
83 $smarty->display (get_template_path('headers.tpl'));
84 $smarty->display (get_template_path('logout.tpl'));
85 exit;
86 }
87 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
88 ?>
89 </html>