Add dolibarr_main_demo and dolibarr_main_prod into config file instead of database for security reasons.

This commit is contained in:
Laurent Destailleur 2009-08-25 14:01:43 +00:00
parent a5c7178a3d
commit e28b304bef
6 changed files with 244 additions and 221 deletions

View File

@ -33,10 +33,10 @@ if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.commande.class.php'); if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.commande.class.php');
if ($conf->tax->enabled) require_once(DOL_DOCUMENT_ROOT.'/chargesociales.class.php'); if ($conf->tax->enabled) require_once(DOL_DOCUMENT_ROOT.'/chargesociales.class.php');
// L'espace compta/tréso doit toujours etre actif car c'est un espace partagé // L'espace compta/tr<EFBFBD>so doit toujours etre actif car c'est un espace partag<61>
// par de nombreux modules (banque, facture, commande à facturer, etc...) indépendemment // par de nombreux modules (banque, facture, commande <EFBFBD> facturer, etc...) ind<6E>pendemment
// de l'utilisation de la compta ou non. C'est au sein de cet espace que chaque sous fonction // de l'utilisation de la compta ou non. C'est au sein de cet espace que chaque sous fonction
// est protégé par le droit qui va bien du module concerné. // est prot<EFBFBD>g<EFBFBD> par le droit qui va bien du module concern<72>.
//if (!$user->rights->compta->general->lire) //if (!$user->rights->compta->general->lire)
// accessforbidden(); // accessforbidden();
@ -653,7 +653,7 @@ if ($conf->tax->enabled && $user->rights->tax->charges->lire)
} }
/* /*
* Commandes clients à facturer * Commandes clients <EFBFBD> facturer
*/ */
if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->commande->lire) if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->commande->lire)
{ {
@ -752,7 +752,7 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman
} }
/* /*
* Factures clients impayées * Factures clients impay<EFBFBD>es
*/ */
if ($conf->facture->enabled && $user->rights->facture->lire) if ($conf->facture->enabled && $user->rights->facture->lire)
{ {
@ -851,7 +851,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
} }
/* /*
* Factures fournisseurs impayées * Factures fournisseurs impay<EFBFBD>es
*/ */
if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire)
{ {

View File

@ -1,179 +1,194 @@
<?php <?php
# #
# Dolibarr example for conf.php file # Dolibarr example for conf.php file
# #
# Do not edit this file without changing its name. # Do not edit this file without changing its name.
# This file is used by Dolibarr setup process to create true Dolibarr # This file is used by Dolibarr setup process to create true Dolibarr
# config file called "conf.php". # config file called "conf.php".
# #
# $Id$ # $Id$
# dolibarr_main_url_root # dolibarr_main_url_root
# This parameter defines the root URL of your Dolibarr index.php page. # This parameter defines the root URL of your Dolibarr index.php page.
# It must link to the directory htdocs. # It must link to the directory htdocs.
# Examples: # Examples:
# $dolibarr_main_url_root="http://localhost"; # $dolibarr_main_url_root="http://localhost";
# $dolibarr_main_url_root="http://mydolibarrvirtualhost"; # $dolibarr_main_url_root="http://mydolibarrvirtualhost";
# $dolibarr_main_url_root="http://myserver/dolibarr/htdocs"; # $dolibarr_main_url_root="http://myserver/dolibarr/htdocs";
# #
$dolibarr_main_url_root=""; $dolibarr_main_url_root="";
# dolibarr_main_document_root # dolibarr_main_document_root
# This parameter contains absolute file system directory of Dolibarr # This parameter contains absolute file system directory of Dolibarr
# htdocs directory # htdocs directory
# Examples: # Examples:
# $dolibarr_main_document_root="/var/www/dolibarr/htdocs"; # $dolibarr_main_document_root="/var/www/dolibarr/htdocs";
# $dolibarr_main_document_root="C:/My web sites/dolibarr/htdocs"; # $dolibarr_main_document_root="C:/My web sites/dolibarr/htdocs";
# #
$dolibarr_main_document_root=""; $dolibarr_main_document_root="";
# dolibarr_main_data_root # dolibarr_main_data_root
# This parameter contains absolute file system directory of Dolibarr # This parameter contains absolute file system directory of Dolibarr
# directory used to store uploaded and generated physical files. # directory used to store uploaded and generated physical files.
# Examples: # Examples:
# $dolibarr_main_document_root="/var/www/dolibarr/documents"; # $dolibarr_main_document_root="/var/www/dolibarr/documents";
# $dolibarr_main_document_root="E:/My web sites/dolibarr/documents"; # $dolibarr_main_document_root="E:/My web sites/dolibarr/documents";
# #
$dolibarr_main_data_root=""; $dolibarr_main_data_root="";
# dolibarr_main_db_host # dolibarr_main_db_host
# This parameter contains host name or ip address of Dolibarr database # This parameter contains host name or ip address of Dolibarr database
# server. # server.
# Examples: # Examples:
# $dolibarr_main_db_host="localhost"; # $dolibarr_main_db_host="localhost";
# $dolibarr_main_db_host="127.0.0.1"; # $dolibarr_main_db_host="127.0.0.1";
# $dolibarr_main_db_host="192.168.0.10"; # $dolibarr_main_db_host="192.168.0.10";
# $dolibarr_main_db_host="mysql.myserver.com"; # $dolibarr_main_db_host="mysql.myserver.com";
# #
$dolibarr_main_db_host=""; $dolibarr_main_db_host="";
# dolibarr_main_db_port # dolibarr_main_db_port
# This parameter contains the port of the Dolibarr database. # This parameter contains the port of the Dolibarr database.
# Default value: none # Default value: none
# Examples: # Examples:
# $dolibarr_main_db_host="3306; # $dolibarr_main_db_host="3306;
# #
$dolibarr_main_db_port=""; $dolibarr_main_db_port="";
# dolibarr_main_db_name # dolibarr_main_db_name
# This parameter contains name of Dolibarr database. # This parameter contains name of Dolibarr database.
# Examples: # Examples:
# $dolibarr_main_db_name="dolibarr"; # $dolibarr_main_db_name="dolibarr";
# $dolibarr_main_db_name="mydatabase"; # $dolibarr_main_db_name="mydatabase";
# #
$dolibarr_main_db_name=""; $dolibarr_main_db_name="";
# dolibarr_main_db_user # dolibarr_main_db_user
# This parameter contains user name used to read and write into # This parameter contains user name used to read and write into
# Dolibarr database. # Dolibarr database.
# Examples: # Examples:
# $dolibarr_main_db_user="admin"; # $dolibarr_main_db_user="admin";
# $dolibarr_main_db_user="dolibarruser"; # $dolibarr_main_db_user="dolibarruser";
# #
$dolibarr_main_db_user=""; $dolibarr_main_db_user="";
# dolibarr_main_db_pass # dolibarr_main_db_pass
# This parameter contains password used to read and write into # This parameter contains password used to read and write into
# Dolibarr database. # Dolibarr database.
# Examples: # Examples:
# $dolibarr_main_db_pass="myadminpass"; # $dolibarr_main_db_pass="myadminpass";
# $dolibarr_main_db_pass="myuserpassword"; # $dolibarr_main_db_pass="myuserpassword";
# #
$dolibarr_main_db_pass=""; $dolibarr_main_db_pass="";
# dolibarr_main_db_type # dolibarr_main_db_type
# This parameter contains the name of the driver used to access your # This parameter contains the name of the driver used to access your
# Dolibarr database. # Dolibarr database.
# Default value: none # Default value: none
# Possible values: mysql, mysqli, pgsql # Possible values: mysql, mysqli, pgsql
# Examples: # Examples:
# $dolibarr_main_db_type="mysql; # $dolibarr_main_db_type="mysql;
# $dolibarr_main_db_type="mysqli"; # $dolibarr_main_db_type="mysqli";
# $dolibarr_main_db_type="pgsql"; # $dolibarr_main_db_type="pgsql";
# #
$dolibarr_main_db_type=""; $dolibarr_main_db_type="";
# dolibarr_main_db_character_set # dolibarr_main_db_character_set
# Database character set used to store data (forced during database creation). # Database character set used to store data (forced during database creation).
# Default value: depends on database driver # Default value: depends on database driver
# Examples: # Examples:
# dolibarr_main_db_character_set="latin1"; # dolibarr_main_db_character_set="latin1";
# #
$dolibarr_main_db_character_set="latin1"; $dolibarr_main_db_character_set="latin1";
# dolibarr_main_db_collation # dolibarr_main_db_collation
# Database character set used to sort data (forced during database creation). # Database character set used to sort data (forced during database creation).
# Default value: depends on database driver # Default value: depends on database driver
# Examples: # Examples:
# dolibarr_main_db_collation="latin1_swedish_ci"; # dolibarr_main_db_collation="latin1_swedish_ci";
# #
$dolibarr_main_db_collation="latin1_swedish_ci"; $dolibarr_main_db_collation="latin1_swedish_ci";
# dolibarr_main_authentication # dolibarr_main_authentication
# This parameter contains the way authentication is done. # This parameter contains the way authentication is done.
# If value "ldap" is used, you must also set parameters dolibarr_main_auth_ldap_* # If value "ldap" is used, you must also set parameters dolibarr_main_auth_ldap_*
# Default value: dolibarr # Default value: dolibarr
# Possible values: Any values found in files in htdocs/includes/login directory after # Possible values: Any values found in files in htdocs/includes/login directory after
# the "function_" string and before the ".php" string. # the "function_" string and before the ".php" string.
# Examples: # Examples:
# $dolibarr_main_authentication="http"; # $dolibarr_main_authentication="http";
# $dolibarr_main_authentication="dolibarr"; # $dolibarr_main_authentication="dolibarr";
# $dolibarr_main_authentication="ldap"; # $dolibarr_main_authentication="ldap";
# #
$dolibarr_main_authentication="dolibarr"; $dolibarr_main_authentication="dolibarr";
# dolibarr_main_force_https # dolibarr_main_force_https
# This parameter allows to force the HTTPS mode. # This parameter allows to force the HTTPS mode.
# Warning: If you enable this parameter, your dolibarr_main_url_root parameter # Warning: If you enable this parameter, your dolibarr_main_url_root parameter
# must contains an URL with https and web server must be configured to respond # must contains an URL with https and web server must be configured to respond
# to such an URL. # to such an URL.
# Default value: 0 # Default value: 0
# Possible values: 0 or 1 # Possible values: 0 or 1
# Examples: # Examples:
# $dolibarr_main_force_https=0; # $dolibarr_main_force_https=0;
# #
$dolibarr_main_force_https="0"; $dolibarr_main_force_https="0";
# Parameters used to setup LDAP authentication. # Parameters used to setup LDAP authentication.
# Uncomment them if dolibarr_main_authentication = "ldap" # Uncomment them if dolibarr_main_authentication = "ldap"
# #
# $dolibarr_main_auth_ldap_host="127.0.0.1"; # $dolibarr_main_auth_ldap_host="127.0.0.1";
# $dolibarr_main_auth_ldap_port="389"; # $dolibarr_main_auth_ldap_port="389";
# $dolibarr_main_auth_ldap_version="3"; # $dolibarr_main_auth_ldap_version="3";
# $dolibarr_main_auth_ldap_servertype="openldap"; # openldap, activedirectory or egroupware # $dolibarr_main_auth_ldap_servertype="openldap"; # openldap, activedirectory or egroupware
# #
# Following parameters should not be used in LDAP connection (deprecated ?): # Following parameters should not be used in LDAP connection (deprecated ?):
# $dolibarr_main_auth_ldap_login_attribute="loginfield"; # uid or samaccountname for active directory # $dolibarr_main_auth_ldap_login_attribute="loginfield"; # uid or samaccountname for active directory
# $dolibarr_main_auth_ldap_dn=""; # Ex: ou=users,dc=my-domain,dc=com # $dolibarr_main_auth_ldap_dn=""; # Ex: ou=users,dc=my-domain,dc=com
# $dolibarr_main_auth_ldap_admin_login=""; # Required only if anonymous bind disabled # $dolibarr_main_auth_ldap_admin_login=""; # Required only if anonymous bind disabled
# $dolibarr_main_auth_ldap_admin_pass=""; # Required only if anonymous bind disabled # $dolibarr_main_auth_ldap_admin_pass=""; # Required only if anonymous bind disabled
# #
# $dolibarr_main_auth_ldap_debug="false"; # $dolibarr_main_auth_ldap_debug="false";
# Parameters not used yet # Parameters not used yet
# dolibarr_smarty_libs_dir,dolibarr_smarty_compile,dolibarr_smarty_cache # dolibarr_smarty_libs_dir,dolibarr_smarty_compile,dolibarr_smarty_cache
# Examples: # Examples:
# $dolibarr_smarty_libs_dir="/var/www/dolibarr/external-libs/smarty/libs/"; # $dolibarr_smarty_libs_dir="/var/www/dolibarr/external-libs/smarty/libs/";
# $dolibarr_smarty_compile="/var/www/dolibarr/documents/temp/smarty_templates"; # $dolibarr_smarty_compile="/var/www/dolibarr/documents/temp/smarty_templates";
# $dolibarr_smarty_cache="/var/www/dolibarr/documents/temp/smarty_cache"; # $dolibarr_smarty_cache="/var/www/dolibarr/documents/temp/smarty_cache";
# #
$dolibarr_smarty_libs_dir=""; $dolibarr_smarty_libs_dir="";
$dolibarr_smarty_compile=""; $dolibarr_smarty_compile="";
$dolibarr_smarty_cache=""; $dolibarr_smarty_cache="";
?>
# Login and pass to use in a demo mode
# Default value: 0
# Possible values: 0 or 1
# Examples:
# $dolibarr_main_demo="autologin,autopass"
# When this parameter is defined, all errors messages are not reported.
# This feature exists for production usage to avoid to give any information to hackers.
# Default value: 0
# Possible values: 0 or 1
# Examples:
# $dolibarr_main_prod=1
?>

View File

@ -1684,12 +1684,13 @@ function dolibarr_print_error($db='',$error='')
* On doit appeler cette fonction quand une erreur technique bloquante est rencontree. * On doit appeler cette fonction quand une erreur technique bloquante est rencontree.
* Toutefois, il faut essayer de ne l'appeler qu'au sein de pages php, les classes devant * Toutefois, il faut essayer de ne l'appeler qu'au sein de pages php, les classes devant
* renvoyer leur erreur par l'intermediaire de leur propriete "error". * renvoyer leur erreur par l'intermediaire de leur propriete "error".
* \param db Database handler * \param db Database handler
* \param error Chaine erreur ou tableau de chaines erreur complementaires a afficher * \param error Chaine erreur ou tableau de chaines erreur complementaires a afficher
*/ */
function dol_print_error($db='',$error='') function dol_print_error($db='',$error='')
{ {
global $conf,$langs,$argv; global $conf,$langs,$argv;
$out = '';
$syslog = ''; $syslog = '';
// Si erreur intervenue avant chargement langue // Si erreur intervenue avant chargement langue
@ -1699,28 +1700,29 @@ function dol_print_error($db='',$error='')
$langs = new Translate("", $conf); $langs = new Translate("", $conf);
$langs->load("main"); $langs->load("main");
} }
$langs->load("errors");
if ($_SERVER['DOCUMENT_ROOT']) // Mode web if ($_SERVER['DOCUMENT_ROOT']) // Mode web
{ {
print $langs->trans("DolibarrHasDetectedError").".<br>\n"; $out.=$langs->trans("DolibarrHasDetectedError").".<br>\n";
if (! empty($conf->global->MAIN_FEATURES_LEVEL)) if (! empty($conf->global->MAIN_FEATURES_LEVEL))
print "You use an experimental level of features, so please do NOT report any bugs, anywhere, until going back to MAIN_FEATURES_LEVEL = 0.<br>\n"; $out.="You use an experimental level of features, so please do NOT report any bugs, anywhere, until going back to MAIN_FEATURES_LEVEL = 0.<br>\n";
print $langs->trans("InformationToHelpDiagnose").":<br>\n"; $out.=$langs->trans("InformationToHelpDiagnose").":<br>\n";
print "<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION."<br>\n";; $out.="<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION."<br>\n";;
print "<b>".$langs->trans("Date").":</b> ".dol_print_date(time(),'dayhourlog')."<br>\n";; $out.="<b>".$langs->trans("Date").":</b> ".dol_print_date(time(),'dayhourlog')."<br>\n";;
if (isset($conf->global->MAIN_FEATURES_LEVEL)) print "<b>".$langs->trans("LevelOfFeature").":</b> ".$conf->global->MAIN_FEATURES_LEVEL."<br>\n";; if (isset($conf->global->MAIN_FEATURES_LEVEL)) $out.="<b>".$langs->trans("LevelOfFeature").":</b> ".$conf->global->MAIN_FEATURES_LEVEL."<br>\n";;
print "<b>".$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";; $out.="<b>".$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";;
print "<b>".$langs->trans("Referer").":</b> ".$_SERVER["HTTP_REFERER"]."<br>\n";; $out.="<b>".$langs->trans("Referer").":</b> ".$_SERVER["HTTP_REFERER"]."<br>\n";;
print "<b>".$langs->trans("RequestedUrl").":</b> ".$_SERVER["REQUEST_URI"]."<br>\n";; $out.="<b>".$langs->trans("RequestedUrl").":</b> ".$_SERVER["REQUEST_URI"]."<br>\n";;
print "<b>".$langs->trans("MenuManager").":</b> ".$conf->left_menu.'/'.$conf->top_menu."<br>\n"; $out.="<b>".$langs->trans("MenuManager").":</b> ".$conf->left_menu.'/'.$conf->top_menu."<br>\n";
print "<br>\n"; $out.="<br>\n";
$syslog.="url=".$_SERVER["REQUEST_URI"]; $syslog.="url=".$_SERVER["REQUEST_URI"];
$syslog.=", query_string=".$_SERVER["QUERY_STRING"]; $syslog.=", query_string=".$_SERVER["QUERY_STRING"];
} }
else // Mode CLI else // Mode CLI
{ {
print '> '.$langs->transnoentities("ErrorInternalErrorDetected").":\n".$argv[0]."\n"; $out.='> '.$langs->transnoentities("ErrorInternalErrorDetected").":\n".$argv[0]."\n";
$syslog.="pid=".getmypid(); $syslog.="pid=".getmypid();
} }
@ -1728,18 +1730,18 @@ function dol_print_error($db='',$error='')
{ {
if ($_SERVER['DOCUMENT_ROOT']) // Mode web if ($_SERVER['DOCUMENT_ROOT']) // Mode web
{ {
print "<b>".$langs->trans("DatabaseTypeManager").":</b> ".$db->type."<br>\n"; $out.="<b>".$langs->trans("DatabaseTypeManager").":</b> ".$db->type."<br>\n";
print "<b>".$langs->trans("RequestLastAccessInError").":</b> ".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."<br>\n"; $out.="<b>".$langs->trans("RequestLastAccessInError").":</b> ".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."<br>\n";
print "<b>".$langs->trans("ReturnCodeLastAccessInError").":</b> ".($db->lasterrno()?$db->lasterrno():$langs->trans("ErrorNoRequestInError"))."<br>\n"; $out.="<b>".$langs->trans("ReturnCodeLastAccessInError").":</b> ".($db->lasterrno()?$db->lasterrno():$langs->trans("ErrorNoRequestInError"))."<br>\n";
print "<b>".$langs->trans("InformationLastAccessInError").":</b> ".($db->lasterror()?$db->lasterror():$langs->trans("ErrorNoRequestInError"))."<br>\n"; $out.="<b>".$langs->trans("InformationLastAccessInError").":</b> ".($db->lasterror()?$db->lasterror():$langs->trans("ErrorNoRequestInError"))."<br>\n";
print "<br>\n"; $out.="<br>\n";
} }
else // Mode CLI else // Mode CLI
{ {
print '> '.$langs->transnoentities("DatabaseTypeManager").":\n".$db->type."\n"; $out.='> '.$langs->transnoentities("DatabaseTypeManager").":\n".$db->type."\n";
print '> '.$langs->transnoentities("RequestLastAccessInError").":\n".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."\n"; $out.='> '.$langs->transnoentities("RequestLastAccessInError").":\n".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."\n";
print '> '.$langs->transnoentities("ReturnCodeLastAccessInError").":\n".($db->lasterrno()?$db->lasterrno():$langs->trans("ErrorNoRequestInError"))."\n"; $out.='> '.$langs->transnoentities("ReturnCodeLastAccessInError").":\n".($db->lasterrno()?$db->lasterrno():$langs->trans("ErrorNoRequestInError"))."\n";
print '> '.$langs->transnoentities("InformationLastAccessInError").":\n".($db->lasterror()?$db->lasterror():$langs->trans("ErrorNoRequestInError"))."\n"; $out.='> '.$langs->transnoentities("InformationLastAccessInError").":\n".($db->lasterror()?$db->lasterror():$langs->trans("ErrorNoRequestInError"))."\n";
} }
$syslog.=", sql=".$db->lastquery(); $syslog.=", sql=".$db->lastquery();
@ -1758,23 +1760,26 @@ function dol_print_error($db='',$error='')
$msg=$langs->trans($msg); $msg=$langs->trans($msg);
if ($_SERVER['DOCUMENT_ROOT']) // Mode web if ($_SERVER['DOCUMENT_ROOT']) // Mode web
{ {
print "<b>".$langs->trans("Message").":</b> ".$msg."<br>\n" ; $out.="<b>".$langs->trans("Message").":</b> ".$msg."<br>\n" ;
} }
else // Mode CLI else // Mode CLI
{ {
print '> '.$langs->transnoentities("Message").":\n".$msg."\n" ; $out.='> '.$langs->transnoentities("Message").":\n".$msg."\n" ;
} }
$syslog.=", msg=".$msg; $syslog.=", msg=".$msg;
} }
} }
if ($_SERVER['DOCUMENT_ROOT'] && function_exists('xdebug_call_file')) if ($_SERVER['DOCUMENT_ROOT'] && function_exists('xdebug_call_file'))
{ {
print '<b>XDebug informations:</b>'."<br>\n"; $out.='<b>XDebug informations:</b>'."<br>\n";
print 'File: '.xdebug_call_file()."<br>\n"; $out.='File: '.xdebug_call_file()."<br>\n";
print 'Line: '.xdebug_call_line()."<br>\n"; $out.='Line: '.xdebug_call_line()."<br>\n";
print "<br>\n"; $out.="<br>\n";
} }
global $dolibarr_main_prod;
if (empty($dolibarr_main_prod)) print $out;
else print 'Sorry, an error occured but the parameter $dolibarr_main_prod is defined in conf file so no message is reported on browsers. Please read the log file for error message.';
dol_syslog("Error ".$syslog, LOG_ERR); dol_syslog("Error ".$syslog, LOG_ERR);
} }

View File

@ -126,9 +126,11 @@ function dol_loginfunction($langs,$conf,$mysoc)
$demologin=''; $demologin='';
$demopassword=''; $demopassword='';
if (! empty($conf->global->MAIN_DEMO))
global $dolibarr_main_demo;
if (! empty($dolibarr_main_demo))
{ {
$tab=split(',',$conf->global->MAIN_DEMO); $tab=split(',',$dolibarr_main_demo);
$demologin=$tab[0]; $demologin=$tab[0];
$demopassword=$tab[1]; $demopassword=$tab[1];
} }

View File

@ -34,7 +34,8 @@ $langs->load("main");
$langs->load("other"); $langs->load("other");
// Security check // Security check
if (empty($conf->global->MAIN_DEMO)) accessforbidden('Constant MAIN_DEMO must be defined in Home->Setup->Misc with value "default login,default pass" to enable the demo entry page',1,1,1); global $dolibarr_main_demo;
if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page',1,1,1);
$demoprofiles=array( $demoprofiles=array(

View File

@ -166,7 +166,7 @@ if ($_GET["action"] == 'edit')
print '<tr '.$bc[$var].'><td>'.$langs->trans("Language").'</td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("Language").'</td>';
print '<td>'.($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$conf->global->MAIN_LANG_DEFAULT).'</td>'; print '<td>'.($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$conf->global->MAIN_LANG_DEFAULT).'</td>';
print '<td align="left" nowrap="nowrap" width="20%"><input '.$bc[$var].' name="check_MAIN_LANG_DEFAULT" type="checkbox" '.($fuser->conf->MAIN_LANG_DEFAULT?" checked":""); print '<td align="left" nowrap="nowrap" width="20%"><input '.$bc[$var].' name="check_MAIN_LANG_DEFAULT" type="checkbox" '.($fuser->conf->MAIN_LANG_DEFAULT?" checked":"");
print ! empty($conf->global->MAIN_DEMO)?' disabled="true"':''; // Disabled for demo print ! empty($dolibarr_main_demo)?' disabled="true"':''; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>'; print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>'; print '<td>';
$html=new Form($db); $html=new Form($db);
@ -178,7 +178,7 @@ if ($_GET["action"] == 'edit')
print '<tr '.$bc[$var].'><td>'.$langs->trans("MaxSizeList").'</td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("MaxSizeList").'</td>';
print '<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'</td>'; print '<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'</td>';
print '<td align="left" nowrap="nowrap" width="20%"><input '.$bc[$var].' name="check_SIZE_LISTE_LIMIT" type="checkbox" '.($fuser->conf->MAIN_SIZE_LISTE_LIMIT?" checked":""); print '<td align="left" nowrap="nowrap" width="20%"><input '.$bc[$var].' name="check_SIZE_LISTE_LIMIT" type="checkbox" '.($fuser->conf->MAIN_SIZE_LISTE_LIMIT?" checked":"");
print ! empty($conf->global->MAIN_DEMO)?' disabled="true"':''; // Disabled for demo print ! empty($dolibarr_main_demo)?' disabled="true"':''; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>'; print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td><input class="flat" name="main_size_liste_limit" size="4" value="' . $fuser->conf->SIZE_LISTE_LIMIT . '"></td></tr>'; print '<td><input class="flat" name="main_size_liste_limit" size="4" value="' . $fuser->conf->SIZE_LISTE_LIMIT . '"></td></tr>';
@ -186,7 +186,7 @@ if ($_GET["action"] == 'edit')
// Theme // Theme
show_theme($fuser,$conf->global->MAIN_DEMO?0:1,true); show_theme($fuser,empty($dolibarr_main_demo)?1:0,true);
print '</div>'; print '</div>';
@ -226,7 +226,7 @@ else
print '</div>'; print '</div>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($conf->global->MAIN_DEMO) if (! empty($dolibarr_main_demo))
{ {
print "<a class=\"butActionRefused\" title=\"".$langs->trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify")."</a>"; print "<a class=\"butActionRefused\" title=\"".$langs->trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify")."</a>";
} }