New: add generic function for module parts
This commit is contained in:
parent
2c0bbad50d
commit
a444fc955d
@ -102,7 +102,7 @@ class Auth
|
|||||||
$authmode=explode(',',$dolibarr_main_authentication);
|
$authmode=explode(',',$dolibarr_main_authentication);
|
||||||
|
|
||||||
// No authentication mode
|
// No authentication mode
|
||||||
if (! count($authmode) && empty($conf->login_method_modules))
|
if (! count($authmode) && empty($conf->login_modules))
|
||||||
{
|
{
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
dol_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication'));
|
dol_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication'));
|
||||||
|
|||||||
@ -51,26 +51,26 @@ class Conf
|
|||||||
public $top_menu;
|
public $top_menu;
|
||||||
public $smart_menu;
|
public $smart_menu;
|
||||||
|
|
||||||
public $modules = array(); // List of activated modules
|
public $modules = array(); // List of activated modules
|
||||||
|
|
||||||
public $css_modules = array();
|
public $css_modules = array();
|
||||||
public $tabs_modules = array();
|
public $tabs_modules = array();
|
||||||
public $triggers_modules = array();
|
public $triggers_modules = array();
|
||||||
public $menus_modules = array();
|
public $menus_modules = array();
|
||||||
public $hooks_modules = array();
|
public $hooks_modules = array();
|
||||||
public $login_method_modules = array();
|
public $login_modules = array();
|
||||||
public $sms_engine_modules = array();
|
public $sms_engine_modules = array();
|
||||||
public $barcode_modules = array();
|
public $barcode_modules = array();
|
||||||
public $substitutions_modules = array();
|
public $substitutions_modules = array();
|
||||||
|
|
||||||
var $logbuffer = array();
|
var $logbuffer = array();
|
||||||
|
|
||||||
//! To store properties of multi-company
|
//! To store properties of multi-company
|
||||||
public $multicompany;
|
public $multicompany;
|
||||||
//! Used to store running instance for multi-company (default 1)
|
//! Used to store running instance for multi-company (default 1)
|
||||||
public $entity=1;
|
public $entity = 1;
|
||||||
//! Used to store list of entities to use for each element
|
//! Used to store list of entities to use for each element
|
||||||
public $entities = array();
|
public $entities = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -176,14 +176,22 @@ class Conf
|
|||||||
$modulename = strtolower($reg[1]);
|
$modulename = strtolower($reg[1]);
|
||||||
$this->barcode_modules[$modulename] = '/'.$modulename.'/core/modules/barcode/';
|
$this->barcode_modules[$modulename] = '/'.$modulename.'/core/modules/barcode/';
|
||||||
}
|
}
|
||||||
|
// If this is constant for all generic part activated by a module
|
||||||
|
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_([A-Z]+)$/i',$key,$reg))
|
||||||
|
{
|
||||||
|
$modulename = strtolower($reg[1]);
|
||||||
|
$partname = strtolower($reg[2]);
|
||||||
|
$varname = $partname.'_modules';
|
||||||
|
$this->$varname[$modulename] = '/'.$modulename.'/core/'.$partname.'/';
|
||||||
|
}
|
||||||
|
|
||||||
// TODO All of this part could be mutualized into one generic part
|
// TODO All of this part could be mutualized into one generic part
|
||||||
|
/*
|
||||||
// If this is constant for login method activated by a module
|
// If this is constant for login method activated by a module
|
||||||
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_LOGIN$/i',$key,$reg))
|
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_LOGIN$/i',$key,$reg))
|
||||||
{
|
{
|
||||||
$modulename = strtolower($reg[1]);
|
$modulename = strtolower($reg[1]);
|
||||||
$this->login_method_modules[$modulename] = '/'.$modulename.'/core/login/';
|
$this->login_modules[$modulename] = '/'.$modulename.'/core/login/';
|
||||||
}
|
}
|
||||||
// If this is constant for a new tab page activated by a module
|
// If this is constant for a new tab page activated by a module
|
||||||
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_MENUS$/i',$key,$reg))
|
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_MENUS$/i',$key,$reg))
|
||||||
@ -203,6 +211,7 @@ class Conf
|
|||||||
$modulename = strtolower($reg[1]);
|
$modulename = strtolower($reg[1]);
|
||||||
$this->substitutions_modules[$modulename] = '/'.$modulename.'/core/substitutions/';
|
$this->substitutions_modules[$modulename] = '/'.$modulename.'/core/substitutions/';
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// If this is a module constant (must be at end)
|
// If this is a module constant (must be at end)
|
||||||
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)$/i',$key,$reg))
|
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)$/i',$key,$reg))
|
||||||
|
|||||||
@ -61,9 +61,9 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
|
|||||||
$login = '';
|
$login = '';
|
||||||
|
|
||||||
// Validation of login/pass/entity with a third party login module method
|
// Validation of login/pass/entity with a third party login module method
|
||||||
if (! empty($conf->login_method_modules) && is_array($conf->login_method_modules))
|
if (! empty($conf->login_modules) && is_array($conf->login_modules))
|
||||||
{
|
{
|
||||||
foreach($conf->login_method_modules as $reldir)
|
foreach($conf->login_modules as $reldir)
|
||||||
{
|
{
|
||||||
$dir=dol_buildpath($reldir,0);
|
$dir=dol_buildpath($reldir,0);
|
||||||
|
|
||||||
|
|||||||
@ -320,7 +320,7 @@ if (! defined('NOLOGIN'))
|
|||||||
$authmode=explode(',',$dolibarr_main_authentication);
|
$authmode=explode(',',$dolibarr_main_authentication);
|
||||||
|
|
||||||
// No authentication mode
|
// No authentication mode
|
||||||
if (! count($authmode) && empty($conf->login_method_modules))
|
if (! count($authmode) && empty($conf->login_modules))
|
||||||
{
|
{
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
dol_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication'));
|
dol_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication'));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user