Code

Updated acl_definitions
[gosa.git] / html / logout.php
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");
25 get_dir_list("$BASE_DIR/plugins");
27 /* try to start session, so we can remove userlocks, 
28   if the old session is still available */
29 @session_start();
30 if(isset($_SESSION['ui'])){
31   
32   /* Get config & ui informations */
33   $ui= $_SESSION["ui"];
34   
35   /* config used for del_user_locks & some lines below to detect the language */  
36   $config= $_SESSION["config"];
38   /* Remove all locks of this user */
39   del_user_locks($ui->dn);
40   
41   /* Write something to log */  
42   gosa_log ("User \"".$ui->username."\" logged out");
43 }
45 /* If GET request is posted, the logout was forced by pressing the link */
46 if (isset($_GET['request'])){
47   
48   /* destroy old session */
49   @session_unset ();
50   @session_destroy ();
51   
52   /* Go back to the base via header */
53   header ("Location: index.php");
54   exit();
56 }else{  // The logout wasn't forced, so the session is invalid 
57   
58   /* Language setup */
59   if ((!isset($config))||(empty($config->data['MAIN']['LANG']))){
60     $lang= get_browser_language();
61   } else {
62     $lang= $config->data['MAIN']['LANG'];
63   }
65   $lang.=".UTF-8";
66   putenv("LANGUAGE=");
67   putenv("LANG=$lang");
68   setlocale(LC_ALL, $lang);
69   $GLOBALS['t_language']= $lang;
70   $GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/';
72   /* Set the text domain as 'messages' */
73   $domain = 'messages';
74   bindtextdomain($domain, "$BASE_DIR/locale");
75   textdomain($domain);
76     
77   /* Create smarty & Set template compile directory */
78   $smarty= new smarty();
79   if (isset ($config->data['MAIN']['COMPILE'])){
80     $smarty->compile_dir= $config->data['MAIN']['COMPILE'];
81   } else {
82     $smarty->compile_dir= '/var/spool/gosa/';
83   }
84   $smarty->display (get_template_path('headers.tpl'));
85   $smarty->display (get_template_path('logout.tpl'));
86   exit;
87 }
88 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
89 ?>
90 </html>