X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=html%2Flogout.php;h=6fb8bcc611d60db744d9c00a3e2dd4c458471912;hb=7c609320bfece1e82ed61360159e5b744b1feadb;hp=aae94bc87896b9e950725fc1f0ba0b31ae494671;hpb=2e8e102c10ae78344e5f07a209f6e48cbfe2b9a7;p=gosa.git diff --git a/html/logout.php b/html/logout.php index aae94bc87..6fb8bcc61 100644 --- a/html/logout.php +++ b/html/logout.php @@ -18,34 +18,63 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - /* Basic setup, remove eventually registered sessions */ require_once ("../include/php_setup.inc"); require_once ("functions.inc"); -session_start (); +header("Content-type: text/html; charset=UTF-8"); +get_dir_list("$BASE_DIR/plugins"); + +/* 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"]; -/* Language setup */ -if ($config->data['MAIN']['LANG'] == ""){ - $lang= get_browser_language(); -} else { - $lang= $config->data['MAIN']['LANG']; + /* Remove all locks of this user */ + del_user_locks($ui->dn); + + /* Write something to log */ + gosa_log ("User \"".$ui->username."\" logged out"); } -$lang.=".UTF-8"; -putenv("LANGUAGE="); -putenv("LANG=$lang"); -setlocale(LC_ALL, $lang); -$GLOBALS['t_language']= $lang; -$GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/'; -/* Set the text domain as 'messages' */ -$domain = 'messages'; -bindtextdomain($domain, "$BASE_DIR/locale"); -textdomain($domain); +/* 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 ((!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"); + setlocale(LC_ALL, $lang); + $GLOBALS['t_language']= $lang; + $GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/'; -/* Do logout-logging and destroy session */ -if (!isset($_SESSION["ui"])){ + /* Set the text domain as 'messages' */ + $domain = 'messages'; + 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']; @@ -56,18 +85,6 @@ if (!isset($_SESSION["ui"])){ $smarty->display (get_template_path('logout.tpl')); 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: ?>