From c0f46834cb50a39620ec6d0dcb1cdedab7486717 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Jun 2017 13:22:05 +0200 Subject: [PATCH] Fix demo links --- htdocs/langs/en_US/projects.lang | 1 + htdocs/main.inc.php | 4 +- htdocs/public/demo/index.php | 67 +++++++++++++++++++------------- 3 files changed, 43 insertions(+), 29 deletions(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index b3317df9c8e..d940555f206 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -64,6 +64,7 @@ TaskDescription=Task description NewTask=New task AddTask=Create task AddTimeSpent=Create time spent +AddHereTimeSpentForDay=Add here time spent for this day/task Activity=Activity Activities=Tasks/activities MyActivities=My tasks/activities diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 74f3698e728..6b75b957590 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -396,8 +396,8 @@ if (! defined('NOLOGIN')) { if (empty($_SERVER['HTTP_REFERER']) || ! preg_match('/public/',$_SERVER['HTTP_REFERER'])) { - dol_syslog("Call index page from another url than demo page"); - $url=''; + dol_syslog("Call index page from another url than demo page (call is done from page ".$_SERVER['HTTP_REFERER'].")"); + $url=''; $url.=($url?'&':'').($dol_hide_topmenu?'dol_hide_topmenu='.$dol_hide_topmenu:''); $url.=($url?'&':'').($dol_hide_leftmenu?'dol_hide_leftmenu='.$dol_hide_leftmenu:''); $url.=($url?'&':'').($dol_optimize_smallscreen?'dol_optimize_smallscreen='.$dol_optimize_smallscreen:''); diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index be844c8a2da..f9bb4db7ecf 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -54,12 +54,13 @@ $alwaysuncheckedmodules=array(); $alwayshiddencheckedmodules=array(); $alwayshiddenuncheckedmodules=array(); -$url=DOL_URL_ROOT.'/index.php?'; +$url=''; $url.=($url?'&':'').($conf->dol_hide_topmenu?'dol_hide_topmenu='.$conf->dol_hide_topmenu:''); $url.=($url?'&':'').($conf->dol_hide_leftmenu?'dol_hide_leftmenu='.$conf->dol_hide_leftmenu:''); $url.=($url?'&':'').($conf->dol_optimize_smallscreen?'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen:''); $url.=($url?'&':'').($conf->dol_no_mouse_hover?'dol_no_mouse_hover='.$conf->dol_no_mouse_hover:''); $url.=($url?'&':'').($conf->dol_use_jmobile?'dol_use_jmobile='.$conf->dol_use_jmobile:''); +$url=DOL_URL_ROOT.'/index.php'.($url?'?'.$url:''); $tmpaction = 'view'; $parameters=array(); @@ -105,6 +106,7 @@ if (empty($reshook)) ) ); + // Visible $alwayscheckedmodules=array('barcode','bookmark','categorie','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want $alwaysuncheckedmodules=array('dynamicprices','loan','multicurrency','paybox','paypal','stripe','google','printing','scanner','workflow'); // Module we never want @@ -202,7 +204,7 @@ asort($orders); * Actions */ -if (GETPOST('action','aZ09') == 'gotodemo') +if (GETPOST('action','aZ09') == 'gotodemo') // Action run when we click on "Start" after selection modules { //print 'ee'.GETPOST("demochoice"); $disablestring=''; @@ -232,8 +234,9 @@ if (GETPOST('action','aZ09') == 'gotodemo') // Do redirect to login page if ($disablestring) { - if (GETPOST('urlfrom')) $url.=($url?'&':'').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); - $url.=($url?'&':'').'disablemodules='.$disablestring; + if (GETPOST('urlfrom')) $url.=(preg_match('/\?/',$url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); + $url.=(preg_match('/\?/',$url)?'&':'?').'disablemodules='.$disablestring; + //var_dump($url);exit; header("Location: ".$url); exit; } @@ -252,25 +255,25 @@ $head.=' '; @@ -304,13 +307,23 @@ foreach ($demoprofiles as $profilearray) //print $profilearray['lang']; if (! empty($profilearray['lang'])) $langs->load($profilearray['lang']); - $url=$_SERVER["PHP_SELF"].'?action=gotodemo&urlfrom='.urlencode($_SERVER["PHP_SELF"]); + $url=$_SERVER["PHP_SELF"].'?action=gotodemo'; $urlwithmod=$url.'&demochoice='.$profilearray['key']; // Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr' //print "xx".$_SERVER["PHP_SELF"].' '.DOL_URL_ROOT.'
'; - $urlfrom=preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/i','',$_SERVER["PHP_SELF"]); + + $urlfrom=preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/i','',$_SERVER["PHP_SELF"]); //print $urlfrom; - if (! empty($profilearray['url'])) $urlwithmod=$profilearray['url']; + + if (! empty($profilearray['url'])) + { + $urlwithmod=$profilearray['url']; + $urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&':'?').'urlfrom='.urlencode($urlfrom); + if (! empty($profilearray['disablemodules'])) + { + $urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&':'?').'disablemodules='.$profilearray['disablemodules']; + } + } if (empty($profilearray['url'])) { @@ -348,7 +361,7 @@ foreach ($demoprofiles as $profilearray) print ''; - // Modules + // Modules (a profile you must choose modules) if (empty($profilearray['url'])) { print '