Fix: Module not disabled
This commit is contained in:
parent
829b8e98ad
commit
6a590ffec8
@ -19,15 +19,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/public/demo/index.php
|
* \file htdocs/public/demo/index.php
|
||||||
* \ingroup core
|
* \ingroup core
|
||||||
* \brief Entry page to access demo
|
* \brief Entry page to access demo
|
||||||
* \author Laurent Destailleur
|
* \author Laurent Destailleur
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||||
|
|
||||||
require("../../main.inc.php");
|
require("../../main.inc.php");
|
||||||
|
|
||||||
@ -41,33 +41,33 @@ if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo mu
|
|||||||
|
|
||||||
|
|
||||||
$demoprofiles=array(
|
$demoprofiles=array(
|
||||||
array('default'=>'-1', 'key'=>'profdemofun','label'=>'DemoFundation',
|
array('default'=>'-1', 'key'=>'profdemofun','label'=>'DemoFundation',
|
||||||
'disablemodules'=>'banque,barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,prelevement,produit,projet,propal,propale,service,societe,stock,tax',
|
'disablemodules'=>'banque,barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,prelevement,product,projet,propal,propale,service,societe,stock,tax',
|
||||||
'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png'),
|
'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png'),
|
||||||
array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2',
|
array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2',
|
||||||
'disablemodules'=>'barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,prelevement,produit,projet,propal,propale,service,societe,stock',
|
'disablemodules'=>'barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,prelevement,product,projet,propal,propale,service,societe,stock,tax',
|
||||||
'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png'),
|
'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png'),
|
||||||
array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly',
|
array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly',
|
||||||
'disablemodules'=>'adherent,barcode,boutique,cashdesk,don,expedition,externalsite,prelevement,stock',
|
'disablemodules'=>'adherent,barcode,boutique,cashdesk,categorie,don,expedition,externalsite,prelevement,product,stock',
|
||||||
'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png'),
|
'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png'),
|
||||||
array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk',
|
array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk',
|
||||||
'disablemodules'=>'adherent,boutique,don,externalsite,ficheinter,prelevement,produit,stock',
|
'disablemodules'=>'adherent,boutique,don,externalsite,ficheinter,prelevement,product,stock',
|
||||||
'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'),
|
'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'),
|
||||||
array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks',
|
array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks',
|
||||||
'disablemodules'=>'adherent,boutique,don,externalsite,ficheinter,prelevement,service',
|
'disablemodules'=>'adherent,boutique,don,externalsite,ficheinter,prelevement,service',
|
||||||
'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'),
|
'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'),
|
||||||
array('default'=>'0', 'key'=>'profdemoall','label'=>'DemoCompanyAll',
|
array('default'=>'0', 'key'=>'profdemoall','label'=>'DemoCompanyAll',
|
||||||
'disablemodules'=>'adherent,boutique,don,externalsite',
|
'disablemodules'=>'adherent,boutique,don,externalsite',
|
||||||
'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png'),
|
'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$alwayscheckedmodules=array('barcode','bookmark','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want
|
$alwayscheckedmodules=array('barcode','bookmark','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want
|
||||||
$alwaysuncheckedmodules=array('paybox','paypal','filemanager','google','scanner'); // Module we never want
|
$alwaysuncheckedmodules=array('paybox','paypal','filemanager','google','scanner'); // Module we never want
|
||||||
$alwayshiddenmodules=array('accounting','barcode','bookmark','boutique','clicktodial','document','domain','externalrss','externalsite','fckeditor','ftp','geoipmaxmind','gravatar','label','ldap','mantis','memcached','notification',
|
$alwayshiddenmodules=array('accounting','barcode','bookmark','boutique','clicktodial','document','domain','externalrss','externalsite','fckeditor','ftp','geoipmaxmind','gravatar','label','ldap','mantis','memcached','notification',
|
||||||
'syslog','user','webservices',
|
'syslog','user','webservices',
|
||||||
// Extended modules
|
// Extended modules
|
||||||
'awstats','bittorrent','cabinetmed','filemanager','monitoring','nltechno','ovh','phenix','phpsysinfo','submiteverywhere',
|
'awstats','bittorrent','cabinetmed','filemanager','monitoring','nltechno','ovh','phenix','phpsysinfo','postnuke','submiteverywhere',
|
||||||
'thomsonphonebook','webcalendar','webmail');
|
'survey','thomsonphonebook','voyage','webcalendar','webmail');
|
||||||
|
|
||||||
// Search modules
|
// Search modules
|
||||||
$dirlist=$conf->file->dol_document_root;
|
$dirlist=$conf->file->dol_document_root;
|
||||||
@ -148,38 +148,38 @@ asort($orders);
|
|||||||
|
|
||||||
if (GETPOST("action") == 'gotodemo')
|
if (GETPOST("action") == 'gotodemo')
|
||||||
{
|
{
|
||||||
//print 'ee'.GETPOST("demochoice");
|
//print 'ee'.GETPOST("demochoice");
|
||||||
$disablestring='';
|
$disablestring='';
|
||||||
// If we disable modules using a profile choice
|
// If we disable modules using a profile choice
|
||||||
if (GETPOST("demochoice"))
|
if (GETPOST("demochoice"))
|
||||||
{
|
{
|
||||||
foreach ($demoprofiles as $profilearray)
|
foreach ($demoprofiles as $profilearray)
|
||||||
{
|
{
|
||||||
if ($profilearray['key'] == GETPOST("demochoice"))
|
if ($profilearray['key'] == GETPOST("demochoice"))
|
||||||
{
|
{
|
||||||
$disablestring=$profilearray['disablemodules'];
|
$disablestring=$profilearray['disablemodules'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If we disable modules using personalized list
|
// If we disable modules using personalized list
|
||||||
foreach($modules as $val)
|
foreach($modules as $val)
|
||||||
{
|
{
|
||||||
$modulekeyname=strtolower($val->name);
|
$modulekeyname=strtolower($val->name);
|
||||||
if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname,$alwayscheckedmodules))
|
if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname,$alwayscheckedmodules))
|
||||||
{
|
{
|
||||||
$disablestring.=$modulekeyname.',';
|
$disablestring.=$modulekeyname.',';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Do redirect to login page
|
// Do redirect to login page
|
||||||
if ($disablestring)
|
if ($disablestring)
|
||||||
{
|
{
|
||||||
$url=DOL_URL_ROOT.'/index.php?disablemodules='.$disablestring;
|
$url=DOL_URL_ROOT.'/index.php?disablemodules='.$disablestring;
|
||||||
if (GETPOST("urlfrom")) $url.='&urlfrom='.GETPOST("urlfrom");
|
if (GETPOST("urlfrom")) $url.='&urlfrom='.GETPOST("urlfrom");
|
||||||
header("Location: ".$url);
|
header("Location: ".$url);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -231,69 +231,69 @@ print '<table style="font-size:14px;" width="100%" summary="List of Dolibarr dem
|
|||||||
$i=0;
|
$i=0;
|
||||||
foreach ($demoprofiles as $profilarray)
|
foreach ($demoprofiles as $profilarray)
|
||||||
{
|
{
|
||||||
if ($profilarray['default'] >= 0)
|
if ($profilarray['default'] >= 0)
|
||||||
{
|
{
|
||||||
$url=$_SERVER["PHP_SELF"].'?action=gotodemo&urlfrom='.urlencode($_SERVER["PHP_SELF"]);
|
$url=$_SERVER["PHP_SELF"].'?action=gotodemo&urlfrom='.urlencode($_SERVER["PHP_SELF"]);
|
||||||
$urlwithmod=$url.'&demochoice='.$profilarray['key'];
|
$urlwithmod=$url.'&demochoice='.$profilarray['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 ($i % $NBOFCOLS == 0) print '<tr>';
|
//if ($i % $NBOFCOLS == 0) print '<tr>';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'."\n";
|
print '<td>'."\n";
|
||||||
|
|
||||||
print '<form method="POST" name="form'.$profilarray['key'].'" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
print '<form method="POST" name="form'.$profilarray['key'].'" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
print '<input type="hidden" name="action" value="gotodemo">'."\n";
|
print '<input type="hidden" name="action" value="gotodemo">'."\n";
|
||||||
print '<input type="hidden" name="urlfrom" value="'.urlencode($urlfrom).'">'."\n";
|
print '<input type="hidden" name="urlfrom" value="'.urlencode($urlfrom).'">'."\n";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||||
print '<input type="hidden" name="username" value="demo">'."\n";
|
print '<input type="hidden" name="username" value="demo">'."\n";
|
||||||
print '<table summary="Dolibarr online demonstration for profile '.$profilarray['label'].'" style="font-size:14px;" width="100%" class="CTableRow'.($i%2==0?'1':'1').'">'."\n";
|
print '<table summary="Dolibarr online demonstration for profile '.$profilarray['label'].'" style="font-size:14px;" width="100%" class="CTableRow'.($i%2==0?'1':'1').'">'."\n";
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td width="50"><a href="'.$urlwithmod.'" id="a1'.$profilarray['key'].'" class="modulelineshow"><img src="'.$profilarray['icon'].'" width="48" border="0" alt="Demo '.$profilarray['label'].'"></a></td>';
|
print '<td width="50"><a href="'.$urlwithmod.'" id="a1'.$profilarray['key'].'" class="modulelineshow"><img src="'.$profilarray['icon'].'" width="48" border="0" alt="Demo '.$profilarray['label'].'"></a></td>';
|
||||||
//print '<td><input type="radio" name="demochoice"';
|
//print '<td><input type="radio" name="demochoice"';
|
||||||
//if ($profilarray['default']) print ' checked="true"';
|
//if ($profilarray['default']) print ' checked="true"';
|
||||||
//print ' value="'.$profilarray['key'].'"></td>';
|
//print ' value="'.$profilarray['key'].'"></td>';
|
||||||
print '<td><a href="'.$urlwithmod.'" id="a2'.$profilarray['key'].'" class="modulelineshow">'.$langs->trans($profilarray['label']).'</a></td></tr>'."\n";
|
print '<td><a href="'.$urlwithmod.'" id="a2'.$profilarray['key'].'" class="modulelineshow">'.$langs->trans($profilarray['label']).'</a></td></tr>'."\n";
|
||||||
|
|
||||||
print '<tr id="tr1'.$profilarray['key'].'" class="moduleline">';
|
print '<tr id="tr1'.$profilarray['key'].'" class="moduleline">';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print $langs->trans("ThisIsListOfModules").'<br>';
|
print $langs->trans("ThisIsListOfModules").'<br>';
|
||||||
print '<table width="100%">';
|
print '<table width="100%">';
|
||||||
$listofdisabledmodules=explode(',',$profilarray['disablemodules']);
|
$listofdisabledmodules=explode(',',$profilarray['disablemodules']);
|
||||||
$j=0;$nbcolsmod=4;
|
$j=0;$nbcolsmod=4;
|
||||||
foreach($modules as $val) // Loop on qualified (enabled) modules
|
foreach($modules as $val) // Loop on qualified (enabled) modules
|
||||||
{
|
{
|
||||||
$modulekeyname=strtolower($val->name);
|
$modulekeyname=strtolower($val->name);
|
||||||
|
|
||||||
$modulequalified=1;
|
$modulequalified=1;
|
||||||
if (! empty($val->always_enabled) || in_array($modulekeyname,$alwayshiddenmodules)) $modulequalified=0;
|
if (! empty($val->always_enabled) || in_array($modulekeyname,$alwayshiddenmodules)) $modulequalified=0;
|
||||||
if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0;
|
if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0;
|
||||||
if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
|
if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
|
||||||
if (! $modulequalified) continue;
|
if (! $modulequalified) continue;
|
||||||
|
|
||||||
$modulo=($j % $nbcolsmod);
|
$modulo=($j % $nbcolsmod);
|
||||||
if ($modulo == 0) print '<tr>';
|
if ($modulo == 0) print '<tr>';
|
||||||
print '<td><input type="checkbox" class="checkbox" name="'.$modulekeyname.'" value="1"';
|
print '<td><input type="checkbox" class="checkbox" name="'.$modulekeyname.'" value="1"';
|
||||||
if (in_array($modulekeyname,$alwaysuncheckedmodules)) print ' disabled="true"';
|
if (in_array($modulekeyname,$alwaysuncheckedmodules)) print ' disabled="true"';
|
||||||
if (! in_array($modulekeyname,$alwaysuncheckedmodules) && (! in_array($modulekeyname,$listofdisabledmodules) || in_array($modulekeyname,$alwayscheckedmodules))) print ' checked="true"';
|
if (! in_array($modulekeyname,$alwaysuncheckedmodules) && (! in_array($modulekeyname,$listofdisabledmodules) || in_array($modulekeyname,$alwayscheckedmodules))) print ' checked="true"';
|
||||||
print '>'.$val->getName().' </td>';
|
print '>'.$val->getName().' </td>';
|
||||||
if ($modulo == ($nbcolsmod - 1)) print '</tr>';
|
if ($modulo == ($nbcolsmod - 1)) print '</tr>';
|
||||||
$j++;
|
$j++;
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
print '<tr id="tr2'.$profilarray['key'].'" class="moduleline"><td colspan="'.$nbcolsmod.'" align="center"><input type="submit" value=" '.$langs->trans("Start").' " class="button"></td></tr>';
|
print '<tr id="tr2'.$profilarray['key'].'" class="moduleline"><td colspan="'.$nbcolsmod.'" align="center"><input type="submit" value=" '.$langs->trans("Start").' " class="button"></td></tr>';
|
||||||
print '</table></form>'."\n";
|
print '</table></form>'."\n";
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
//if ($i % $NBOFCOLS == ($NBOFCOLS-1)) print '</tr>'."\n";
|
//if ($i % $NBOFCOLS == ($NBOFCOLS-1)) print '</tr>'."\n";
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
@ -318,23 +318,41 @@ print '</table>';
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
// Google Adsense (ex: demo mode)
|
// Google Adsense (need Google module)
|
||||||
if (! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))
|
if (! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))
|
||||||
{
|
{
|
||||||
print '<div align="center">'."\n";
|
print '<div align="center">'."\n";
|
||||||
print '<script type="text/javascript"><!--'."\n";
|
print '<script type="text/javascript"><!--'."\n";
|
||||||
print 'google_ad_client = "'.$conf->global->MAIN_GOOGLE_AD_CLIENT.'";'."\n";
|
print 'google_ad_client = "'.$conf->global->MAIN_GOOGLE_AD_CLIENT.'";'."\n";
|
||||||
print 'google_ad_slot = "'.$conf->global->MAIN_GOOGLE_AD_SLOT.'";'."\n";
|
print 'google_ad_slot = "'.$conf->global->MAIN_GOOGLE_AD_SLOT.'";'."\n";
|
||||||
print 'google_ad_width = '.$conf->global->MAIN_GOOGLE_AD_WIDTH.';'."\n";
|
print 'google_ad_width = '.$conf->global->MAIN_GOOGLE_AD_WIDTH.';'."\n";
|
||||||
print 'google_ad_height = '.$conf->global->MAIN_GOOGLE_AD_HEIGHT.';'."\n";
|
print 'google_ad_height = '.$conf->global->MAIN_GOOGLE_AD_HEIGHT.';'."\n";
|
||||||
print '//-->'."\n";
|
print '//-->'."\n";
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
print '<script type="text/javascript"'."\n";
|
print '<script type="text/javascript"'."\n";
|
||||||
print 'src="http://pagead2.googlesyndication.com/pagead/show_ads.js">'."\n";
|
print 'src="http://pagead2.googlesyndication.com/pagead/show_ads.js">'."\n";
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
print '</div>'."\n";
|
print '</div>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Google Analytics (need Google module)
|
||||||
|
if (! empty($conf->global->MAIN_GOOGLE_AN_ID))
|
||||||
|
{
|
||||||
|
print "\n";
|
||||||
|
print '<script type="text/javascript">'."\n";
|
||||||
|
print ' var _gaq = _gaq || [];'."\n";
|
||||||
|
print ' _gaq.push([\'_setAccount\', \''.$conf->global->MAIN_GOOGLE_AN_ID.'\']);'."\n";
|
||||||
|
print ' _gaq.push([\'_trackPageview\']);'."\n";
|
||||||
|
print ''."\n";
|
||||||
|
print ' (function() {'."\n";
|
||||||
|
print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;'."\n";
|
||||||
|
print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';'."\n";
|
||||||
|
print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);'."\n";
|
||||||
|
print ' })();'."\n";
|
||||||
|
print '</script>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
llxFooterVierge('$Date$ - $Revision$');
|
llxFooterVierge('$Date$ - $Revision$');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user