diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php
index 757eb250ca2..914d4e66abb 100644
--- a/htdocs/admin/menus.php
+++ b/htdocs/admin/menus.php
@@ -39,12 +39,13 @@ $langs->load("other");
// Security check
if (!$user->admin) accessforbidden();
-$dirstandard = array("/core/menus/standard");
-$dirsmartphone = array("/core/menus/smartphone");
-foreach($conf->menus_modules as $dir)
+$dirstandard = array();
+$dirsmartphone = array();
+$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
+foreach($dirmenus as $dirmenu)
{
- $dirstandard[]=$dir.'standard';
- $dirsmartphone[]=$dir.'standard';
+ $dirstandard[]=$dirmenu.'standard';
+ $dirsmartphone[]=$dirmenu.'smartphone';
}
diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php
index a05567af734..b99893d553b 100644
--- a/htdocs/admin/menus/index.php
+++ b/htdocs/admin/menus/index.php
@@ -32,12 +32,13 @@ $langs->load("admin");
if (! $user->admin) accessforbidden();
-$dirstandard = array("/core/menus/standard");
-$dirsmartphone = array("/core/menus/smartphone");
-foreach($conf->menus_modules as $dir)
+$dirstandard = array();
+$dirsmartphone = array();
+$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
+foreach($dirmenus as $dirmenu)
{
- $dirstandard[]=$dir.'standard';
- $dirsmartphone[]=$dir.'standard';
+ $dirstandard[]=$dirmenus.'standard';
+ $dirsmartphone[]=$dirmenus.'smartphone';
}
$mesg=$_GET["mesg"];
diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php
index 243b3846232..a7c27179818 100644
--- a/htdocs/admin/system/constall.php
+++ b/htdocs/admin/system/constall.php
@@ -178,6 +178,7 @@ foreach($configfileparameters as $key)
else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
else if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT');
else print ${$newkey};
+ if ($newkey == 'dolibarr_main_url_root' && $newkey != DOL_MAIN_URL_ROOT) print ' (currently used by autodetect: '.DOL_MAIN_URL_ROOT.')';
print "";
}
print "\n";
@@ -242,7 +243,8 @@ if ($resql)
print '';
-$db->close();
llxFooter();
+
+$db->close();
?>
diff --git a/htdocs/cashdesk/class/Auth.class.php b/htdocs/cashdesk/class/Auth.class.php
index a6868aa1814..7eec78ebd32 100644
--- a/htdocs/cashdesk/class/Auth.class.php
+++ b/htdocs/cashdesk/class/Auth.class.php
@@ -102,7 +102,7 @@ class Auth
$authmode=explode(',',$dolibarr_main_authentication);
// No authentication mode
- if (! count($authmode) && empty($conf->login_modules))
+ if (! count($authmode))
{
$langs->load('main');
dol_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication'));
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 5f8185253ed..2914a1aecd1 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -52,17 +52,12 @@ class Conf
public $smart_menu;
public $modules = array(); // List of activated modules
- public $modules_parts = array('triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array()); // List of modules parts
+ public $modules_parts = array('js'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array()); // List of modules parts
- // TODO Remove all thoose tabs with one generic
- public $triggers_modules = array();
- public $login_modules = array();
- public $substitutions_modules = array();
- public $menus_modules = array();
- public $barcode_modules = array();
- public $sms_engine_modules = array();
- public $css_modules = array();
+ // TODO Remove thoose arrays with generic module_parts
public $tabs_modules = array();
+ public $sms_engine_modules = array();
+ // TODO Remove thoose arrays with generic module_parts
public $hooks_modules = array();
public $societe_modules = array();
@@ -183,15 +178,15 @@ class Conf
{
$modulename = strtolower($reg[1]);
$partname = strtolower($reg[2]);
- $varname = $partname.'_modules'; // TODO deprecated
- if (! isset($this->$varname) || ! is_array($this->$varname)) { $this->$varname = array(); } // TODO deprecated
+ //$varname = $partname.'_modules'; // TODO deprecated
+ //if (! isset($this->$varname) || ! is_array($this->$varname)) { $this->$varname = array(); } // TODO deprecated
if (! isset($this->modules_parts[$partname]) || ! is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); }
$arrValue = json_decode($value,true);
if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue;
else if (in_array($partname,array('login','menus','substitutions','triggers','tpl','theme'))) $value = '/'.$modulename.'/core/'.$partname.'/';
else if (in_array($partname,array('models'))) $value = '/'.$modulename.'/';
else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/';
- $this->$varname = array_merge($this->$varname, array($modulename => $value)); // TODO deprecated
+ //$this->$varname = array_merge($this->$varname, array($modulename => $value)); // TODO deprecated
$this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value));
}
// If this is a module constant (must be at end)
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index eeff6e48068..bac8f90d211 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -3370,7 +3370,7 @@ function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
// Check if there is external substitution to do asked by plugins
- $dirsubstitutions=array_merge(array(),$conf->modules_parts['substitutions']);
+ $dirsubstitutions=array_merge(array(),(array) $conf->modules_parts['substitutions']);
foreach($dirsubstitutions as $reldir)
{
diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php
index aa5209af653..bd8ef60f3e1 100644
--- a/htdocs/core/lib/security2.lib.php
+++ b/htdocs/core/lib/security2.lib.php
@@ -61,51 +61,49 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
$login = '';
// Validation of login/pass/entity with a third party login module method
- if (! empty($conf->login_modules) && is_array($conf->login_modules))
- {
- foreach($conf->login_modules as $reldir)
- {
- $dir=dol_buildpath($reldir,0);
+ $dirlogin=array_merge(array("/core/login"),(array) $conf->modules_parts['login']);
+ foreach($dirlogin as $reldir)
+ {
+ $dir=dol_buildpath($reldir,0);
- $newdir=dol_osencode($dir);
+ $newdir=dol_osencode($dir);
- // Check if directory exists
- if (! is_dir($newdir)) continue;
+ // Check if directory exists
+ if (! is_dir($newdir)) continue;
- $handle=opendir($newdir);
- if (is_resource($handle))
- {
- while (($file = readdir($handle))!==false)
- {
- if (is_readable($dir.'/'.$file) && preg_match('/^functions_([^_]+)\.php/',$file,$reg))
- {
- $authfile = $dir.'/'.$file;
- $mode = $reg[1];
+ $handle=opendir($newdir);
+ if (is_resource($handle))
+ {
+ while (($file = readdir($handle))!==false)
+ {
+ if (is_readable($dir.'/'.$file) && preg_match('/^functions_([^_]+)\.php/',$file,$reg))
+ {
+ $authfile = $dir.'/'.$file;
+ $mode = $reg[1];
- $result=include_once($authfile);
- if ($result)
- {
- // Call function to check user/password
- $function='check_user_password_'.$mode;
- $login=call_user_func($function,$usertotest,$passwordtotest,$entitytotest);
- if ($login)
- {
- $conf->authmode=$mode; // This properties is defined only when logged to say what mode was successfully used
- }
- }
- else
- {
- dol_syslog("Authentification ko - failed to load file '".$authfile."'",LOG_ERR);
- sleep(1); // To slow brut force cracking
- $langs->load('main');
- $langs->load('other');
- $_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode",$mode);
- }
- }
- }
- closedir($handle);
- }
- }
+ $result=include_once($authfile);
+ if ($result)
+ {
+ // Call function to check user/password
+ $function='check_user_password_'.$mode;
+ $login=call_user_func($function,$usertotest,$passwordtotest,$entitytotest);
+ if ($login)
+ {
+ $conf->authmode=$mode; // This properties is defined only when logged to say what mode was successfully used
+ }
+ }
+ else
+ {
+ dol_syslog("Authentification ko - failed to load file '".$authfile."'",LOG_ERR);
+ sleep(1); // To slow brut force cracking
+ $langs->load('main');
+ $langs->load('other');
+ $_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode",$mode);
+ }
+ }
+ }
+ closedir($handle);
+ }
}
// Validation of login/pass/entity with standard modules
diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php
index 30b23141e62..1a15ed81d99 100755
--- a/htdocs/filefunc.inc.php
+++ b/htdocs/filefunc.inc.php
@@ -78,7 +78,6 @@ if (! $result && ! empty($_SERVER["GATEWAY_INTERFACE"])) // If install not do
header("Location: install/index.php");
exit;
}
-
// Disable php display errors
if (! empty($dolibarr_main_prod)) ini_set('display_errors','Off');
@@ -149,7 +148,7 @@ $concatpath='';
foreach($paths as $tmppath)
{
if ($tmppath) $concatpath.='/'.$tmppath;
- //print $real_$dolibarr_main_document_root.'-'.realpath($pathroot.$concatpath).'
';
+ //print $_SERVER["SCRIPT_NAME"].'-'.$pathroot.'-'.$concatpath.'-'.$real_dolibarr_main_document_root.'-'.realpath($pathroot.$concatpath).'
';
if ($real_dolibarr_main_document_root == @realpath($pathroot.$concatpath)) // @ avoid warning when safe_mode is on.
{
$tmp3=$concatpath;
@@ -157,7 +156,9 @@ foreach($paths as $tmppath)
$found=1;
break;
}
+ //else print "Not found yet for concatpath=".$concatpath."
\n";
}
+
if (! $found) // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT.
{
$tmp=$dolibarr_main_url_root;
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 4076699e201..0678797c8aa 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -310,7 +310,7 @@ if (! defined('NOLOGIN'))
$authmode=explode(',',$dolibarr_main_authentication);
// No authentication mode
- if (! count($authmode) && empty($conf->login_modules))
+ if (! count($authmode))
{
$langs->load('main');
dol_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication'));
@@ -893,16 +893,14 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
print ''."\n";
// CSS forced by modules (relative url starting with /)
- if (is_array($conf->css_modules))
+ $dircss=(array) $conf->modules_parts['css'];
+ foreach($dircss as $key => $cssfile)
{
- foreach($conf->css_modules as $key => $cssfile)
- {
- // cssfile is an absolute path
- print ''."\n";
- }
+ // cssfile is a relative path
+ print ''."\n";
}
// CSS forced by page in top_htmlhead call (relative url starting with /)
if (is_array($arrayofcss))
@@ -1033,7 +1031,14 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
// Add datepicker default options
print ''."\n";
- // Output module javascript
+ // JS forced by modules (relative url starting with /)
+ $dirjs=(array) $conf->modules_parts['js'];
+ foreach($dirjs as $key => $jsfile)
+ {
+ // jsfile is a relative path
+ print ''."\n";
+ }
+ // JS forced by page in top_htmlhead (relative url starting with /)
if (is_array($arrayofjs))
{
print ''."\n";
@@ -1189,7 +1194,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
if (! class_exists('MenuTop'))
{
$menufound=0;
- $dirmenus=array_merge(array("/core/menus/"),$conf->modules_parts['menus']);
+ $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
foreach($dirmenus as $dirmenu)
{
$menufound=dol_include_once($dirmenu."standard/".$top_menu);
@@ -1395,7 +1400,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
if (! class_exists('MenuLeft'))
{
$menufound=0;
- $dirmenus=array_merge(array("/core/menus/"),$conf->modules_parts['menus']);
+ $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
foreach($dirmenus as $dirmenu)
{
$menufound=dol_include_once($dirmenu."standard/".$left_menu);