forked from Wavyzz/dolibarr
Qual: Removed deprecated var
New: Can add global js
This commit is contained in:
@@ -39,12 +39,13 @@ $langs->load("other");
|
|||||||
// Security check
|
// Security check
|
||||||
if (!$user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
$dirstandard = array("/core/menus/standard");
|
$dirstandard = array();
|
||||||
$dirsmartphone = array("/core/menus/smartphone");
|
$dirsmartphone = array();
|
||||||
foreach($conf->menus_modules as $dir)
|
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
|
||||||
|
foreach($dirmenus as $dirmenu)
|
||||||
{
|
{
|
||||||
$dirstandard[]=$dir.'standard';
|
$dirstandard[]=$dirmenu.'standard';
|
||||||
$dirsmartphone[]=$dir.'standard';
|
$dirsmartphone[]=$dirmenu.'smartphone';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,12 +32,13 @@ $langs->load("admin");
|
|||||||
|
|
||||||
if (! $user->admin) accessforbidden();
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
$dirstandard = array("/core/menus/standard");
|
$dirstandard = array();
|
||||||
$dirsmartphone = array("/core/menus/smartphone");
|
$dirsmartphone = array();
|
||||||
foreach($conf->menus_modules as $dir)
|
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
|
||||||
|
foreach($dirmenus as $dirmenu)
|
||||||
{
|
{
|
||||||
$dirstandard[]=$dir.'standard';
|
$dirstandard[]=$dirmenus.'standard';
|
||||||
$dirsmartphone[]=$dir.'standard';
|
$dirsmartphone[]=$dirmenus.'smartphone';
|
||||||
}
|
}
|
||||||
|
|
||||||
$mesg=$_GET["mesg"];
|
$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' && 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 if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT');
|
||||||
else print ${$newkey};
|
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 "</td>";
|
||||||
}
|
}
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@@ -242,7 +243,8 @@ if ($resql)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -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_modules))
|
if (! count($authmode))
|
||||||
{
|
{
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
dol_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication'));
|
dol_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication'));
|
||||||
|
|||||||
@@ -52,17 +52,12 @@ class Conf
|
|||||||
public $smart_menu;
|
public $smart_menu;
|
||||||
|
|
||||||
public $modules = array(); // List of activated modules
|
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
|
// TODO Remove thoose arrays with generic module_parts
|
||||||
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();
|
|
||||||
public $tabs_modules = array();
|
public $tabs_modules = array();
|
||||||
|
public $sms_engine_modules = array();
|
||||||
|
// TODO Remove thoose arrays with generic module_parts
|
||||||
public $hooks_modules = array();
|
public $hooks_modules = array();
|
||||||
public $societe_modules = array();
|
public $societe_modules = array();
|
||||||
|
|
||||||
@@ -183,15 +178,15 @@ class Conf
|
|||||||
{
|
{
|
||||||
$modulename = strtolower($reg[1]);
|
$modulename = strtolower($reg[1]);
|
||||||
$partname = strtolower($reg[2]);
|
$partname = strtolower($reg[2]);
|
||||||
$varname = $partname.'_modules'; // TODO deprecated
|
//$varname = $partname.'_modules'; // TODO deprecated
|
||||||
if (! isset($this->$varname) || ! is_array($this->$varname)) { $this->$varname = array(); } // 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(); }
|
if (! isset($this->modules_parts[$partname]) || ! is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); }
|
||||||
$arrValue = json_decode($value,true);
|
$arrValue = json_decode($value,true);
|
||||||
if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue;
|
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('login','menus','substitutions','triggers','tpl','theme'))) $value = '/'.$modulename.'/core/'.$partname.'/';
|
||||||
else if (in_array($partname,array('models'))) $value = '/'.$modulename.'/';
|
else if (in_array($partname,array('models'))) $value = '/'.$modulename.'/';
|
||||||
else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/';
|
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));
|
$this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value));
|
||||||
}
|
}
|
||||||
// If this is a module constant (must be at end)
|
// 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');
|
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||||
|
|
||||||
// Check if there is external substitution to do asked by plugins
|
// 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)
|
foreach($dirsubstitutions as $reldir)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,51 +61,49 @@ 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_modules) && is_array($conf->login_modules))
|
$dirlogin=array_merge(array("/core/login"),(array) $conf->modules_parts['login']);
|
||||||
{
|
foreach($dirlogin as $reldir)
|
||||||
foreach($conf->login_modules as $reldir)
|
{
|
||||||
{
|
$dir=dol_buildpath($reldir,0);
|
||||||
$dir=dol_buildpath($reldir,0);
|
|
||||||
|
|
||||||
$newdir=dol_osencode($dir);
|
$newdir=dol_osencode($dir);
|
||||||
|
|
||||||
// Check if directory exists
|
// Check if directory exists
|
||||||
if (! is_dir($newdir)) continue;
|
if (! is_dir($newdir)) continue;
|
||||||
|
|
||||||
$handle=opendir($newdir);
|
$handle=opendir($newdir);
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (is_readable($dir.'/'.$file) && preg_match('/^functions_([^_]+)\.php/',$file,$reg))
|
if (is_readable($dir.'/'.$file) && preg_match('/^functions_([^_]+)\.php/',$file,$reg))
|
||||||
{
|
{
|
||||||
$authfile = $dir.'/'.$file;
|
$authfile = $dir.'/'.$file;
|
||||||
$mode = $reg[1];
|
$mode = $reg[1];
|
||||||
|
|
||||||
$result=include_once($authfile);
|
$result=include_once($authfile);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
// Call function to check user/password
|
// Call function to check user/password
|
||||||
$function='check_user_password_'.$mode;
|
$function='check_user_password_'.$mode;
|
||||||
$login=call_user_func($function,$usertotest,$passwordtotest,$entitytotest);
|
$login=call_user_func($function,$usertotest,$passwordtotest,$entitytotest);
|
||||||
if ($login)
|
if ($login)
|
||||||
{
|
{
|
||||||
$conf->authmode=$mode; // This properties is defined only when logged to say what mode was successfully used
|
$conf->authmode=$mode; // This properties is defined only when logged to say what mode was successfully used
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("Authentification ko - failed to load file '".$authfile."'",LOG_ERR);
|
dol_syslog("Authentification ko - failed to load file '".$authfile."'",LOG_ERR);
|
||||||
sleep(1); // To slow brut force cracking
|
sleep(1); // To slow brut force cracking
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
$langs->load('other');
|
$langs->load('other');
|
||||||
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode",$mode);
|
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode",$mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validation of login/pass/entity with standard modules
|
// 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");
|
header("Location: install/index.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable php display errors
|
// Disable php display errors
|
||||||
if (! empty($dolibarr_main_prod)) ini_set('display_errors','Off');
|
if (! empty($dolibarr_main_prod)) ini_set('display_errors','Off');
|
||||||
|
|
||||||
@@ -149,7 +148,7 @@ $concatpath='';
|
|||||||
foreach($paths as $tmppath)
|
foreach($paths as $tmppath)
|
||||||
{
|
{
|
||||||
if ($tmppath) $concatpath.='/'.$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.
|
if ($real_dolibarr_main_document_root == @realpath($pathroot.$concatpath)) // @ avoid warning when safe_mode is on.
|
||||||
{
|
{
|
||||||
$tmp3=$concatpath;
|
$tmp3=$concatpath;
|
||||||
@@ -157,7 +156,9 @@ foreach($paths as $tmppath)
|
|||||||
$found=1;
|
$found=1;
|
||||||
break;
|
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.
|
if (! $found) // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT.
|
||||||
{
|
{
|
||||||
$tmp=$dolibarr_main_url_root;
|
$tmp=$dolibarr_main_url_root;
|
||||||
|
|||||||
@@ -310,7 +310,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_modules))
|
if (! count($authmode))
|
||||||
{
|
{
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
dol_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication'));
|
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 'themepath='.$themepath.' themeparam='.$themeparam;exit;
|
||||||
print '<link rel="stylesheet" type="text/css" title="default" href="'.$themepath.$themeparam.'">'."\n";
|
print '<link rel="stylesheet" type="text/css" title="default" href="'.$themepath.$themeparam.'">'."\n";
|
||||||
// CSS forced by modules (relative url starting with /)
|
// 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 a relative path
|
||||||
{
|
print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
|
||||||
// cssfile is an absolute path
|
// 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.
|
||||||
print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
|
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
|
||||||
// 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.
|
print '"><!-- Added by module '.$key. '-->'."\n";
|
||||||
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 /)
|
// CSS forced by page in top_htmlhead call (relative url starting with /)
|
||||||
if (is_array($arrayofcss))
|
if (is_array($arrayofcss))
|
||||||
@@ -1033,7 +1031,14 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
// Add datepicker default options
|
// Add datepicker default options
|
||||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/datepicker.js.php?lang='.$langs->defaultlang.'"></script>'."\n";
|
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))
|
if (is_array($arrayofjs))
|
||||||
{
|
{
|
||||||
print '<!-- Includes JS specific to page -->'."\n";
|
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'))
|
if (! class_exists('MenuTop'))
|
||||||
{
|
{
|
||||||
$menufound=0;
|
$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)
|
foreach($dirmenus as $dirmenu)
|
||||||
{
|
{
|
||||||
$menufound=dol_include_once($dirmenu."standard/".$top_menu);
|
$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'))
|
if (! class_exists('MenuLeft'))
|
||||||
{
|
{
|
||||||
$menufound=0;
|
$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)
|
foreach($dirmenus as $dirmenu)
|
||||||
{
|
{
|
||||||
$menufound=dol_include_once($dirmenu."standard/".$left_menu);
|
$menufound=dol_include_once($dirmenu."standard/".$left_menu);
|
||||||
|
|||||||
Reference in New Issue
Block a user