Fix param of include js

This commit is contained in:
Laurent Destailleur 2021-07-08 22:16:47 +02:00
parent 6539961d58
commit a916f668f9

View File

@ -1689,7 +1689,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
// Global js function
print '<!-- Includes JS of Dolibarr -->'."\n";
print '<script src="'.DOL_URL_ROOT.'/core/js/lib_head.js.php?lang='.$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n";
print '<script src="'.DOL_URL_ROOT.'/core/js/lib_head.js.php?lang='.$langs->defaultlang.($ext ? '&amp;'.$ext : '').'"></script>'."\n";
// JS forced by modules (relative url starting with /)
if (!empty($conf->modules_parts['js'])) { // $conf->modules_parts['js'] is array('module'=>array('file1','file2'))
@ -1698,7 +1698,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
$filesjs = (array) $filesjs; // To be sure filejs is an array
foreach ($filesjs as $jsfile) {
// jsfile is a relative path
print '<!-- Include JS added by module '.$modjs.'-->'."\n".'<script src="'.dol_buildpath($jsfile, 1).'"></script>'."\n";
print '<!-- Include JS added by module '.$modjs.'-->'."\n".'<script src="'.dol_buildpath($jsfile, 1).((strpos($jsfile, '?') === false) ? '?' : '&amp;').'lang='.$langs->defaultlang.'"></script>'."\n";
}
}
}
@ -1707,9 +1707,9 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
print '<!-- Includes JS added by page -->'."\n";
foreach ($arrayofjs as $jsfile) {
if (preg_match('/^(http|\/\/)/i', $jsfile)) {
print '<script src="'.$jsfile.($ext ? ((strpos($jsfile, '?') === false) ? '?' : '&').$ext : '').'"></script>'."\n";
print '<script src="'.$jsfile.((strpos($jsfile, '?') === false) ? '?' : '&amp;').'lang='.$langs->defaultlang.'"></script>'."\n";
} else {
print '<script src="'.dol_buildpath($jsfile, 1).($ext ? ((strpos($jsfile, '?') === false) ? '?' : '&').$ext : '').'"></script>'."\n";
print '<script src="'.dol_buildpath($jsfile, 1).((strpos($jsfile, '?') === false) ? '?' : '&amp;').'lang='.$langs->defaultlang.'"></script>'."\n";
}
}
}