Skip to content
Snippets Groups Projects
Commit bbe68e34 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: dol_hide_topmenu and dol_hide_leftmenu not lost after logout

parent df08d838
No related branches found
No related tags found
No related merge requests found
......@@ -33,12 +33,12 @@ if (! defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) define('EVEN_IF_ONLY_LOGIN_ALLOWED
require_once '../main.inc.php';
// This can happen only with a bookmark or forged url call.
if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuser'
|| $_SESSION["dol_authmode"] == 'http'))
if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuser' || $_SESSION["dol_authmode"] == 'http'))
{
die("Disconnection does not work when connection was made in mode ".$_SESSION["dol_authmode"]);
}
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
......@@ -53,13 +53,16 @@ $urlfrom=empty($_SESSION["urlfrom"])?'':$_SESSION["urlfrom"];
// TODO external module
if (! empty($conf->phenix->enabled) && ! empty($conf->phenix->cookie))
{
// Destroy cookie
setcookie($conf->phenix->cookie, '', 1, "/");
}
// Destroy object of session
unset($_SESSION['dol_login']);
unset($_SESSION['dol_entity']);
// Define url to go
$url=DOL_URL_ROOT."/index.php"; // By default go to login page
if ($urlfrom) $url=DOL_URL_ROOT.$urlfrom;
if (! empty($conf->global->MAIN_LOGOUT_GOTO_URL)) $url=$conf->global->MAIN_LOGOUT_GOTO_URL;
if (! empty($_SESSION['dol_hide_topmenu'])) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_topmenu=1';
if (! empty($_SESSION['dol_hide_leftmenu'])) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_leftmenu=1';
// Destroy session
$prefix=dol_getprefix();
......@@ -70,10 +73,9 @@ session_name($sessionname);
session_destroy();
dol_syslog("End of session ".$sessionname);
// Define url to go
$url=DOL_URL_ROOT."/index.php"; // By default go to login page
if ($urlfrom) $url=DOL_URL_ROOT.$urlfrom;
if (! empty($conf->global->MAIN_LOGOUT_GOTO_URL)) $url=$conf->global->MAIN_LOGOUT_GOTO_URL;
// TODO Not sure this is required
unset($_SESSION['dol_login']);
unset($_SESSION['dol_entity']);
//print 'url='.$url;exit;
header("Location: ".$url);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment