diff --git a/html/logout.php b/html/logout.php
index 1ffbf9d8df21d5bbea541d16c20288727ebf5a20..6fb8bcc611d60db744d9c00a3e2dd4c458471912 100644 (file)
--- a/html/logout.php
+++ b/html/logout.php
require_once ("functions.inc");
header("Content-type: text/html; charset=UTF-8");
get_dir_list("$BASE_DIR/plugins");
-session_start ();
-/* This message will be set if the logout was caused by main.php-
- * if inactivity of user was > than the defined value in gosa.conf (session_lifetime)
- * This Message will be displayed in the logout template.
- * To force displaying the logout template, we have to unset the session.
- */
-if(isset($_SESSION['kick_message'])){
- $kmsg = $_SESSION['kick_message'];
- @session_unset();
-}else{
- $kmsg = "";
+/* try to start session, so we can remove userlocks,
+ if the old session is still available */
+@session_start();
+if(isset($_SESSION['ui'])){
+
+ /* Get config & ui informations */
+ $ui= $_SESSION["ui"];
+
+ /* config used for del_user_locks & some lines below to detect the language */
+ $config= $_SESSION["config"];
+
+ /* Remove all locks of this user */
+ del_user_locks($ui->dn);
+
+ /* Write something to log */
+ gosa_log ("User \"".$ui->username."\" logged out");
}
-/* Do logout-logging and destroy session */
-if (!isset($_SESSION["config"])){
+/* If GET request is posted, the logout was forced by pressing the link */
+if (isset($_GET['request'])){
+
+ /* destroy old session */
+ @session_unset ();
+ @session_destroy ();
+
+ /* Go back to the base via header */
+ header ("Location: index.php");
+ exit();
+
+}else{ // The logout wasn't forced, so the session is invalid
+
/* Language setup */
- if ($config->data['MAIN']['LANG'] == ""){
+ if ((!isset($config))||(empty($config->data['MAIN']['LANG']))){
$lang= get_browser_language();
} else {
$lang= $config->data['MAIN']['LANG'];
}
+
$lang.=".UTF-8";
putenv("LANGUAGE=");
putenv("LANG=$lang");
bindtextdomain($domain, "$BASE_DIR/locale");
textdomain($domain);
- /* Set template compile directory */
+ /* Create smarty & Set template compile directory */
$smarty= new smarty();
if (isset ($config->data['MAIN']['COMPILE'])){
$smarty->compile_dir= $config->data['MAIN']['COMPILE'];
} else {
$smarty->compile_dir= '/var/spool/gosa/';
}
- $smarty->assign("kmsg",$kmsg);
$smarty->display (get_template_path('headers.tpl'));
$smarty->display (get_template_path('logout.tpl'));
- @session_destroy ();
exit;
}
-$ui= $_SESSION["ui"];
-$config= $_SESSION["config"];
-gosa_log ("User \"".$ui->username."\" logged out");
-
-/* Remove all locks of this user */
-del_user_locks($ui->dn);
-
-@session_destroy ();
-
-/* Go back to the base via header */
-header ("Location: index.php");
-
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
</html>