Code

Removed my debug tags
[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");
26 @session_start();
27 /* Do logout-logging and destroy session */
29 if(isset($_SESSION['logout_was_posted_several_times'])){
30   header ("Location: index.php");
31 }
33 if (isset($_SESSION['config'])){
34   $ui= $_SESSION["ui"];
35   $config= $_SESSION["config"];
37   /* Remove all locks of this user */
38   del_user_locks($ui->dn);
40   @session_unset ();
41   @session_destroy ();
42   @session_start();
43   $_SESSION['logout_was_posted_several_times'] = 1;
44   gosa_log ("User \"".$ui->username."\" logged out".$_SESSION['logout_was_posted_several_times']);
45   /* Go back to the base via header */
46   header ("Location: index.php");
48 }else{
49   /* Language setup */
50   if ((!isset($config))||(empty($config->data['MAIN']['LANG']))){
51     $lang= get_browser_language();
52   } else {
53     $lang= $config->data['MAIN']['LANG'];
54   }
55   $lang.=".UTF-8";
56   putenv("LANGUAGE=");
57   putenv("LANG=$lang");
58   setlocale(LC_ALL, $lang);
59   $GLOBALS['t_language']= $lang;
60   $GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/';
62   /* Set the text domain as 'messages' */
63   $domain = 'messages';
64   bindtextdomain($domain, "$BASE_DIR/locale");
65   textdomain($domain);
66     
67   /* Set template compile directory */
68   $smarty= new smarty();
69   if (isset ($config->data['MAIN']['COMPILE'])){
70     $smarty->compile_dir= $config->data['MAIN']['COMPILE'];
71   } else {
72     $smarty->compile_dir= '/var/spool/gosa/';
73   }
74   $smarty->display (get_template_path('headers.tpl'));
75   $smarty->display (get_template_path('logout.tpl'));
76   @session_destroy ();
77   @session_unset ();
78   exit;
79 }
80 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
81 ?>
82 </html>