Fix demo links

This commit is contained in:
Laurent Destailleur 2017-06-13 13:22:05 +02:00
parent 225c17d047
commit c0f46834cb
3 changed files with 43 additions and 29 deletions

View File

@ -64,6 +64,7 @@ TaskDescription=Task description
NewTask=New task NewTask=New task
AddTask=Create task AddTask=Create task
AddTimeSpent=Create time spent AddTimeSpent=Create time spent
AddHereTimeSpentForDay=Add here time spent for this day/task
Activity=Activity Activity=Activity
Activities=Tasks/activities Activities=Tasks/activities
MyActivities=My tasks/activities MyActivities=My tasks/activities

View File

@ -396,7 +396,7 @@ if (! defined('NOLOGIN'))
{ {
if (empty($_SERVER['HTTP_REFERER']) || ! preg_match('/public/',$_SERVER['HTTP_REFERER'])) if (empty($_SERVER['HTTP_REFERER']) || ! preg_match('/public/',$_SERVER['HTTP_REFERER']))
{ {
dol_syslog("Call index page from another url than demo page"); dol_syslog("Call index page from another url than demo page (call is done from page ".$_SERVER['HTTP_REFERER'].")");
$url=''; $url='';
$url.=($url?'&':'').($dol_hide_topmenu?'dol_hide_topmenu='.$dol_hide_topmenu:''); $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_hide_leftmenu?'dol_hide_leftmenu='.$dol_hide_leftmenu:'');

View File

@ -54,12 +54,13 @@ $alwaysuncheckedmodules=array();
$alwayshiddencheckedmodules=array(); $alwayshiddencheckedmodules=array();
$alwayshiddenuncheckedmodules=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_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_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_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_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.=($url?'&':'').($conf->dol_use_jmobile?'dol_use_jmobile='.$conf->dol_use_jmobile:'');
$url=DOL_URL_ROOT.'/index.php'.($url?'?'.$url:'');
$tmpaction = 'view'; $tmpaction = 'view';
$parameters=array(); $parameters=array();
@ -105,6 +106,7 @@ if (empty($reshook))
) )
); );
// Visible // Visible
$alwayscheckedmodules=array('barcode','bookmark','categorie','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want $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 $alwaysuncheckedmodules=array('dynamicprices','loan','multicurrency','paybox','paypal','stripe','google','printing','scanner','workflow'); // Module we never want
@ -202,7 +204,7 @@ asort($orders);
* Actions * 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"); //print 'ee'.GETPOST("demochoice");
$disablestring=''; $disablestring='';
@ -232,8 +234,9 @@ if (GETPOST('action','aZ09') == 'gotodemo')
// Do redirect to login page // Do redirect to login page
if ($disablestring) if ($disablestring)
{ {
if (GETPOST('urlfrom')) $url.=($url?'&':'').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); if (GETPOST('urlfrom')) $url.=(preg_match('/\?/',$url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom','alpha'));
$url.=($url?'&':'').'disablemodules='.$disablestring; $url.=(preg_match('/\?/',$url)?'&':'?').'disablemodules='.$disablestring;
//var_dump($url);exit;
header("Location: ".$url); header("Location: ".$url);
exit; exit;
} }
@ -304,13 +307,23 @@ foreach ($demoprofiles as $profilearray)
//print $profilearray['lang']; //print $profilearray['lang'];
if (! empty($profilearray['lang'])) $langs->load($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']; $urlwithmod=$url.'&demochoice='.$profilearray['key'];
// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr' // Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
//print "xx".$_SERVER["PHP_SELF"].' '.DOL_URL_ROOT.'<br>'; //print "xx".$_SERVER["PHP_SELF"].' '.DOL_URL_ROOT.'<br>';
$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; //print $urlfrom;
if (! empty($profilearray['url'])) $urlwithmod=$profilearray['url'];
if (! empty($profilearray['url']))
{
$urlwithmod=$profilearray['url'];
$urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&amp;':'?').'urlfrom='.urlencode($urlfrom);
if (! empty($profilearray['disablemodules']))
{
$urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&amp;':'?').'disablemodules='.$profilearray['disablemodules'];
}
}
if (empty($profilearray['url'])) if (empty($profilearray['url']))
{ {
@ -348,7 +361,7 @@ foreach ($demoprofiles as $profilearray)
print '</a>'; print '</a>';
// Modules // Modules (a profile you must choose modules)
if (empty($profilearray['url'])) if (empty($profilearray['url']))
{ {
print '<div id="tr1'.$profilearray['key'].'" class="moduleline hidden" style="margin-left: 8px; margin-right: 8px; text-align: justify; font-size:14px; line-height: 130%; padding-bottom: 8px">'; print '<div id="tr1'.$profilearray['key'].'" class="moduleline hidden" style="margin-left: 8px; margin-right: 8px; text-align: justify; font-size:14px; line-height: 130%; padding-bottom: 8px">';