diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 330fe39b756..10875551b23 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -102,7 +102,10 @@ if ($_REQUEST["action"] == 'gotodemo') if ($disablestring) { - header("Location: ".DOL_URL_ROOT.'/index.php?disablemodules='.$disablestring); + $url=DOL_URL_ROOT.'/index.php?disablemodules='.$disablestring; + if (! empty($_REQUEST["urlfrom"])) $url.='&urlfrom='.$_REQUEST["urlfrom"]; + if (! empty($conf->global->MAIN_DEMO)) $url.='&username='.urlencode($conf->global->MAIN_DEMO); + header("Location: ".$url); exit; } } @@ -207,7 +210,7 @@ foreach ($demoprofiles as $profilarray) { if ($profilarray['default'] >= 0) { - $url=$_SERVER["PHP_SELF"].'?action=gotodemo&demochoice='.$profilarray['key']; + $url=$_SERVER["PHP_SELF"].'?action=gotodemo&demochoice='.$profilarray['key'].'&urlfrom='.urlencode($_SERVER["PHP_SELF"]); //if ($i % $NBOFCOLS == 0) print ''; print ''; print ''; diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index 6c1c9d5c2a2..a0ec668c8f4 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -33,6 +33,9 @@ if ($_SESSION["dol_authmode"] == 'forceuser' include_once("../conf/conf.php"); require_once("../main.inc.php"); +// Define url to go after disconnect +$urlfrom=empty($_SESSION["urlfrom"])?'':$_SESSION["urlfrom"]; + // Module Phenix if ($conf->phenix->enabled && $conf->phenix->cookie) { @@ -56,5 +59,13 @@ dolibarr_syslog("Start session name=".$sessionname." Session id()=".session_id() session_unregister("dol_login"); -header("Location: ".DOL_URL_ROOT."/index.php"); + +// Define url to go +$url=DOL_URL_ROOT."/index.php"; // By default go to login page +if ($urlfrom) +{ + $url=DOL_URL_ROOT.$urlfrom; +} + +header("Location: ".$url); ?>