Qual: Removed deprecated var
New: Can add global js
This commit is contained in:
parent
a5702e150c
commit
a23df4f407
@ -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';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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"];
|
||||
|
||||
@ -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 "</td>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
@ -242,7 +243,8 @@ if ($resql)
|
||||
|
||||
print '</table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -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'));
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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).'<br>';
|
||||
//print $_SERVER["SCRIPT_NAME"].'-'.$pathroot.'-'.$concatpath.'-'.$real_dolibarr_main_document_root.'-'.realpath($pathroot.$concatpath).'<br>';
|
||||
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."<br>\n";
|
||||
}
|
||||
|
||||
if (! $found) // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT.
|
||||
{
|
||||
$tmp=$dolibarr_main_url_root;
|
||||
|
||||
@ -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 '<link rel="stylesheet" type="text/css" title="default" href="'.$themepath.$themeparam.'">'."\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 '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
|
||||
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
|
||||
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
|
||||
print '"><!-- Added by module '.$key. '-->'."\n";
|
||||
}
|
||||
// cssfile is a relative path
|
||||
print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
|
||||
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
|
||||
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
|
||||
print '"><!-- Added by module '.$key. '-->'."\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 '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/datepicker.js.php?lang='.$langs->defaultlang.'"></script>'."\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 '<script type="text/javascript" src="'.dol_buildpath($jsfile,1).'"></script><!-- Added by module '.$key. '-->'."\n";
|
||||
}
|
||||
// JS forced by page in top_htmlhead (relative url starting with /)
|
||||
if (is_array($arrayofjs))
|
||||
{
|
||||
print '<!-- Includes JS specific to page -->'."\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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user