From 6a590ffec8c0b08592941cb03902b00e9fdbc221 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Feb 2011 18:33:44 +0000 Subject: [PATCH] Fix: Module not disabled --- htdocs/public/demo/index.php | 242 +++++++++++++++++++---------------- 1 file changed, 130 insertions(+), 112 deletions(-) diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 8c68fd61450..8ef49d82cb9 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -19,15 +19,15 @@ */ /** - * \file htdocs/public/demo/index.php - * \ingroup core - * \brief Entry page to access demo - * \author Laurent Destailleur - * \version $Id$ + * \file htdocs/public/demo/index.php + * \ingroup core + * \brief Entry page to access demo + * \author Laurent Destailleur + * \version $Id$ */ -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("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. require("../../main.inc.php"); @@ -41,33 +41,33 @@ if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo mu $demoprofiles=array( - 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', - 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png'), - 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', - 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png'), - array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly', - 'disablemodules'=>'adherent,barcode,boutique,cashdesk,don,expedition,externalsite,prelevement,stock', - 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png'), - array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk', - 'disablemodules'=>'adherent,boutique,don,externalsite,ficheinter,prelevement,produit,stock', - 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'), - array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks', - 'disablemodules'=>'adherent,boutique,don,externalsite,ficheinter,prelevement,service', - 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'), - array('default'=>'0', 'key'=>'profdemoall','label'=>'DemoCompanyAll', - 'disablemodules'=>'adherent,boutique,don,externalsite', - 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png'), - ); + array('default'=>'-1', 'key'=>'profdemofun','label'=>'DemoFundation', + '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'), + array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2', + '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'), + array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly', + 'disablemodules'=>'adherent,barcode,boutique,cashdesk,categorie,don,expedition,externalsite,prelevement,product,stock', + 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png'), + array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk', + 'disablemodules'=>'adherent,boutique,don,externalsite,ficheinter,prelevement,product,stock', + 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'), + array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks', + 'disablemodules'=>'adherent,boutique,don,externalsite,ficheinter,prelevement,service', + 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'), + array('default'=>'0', 'key'=>'profdemoall','label'=>'DemoCompanyAll', + 'disablemodules'=>'adherent,boutique,don,externalsite', + '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 $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', 'syslog','user','webservices', // Extended modules - 'awstats','bittorrent','cabinetmed','filemanager','monitoring','nltechno','ovh','phenix','phpsysinfo','submiteverywhere', - 'thomsonphonebook','webcalendar','webmail'); + 'awstats','bittorrent','cabinetmed','filemanager','monitoring','nltechno','ovh','phenix','phpsysinfo','postnuke','submiteverywhere', + 'survey','thomsonphonebook','voyage','webcalendar','webmail'); // Search modules $dirlist=$conf->file->dol_document_root; @@ -148,38 +148,38 @@ asort($orders); if (GETPOST("action") == 'gotodemo') { - //print 'ee'.GETPOST("demochoice"); - $disablestring=''; - // If we disable modules using a profile choice - if (GETPOST("demochoice")) - { - foreach ($demoprofiles as $profilearray) - { - if ($profilearray['key'] == GETPOST("demochoice")) - { - $disablestring=$profilearray['disablemodules']; - break; - } - } - } - // If we disable modules using personalized list - foreach($modules as $val) - { - $modulekeyname=strtolower($val->name); - if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname,$alwayscheckedmodules)) - { - $disablestring.=$modulekeyname.','; - } + //print 'ee'.GETPOST("demochoice"); + $disablestring=''; + // If we disable modules using a profile choice + if (GETPOST("demochoice")) + { + foreach ($demoprofiles as $profilearray) + { + if ($profilearray['key'] == GETPOST("demochoice")) + { + $disablestring=$profilearray['disablemodules']; + break; + } + } + } + // If we disable modules using personalized list + foreach($modules as $val) + { + $modulekeyname=strtolower($val->name); + if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname,$alwayscheckedmodules)) + { + $disablestring.=$modulekeyname.','; + } - } + } // Do redirect to login page - if ($disablestring) - { - $url=DOL_URL_ROOT.'/index.php?disablemodules='.$disablestring; - if (GETPOST("urlfrom")) $url.='&urlfrom='.GETPOST("urlfrom"); - header("Location: ".$url); - exit; - } + if ($disablestring) + { + $url=DOL_URL_ROOT.'/index.php?disablemodules='.$disablestring; + if (GETPOST("urlfrom")) $url.='&urlfrom='.GETPOST("urlfrom"); + header("Location: ".$url); + exit; + } } @@ -231,69 +231,69 @@ print ''; - $urlfrom=preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/i','',$_SERVER["PHP_SELF"]); - //print $urlfrom; + if ($profilarray['default'] >= 0) + { + $url=$_SERVER["PHP_SELF"].'?action=gotodemo&urlfrom='.urlencode($_SERVER["PHP_SELF"]); + $urlwithmod=$url.'&demochoice='.$profilarray['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"]); + //print $urlfrom; - //if ($i % $NBOFCOLS == 0) print ''; - print ''; - print ''; + print ''; + print ''; + print '
'."\n"; + //if ($i % $NBOFCOLS == 0) print '
'."\n"; - print '
'."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; - print ''; - print ''; - //print ''; - print ''."\n"; + print ''; + print ''; + //print ''; + print ''."\n"; - print ''; - print ''; + print ''."\n"; - print ''; - print '
Demo '.$profilarray['label'].''.$langs->trans($profilarray['label']).'
Demo '.$profilarray['label'].''.$langs->trans($profilarray['label']).'
'; - print $langs->trans("ThisIsListOfModules").'
'; - print ''; - $listofdisabledmodules=explode(',',$profilarray['disablemodules']); - $j=0;$nbcolsmod=4; - foreach($modules as $val) // Loop on qualified (enabled) modules - { - $modulekeyname=strtolower($val->name); + print ''; + print ''; - print ''."\n"; + } + print '
'; + print $langs->trans("ThisIsListOfModules").'
'; + print ''; + $listofdisabledmodules=explode(',',$profilarray['disablemodules']); + $j=0;$nbcolsmod=4; + foreach($modules as $val) // Loop on qualified (enabled) modules + { + $modulekeyname=strtolower($val->name); - $modulequalified=1; + $modulequalified=1; 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 == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; if (! $modulequalified) continue; $modulo=($j % $nbcolsmod); - if ($modulo == 0) print ''; + if ($modulo == 0) print ''; print ''; if ($modulo == ($nbcolsmod - 1)) print ''; $j++; - } - print '
'.$val->getName().'  
'; - print '
'; + print '
'."\n"; + print '
'."\n"; - print ''; - //if ($i % $NBOFCOLS == ($NBOFCOLS-1)) print ''."\n"; - print ''."\n"; - $i++; - } + print ''; + //if ($i % $NBOFCOLS == ($NBOFCOLS-1)) print ''."\n"; + print ''."\n"; + $i++; + } } print ''; @@ -318,23 +318,41 @@ print ''; $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)) { - print '
'."\n"; - print ''."\n"; - print ''."\n"; - print '
'."\n"; + print '
'."\n"; + print ''."\n"; + print ''."\n"; + print '
'."\n"; } +// Google Analytics (need Google module) +if (! empty($conf->global->MAIN_GOOGLE_AN_ID)) +{ + print "\n"; + print ''."\n"; +} + + llxFooterVierge('$Date$ - $Revision$');