42 $micro_start_time = 0;
43 if (!empty($_SERVER[
'MAIN_SHOW_TUNING_INFO'])) {
44 list($usec, $sec) = explode(
" ", microtime());
45 $micro_start_time = ((
float) $usec + (
float) $sec);
48 if (defined(
'XDEBUGCOVERAGE')) {
49 xdebug_start_code_coverage();
63 $newstringnumentity = preg_replace(
'/;$/',
'', $matches[1]);
66 if (preg_match(
'/^x/i', $newstringnumentity)) {
67 $newstringnumentity = hexdec(preg_replace(
'/^x/i',
'', $newstringnumentity));
71 if (($newstringnumentity >= 65 && $newstringnumentity <= 90) || ($newstringnumentity >= 97 && $newstringnumentity <= 122)) {
72 return chr((
int) $newstringnumentity);
75 return '&#'.$matches[1];
99 $val = html_entity_decode($val, ENT_QUOTES | ENT_HTML5);
101 $val = preg_replace_callback(
'/&#(x?[0-9][0-9a-f]+;?)/i',
function ($m) {
106 $val = preg_replace(
'/<!--[^>]*-->/',
'', $val);
107 $val = preg_replace(
'/[\r\n\t]/',
'', $val);
108 }
while ($oldval != $val);
119 $newval = preg_replace(
'/[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F]/u',
'', $val);
122 if ($newval != $val) {
129 if ($type == 1 || $type == 3) {
131 $inj += preg_match(
'/delete\s*from/i', $val);
132 $inj += preg_match(
'/create\s*table/i', $val);
133 $inj += preg_match(
'/insert\s*into/i', $val);
134 $inj += preg_match(
'/select\s*from/i', $val);
135 $inj += preg_match(
'/into\s*(outfile|dumpfile)/i', $val);
136 $inj += preg_match(
'/user\s*\(/i', $val);
137 $inj += preg_match(
'/information_schema/i', $val);
138 $inj += preg_match(
'/<svg/i', $val);
139 $inj += preg_match(
'/update[^&=\w].*set.+=/i', $val);
140 $inj += preg_match(
'/union.+select/i', $val);
144 $inj += preg_match(
'/select|update|delete|truncate|replace|group\s*by|concat|count|from|union/i', $val);
147 $inj += preg_match(
'/updatexml\(/i', $val);
148 $inj += preg_match(
'/(\.\.%2f)+/i', $val);
149 $inj += preg_match(
'/\s@@/', $val);
152 $inj += preg_match(
'/<\/textarea/i', $val);
158 $inj += preg_match(
'/<audio/i', $val);
159 $inj += preg_match(
'/<embed/i', $val);
160 $inj += preg_match(
'/<iframe/i', $val);
161 $inj += preg_match(
'/<object/i', $val);
162 $inj += preg_match(
'/<script/i', $val);
163 $inj += preg_match(
'/Set\.constructor/i', $val);
164 if (!defined(
'NOSTYLECHECK')) {
165 $inj += preg_match(
'/<style/i', $val);
167 $inj += preg_match(
'/base\s+href/si', $val);
168 $inj += preg_match(
'/=data:/si', $val);
170 $inj += preg_match(
'/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $val);
171 $inj += preg_match(
'/on(abort|afterprint|animation|auxclick|beforecopy|beforecut|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $val);
172 $inj += preg_match(
'/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $val);
173 $inj += preg_match(
'/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $val);
174 $inj += preg_match(
'/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $val);
175 $inj += preg_match(
'/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $val);
177 $inj += preg_match(
'/on(repeat|begin|finish|beforeinput)\s*=/i', $val);
180 $tmpval = preg_replace(
'/<[^<]+>/',
'', $val);
182 $inj += preg_match(
'/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $tmpval);
183 $inj += preg_match(
'/on(abort|afterprint|animation|auxclick|beforecopy|beforecut|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $tmpval);
184 $inj += preg_match(
'/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $tmpval);
185 $inj += preg_match(
'/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $tmpval);
186 $inj += preg_match(
'/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $tmpval);
187 $inj += preg_match(
'/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $tmpval);
189 $inj += preg_match(
'/on(repeat|begin|finish|beforeinput)\s*=/i', $tmpval);
192 $inj += preg_match(
'/:|:|:/i', $val);
193 $inj += preg_match(
'/j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t\s*:/i', $val);
194 $inj += preg_match(
'/vbscript\s*:/i', $val);
196 if ($type == 1 || $type == 3) {
197 $val = str_replace(
'enclosure="',
'enclosure=X', $val);
198 $inj += preg_match(
'/"/i', $val);
201 $inj += preg_match(
'/[:;"\'<>\?\(\){}\$%]/', $val);
216 if (is_array($var)) {
217 foreach ($var as $key => $value) {
222 $ip = (empty($_SERVER[
'REMOTE_ADDR']) ?
'unknown' : $_SERVER[
'REMOTE_ADDR']);
223 $errormessage =
'Access refused to '.htmlentities($ip, ENT_COMPAT,
'UTF-8').
' by SQL or Script injection protection in main.inc.php - GETPOST type='.htmlentities($type, ENT_COMPAT,
'UTF-8').
' paramkey='.htmlentities($key, ENT_COMPAT,
'UTF-8').
' paramvalue='.htmlentities($value, ENT_COMPAT,
'UTF-8').
' page='.htmlentities($_SERVER[
"REQUEST_URI"], ENT_COMPAT,
'UTF-8');
226 if (function_exists(
'error_log')) {
227 error_log($errormessage);
245 if ((defined(
'NOREQUIREDB') || defined(
'NOREQUIRETRAN')) && !defined(
'NOREQUIREMENU')) {
246 print
'If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not set them.';
249 if (defined(
'NOREQUIREUSER') && !defined(
'NOREQUIREMENU')) {
250 print
'If define NOREQUIREUSER is set, you must also set NOREQUIREMENU or not set it.';
255 if (!defined(
'NOSCANPHPSELFFORINJECTION') && !empty($_SERVER[
"PHP_SELF"])) {
256 $morevaltochecklikepost = array($_SERVER[
"PHP_SELF"]);
260 if (!defined(
'NOSCANGETFORINJECTION') && !empty($_SERVER[
"QUERY_STRING"])) {
264 $morevaltochecklikeget = array(urldecode($_SERVER[
"QUERY_STRING"]));
268 if (!defined(
'NOSCANPOSTFORINJECTION')) {
273 if (!empty($_SERVER[
'DOCUMENT_ROOT']) && substr($_SERVER[
'DOCUMENT_ROOT'], -6) !==
'htdocs') {
274 set_include_path($_SERVER[
'DOCUMENT_ROOT'].
'/htdocs');
278 require_once
'filefunc.inc.php';
283 if (!empty($_POST[
"DOL_AUTOSET_COOKIE"])) {
284 $tmpautoset = explode(
':', $_POST[
"DOL_AUTOSET_COOKIE"], 2);
285 $tmplist = explode(
',', $tmpautoset[1]);
286 $cookiearrayvalue = array();
287 foreach ($tmplist as $tmpkey) {
288 $postkey = $tmpautoset[0].
'_'.$tmpkey;
290 if (!empty($_POST[$postkey])) {
291 $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
294 $cookiename = $tmpautoset[0];
295 $cookievalue = json_encode($cookiearrayvalue);
297 if (PHP_VERSION_ID < 70300) {
298 setcookie($cookiename, empty($cookievalue) ?
'' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)),
'/',
null, ((empty($dolibarr_main_force_https) &&
isHTTPS() ===
false) ?
false :
true),
true);
301 $cookieparams = array(
302 'expires' => empty($cookievalue) ? 0 : (time() + (86400 * 354)),
305 'secure' => ((empty($dolibarr_main_force_https) &&
isHTTPS() ===
false) ?
false :
true),
309 setcookie($cookiename, empty($cookievalue) ?
'' : $cookievalue, $cookieparams);
311 if (empty($cookievalue)) {
312 unset($_COOKIE[$cookiename]);
318 if (!empty($php_session_save_handler) && $php_session_save_handler ==
'db') {
319 require_once
'core/lib/phpsessionin'.$php_session_save_handler.
'.lib.php';
325 $prefix = dol_getprefix(
'');
326 $sessionname =
'DOLSESSID_'.$prefix;
327 $sessiontimeout =
'DOLSESSTIMEOUT_'.$prefix;
328 if (!empty($_COOKIE[$sessiontimeout])) {
329 ini_set(
'session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
334 if (!defined(
'NOSESSION')) {
335 if (PHP_VERSION_ID < 70300) {
336 session_set_cookie_params(0,
'/',
null, ((empty($dolibarr_main_force_https) &&
isHTTPS() ===
false) ?
false :
true),
true);
339 $sessioncookieparams = array(
343 'secure' => ((empty($dolibarr_main_force_https) &&
isHTTPS() ===
false) ?
false :
true),
347 session_set_cookie_params($sessioncookieparams);
349 session_name($sessionname);
356 require_once
'master.inc.php';
359 if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
361 if ((!session_id() || !isset($_SESSION[
"dol_login"])) && !isset($_POST[
"username"]) && !empty($_SERVER[
"GATEWAY_INTERFACE"])) {
363 } elseif (isset($_POST[
"username"]) && $_POST[
"username"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) {
365 } elseif (defined(
'NOREQUIREDB')) {
367 } elseif (defined(
'EVEN_IF_ONLY_LOGIN_ALLOWED')) {
369 } elseif (session_id() && isset($_SESSION[
"dol_login"]) && $_SESSION[
"dol_login"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) {
373 if (session_id() && isset($_SESSION[
"dol_login"]) && $_SESSION[
"dol_login"] != $conf->global->MAIN_ONLY_LOGIN_ALLOWED) {
374 print
'Sorry, your application is offline.'.
"\n";
375 print
'You are logged with user "'.$_SESSION[
"dol_login"].
'" and only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.
'" is allowed to connect for the moment.'.
"\n";
376 $nexturl = DOL_URL_ROOT.
'/user/logout.php?token='.
newToken();
377 print
'Please try later or <a href="'.$nexturl.
'">click here to disconnect and change login user</a>...'.
"\n";
379 print
'Sorry, your application is offline. Only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.
'" is allowed to connect for the moment.'.
"\n";
380 $nexturl = DOL_URL_ROOT.
'/';
381 print
'Please try later or <a href="'.$nexturl.
'">click here to change login user</a>...'.
"\n";
389 register_shutdown_function(
'dol_shutdown');
392 if (
isModEnabled(
'debugbar') && !
GETPOST(
'dol_use_jmobile') && empty($_SESSION[
'dol_use_jmobile'])) {
394 include_once DOL_DOCUMENT_ROOT.
'/debugbar/class/DebugBar.php';
396 $renderer = $debugbar->getRenderer();
397 if (empty($conf->global->MAIN_HTML_HEADER)) {
398 $conf->global->MAIN_HTML_HEADER =
'';
400 $conf->global->MAIN_HTML_HEADER .= $renderer->renderHead();
402 $debugbar[
'time']->startMeasure(
'pageaftermaster',
'Page generation (after environment init)');
406 if (isset($_SERVER[
"HTTP_USER_AGENT"])) {
408 $conf->browser->name = $tmp[
'browsername'];
409 $conf->browser->os = $tmp[
'browseros'];
410 $conf->browser->version = $tmp[
'browserversion'];
411 $conf->browser->layout = $tmp[
'layout'];
414 if ($conf->browser->layout ==
'phone') {
415 $conf->dol_no_mouse_hover = 1;
420 if (
GETPOST(
'theme',
'aZ09')) {
421 $conf->theme =
GETPOST(
'theme',
'aZ09');
422 $conf->css =
"/theme/".$conf->theme.
"/style.css.php";
426 if (
GETPOST(
'textbrowser',
'int') || (!empty($conf->browser->name) && $conf->browser->name ==
'lynxlinks')) {
427 $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1;
432 if (!empty($conf->file->main_force_https) && (empty($_SERVER[
"HTTPS"]) || $_SERVER[
"HTTPS"] !=
'on')) {
434 if (is_numeric($conf->file->main_force_https)) {
435 if ($conf->file->main_force_https ==
'1' && !empty($_SERVER[
"SCRIPT_URI"])) {
436 if (preg_match(
'/^http:/i', $_SERVER[
"SCRIPT_URI"]) && !preg_match(
'/^https:/i', $_SERVER[
"SCRIPT_URI"])) {
437 $newurl = preg_replace(
'/^http:/i',
'https:', $_SERVER[
"SCRIPT_URI"]);
441 $newurl = preg_replace(
'/^http:/i',
'https:', DOL_MAIN_URL_ROOT).$_SERVER[
"REQUEST_URI"];
445 $newurl = $conf->file->main_force_https.$_SERVER[
"REQUEST_URI"];
450 dol_syslog(
"main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl);
451 header(
"Location: ".$newurl);
454 dol_syslog(
"main.inc: dolibarr_main_force_https is on but we failed to forge new https url so no redirect is done", LOG_WARNING);
458 if (!defined(
'NOLOGIN') && !defined(
'NOIPCHECK') && !empty($dolibarr_main_restrict_ip)) {
459 $listofip = explode(
',', $dolibarr_main_restrict_ip);
461 foreach ($listofip as $ip) {
463 if ($ip == $_SERVER[
'REMOTE_ADDR']) {
469 print
'Access refused by IP protection. Your detected IP is '.$_SERVER[
'REMOTE_ADDR'];
475 if (!defined(
'NOREQUIREHTML')) {
476 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
478 if (!defined(
'NOREQUIREAJAX')) {
479 require_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
483 if (!empty($conf->global->MAIN_NOT_INSTALLED) || !empty($conf->global->MAIN_NOT_UPGRADED)) {
484 dol_syslog(
"main.inc: A previous install or upgrade was not complete. Redirect to install page.", LOG_WARNING);
485 header(
"Location: ".DOL_URL_ROOT.
"/install/index.php");
489 if ((!empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ($conf->global->MAIN_VERSION_LAST_UPGRADE != DOL_VERSION))
490 || (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && !empty($conf->global->MAIN_VERSION_LAST_INSTALL) && ($conf->global->MAIN_VERSION_LAST_INSTALL != DOL_VERSION))) {
491 $versiontocompare = empty($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE;
492 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
493 $dolibarrversionlastupgrade = preg_split(
'/[.-]/', $versiontocompare);
494 $dolibarrversionprogram = preg_split(
'/[.-]/', DOL_VERSION);
495 $rescomp =
versioncompare($dolibarrversionprogram, $dolibarrversionlastupgrade);
497 if (empty($conf->global->MAIN_NO_UPGRADE_REDIRECT_ON_LEVEL_3_CHANGE) || $rescomp < 3) {
499 dol_syslog(
"main.inc: database version ".$versiontocompare.
" is lower than programs version ".DOL_VERSION.
". Redirect to install/upgrade page.", LOG_WARNING);
500 header(
"Location: ".DOL_URL_ROOT.
"/install/index.php");
507 if (!defined(
'NOTOKENRENEWAL') && !defined(
'NOSESSION')) {
509 if (!preg_match(
'/\.(css|js|json)\.php$/', $_SERVER[
"PHP_SELF"])) {
511 if (isset($_SESSION[
'newtoken'])) {
512 $_SESSION[
'token'] = $_SESSION[
'newtoken'];
515 if (!isset($_SESSION[
'newtoken']) ||
getDolGlobalInt(
'MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL')) {
519 $token =
dol_hash(uniqid(mt_rand(),
false),
'md5');
520 $_SESSION[
'newtoken'] = $token;
521 dol_syslog(
"NEW TOKEN generated by : ".$_SERVER[
'PHP_SELF'], LOG_DEBUG);
529 if ((!defined(
'NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) &&
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN')) || defined(
'CSRFCHECK_WITH_TOKEN')) {
531 $sensitiveget =
false;
534 if (
GETPOSTISSET(
'massaction') || !in_array(
GETPOST(
'action',
'aZ09'), array(
'create',
'createsite',
'createcard',
'edit',
'editvalidator',
'file_manager',
'presend',
'presend_addmessage',
'preview',
'specimen'))) {
535 $sensitiveget =
true;
539 $arrayofactiontoforcetokencheck = array(
541 'doprev',
'donext',
'dvprev',
'dvnext',
542 'freezone',
'install',
545 if (in_array(
GETPOST(
'action',
'aZ09'), $arrayofactiontoforcetokencheck)) {
546 $sensitiveget =
true;
549 if (preg_match(
'/^(add|classify|close|confirm|copy|del|disable|enable|remove|set|unset|update|save)/',
GETPOST(
'action',
'aZ09'))) {
550 $sensitiveget =
true;
557 $_SERVER[
'REQUEST_METHOD'] ==
'POST' ||
563 if (!
GETPOST(
'token',
'alpha') ||
GETPOST(
'token',
'alpha') ==
'notrequired') {
565 if (
GETPOST(
'uploadform',
'int')) {
566 dol_syslog(
"--- Access to ".(empty($_SERVER[
"REQUEST_METHOD"]) ?
'' : $_SERVER[
"REQUEST_METHOD"].
' ').$_SERVER[
"PHP_SELF"].
" refused. File size too large or not provided.");
567 $langs->loadLangs(array(
"errors",
"install"));
568 print $langs->trans(
"ErrorFileSizeTooLarge").
' ';
569 print $langs->trans(
"ErrorGoBackAndCorrectParameters");
571 http_response_code(403);
572 if (defined(
'CSRFCHECK_WITH_TOKEN')) {
573 dol_syslog(
"--- Access to ".(empty($_SERVER[
"REQUEST_METHOD"]) ?
'' : $_SERVER[
"REQUEST_METHOD"].
' ').$_SERVER[
"PHP_SELF"].
" refused by CSRF protection (CSRFCHECK_WITH_TOKEN protection) in main.inc.php. Token not provided.", LOG_WARNING);
574 print
"Access to a page that needs a token (constant CSRFCHECK_WITH_TOKEN is defined) is refused by CSRF protection in main.inc.php. Token not provided.\n";
576 dol_syslog(
"--- Access to ".(empty($_SERVER[
"REQUEST_METHOD"]) ?
'' : $_SERVER[
"REQUEST_METHOD"].
' ').$_SERVER[
"PHP_SELF"].
" refused by CSRF protection (POST method or GET with a sensible value for 'action' parameter) in main.inc.php. Token not provided.", LOG_WARNING);
577 print
"Access to this page this way (POST method or GET with a sensible value for 'action' parameter) is refused by CSRF protection in main.inc.php. Token not provided.\n";
578 print
"If you access your server behind a proxy using url rewriting and the parameter is provided by caller, you might check that all HTTP header are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0";
579 if (!empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) {
580 print
" instead of ".$conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN;
582 print
" into setup).\n";
589 $sessiontokenforthisurl = (empty($_SESSION[
'token']) ?
'' : $_SESSION[
'token']);
592 dol_syslog(
"--- Access to ".(empty($_SERVER[
"REQUEST_METHOD"]) ?
'' : $_SERVER[
"REQUEST_METHOD"].
' ').$_SERVER[
"PHP_SELF"].
" refused by CSRF protection (invalid token), so we disable POST and some GET parameters - referer=".(empty($_SERVER[
'HTTP_REFERER'])?
'':$_SERVER[
'HTTP_REFERER']).
", action=".
GETPOST(
'action',
'aZ09').
", _GET|POST['token']=".
GETPOST(
'token',
'alpha'), LOG_WARNING);
595 setEventMessages(
'SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry',
null,
'warnings');
597 if (isset($_POST[
'id'])) {
598 $savid = ((int) $_POST[
'id']);
603 unset($_GET[
'confirm']);
604 unset($_GET[
'action']);
605 unset($_GET[
'confirmmassaction']);
606 unset($_GET[
'massaction']);
607 unset($_GET[
'token']);
609 $_POST[
'id'] = ((int) $savid);
618 $_SESSION[
"disablemodules"] =
GETPOST(
'disablemodules',
'alpha');
620 if (!empty($_SESSION[
"disablemodules"])) {
621 $modulepartkeys = array(
'css',
'js',
'tabs',
'triggers',
'login',
'substitutions',
'menus',
'theme',
'sms',
'tpl',
'barcode',
'models',
'societe',
'hooks',
'dir',
'syslog',
'tpllinkable',
'contactelement',
'moduleforexternal');
623 $disabled_modules = explode(
',', $_SESSION[
"disablemodules"]);
624 foreach ($disabled_modules as $module) {
626 if (empty($conf->$module)) {
627 $conf->$module =
new stdClass();
629 $conf->$module->enabled =
false;
630 foreach ($modulepartkeys as $modulepartkey) {
631 unset($conf->modules_parts[$modulepartkey][$module]);
633 if ($module ==
'fournisseur') {
634 $conf->supplier_order->enabled = 0;
635 $conf->supplier_invoice->enabled = 0;
642 $modulepart = explode(
"/", $_SERVER[
"PHP_SELF"]);
643 if (is_array($modulepart) && count($modulepart) > 0) {
644 foreach ($conf->modules as $module) {
645 if (in_array($module, $modulepart)) {
646 $modulepart = $module;
651 if (is_array($modulepart)) {
660 if (!defined(
'NOLOGIN')) {
664 if (defined(
'MAIN_AUTHENTICATION_MODE')) {
665 $dolibarr_main_authentication = constant(
'MAIN_AUTHENTICATION_MODE');
668 if (empty($dolibarr_main_authentication)) {
669 $dolibarr_main_authentication =
'dolibarr';
672 if ($dolibarr_main_authentication ==
'forceuser' && empty($dolibarr_auto_user)) {
673 $dolibarr_auto_user =
'auto';
677 $authmode = explode(
',', $dolibarr_main_authentication);
680 if (!count($authmode)) {
681 $langs->load(
'main');
682 dol_print_error(
'', $langs->trans(
"ErrorConfigParameterNotDefined",
'dolibarr_main_authentication'));
689 $resultFetchUser =
'';
691 if (!isset($_SESSION[
"dol_login"])) {
693 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
695 $dol_dst_observed =
GETPOST(
"dst_observed",
'int', 3);
696 $dol_dst_first =
GETPOST(
"dst_first",
'int', 3);
697 $dol_dst_second =
GETPOST(
"dst_second",
'int', 3);
698 $dol_screenwidth =
GETPOST(
"screenwidth",
'int', 3);
699 $dol_screenheight =
GETPOST(
"screenheight",
'int', 3);
700 $dol_hide_topmenu =
GETPOST(
'dol_hide_topmenu',
'int', 3);
701 $dol_hide_leftmenu =
GETPOST(
'dol_hide_leftmenu',
'int', 3);
702 $dol_optimize_smallscreen =
GETPOST(
'dol_optimize_smallscreen',
'int', 3);
703 $dol_no_mouse_hover =
GETPOST(
'dol_no_mouse_hover',
'int', 3);
704 $dol_use_jmobile =
GETPOST(
'dol_use_jmobile',
'int', 3);
708 if (!empty($dolibarr_main_demo) && $_SERVER[
'PHP_SELF'] == DOL_URL_ROOT.
'/index.php') {
709 if (empty($_SERVER[
'HTTP_REFERER']) || !preg_match(
'/public/', $_SERVER[
'HTTP_REFERER'])) {
710 dol_syslog(
"Call index page from another url than demo page (call is done from page ".$_SERVER[
'HTTP_REFERER'].
")");
712 $url .= ($url ?
'&' :
'').($dol_hide_topmenu ?
'dol_hide_topmenu='.$dol_hide_topmenu :
'');
713 $url .= ($url ?
'&' :
'').($dol_hide_leftmenu ?
'dol_hide_leftmenu='.$dol_hide_leftmenu :
'');
714 $url .= ($url ?
'&' :
'').($dol_optimize_smallscreen ?
'dol_optimize_smallscreen='.$dol_optimize_smallscreen :
'');
715 $url .= ($url ?
'&' :
'').($dol_no_mouse_hover ?
'dol_no_mouse_hover='.$dol_no_mouse_hover :
'');
716 $url .= ($url ?
'&' :
'').($dol_use_jmobile ?
'dol_use_jmobile='.$dol_use_jmobile :
'');
717 $url = DOL_URL_ROOT.
'/public/demo/index.php'.($url ?
'?'.$url :
'');
718 header(
"Location: ".$url);
725 $hookmanager->initHooks(array(
'login'));
726 $parameters = array();
727 $reshook = $hookmanager->executeHooks(
'beforeLoginAuthentication', $parameters, $user, $action);
734 if ($test &&
GETPOST(
"username",
"alpha", 2) && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) && !isset($_SESSION[
'dol_bypass_antispam'])) {
735 $sessionkey =
'dol_antispam_value';
736 $ok = (array_key_exists($sessionkey, $_SESSION) ===
true && (strtolower($_SESSION[$sessionkey]) === strtolower(
GETPOST(
'code',
'restricthtml'))));
740 dol_syslog(
'Bad value for code, connexion refused');
742 $langs->loadLangs(array(
'main',
'errors'));
744 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorBadValueForCode");
748 $user->trigger_mesg =
'ErrorBadValueForCode - login='.GETPOST(
"username",
"alpha", 2);
751 $result = $user->call_trigger(
'USER_LOGIN_FAILED', $user);
759 $hookmanager->initHooks(array(
'login'));
760 $parameters = array(
'dol_authmode'=>$authmode,
'dol_loginmesg'=>$_SESSION[
"dol_loginmesg"]);
761 $reshook = $hookmanager->executeHooks(
'afterLoginFailed', $parameters, $user, $action);
770 $allowedmethodtopostusername = 2;
771 if (defined(
'MAIN_AUTHENTICATION_POST_METHOD')) {
772 $allowedmethodtopostusername = constant(
'MAIN_AUTHENTICATION_POST_METHOD');
774 $usertotest = (!empty($_COOKIE[
'login_dolibarr']) ? preg_replace(
'/[^a-zA-Z0-9_\-]/',
'', $_COOKIE[
'login_dolibarr']) :
GETPOST(
"username",
"alpha", $allowedmethodtopostusername));
775 $passwordtotest =
GETPOST(
'password',
'none', $allowedmethodtopostusername);
776 $entitytotest = (
GETPOST(
'entity',
'int') ?
GETPOST(
'entity',
'int') : (!empty($conf->entity) ? $conf->entity : 1));
779 $goontestloop =
false;
780 if (isset($_SERVER[
"REMOTE_USER"]) && in_array(
'http', $authmode)) {
781 $goontestloop =
true;
783 if ($dolibarr_main_authentication ==
'forceuser' && !empty($dolibarr_auto_user)) {
784 $goontestloop =
true;
786 if (
GETPOST(
"username",
"alpha", $allowedmethodtopostusername) || !empty($_COOKIE[
'login_dolibarr']) ||
GETPOST(
'openid_mode',
'alpha', 1)) {
787 $goontestloop =
true;
790 if (!is_object($langs)) {
791 include_once DOL_DOCUMENT_ROOT.
'/core/class/translate.class.php';
793 $langcode = (
GETPOST(
'lang',
'aZ09', 1) ?
GETPOST(
'lang',
'aZ09', 1) : (empty($conf->global->MAIN_LANG_DEFAULT) ?
'auto' : $conf->global->MAIN_LANG_DEFAULT));
794 if (defined(
'MAIN_LANG_DEFAULT')) {
795 $langcode = constant(
'MAIN_LANG_DEFAULT');
797 $langs->setDefaultLang($langcode);
804 if ($test && $goontestloop && (
GETPOST(
'actionlogin',
'aZ09') ==
'login' || $dolibarr_main_authentication !=
'dolibarr')) {
806 if ($login ===
'--bad-login-validity--') {
813 $dol_authmode = $conf->authmode;
814 $dol_tz = $_POST[
"tz"];
815 $dol_tz_string = $_POST[
"tz_string"];
816 $dol_tz_string = preg_replace(
'/\s*\(.+\)$/',
'', $dol_tz_string);
817 $dol_tz_string = preg_replace(
'/,/',
'/', $dol_tz_string);
818 $dol_tz_string = preg_replace(
'/\s/',
'_', $dol_tz_string);
821 if (isset($_POST[
"dst_first"]) && isset($_POST[
"dst_second"])) {
822 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
826 if ($datenow >= $datefirst && $datenow < $datesecond) {
834 dol_syslog(
'Bad password, connexion refused', LOG_DEBUG);
836 $langs->loadLangs(array(
'main',
'errors'));
840 if (empty($_SESSION[
"dol_loginmesg"])) {
841 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorBadLoginPassword");
845 $user->trigger_mesg = $langs->trans(
"ErrorBadLoginPassword").
' - login='.
GETPOST(
"username",
"alpha", 2);
848 $result = $user->call_trigger(
'USER_LOGIN_FAILED', $user);
856 $hookmanager->initHooks(array(
'login'));
857 $parameters = array(
'dol_authmode'=>$dol_authmode,
'dol_loginmesg'=>$_SESSION[
"dol_loginmesg"]);
858 $reshook = $hookmanager->executeHooks(
'afterLoginFailed', $parameters, $user, $action);
868 if (!$login || (in_array(
'ldap', $authmode) && empty($passwordtotest))) {
870 dol_syslog(
"--- Access to ".(empty($_SERVER[
"REQUEST_METHOD"]) ?
'' : $_SERVER[
"REQUEST_METHOD"].
' ').$_SERVER[
"PHP_SELF"].
" - action=".
GETPOST(
'action',
'aZ09').
" - actionlogin=".
GETPOST(
'actionlogin',
'aZ09').
" - showing the login form and exit", LOG_NOTICE);
871 if (defined(
'NOREDIRECTBYMAINTOLOGIN')) {
876 return 'ERROR_NOT_LOGGED';
878 if ($_SERVER[
"HTTP_USER_AGENT"] ==
'securitytest') {
879 http_response_code(401);
881 dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc :
''));
886 $resultFetchUser = $user->fetch(
'', $login,
'', 1, ($entitytotest > 0 ? $entitytotest : -1));
887 if ($resultFetchUser <= 0) {
888 dol_syslog(
'User not found, connexion refused');
890 session_set_cookie_params(0,
'/',
null, (empty($dolibarr_main_force_https) ?
false :
true),
true);
891 session_name($sessionname);
894 if ($resultFetchUser == 0) {
896 $langs->loadLangs(array(
'main',
'errors'));
898 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorCantLoadUserFromDolibarrDatabase", $login);
900 $user->trigger_mesg =
'ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
902 if ($resultFetchUser < 0) {
903 $_SESSION[
"dol_loginmesg"] = $user->error;
905 $user->trigger_mesg = $user->error;
909 $result = $user->call_trigger(
'USER_LOGIN_FAILED', $user);
918 $hookmanager->initHooks(array(
'login'));
919 $parameters = array(
'dol_authmode'=>$dol_authmode,
'dol_loginmesg'=>$_SESSION[
"dol_loginmesg"]);
920 $reshook = $hookmanager->executeHooks(
'afterLoginFailed', $parameters, $user, $action);
925 $paramsurl = array();
926 if (
GETPOST(
'textbrowser',
'int')) {
927 $paramsurl[] =
'textbrowser='.GETPOST(
'textbrowser',
'int');
930 $paramsurl[] =
'nojs='.GETPOST(
'nojs',
'int');
933 $paramsurl[] =
'lang='.GETPOST(
'lang',
'aZ09');
935 header(
'Location: '.DOL_URL_ROOT.
'/index.php'.(count($paramsurl) ?
'?'.implode(
'&', $paramsurl) :
''));
939 if (!empty($user->conf->MAIN_LANG_DEFAULT)) {
940 $langs->setDefaultLang($user->conf->MAIN_LANG_DEFAULT);
945 $login = $_SESSION[
"dol_login"];
946 $entity = isset($_SESSION[
"dol_entity"]) ? $_SESSION[
"dol_entity"] : 0;
947 dol_syslog(
"- This is an already logged session. _SESSION['dol_login']=".$login.
" _SESSION['dol_entity']=".$entity, LOG_DEBUG);
949 $resultFetchUser = $user->fetch(
'', $login,
'', 1, ($entity > 0 ? $entity : -1));
950 if ($resultFetchUser <= 0) {
952 dol_syslog(
"Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING);
954 session_set_cookie_params(0,
'/',
null, (empty($dolibarr_main_force_https) ?
false :
true),
true);
955 session_name($sessionname);
958 if ($resultFetchUser == 0) {
960 $langs->loadLangs(array(
'main',
'errors'));
962 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorCantLoadUserFromDolibarrDatabase", $login);
964 $user->trigger_mesg =
'ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
966 if ($resultFetchUser < 0) {
967 $_SESSION[
"dol_loginmesg"] = $user->error;
969 $user->trigger_mesg = $user->error;
973 $result = $user->call_trigger(
'USER_LOGIN_FAILED', $user);
981 $hookmanager->initHooks(array(
'login'));
982 $parameters = array(
'dol_authmode' => (isset($dol_authmode) ? $dol_authmode :
''),
'dol_loginmesg' => $_SESSION[
"dol_loginmesg"]);
983 $reshook = $hookmanager->executeHooks(
'afterLoginFailed', $parameters, $user, $action);
988 $paramsurl = array();
989 if (
GETPOST(
'textbrowser',
'int')) {
990 $paramsurl[] =
'textbrowser='.GETPOST(
'textbrowser',
'int');
993 $paramsurl[] =
'nojs='.GETPOST(
'nojs',
'int');
996 $paramsurl[] =
'lang='.GETPOST(
'lang',
'aZ09');
998 header(
'Location: '.DOL_URL_ROOT.
'/index.php'.(count($paramsurl) ?
'?'.implode(
'&', $paramsurl) :
''));
1002 $hookmanager->initHooks(array(
'main'));
1005 if (!empty($_GET[
'save_lastsearch_values']) && !empty($_SERVER[
"HTTP_REFERER"])) {
1006 $relativepathstring = preg_replace(
'/\?.*$/',
'', $_SERVER[
"HTTP_REFERER"]);
1007 $relativepathstring = preg_replace(
'/^https?:\/\/[^\/]*/',
'', $relativepathstring);
1009 if (constant(
'DOL_URL_ROOT')) {
1010 $relativepathstring = preg_replace(
'/^'.preg_quote(constant(
'DOL_URL_ROOT'),
'/').
'/',
'', $relativepathstring);
1012 $relativepathstring = preg_replace(
'/^\//',
'', $relativepathstring);
1013 $relativepathstring = preg_replace(
'/^custom\//',
'', $relativepathstring);
1017 if (!empty($_SESSION[
'lastsearch_values_tmp_'.$relativepathstring])) {
1018 $_SESSION[
'lastsearch_values_'.$relativepathstring] = $_SESSION[
'lastsearch_values_tmp_'.$relativepathstring];
1019 unset($_SESSION[
'lastsearch_values_tmp_'.$relativepathstring]);
1021 if (!empty($_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring])) {
1022 $_SESSION[
'lastsearch_contextpage_'.$relativepathstring] = $_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring];
1023 unset($_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring]);
1025 if (!empty($_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit) {
1026 $_SESSION[
'lastsearch_limit_'.$relativepathstring] = $_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring];
1027 unset($_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring]);
1029 if (!empty($_SESSION[
'lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION[
'lastsearch_page_tmp_'.$relativepathstring] > 0) {
1030 $_SESSION[
'lastsearch_page_'.$relativepathstring] = $_SESSION[
'lastsearch_page_tmp_'.$relativepathstring];
1031 unset($_SESSION[
'lastsearch_page_tmp_'.$relativepathstring]);
1033 if (!empty($_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring])) {
1034 $_SESSION[
'lastsearch_mode_'.$relativepathstring] = $_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring];
1035 unset($_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring]);
1040 $reshook = $hookmanager->executeHooks(
'updateSession', array(), $user, $action);
1049 if (!isset($_SESSION[
"dol_login"])) {
1054 $_SESSION[
"dol_login"] = $user->login;
1055 $_SESSION[
"dol_authmode"] = isset($dol_authmode) ? $dol_authmode :
'';
1056 $_SESSION[
"dol_tz"] = isset($dol_tz) ? $dol_tz :
'';
1057 $_SESSION[
"dol_tz_string"] = isset($dol_tz_string) ? $dol_tz_string :
'';
1058 $_SESSION[
"dol_dst"] = isset($dol_dst) ? $dol_dst :
'';
1059 $_SESSION[
"dol_dst_observed"] = isset($dol_dst_observed) ? $dol_dst_observed :
'';
1060 $_SESSION[
"dol_dst_first"] = isset($dol_dst_first) ? $dol_dst_first :
'';
1061 $_SESSION[
"dol_dst_second"] = isset($dol_dst_second) ? $dol_dst_second :
'';
1062 $_SESSION[
"dol_screenwidth"] = isset($dol_screenwidth) ? $dol_screenwidth :
'';
1063 $_SESSION[
"dol_screenheight"] = isset($dol_screenheight) ? $dol_screenheight :
'';
1065 $_SESSION[
"dol_entity"] = $conf->entity;
1067 if (!empty($dol_hide_topmenu)) {
1068 $_SESSION[
'dol_hide_topmenu'] = $dol_hide_topmenu;
1070 if (!empty($dol_hide_leftmenu)) {
1071 $_SESSION[
'dol_hide_leftmenu'] = $dol_hide_leftmenu;
1073 if (!empty($dol_optimize_smallscreen)) {
1074 $_SESSION[
'dol_optimize_smallscreen'] = $dol_optimize_smallscreen;
1076 if (!empty($dol_no_mouse_hover)) {
1077 $_SESSION[
'dol_no_mouse_hover'] = $dol_no_mouse_hover;
1079 if (!empty($dol_use_jmobile)) {
1080 $_SESSION[
'dol_use_jmobile'] = $dol_use_jmobile;
1083 dol_syslog(
"This is a new started user session. _SESSION['dol_login']=".$_SESSION[
"dol_login"].
" Session id=".session_id());
1087 $user->update_last_login_date();
1089 $loginfo =
'TZ='.$_SESSION[
"dol_tz"].
';TZString='.$_SESSION[
"dol_tz_string"].
';Screen='.$_SESSION[
"dol_screenwidth"].
'x'.$_SESSION[
"dol_screenheight"];
1092 $user->trigger_mesg = $loginfo;
1095 $result = $user->call_trigger(
'USER_LOGIN', $user);
1103 $hookmanager->initHooks(array(
'login'));
1104 $parameters = array(
'dol_authmode'=>$dol_authmode,
'dol_loginfo'=>$loginfo);
1105 $reshook = $hookmanager->executeHooks(
'afterLogin', $parameters, $user, $action);
1113 dol_print_error($db,
'Error in some triggers USER_LOGIN or in some hooks afterLogin');
1120 $landingpage = (empty($user->conf->MAIN_LANDING_PAGE) ? (empty($conf->global->MAIN_LANDING_PAGE) ?
'' : $conf->global->MAIN_LANDING_PAGE) : $user->conf->MAIN_LANDING_PAGE);
1121 if (!empty($landingpage)) {
1123 if ($_SERVER[
"PHP_SELF"] != $newpath) {
1124 header(
'Location: '.$newpath);
1133 $user->rights->user->user->lire = 1;
1134 $user->rights->user->user->creer = 1;
1135 $user->rights->user->user->password = 1;
1136 $user->rights->user->user->supprimer = 1;
1137 $user->rights->user->self->creer = 1;
1138 $user->rights->user->self->password = 1;
1141 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
1142 if (empty($user->rights->user->user_advance)) {
1143 $user->rights->user->user_advance =
new stdClass();
1145 if (empty($user->rights->user->self_advance)) {
1146 $user->rights->user->self_advance =
new stdClass();
1148 if (empty($user->rights->user->group_advance)) {
1149 $user->rights->user->group_advance =
new stdClass();
1152 $user->rights->user->user_advance->readperms = 1;
1153 $user->rights->user->user_advance->write = 1;
1154 $user->rights->user->self_advance->readperms = 1;
1155 $user->rights->user->self_advance->writeperms = 1;
1156 $user->rights->user->group_advance->read = 1;
1157 $user->rights->user->group_advance->readperms = 1;
1158 $user->rights->user->group_advance->write = 1;
1159 $user->rights->user->group_advance->delete = 1;
1168 if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) {
1169 $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT;
1171 if (isset($user->conf->PRODUIT_LIMIT_SIZE)) {
1172 $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE;
1176 if (empty($conf->global->MAIN_FORCETHEME) && !empty($user->conf->MAIN_THEME)) {
1177 $conf->theme = $user->conf->MAIN_THEME;
1178 $conf->css =
"/theme/".$conf->theme.
"/style.css.php";
1182 if (!empty($user) && method_exists($user,
'loadDefaultValues')) {
1183 $user->loadDefaultValues();
1189 if (
GETPOST(
'theme',
'aZ09')) {
1190 $conf->theme =
GETPOST(
'theme',
'aZ09', 1);
1191 $conf->css =
"/theme/".$conf->theme.
"/style.css.php";
1196 $conf->use_javascript_ajax = 0;
1198 if (!empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) {
1199 $conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT;
1204 if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1205 $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = $user->conf->MAIN_OPTIMIZEFORTEXTBROWSER;
1209 $conf->global->MAIN_OPTIMIZEFORCOLORBLIND = empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND) ?
'' : $user->conf->MAIN_OPTIMIZEFORCOLORBLIND;
1212 if (
GETPOST(
'dol_hide_leftmenu',
'int') || !empty($_SESSION[
'dol_hide_leftmenu'])) {
1213 $conf->dol_hide_leftmenu = 1;
1215 if (
GETPOST(
'dol_hide_topmenu',
'int') || !empty($_SESSION[
'dol_hide_topmenu'])) {
1216 $conf->dol_hide_topmenu = 1;
1218 if (
GETPOST(
'dol_optimize_smallscreen',
'int') || !empty($_SESSION[
'dol_optimize_smallscreen'])) {
1219 $conf->dol_optimize_smallscreen = 1;
1221 if (
GETPOST(
'dol_no_mouse_hover',
'int') || !empty($_SESSION[
'dol_no_mouse_hover'])) {
1222 $conf->dol_no_mouse_hover = 1;
1224 if (
GETPOST(
'dol_use_jmobile',
'int') || !empty($_SESSION[
'dol_use_jmobile'])) {
1225 $conf->dol_use_jmobile = 1;
1228 if (!empty($conf->browser->layout) && $conf->browser->layout !=
'classic') {
1229 $conf->dol_no_mouse_hover = 1;
1233 if ((!empty($conf->browser->layout) && $conf->browser->layout ==
'phone')
1234 || (!empty($_SESSION[
'dol_screenwidth']) && $_SESSION[
'dol_screenwidth'] < 400)
1235 || (!empty($_SESSION[
'dol_screenheight']) && $_SESSION[
'dol_screenheight'] < 400
1236 || !empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
1238 $conf->dol_optimize_smallscreen = 1;
1240 if (isset($conf->global->PRODUIT_DESC_IN_FORM) && $conf->global->PRODUIT_DESC_IN_FORM == 1) {
1241 $conf->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = 0;
1245 if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array(
'bureau2crea',
'cameleo',
'amarok'))) {
1246 $conf->theme =
'eldy';
1247 $conf->css =
"/theme/".$conf->theme.
"/style.css.php";
1250 if (!defined(
'NOREQUIRETRAN')) {
1251 if (!
GETPOST(
'lang',
'aZ09')) {
1253 if (!empty($user->conf->MAIN_LANG_DEFAULT)) {
1256 if ($langs->getDefaultLang() != $user->conf->MAIN_LANG_DEFAULT) {
1257 $langs->setDefaultLang($user->conf->MAIN_LANG_DEFAULT);
1263 if (!defined(
'NOLOGIN')) {
1266 if (!$user->login) {
1271 if ($user->statut < 1) {
1273 $langs->loadLangs(array(
"errors",
"other"));
1274 dol_syslog(
"Authentication KO as login is disabled", LOG_NOTICE);
1282 dol_syslog(
"--- Access to ".(empty($_SERVER[
"REQUEST_METHOD"]) ?
'' : $_SERVER[
"REQUEST_METHOD"].
' ').$_SERVER[
"PHP_SELF"].
' - action='.
GETPOST(
'action',
'aZ09').
', massaction='.
GETPOST(
'massaction',
'aZ09').(defined(
'NOTOKENRENEWAL') ?
' NOTOKENRENEWAL='.constant(
'NOTOKENRENEWAL') :
''), LOG_NOTICE);
1287 if (!defined(
'NOREQUIRETRAN')) {
1289 $langs->loadLangs(array(
'main',
'dict'));
1293 $bc = array(0=>
'class="impair"', 1=>
'class="pair"');
1294 $bcdd = array(0=>
'class="drag drop oddeven"', 1=>
'class="drag drop oddeven"');
1295 $bcnd = array(0=>
'class="nodrag nodrop nohover"', 1=>
'class="nodrag nodrop nohoverpair"');
1296 $bctag = array(0=>
'class="impair tagtr"', 1=>
'class="pair tagtr"');
1299 $mesg =
''; $warning =
''; $error = 0;
1301 $mesgs = array(); $warnings = array(); $errors = array();
1304 if (empty($conf->browser->firefox)) {
1305 define(
'ROWS_1', 1);
1306 define(
'ROWS_2', 2);
1307 define(
'ROWS_3', 3);
1308 define(
'ROWS_4', 4);
1309 define(
'ROWS_5', 5);
1310 define(
'ROWS_6', 6);
1311 define(
'ROWS_7', 7);
1312 define(
'ROWS_8', 8);
1313 define(
'ROWS_9', 9);
1315 define(
'ROWS_1', 0);
1316 define(
'ROWS_2', 1);
1317 define(
'ROWS_3', 2);
1318 define(
'ROWS_4', 3);
1319 define(
'ROWS_5', 4);
1320 define(
'ROWS_6', 5);
1321 define(
'ROWS_7', 6);
1322 define(
'ROWS_8', 7);
1323 define(
'ROWS_9', 8);
1326 $heightforframes = 50;
1329 if (!defined(
'NOREQUIREMENU')) {
1330 if (empty($user->socid)) {
1331 $conf->standard_menu = (empty($conf->global->MAIN_MENU_STANDARD_FORCED) ? (empty($conf->global->MAIN_MENU_STANDARD) ?
'eldy_menu.php' : $conf->global->MAIN_MENU_STANDARD) : $conf->global->MAIN_MENU_STANDARD_FORCED);
1334 $conf->standard_menu = (empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED) ? (empty($conf->global->MAIN_MENUFRONT_STANDARD) ?
'eldy_menu.php' : $conf->global->MAIN_MENUFRONT_STANDARD) : $conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
1338 $file_menu = $conf->standard_menu;
1339 if (
GETPOST(
'menu',
'alpha')) {
1340 $file_menu =
GETPOST(
'menu',
'alpha');
1342 if (!class_exists(
'MenuManager')) {
1344 $dirmenus = array_merge(array(
"/core/menus/"), (array) $conf->modules_parts[
'menus']);
1345 foreach ($dirmenus as $dirmenu) {
1347 if (class_exists(
'MenuManager')) {
1351 if (!class_exists(
'MenuManager')) {
1352 dol_syslog(
"You define a menu manager '".$file_menu.
"' that can not be loaded.", LOG_WARNING);
1353 $file_menu =
'eldy_menu.php';
1354 include_once DOL_DOCUMENT_ROOT.
"/core/menus/standard/".$file_menu;
1357 $menumanager =
new MenuManager($db, empty($user->socid) ? 0 : 1);
1358 $menumanager->loadMenu();
1365 if (!function_exists(
"llxHeader")) {
1386 function llxHeader($head =
'', $title =
'',
$help_url =
'', $target =
'', $disablejs = 0, $disablehead = 0, $arrayofjs =
'', $arrayofcss =
'', $morequerystring =
'', $morecssonbody =
'', $replacemainareaby =
'', $disablenofollow = 0, $disablenoindex = 0)
1388 global $conf, $hookmanager;
1391 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, $disablenofollow, $disablenoindex);
1393 $tmpcsstouse =
'sidebar-collapse'.($morecssonbody ?
' '.$morecssonbody :
'');
1395 if ($conf->theme ==
'md' && !in_array($conf->browser->layout, array(
'phone',
'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1397 if ($mainmenu !=
'website') {
1398 $tmpcsstouse = $morecssonbody;
1402 if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) {
1403 $tmpcsstouse .=
' colorblind-'.strip_tags($conf->global->MAIN_OPTIMIZEFORCOLORBLIND);
1406 print
'<body id="mainbody" class="'.$tmpcsstouse.
'">'.
"\n";
1408 $parameters = array(
'help_url' =>
$help_url);
1409 $reshook = $hookmanager->executeHooks(
'changeHelpURL', $parameters);
1415 if ((empty($conf->dol_hide_topmenu) ||
GETPOST(
'dol_invisible_topmenu',
'int')) && !
GETPOST(
'dol_openinpopup',
'aZ09')) {
1416 top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring,
$help_url);
1419 if (empty($conf->dol_hide_leftmenu) && !
GETPOST(
'dol_openinpopup',
'aZ09')) {
1424 if ($replacemainareaby) {
1425 print $replacemainareaby;
1442 global $db, $conf, $hookmanager;
1444 if ($contenttype ==
'text/html') {
1445 header(
"Content-Type: text/html; charset=".$conf->file->character_set_client);
1447 header(
"Content-Type: ".$contenttype);
1453 header(
"X-Content-Type-Options: nosniff");
1456 if (!defined(
'XFRAMEOPTIONS_ALLOWALL')) {
1457 header(
"X-Frame-Options: SAMEORIGIN");
1459 header(
"X-Frame-Options: ALLOWALL");
1466 if (!defined(
'MAIN_SECURITY_FORCECSPRO')) {
1481 if (!is_object($hookmanager)) {
1482 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
1485 $hookmanager->initHooks(array(
"main"));
1487 $parameters = array(
'contentsecuritypolicy'=>$contentsecuritypolicy,
'mode'=>
'reportonly');
1488 $result = $hookmanager->executeHooks(
'setContentSecurityPolicy', $parameters);
1490 $contentsecuritypolicy = $hookmanager->resPrint;
1492 $contentsecuritypolicy .= $hookmanager->resPrint;
1495 if (!empty($contentsecuritypolicy)) {
1496 header(
"Content-Security-Policy-Report-Only: ".$contentsecuritypolicy);
1499 header(
"Content-Security-Policy: ".constant(
'MAIN_SECURITY_FORCECSPRO'));
1503 if (!defined(
'MAIN_SECURITY_FORCECSP')) {
1518 if (!is_object($hookmanager)) {
1519 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
1522 $hookmanager->initHooks(array(
"main"));
1524 $parameters = array(
'contentsecuritypolicy'=>$contentsecuritypolicy,
'mode'=>
'active');
1525 $result = $hookmanager->executeHooks(
'setContentSecurityPolicy', $parameters);
1527 $contentsecuritypolicy = $hookmanager->resPrint;
1529 $contentsecuritypolicy .= $hookmanager->resPrint;
1532 if (!empty($contentsecuritypolicy)) {
1533 header(
"Content-Security-Policy: ".$contentsecuritypolicy);
1536 header(
"Content-Security-Policy: ".constant(
'MAIN_SECURITY_FORCECSP'));
1542 if (!defined(
'MAIN_SECURITY_FORCERP')) {
1545 header(
"Referrer-Policy: ".$referrerpolicy);
1548 if ($forcenocache) {
1549 header(
"Cache-Control: no-cache, no-store, must-revalidate, max-age=0");
1571 function top_htmlhead($head, $title =
'', $disablejs = 0, $disablehead = 0, $arrayofjs =
'', $arrayofcss =
'', $disableforlogin = 0, $disablenofollow = 0, $disablenoindex = 0)
1573 global $db, $conf, $langs, $user, $mysoc, $hookmanager;
1577 if (empty($conf->css)) {
1578 $conf->css =
'/theme/eldy/style.css.php';
1581 print
'<!doctype html>'.
"\n";
1583 print
'<html lang="'.substr($langs->defaultlang, 0, 2).
'">'.
"\n";
1586 if (empty($disablehead)) {
1587 if (!is_object($hookmanager)) {
1590 $hookmanager->initHooks(array(
"main"));
1592 $ext =
'layout='.$conf->browser->layout.
'&version='.urlencode(DOL_VERSION);
1596 if (
GETPOST(
'dol_basehref',
'alpha')) {
1597 print
'<base href="'.dol_escape_htmltag(
GETPOST(
'dol_basehref',
'alpha')).
'">'.
"\n";
1601 print
'<meta charset="utf-8">'.
"\n";
1602 print
'<meta name="robots" content="'.($disablenoindex ?
'index' :
'noindex').($disablenofollow ?
',follow' :
',nofollow').
'">'.
"\n";
1603 print
'<meta name="viewport" content="width=device-width, initial-scale=1.0">'.
"\n";
1604 print
'<meta name="author" content="Dolibarr Development Team">'.
"\n";
1605 print
'<meta name="anti-csrf-newtoken" content="'.newToken().
'">'.
"\n";
1606 print
'<meta name="anti-csrf-currenttoken" content="'.currentToken().
'">'.
"\n";
1608 print
'<meta name="MAIN_FEATURES_LEVEL" content="'.getDolGlobalInt(
'MAIN_FEATURES_LEVEL').
'">'.
"\n";
1611 $favicon = DOL_URL_ROOT.
'/theme/dolibarr_256x256_color.png';
1612 if (!empty($mysoc->logo_squarred_mini)) {
1613 $favicon = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode(
'logos/thumbs/'.$mysoc->logo_squarred_mini);
1618 if (empty($conf->dol_use_jmobile)) {
1619 print
'<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.
'"/>'.
"\n";
1627 $manifest = DOL_URL_ROOT.
'/theme/'.$conf->theme.
'/manifest.json.php';
1628 if (!empty($manifest)) {
1629 print
'<link rel="manifest" href="'.$manifest.
'" />'.
"\n";
1632 if (!empty($conf->global->THEME_ELDY_TOPMENU_BACK1)) {
1634 print
'<meta name="theme-color" content="rgb('.$conf->global->THEME_ELDY_TOPMENU_BACK1.
')">'.
"\n";
1638 if (
GETPOST(
'autorefresh',
'int') > 0) {
1639 print
'<meta http-equiv="refresh" content="'.GETPOST(
'autorefresh',
'int').
'">';
1643 $appli = constant(
'DOL_APPLICATION_TITLE');
1644 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1645 $appli = $conf->global->MAIN_APPLICATION_TITLE;
1650 if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/noapp/', $conf->global->MAIN_HTML_TITLE)) {
1658 $parameters = array(
'title'=>$titletoshow);
1659 $result = $hookmanager->executeHooks(
'setHtmlTitle', $parameters);
1661 $titletoshow = $hookmanager->resPrint;
1663 $titletoshow .= $hookmanager->resPrint;
1671 if (
GETPOST(
'version',
'int')) {
1672 $ext =
'version='.GETPOST(
'version',
'int');
1675 if (
GETPOST(
'dol_resetcache')) {
1679 $themeparam =
'?lang='.$langs->defaultlang.
'&theme='.$conf->theme.(GETPOST(
'optioncss',
'aZ09') ?
'&optioncss='.GETPOST(
'optioncss',
'aZ09', 1) :
'').(empty($user->id) ?
'' : (
'&userid='.$user->id)).
'&entity='.$conf->entity;
1681 $themeparam .= ($ext ?
'&'.$ext :
'').
'&revision='.
getDolGlobalInt(
"MAIN_IHM_PARAMS_REV");
1683 $themeparam .=
'&dol_hide_topmenu='.GETPOST(
'dol_hide_topmenu',
'int');
1686 $themeparam .=
'&dol_hide_leftmenu='.GETPOST(
'dol_hide_leftmenu',
'int');
1689 $themeparam .=
'&dol_optimize_smallscreen='.GETPOST(
'dol_optimize_smallscreen',
'int');
1692 $themeparam .=
'&dol_no_mouse_hover='.GETPOST(
'dol_no_mouse_hover',
'int');
1695 $themeparam .=
'&dol_use_jmobile='.GETPOST(
'dol_use_jmobile',
'int'); $conf->dol_use_jmobile =
GETPOST(
'dol_use_jmobile',
'int');
1698 $themeparam .=
'&THEME_DARKMODEENABLED='.GETPOST(
'THEME_DARKMODEENABLED',
'int');
1701 $themeparam .=
'&THEME_SATURATE_RATIO='.GETPOST(
'THEME_SATURATE_RATIO',
'int');
1704 if (!empty($conf->global->MAIN_ENABLE_FONT_ROBOTO)) {
1705 print
'<link rel="preconnect" href="https://fonts.gstatic.com">'.
"\n";
1706 print
'<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@200;300;400;500;600&display=swap" rel="stylesheet">'.
"\n";
1709 if (!defined(
'DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) {
1710 print
'<!-- Includes CSS for JQuery (Ajax library) -->'.
"\n";
1711 $jquerytheme =
'base';
1712 if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) {
1713 $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
1715 if (constant(
'JS_JQUERY_UI')) {
1716 print
'<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.
'css/'.$jquerytheme.
'/jquery-ui.min.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1718 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/includes/jquery/css/'.$jquerytheme.
'/jquery-ui.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1720 if (!defined(
'DISABLE_JQUERY_JNOTIFY')) {
1721 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1723 if (!defined(
'DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined(
'REQUIRE_JQUERY_MULTISELECT'))) {
1724 $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ?constant(
'REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1725 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/includes/jquery/plugins/'.$tmpplugin.
'/dist/css/'.$tmpplugin.
'.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1729 if (!defined(
'DISABLE_FONT_AWSOME')) {
1730 print
'<!-- Includes CSS for font awesome -->'.
"\n";
1731 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/theme/common/fontawesome-5/css/all.min.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1732 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/theme/common/fontawesome-5/css/v4-shims.min.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1735 print
'<!-- Includes CSS for Dolibarr theme -->'.
"\n";
1739 if (!empty($conf->modules_parts[
'theme'])) {
1740 foreach ($conf->modules_parts[
'theme'] as $reldir) {
1743 $themesubdir = $reldir;
1750 print
'<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.
'">'.
"\n";
1751 if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME)) {
1752 print
'<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->'.
"\n".
'<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">'.
"\n";
1756 if (!empty($conf->modules_parts[
'css'])) {
1757 $arraycss = (array) $conf->modules_parts[
'css'];
1758 foreach ($arraycss as $modcss => $filescss) {
1759 $filescss = (array) $filescss;
1760 foreach ($filescss as $cssfile) {
1761 if (empty($cssfile)) {
1762 dol_syslog(
"Warning: module ".$modcss.
" declared a css path file into its descriptor that is empty.", LOG_WARNING);
1766 if ($urlforcss && $urlforcss !=
'/') {
1767 print
'<!-- Includes CSS added by module '.$modcss.
' -->'.
"\n".
'<link rel="stylesheet" type="text/css" href="'.$urlforcss;
1769 if (!preg_match(
'/\.css$/i', $cssfile)) {
1774 dol_syslog(
"Warning: module ".$modcss.
" declared a css path file for a file we can't find.", LOG_WARNING);
1780 if (is_array($arrayofcss)) {
1781 foreach ($arrayofcss as $cssfile) {
1782 if (preg_match(
'/^(http|\/\/)/i', $cssfile)) {
1783 $urltofile = $cssfile;
1787 print
'<!-- Includes CSS added by page -->'.
"\n".
'<link rel="stylesheet" type="text/css" title="default" href="'.$urltofile;
1789 if (!preg_match(
'/\.css$/i', $cssfile)) {
1797 if (!defined(
'DISABLE_JQUERY') && !$disablejs && !empty($conf->use_javascript_ajax)) {
1799 print
'<!-- Includes JS for JQuery -->'.
"\n";
1800 if (defined(
'JS_JQUERY') && constant(
'JS_JQUERY')) {
1801 print
'<script src="'.JS_JQUERY.
'jquery.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1803 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/js/jquery.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1805 if (defined(
'JS_JQUERY_UI') && constant(
'JS_JQUERY_UI')) {
1806 print
'<script src="'.JS_JQUERY_UI.
'jquery-ui.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1808 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/js/jquery-ui.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1811 if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined(
'DISABLE_JQUERY_JNOTIFY')) {
1812 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1815 if (empty($disableforlogin) && !defined(
'DISABLE_JQUERY_TABLEDND')) {
1816 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1819 if (empty($disableforlogin) && (empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH ==
'chart') && !defined(
'DISABLE_JS_GRAPH')) {
1820 print
'<script src="'.DOL_URL_ROOT.
'/includes/nnnick/chartjs/dist/chart.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1824 if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !defined(
'DISABLE_JQUERY_JEDITABLE')) {
1825 print
'<!-- JS to manage editInPlace feature -->'.
"\n";
1826 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jeditable/jquery.jeditable.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1827 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1828 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1829 print
'<script>'.
"\n";
1830 print
'var urlSaveInPlace = \''.DOL_URL_ROOT.
'/core/ajax/saveinplace.php\';'.
"\n";
1831 print
'var urlLoadInPlace = \''.DOL_URL_ROOT.
'/core/ajax/loadinplace.php\';'.
"\n";
1832 print
'var tooltipInPlace = \''.$langs->transnoentities(
'ClickToEdit').
'\';
'."\n"; // Added in title attribute of span
1833 print 'var placeholderInPlace = \
' \';'.
"\n";
1834 print
'var cancelInPlace = \''.$langs->trans(
"Cancel").
'\';
'."\n";
1835 print 'var submitInPlace = \
''.$langs->trans(
'Ok').
'\';
'."\n";
1836 print 'var indicatorInPlace = \
'<img src="'.DOL_URL_ROOT.
"/theme/".$conf->theme.
"/img/working.gif".
'">\';'.
"\n";
1837 print
'var withInPlace = 300;';
1838 print
'</script>'.
"\n";
1839 print
'<script src="'.DOL_URL_ROOT.
'/core/js/editinplace.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1840 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1843 if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined(
'REQUIRE_JQUERY_TIMEPICKER')) {
1844 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/timepicker/jquery-ui-timepicker-addon.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1845 print
'<script src="'.DOL_URL_ROOT.
'/core/js/timepicker.js.php?lang='.$langs->defaultlang.($ext ?
'&'.$ext :
'').
'"></script>'.
"\n";
1847 if (!defined(
'DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined(
'REQUIRE_JQUERY_MULTISELECT'))) {
1849 $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ?constant(
'REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1850 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/'.$tmpplugin.
'/dist/js/'.$tmpplugin.
'.full.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1852 if (!defined(
'DISABLE_MULTISELECT')) {
1853 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/multiselect/jquery.multi-select.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1857 if (!$disablejs && !empty($conf->use_javascript_ajax)) {
1859 if (empty($disableforlogin) && (
isModEnabled(
'fckeditor') && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME ==
'ckeditor') && !defined(
'DISABLE_CKEDITOR')) || defined(
'FORCE_CKEDITOR')) {
1860 print
'<!-- Includes JS for CKEditor -->'.
"\n";
1861 $pathckeditor = DOL_URL_ROOT.
'/includes/ckeditor/ckeditor/';
1862 $jsckeditor =
'ckeditor.js';
1863 if (constant(
'JS_CKEDITOR')) {
1865 $pathckeditor = constant(
'JS_CKEDITOR');
1868 print
'/* enable ckeditor by main.inc.php */';
1869 print
'var CKEDITOR_BASEPATH = \''.dol_escape_js($pathckeditor).
'\';
'."\n";
1870 print 'var ckeditorConfig = \
''.dol_escape_js(
dol_buildpath($themesubdir.
'/theme/'.$conf->theme.
'/ckeditor/config.js'.($ext ?
'?'.$ext :
''), 1)).
'\';
'."\n"; // $themesubdir='' in standard usage
1871 print 'var ckeditorFilebrowserBrowseUrl = \
''.DOL_URL_ROOT.
'/core/filemanagerdol/browser/default/browser.php?Connector='.DOL_URL_ROOT.
'/core/filemanagerdol/connectors/php/connector.php\';'.
"\n";
1872 print
'var ckeditorFilebrowserImageBrowseUrl = \''.DOL_URL_ROOT.
'/core/filemanagerdol/browser/default/browser.php?Type=Image&Connector='.DOL_URL_ROOT.
'/core/filemanagerdol/connectors/php/connector.php\';'.
"\n";
1873 print
'</script>'.
"\n";
1874 print
'<script src="'.$pathckeditor.$jsckeditor.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1876 if (
GETPOST(
'mode',
'aZ09') ==
'Full_inline') {
1877 print
'CKEDITOR.disableAutoInline = false;'.
"\n";
1879 print
'CKEDITOR.disableAutoInline = true;'.
"\n";
1881 print
'</script>'.
"\n";
1885 if (!defined(
'NOBROWSERNOTIF') && !defined(
'NOREQUIREMENU') && !defined(
'NOLOGIN')) {
1886 $enablebrowsernotif =
false;
1887 if (
isModEnabled(
'agenda') && !empty($conf->global->AGENDA_REMINDER_BROWSER)) {
1888 $enablebrowsernotif =
true;
1890 if ($conf->browser->layout ==
'phone') {
1891 $enablebrowsernotif =
false;
1893 if ($enablebrowsernotif) {
1894 print
'<!-- Includes JS of Dolibarr (browser layout = '.$conf->browser->layout.
')-->'.
"\n";
1895 print
'<script src="'.DOL_URL_ROOT.
'/core/js/lib_notification.js.php'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1900 print
'<!-- Includes JS of Dolibarr -->'.
"\n";
1901 print
'<script src="'.DOL_URL_ROOT.
'/core/js/lib_head.js.php?lang='.$langs->defaultlang.($ext ?
'&'.$ext :
'').
'"></script>'.
"\n";
1904 if (!empty($conf->modules_parts[
'js'])) {
1905 $arrayjs = (array) $conf->modules_parts[
'js'];
1906 foreach ($arrayjs as $modjs => $filesjs) {
1907 $filesjs = (array) $filesjs;
1908 foreach ($filesjs as $jsfile) {
1911 if ($urlforjs && $urlforjs !=
'/') {
1912 print
'<!-- Include JS added by module '.$modjs.
'-->'.
"\n".
'<script src="'.$urlforjs.((strpos($jsfile,
'?') ===
false) ?
'?' :
'&').
'lang='.$langs->defaultlang.
'"></script>'.
"\n";
1914 dol_syslog(
"Warning: module ".$modjs.
" declared a js path file for a file we can't find.", LOG_WARNING);
1920 if (is_array($arrayofjs)) {
1921 print
'<!-- Includes JS added by page -->'.
"\n";
1922 foreach ($arrayofjs as $jsfile) {
1923 if (preg_match(
'/^(http|\/\/)/i', $jsfile)) {
1924 print
'<script src="'.$jsfile.((strpos($jsfile,
'?') ===
false) ?
'?' :
'&').
'lang='.$langs->defaultlang.
'"></script>'.
"\n";
1926 print
'<script src="'.dol_buildpath($jsfile, 1).((strpos($jsfile,
'?') ===
false) ?
'?' :
'&').
'lang='.$langs->defaultlang.
'"></script>'.
"\n";
1933 if (!empty($conf->global->ALLOW_THEME_JS)) {
1934 $theme_js =
dol_buildpath(
'/theme/'.$conf->theme.
'/'.$conf->theme.
'.js', 0);
1935 if (file_exists($theme_js)) {
1936 print
'<script src="'.DOL_URL_ROOT.
'/theme/'.$conf->theme.
'/'.$conf->theme.
'.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1940 if (!empty($head)) {
1943 if (!empty($conf->global->MAIN_HTML_HEADER)) {
1944 print $conf->global->MAIN_HTML_HEADER.
"\n";
1947 $parameters = array();
1948 $result = $hookmanager->executeHooks(
'addHtmlHeader', $parameters);
1949 print $hookmanager->resPrint;
1951 print
"</head>\n\n";
1954 $conf->headerdone = 1;
1974 function top_menu($head, $title =
'', $target =
'', $disablejs = 0, $disablehead = 0, $arrayofjs =
'', $arrayofcss =
'', $morequerystring =
'', $helppagename =
'')
1976 global $user, $conf, $langs, $db;
1977 global $dolibarr_main_authentication, $dolibarr_main_demo;
1978 global $hookmanager, $menumanager;
1983 $hookmanager->initHooks(array(
'toprightmenu'));
1988 if (empty($conf->headerdone)) {
1989 $disablenofollow = 0;
1990 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, $disablenofollow);
1991 print
'<body id="mainbody">';
1997 if ((empty($conf->dol_hide_topmenu) ||
GETPOST(
'dol_invisible_topmenu',
'int')) && (!defined(
'NOREQUIREMENU') || !constant(
'NOREQUIREMENU'))) {
1999 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
2003 print
"\n".
'<!-- Start top horizontal -->'.
"\n";
2005 print
'<header id="id-top" class="side-nav-vert'.(GETPOST(
'dol_invisible_topmenu',
'int') ?
' hidden' :
'').
'">';
2008 print
'<div id="tmenu_tooltip'.(empty($conf->global->MAIN_MENU_INVERT) ?
'' :
'invert').
'" class="tmenu">'.
"\n";
2009 $menumanager->atarget = $target;
2010 $menumanager->showmenu(
'top', array(
'searchform'=>$searchform));
2014 $appli = constant(
'DOL_APPLICATION_TITLE');
2015 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
2016 $appli = $conf->global->MAIN_APPLICATION_TITLE;
2017 if (preg_match(
'/\d\.\d/', $appli)) {
2018 if (!preg_match(
'/'.preg_quote(DOL_VERSION).
'/', $appli)) {
2019 $appli .=
" (".DOL_VERSION.
")";
2022 $appli .=
" ".DOL_VERSION;
2025 $appli .=
" ".DOL_VERSION;
2029 $appli .=
"<br>".$langs->trans(
"LevelOfFeature").
': '.
getDolGlobalInt(
'MAIN_FEATURES_LEVEL');
2033 $logouthtmltext =
'';
2034 if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
2036 if ($_SESSION[
"dol_authmode"] !=
'forceuser' && $_SESSION[
"dol_authmode"] !=
'http') {
2037 $logouthtmltext .= $langs->trans(
"Logout").
'<br>';
2039 $logouttext .=
'<a accesskey="l" href="'.DOL_URL_ROOT.
'/user/logout.php?token='.
newToken().
'">';
2040 $logouttext .=
img_picto($langs->trans(
'Logout'),
'sign-out',
'',
false, 0, 0,
'',
'atoplogin valignmiddle');
2041 $logouttext .=
'</a>';
2043 $logouthtmltext .= $langs->trans(
"NoLogoutProcessWithAuthMode", $_SESSION[
"dol_authmode"]);
2044 $logouttext .=
img_picto($langs->trans(
'Logout'),
'sign-out',
'',
false, 0, 0,
'',
'atoplogin valignmiddle opacitymedium');
2048 print
'<div class="login_block usedropdown">'.
"\n";
2050 $toprightmenu .=
'<div class="login_block_other">';
2053 $parameters = array();
2054 $result = $hookmanager->executeHooks(
'printTopRightMenu', $parameters);
2055 if (is_numeric($result)) {
2057 $toprightmenu .= $hookmanager->resPrint;
2059 $toprightmenu = $hookmanager->resPrint;
2062 $toprightmenu .= $result;
2067 $text =
'<a href="'.DOL_URL_ROOT.
'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="modulebuilder">';
2069 $text .=
'<span class="fa fa-bug atoplogin valignmiddle"></span>';
2071 $toprightmenu .=
$form->textwithtooltip(
'', $langs->trans(
"ModuleBuilder"), 2, 1, $text,
'login_block_elem', 2);
2075 if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
2078 if (isset($_POST) && is_array($_POST)) {
2079 foreach ($_POST as $key => $value) {
2080 $key = preg_replace(
'/[^a-z0-9_\-\[\]]/i',
'', $key);
2081 if (in_array($key, array(
'action',
'massaction',
'password'))) {
2084 if (!is_array($value)) {
2085 if ($value !==
'') {
2086 $qs .=
'&'.$key.
'='.urlencode($value);
2089 foreach ($value as $value2) {
2090 if (($value2 !==
'') && (!is_array($value2))) {
2091 $qs .=
'&'.$key.
'[]='.urlencode($value2);
2097 $qs .= (($qs && $morequerystring) ?
'&' :
'').$morequerystring;
2098 $text =
'<a href="'.dol_escape_htmltag($_SERVER[
"PHP_SELF"]).
'?'.$qs.($qs ?
'&' :
'').
'optioncss=print" target="_blank" rel="noopener noreferrer">';
2100 $text .=
'<span class="fa fa-print atoplogin valignmiddle"></span>';
2102 $toprightmenu .=
$form->textwithtooltip(
'', $langs->trans(
"PrintContentArea"), 2, 1, $text,
'login_block_elem', 2);
2106 if (empty($conf->global->MAIN_HELP_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
2107 $langs->load(
"help");
2114 if (empty($helppagename)) {
2115 $helppagename =
'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios';
2117 $helppresent =
'helppresent';
2122 $helpbaseurl = $arrayres[
'helpbaseurl'];
2123 $helppage = $arrayres[
'helppage'];
2124 $mode = $arrayres[
'mode'];
2127 if ($helpbaseurl && $helppage) {
2129 $title = $langs->trans($mode ==
'wiki' ?
'GoToWikiHelpPage' :
'GoToHelpPage').
', ';
2130 if ($mode ==
'wiki') {
2131 $title .=
'<br>'.img_picto(
'',
'globe',
'class="pictofixedwidth"').$langs->trans(
"PageWiki").
' '.
dol_escape_htmltag(
'"'.strtr($helppage,
'_',
' ').
'"');
2133 $title .=
' <span class="opacitymedium">('.$langs->trans(
"DedicatedPageAvailable").
')</span>';
2135 $title .=
' <span class="opacitymedium">('.$langs->trans(
"HomePage").
')</span>';
2138 $text .=
'<a class="help" target="_blank" rel="noopener noreferrer" href="';
2139 if ($mode ==
'wiki') {
2140 $text .= sprintf($helpbaseurl, urlencode(html_entity_decode($helppage)));
2142 $text .= sprintf($helpbaseurl, $helppage);
2145 $text .=
'<span class="fa fa-question-circle atoplogin valignmiddle'.($helppresent ?
' '.$helppresent :
'').
'"></span>';
2146 $text .=
'<span class="fa fa-long-arrow-alt-up helppresentcircle'.($helppresent ?
'' :
' unvisible').
'"></span>';
2148 $toprightmenu .=
$form->textwithtooltip(
'', $title, 2, 1, $text,
'login_block_elem', 2);
2152 if (!empty($conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) {
2153 $langs->load(
'admin');
2154 $appli .=
'<br>'.$langs->trans(
"Database").
': '.$db->database_name;
2158 if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
2159 $text =
'<span class="aversion"><span class="hideonsmartphone small">'.DOL_VERSION.
'</span></span>';
2160 $toprightmenu .=
$form->textwithtooltip(
'', $appli, 2, 1, $text,
'login_block_elem', 2);
2164 $toprightmenu .=
$form->textwithtooltip(
'', $logouthtmltext, 2, 1, $logouttext,
'login_block_elem logout-btn', 2);
2166 $toprightmenu .=
'</div>';
2170 $toprightmenu .=
'<div class="login_block_user">';
2174 $toprightmenu .=
'<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">';
2176 if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) {
2181 if (!empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) {
2192 $toprightmenu .=
'</div></div>';
2194 $toprightmenu .=
'</div>'.
"\n";
2197 print $toprightmenu;
2204 print
'<div style="clear: both;"></div>';
2205 print
"<!-- End top horizontal menu -->\n\n";
2208 if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) {
2209 print
'<!-- Begin div id-container --><div id="id-container" class="id-container">';
2223 global $langs, $conf, $db, $hookmanager, $user, $mysoc;
2224 global $dolibarr_main_authentication, $dolibarr_main_demo;
2225 global $menumanager;
2227 $langs->load(
'companies');
2229 $userImage = $userDropDownImage =
'';
2230 if (!empty($user->photo)) {
2231 $userImage =
Form::showphoto(
'userphoto', $user, 0, 0, 0,
'photouserphoto userphoto',
'small', 0, 1);
2232 $userDropDownImage =
Form::showphoto(
'userphoto', $user, 0, 0, 0,
'dropdown-user-image',
'small', 0, 1);
2234 $nophoto =
'/public/theme/common/user_anonymous.png';
2235 if ($user->gender ==
'man') {
2236 $nophoto =
'/public/theme/common/user_man.png';
2238 if ($user->gender ==
'woman') {
2239 $nophoto =
'/public/theme/common/user_woman.png';
2242 $userImage =
'<img class="photo photouserphoto userphoto" alt="No photo" src="'.DOL_URL_ROOT.$nophoto.
'">';
2243 $userDropDownImage =
'<img class="photo dropdown-user-image" alt="No photo" src="'.DOL_URL_ROOT.$nophoto.
'">';
2247 $dropdownBody .=
'<span id="topmenulogincompanyinfo-btn"><i class="fa fa-caret-right"></i> '.$langs->trans(
"ShowCompanyInfos").
'</span>';
2248 $dropdownBody .=
'<div id="topmenulogincompanyinfo" >';
2250 if ($langs->transcountry(
"ProfId1", $mysoc->country_code) !=
'-') {
2253 if ($langs->transcountry(
"ProfId2", $mysoc->country_code) !=
'-') {
2256 if ($langs->transcountry(
"ProfId3", $mysoc->country_code) !=
'-') {
2259 if ($langs->transcountry(
"ProfId4", $mysoc->country_code) !=
'-') {
2262 if ($langs->transcountry(
"ProfId5", $mysoc->country_code) !=
'-') {
2265 if ($langs->transcountry(
"ProfId6", $mysoc->country_code) !=
'-') {
2269 $dropdownBody .=
'<br><b>'.$langs->trans(
"Country").
'</b>: <span>'.($mysoc->country_code ? $langs->trans(
"Country".$mysoc->country_code) :
'').
'</span>';
2271 $dropdownBody .=
'</div>';
2273 $dropdownBody .=
'<br>';
2274 $dropdownBody .=
'<span id="topmenuloginmoreinfo-btn"><i class="fa fa-caret-right"></i> '.$langs->trans(
"ShowMoreInfos").
'</span>';
2275 $dropdownBody .=
'<div id="topmenuloginmoreinfo" >';
2278 if (!empty($user->admin)) {
2279 $dropdownBody .=
'<br><b>'.$langs->trans(
"Administrator").
'</b>: '.
yn($user->admin);
2281 if (!empty($user->socid)) {
2282 $thirdpartystatic =
new Societe($db);
2283 $thirdpartystatic->fetch($user->socid);
2284 $companylink =
' '.$thirdpartystatic->getNomUrl(2);
2285 $company =
' ('.$langs->trans(
"Company").
': '.$thirdpartystatic->name.
')';
2287 $type = ($user->socid ? $langs->trans(
"External").$company : $langs->trans(
"Internal"));
2288 $dropdownBody .=
'<br><b>'.$langs->trans(
"Type").
':</b> '.$type;
2289 $dropdownBody .=
'<br><b>'.$langs->trans(
"Status").
'</b>: '.$user->getLibStatut(0);
2290 $dropdownBody .=
'<br>';
2292 $dropdownBody .=
'<br><u>'.$langs->trans(
"Session").
'</u>';
2293 $dropdownBody .=
'<br><b>'.$langs->trans(
"IPAddress").
'</b>: '.
dol_escape_htmltag($_SERVER[
"REMOTE_ADDR"]);
2294 if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) {
2295 $dropdownBody .=
'<br><b>'.$langs->trans(
"ConnectedOnMultiCompany").
':</b> '.$conf->entity.
' (user entity '.$user->entity.
')';
2297 $dropdownBody .=
'<br><b>'.$langs->trans(
"AuthenticationMode").
':</b> '.$_SESSION[
"dol_authmode"].(empty($dolibarr_main_demo) ?
'' :
' (demo)');
2298 $dropdownBody .=
'<br><b>'.$langs->trans(
"ConnectedSince").
':</b> '.
dol_print_date($user->datelastlogin,
"dayhour",
'tzuser');
2299 $dropdownBody .=
'<br><b>'.$langs->trans(
"PreviousConnexion").
':</b> '.
dol_print_date($user->datepreviouslogin,
"dayhour",
'tzuser');
2300 $dropdownBody .=
'<br><b>'.$langs->trans(
"CurrentTheme").
':</b> '.$conf->theme;
2301 $dropdownBody .=
'<br><b>'.$langs->trans(
"CurrentMenuManager").
':</b> '.(isset($menumanager) ? $menumanager->name :
'unknown');
2303 $dropdownBody .=
'<br><b>'.$langs->trans(
"CurrentUserLanguage").
':</b> '.($langFlag ? $langFlag.
' ' :
'').$langs->getDefaultLang();
2305 $tz = (int) $_SESSION[
'dol_tz'] + (
int) $_SESSION[
'dol_dst'];
2306 $dropdownBody .=
'<br><b>'.$langs->trans(
"ClientTZ").
':</b> '.($tz ? ($tz >= 0 ?
'+' :
'').$tz :
'');
2307 $dropdownBody .=
' ('.$_SESSION[
'dol_tz_string'].
')';
2312 $dropdownBody .=
'<br><b>'.$langs->trans(
"Browser").
':</b> '.$conf->browser->name.($conf->browser->version ?
' '.$conf->browser->version :
'').
' ('.
dol_escape_htmltag($_SERVER[
'HTTP_USER_AGENT']).
')';
2313 $dropdownBody .=
'<br><b>'.$langs->trans(
"Layout").
':</b> '.$conf->browser->layout;
2314 $dropdownBody .=
'<br><b>'.$langs->trans(
"Screen").
':</b> '.$_SESSION[
'dol_screenwidth'].
' x '.$_SESSION[
'dol_screenheight'];
2315 if ($conf->browser->layout ==
'phone') {
2316 $dropdownBody .=
'<br><b>'.$langs->trans(
"Phone").
':</b> '.$langs->trans(
"Yes");
2318 if (!empty($_SESSION[
"disablemodules"])) {
2319 $dropdownBody .=
'<br><b>'.$langs->trans(
"DisabledModules").
':</b> <br>'.join(
', ', explode(
',', $_SESSION[
"disablemodules"]));
2321 $dropdownBody .=
'</div>';
2324 $parameters = array(
'user'=>$user,
'langs' => $langs);
2325 $result = $hookmanager->executeHooks(
'printTopRightMenuLoginDropdownBody', $parameters);
2326 if (is_numeric($result)) {
2328 $dropdownBody .= $hookmanager->resPrint;
2330 $dropdownBody = $hookmanager->resPrint;
2334 if (empty($urllogout)) {
2335 $urllogout = DOL_URL_ROOT.
'/user/logout.php?token='.
newToken();
2337 $logoutLink =
'<a accesskey="l" href="'.$urllogout.
'" class="button-top-menu-dropdown" ><i class="fa fa-sign-out-alt"></i> '.$langs->trans(
"Logout").
'</a>';
2338 $profilLink =
'<a accesskey="l" href="'.DOL_URL_ROOT.
'/user/card.php?id='.$user->id.
'" class="button-top-menu-dropdown" ><i class="fa fa-user"></i> '.$langs->trans(
"Card").
'</a>';
2341 $profilName = $user->getFullName($langs).
' ('.$user->login.
')';
2343 if (!empty($user->admin)) {
2344 $profilName =
'<i class="far fa-star classfortooltip" title="'.$langs->trans(
"Administrator").
'" ></i> '.$profilName;
2348 $appli = constant(
'DOL_APPLICATION_TITLE');
2349 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
2350 $appli = $conf->global->MAIN_APPLICATION_TITLE;
2351 if (preg_match(
'/\d\.\d/', $appli)) {
2352 if (!preg_match(
'/'.preg_quote(DOL_VERSION).
'/', $appli)) {
2353 $appli .=
" (".DOL_VERSION.
")";
2356 $appli .=
" ".DOL_VERSION;
2359 $appli .=
" ".DOL_VERSION;
2362 if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
2363 $btnUser =
'<!-- div for user link -->
2364 <div id="topmenu-login-dropdown" class="userimg atoplogin dropdown user user-menu inline-block">
2365 <a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$user->id.
'" class="dropdown-toggle login-dropdown-a" data-toggle="dropdown">
2366 '.$userImage.(empty($user->photo) ?
'<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone paddingleft">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).
'</span>' :
'').
'
2368 <div class="dropdown-menu">
2370 <div class="user-header">
2371 '.$userDropDownImage.
'
2373 '.$profilName.
'<br>';
2374 if ($user->datelastlogin) {
2375 $title = $langs->trans(
"ConnectedSince").
' : '.
dol_print_date($user->datelastlogin,
"dayhour",
'tzuser');
2376 if ($user->datepreviouslogin) {
2377 $title .=
'<br>'.$langs->trans(
"PreviousConnexion").
' : '.
dol_print_date($user->datepreviouslogin,
"dayhour",
'tzuser');
2380 $btnUser .=
'<small class="classfortooltip" title="'.dol_escape_htmltag($title).
'" ><i class="fa fa-user-clock"></i> '.
dol_print_date($user->datelastlogin,
"dayhour",
'tzuser').
'</small><br>';
2381 if ($user->datepreviouslogin) {
2382 $btnUser .=
'<small class="classfortooltip" title="'.dol_escape_htmltag($title).
'" ><i class="fa fa-user-clock opacitymedium"></i> '.
dol_print_date($user->datepreviouslogin,
"dayhour",
'tzuser').
'</small><br>';
2391 <div class="user-body">'.$dropdownBody.
'</div>
2394 <div class="user-footer">
2395 <div class="pull-left">
2398 <div class="pull-right">
2401 <div style="clear:both;"></div>
2407 $btnUser =
'<!-- div for user link -->
2408 <div id="topmenu-login-dropdown" class="userimg atoplogin dropdown user user-menu inline-block">
2409 <a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$user->id.
'">
2411 <span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone">'.
dol_trunc($user->firstname ? $user->firstname : $user->login, 10).
'</span>
2416 if (!defined(
'JS_JQUERY_DISABLE_DROPDOWN') && !empty($conf->use_javascript_ajax)) {
2418 <!-- Code to show/hide the user drop-down -->
2420 jQuery(document).ready(function() {
2421 jQuery(document).on("click", function(event) {
2422 if (!$(event.target).closest("#topmenu-login-dropdown").length) {
2423 //console.log("close login dropdown");
2425 jQuery("#topmenu-login-dropdown").removeClass("open");
2430 if ($conf->theme !=
'md') {
2432 jQuery("#topmenu-login-dropdown .dropdown-toggle").on("click", function(event) {
2433 console.log("toggle login dropdown");
2434 event.preventDefault();
2435 jQuery("#topmenu-login-dropdown").toggleClass("open");
2438 jQuery("#topmenulogincompanyinfo-btn").on("click", function() {
2439 console.log("Clik on topmenulogincompanyinfo-btn");
2440 jQuery("#topmenulogincompanyinfo").slideToggle();
2443 jQuery("#topmenuloginmoreinfo-btn").on("click", function() {
2444 console.log("Clik on topmenuloginmoreinfo-btn");
2445 jQuery("#topmenuloginmoreinfo").slideToggle();
2469 $html .=
'<!-- div for quick add link -->
2470 <div id="topmenu-quickadd-dropdown" class="atoplogin dropdown inline-block">
2471 <a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans(
'QuickAdd').
' ('.$langs->trans(
'QuickAddMenuShortCut').
')"><i class="fa fa-plus-circle"></i></a>
2475 <!-- Code to show/hide the user drop-down -->
2477 jQuery(document).ready(function() {
2478 jQuery(document).on("click", function(event) {
2479 if (!$(event.target).closest("#topmenu-quickadd-dropdown").length) {
2481 $("#topmenu-quickadd-dropdown").removeClass("open");
2484 $("#topmenu-quickadd-dropdown .dropdown-toggle").on("click", function(event) {
2485 openQuickAddDropDown();
2488 $(document).keydown(function(e){
2489 if( e.which === 76 && e.ctrlKey && e.shiftKey ){
2490 console.log(\'control + shift + l : trigger open quick add dropdown\');
2491 openQuickAddDropDown();
2496 var openQuickAddDropDown = function() {
2497 event.preventDefault();
2498 $("#topmenu-quickadd-dropdown").toggleClass("open");
2499 //$("#top-quickadd-search-input").focus();
2514 global $conf, $user, $langs, $hookmanager;
2519 "url" =>
"/adherents/card.php?action=create&mainmenu=members",
2520 "title" =>
"MenuNewMember@members",
2521 "name" =>
"Adherent@members",
2522 "picto" =>
"object_member",
2523 "activation" =>
isModEnabled(
'adherent') && $user->hasRight(
"adherent",
"write"),
2527 "url" =>
"/societe/card.php?action=create&mainmenu=companies",
2528 "title" =>
"MenuNewThirdParty@companies",
2529 "name" =>
"ThirdParty@companies",
2530 "picto" =>
"object_company",
2531 "activation" =>
isModEnabled(
"societe") && $user->hasRight(
"societe",
"write"),
2535 "url" =>
"/contact/card.php?action=create&mainmenu=companies",
2536 "title" =>
"NewContactAddress@companies",
2537 "name" =>
"Contact@companies",
2538 "picto" =>
"object_contact",
2539 "activation" =>
isModEnabled(
"societe") && $user->hasRight(
"societe",
"contact",
"write"),
2543 "url" =>
"/comm/propal/card.php?action=create&mainmenu=commercial",
2544 "title" =>
"NewPropal@propal",
2545 "name" =>
"Proposal@propal",
2546 "picto" =>
"object_propal",
2547 "activation" =>
isModEnabled(
"propal") && $user->hasRight(
"propal",
"write"),
2552 "url" =>
"/commande/card.php?action=create&mainmenu=commercial",
2553 "title" =>
"NewOrder@orders",
2554 "name" =>
"Order@orders",
2555 "picto" =>
"object_order",
2556 "activation" =>
isModEnabled(
'commande') && $user->hasRight(
"commande",
"write"),
2560 "url" =>
"/compta/facture/card.php?action=create&mainmenu=billing",
2561 "title" =>
"NewBill@bills",
2562 "name" =>
"Bill@bills",
2563 "picto" =>
"object_bill",
2564 "activation" =>
isModEnabled(
'facture') && $user->hasRight(
"facture",
"write"),
2568 "url" =>
"/contrat/card.php?action=create&mainmenu=commercial",
2569 "title" =>
"NewContractSubscription@contracts",
2570 "name" =>
"Contract@contracts",
2571 "picto" =>
"object_contract",
2572 "activation" =>
isModEnabled(
'contrat') && $user->hasRight(
"contrat",
"write"),
2576 "url" =>
"/supplier_proposal/card.php?action=create&mainmenu=commercial",
2577 "title" =>
"SupplierProposalNew@supplier_proposal",
2578 "name" =>
"SupplierProposal@supplier_proposal",
2579 "picto" =>
"supplier_proposal",
2580 "activation" =>
isModEnabled(
'supplier_proposal') && $user->hasRight(
"supplier_invoice",
"write"),
2584 "url" =>
"/fourn/commande/card.php?action=create&mainmenu=commercial",
2585 "title" =>
"NewSupplierOrderShort@orders",
2586 "name" =>
"SupplierOrder@orders",
2587 "picto" =>
"supplier_order",
2588 "activation" => (
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight(
"fournisseur",
"commande",
"write")) || (
isModEnabled(
"supplier_order") && $user->hasRight(
"supplier_invoice",
"write")),
2592 "url" =>
"/fourn/facture/card.php?action=create&mainmenu=billing",
2593 "title" =>
"NewBill@bills",
2594 "name" =>
"SupplierBill@bills",
2595 "picto" =>
"supplier_invoice",
2596 "activation" => (
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight(
"fournisseur",
"facture",
"write")) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
"supplier_invoice",
"write")),
2600 "url" =>
"/ticket/card.php?action=create&mainmenu=ticket",
2601 "title" =>
"NewTicket@ticket",
2602 "name" =>
"Ticket@ticket",
2603 "picto" =>
"ticket",
2604 "activation" =>
isModEnabled(
'ticket') && $user->hasRight(
"ticket",
"write"),
2608 "url" =>
"/fichinter/card.php?action=create&mainmenu=commercial",
2609 "title" =>
"NewIntervention@interventions",
2610 "name" =>
"Intervention@interventions",
2611 "picto" =>
"intervention",
2612 "activation" =>
isModEnabled(
'ficheinter') && $user->hasRight(
"ficheinter",
"creer"),
2616 "url" =>
"/product/card.php?action=create&type=0&mainmenu=products",
2617 "title" =>
"NewProduct@products",
2618 "name" =>
"Product@products",
2619 "picto" =>
"object_product",
2620 "activation" =>
isModEnabled(
"product") && $user->hasRight(
"produit",
"write"),
2624 "url" =>
"/product/card.php?action=create&type=1&mainmenu=products",
2625 "title" =>
"NewService@products",
2626 "name" =>
"Service@products",
2627 "picto" =>
"object_service",
2628 "activation" =>
isModEnabled(
"service") && $user->hasRight(
"service",
"write"),
2632 "url" =>
"/user/card.php?action=create&type=1&mainmenu=home",
2633 "title" =>
"AddUser@users",
2634 "name" =>
"User@users",
2636 "activation" => $user->hasRight(
"user",
"user",
"write"),
2642 $dropDownQuickAddHtml =
'';
2645 $dropDownQuickAddHtml .=
'<div class="quickadd-body dropdown-body">';
2646 $dropDownQuickAddHtml .=
'<div class="dropdown-quickadd-list">';
2649 $parameters = array();
2650 $hook_items = $items;
2651 $reshook = $hookmanager->executeHooks(
'menuDropdownQuickaddItems', $parameters, $hook_items);
2652 if (is_numeric($reshook) && !empty($hookmanager->results) && is_array($hookmanager->results)) {
2653 if ($reshook == 0) {
2654 $items[
'items'] = array_merge($items[
'items'], $hookmanager->results);
2656 $items = $hookmanager->results;
2660 $position = array();
2661 foreach ($items[
'items'] as $key => $row) {
2662 $position[$key] = $row[
'position'];
2664 $array1_sort_order = SORT_ASC;
2665 array_multisort($position, $array1_sort_order, $items[
'items']);
2668 foreach ($items[
'items'] as $item) {
2669 if (!$item[
'activation']) {
2672 $langs->load(explode(
'@', $item[
'title'])[1]);
2673 $langs->load(explode(
'@', $item[
'name'])[1]);
2674 $dropDownQuickAddHtml .=
'
2675 <a class="dropdown-item quickadd-item" href="'.DOL_URL_ROOT.$item[
'url'].
'" title="'.$langs->trans(explode(
'@', $item[
'title'])[0]).
'">
2676 '.
img_picto(
'', $item[
'picto'],
'style="width:18px;"') .
' ' . $langs->trans(explode(
'@', $item[
'name'])[0]) .
'</a>
2680 $dropDownQuickAddHtml .=
'</div>';
2681 $dropDownQuickAddHtml .=
'</div>';
2683 return $dropDownQuickAddHtml;
2693 global $langs, $conf, $db, $user;
2698 if (!
isModEnabled(
'bookmark') || empty($user->rights->bookmark->lire)) {
2702 if (!defined(
'JS_JQUERY_DISABLE_DROPDOWN') && !empty($conf->use_javascript_ajax)) {
2703 include_once DOL_DOCUMENT_ROOT.
'/bookmarks/bookmarks.lib.php';
2704 $langs->load(
"bookmarks");
2706 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
2707 $html .=
'<div id="topmenu-bookmark-dropdown" class="dropdown inline-block">';
2711 $html .=
'<!-- div for bookmark link -->
2712 <div id="topmenu-bookmark-dropdown" class="dropdown inline-block">
2713 <a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans(
'Bookmarks').
' ('.$langs->trans(
'BookmarksMenuShortCut').
')"><i class="fa fa-star"></i></a>
2714 <div class="dropdown-menu">
2720 <!-- Code to show/hide the bookmark drop-down -->
2722 jQuery(document).ready(function() {
2723 jQuery(document).on("click", function(event) {
2724 if (!$(event.target).closest("#topmenu-bookmark-dropdown").length) {
2725 //console.log("close bookmark dropdown - we click outside");
2727 $("#topmenu-bookmark-dropdown").removeClass("open");
2731 jQuery("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) {
2732 console.log("toggle bookmark dropdown");
2733 openBookMarkDropDown();
2737 jQuery(document).keydown(function(e){
2738 if( e.which === 77 && e.ctrlKey && e.shiftKey ){
2739 console.log(\'control + shift + m : trigger open bookmark dropdown\');
2740 openBookMarkDropDown();
2745 var openBookMarkDropDown = function() {
2746 event.preventDefault();
2747 jQuery("#topmenu-bookmark-dropdown").toggleClass("open");
2748 jQuery("#top-bookmark-search-input").focus();
2766 global $langs, $conf, $db, $user, $hookmanager;
2771 $arrayresult =
null;
2772 include DOL_DOCUMENT_ROOT.
'/core/ajax/selectsearchbox.php';
2774 $defaultAction =
'';
2775 $buttonList =
'<div class="dropdown-global-search-button-list" >';
2777 foreach ($arrayresult as $keyItem => $item) {
2778 if (empty($defaultAction)) {
2779 $defaultAction = $item[
'url'];
2781 $buttonList .=
'<button class="dropdown-item global-search-item" data-target="'.dol_escape_htmltag($item[
'url']).
'" >';
2782 $buttonList .= $item[
'text'];
2783 $buttonList .=
'</button>';
2785 $buttonList .=
'</div>';
2788 $searchInput =
'<input name="search_all" id="top-global-search-input" class="dropdown-search-input" placeholder="'.$langs->trans(
'Search').
'" autocomplete="off" >';
2790 $dropDownHtml =
'<form id="top-menu-action-search" name="actionsearch" method="GET" action="'.$defaultAction.
'" >';
2793 <!-- search input -->
2794 <div class="dropdown-header search-dropdown-header">
2801 <div class="dropdown-body search-dropdown-body">
2806 $dropDownHtml .=
'</form>';
2809 $html .=
'<!-- div for Global Search -->
2810 <div id="topmenu-global-search-dropdown" class="atoplogin dropdown inline-block">
2811 <a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans(
'Search').
' ('.$langs->trans(
'SearchMenuShortCut').
')">
2812 <i class="fa fa-search" ></i>
2814 <div class="dropdown-menu dropdown-search">
2820 <!-- Code to show/hide the user drop-down -->
2822 jQuery(document).ready(function() {
2824 // prevent submiting form on press ENTER
2825 jQuery("#top-global-search-input").keydown(function (e) {
2826 if (e.keyCode == 13) {
2827 var inputs = $(this).parents("form").eq(0).find(":button");
2828 if (inputs[inputs.index(this) + 1] != null) {
2829 inputs[inputs.index(this) + 1].focus();
2837 jQuery(document).keydown(function(e) {
2838 // Get the focused element:
2839 var $focused = $(":focus");
2840 if($focused.length && $focused.hasClass("global-search-item")){
2842 // UP - move to the previous line
2843 if (e.keyCode == 38) {
2845 $focused.prev().focus();
2848 // DOWN - move to the next line
2849 if (e.keyCode == 40) {
2851 $focused.next().focus();
2857 // submit form action
2858 jQuery(".dropdown-global-search-button-list .global-search-item").on("click", function(event) {
2859 jQuery("#top-menu-action-search").attr("action", $(this).data("target"));
2860 jQuery("#top-menu-action-search").submit();
2864 jQuery(document).on("click", function(event) {
2865 if (!$(event.target).closest("#topmenu-global-search-dropdown").length) {
2866 console.log("click close search - we click outside");
2868 jQuery("#topmenu-global-search-dropdown").removeClass("open");
2873 jQuery("#topmenu-global-search-dropdown .dropdown-toggle").on("click", function(event) {
2874 console.log("toggle search dropdown");
2875 openGlobalSearchDropDown();
2879 jQuery(document).keydown(function(e){
2880 if( e.which === 70 && e.ctrlKey && e.shiftKey ){
2881 console.log(\'control + shift + f : trigger open global-search dropdown\');
2882 openGlobalSearchDropDown();
2887 var openGlobalSearchDropDown = function() {
2888 jQuery("#topmenu-global-search-dropdown").toggleClass("open");
2889 jQuery("#top-global-search-input").focus();
2913 function left_menu($menu_array_before, $helppagename =
'', $notused =
'', $menu_array_after =
'', $leftmenuwithoutmainarea = 0, $title =
'', $acceptdelayedhtml = 0)
2915 global $user, $conf, $langs, $db,
$form;
2916 global $hookmanager, $menumanager;
2920 if (!empty($menu_array_before)) {
2921 dol_syslog(
"Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING);
2924 if (empty($conf->dol_hide_leftmenu) && (!defined(
'NOREQUIREMENU') || !constant(
'NOREQUIREMENU'))) {
2926 $hookmanager->initHooks(array(
'leftblock'));
2928 print
"\n".
'<!-- Begin side-nav id-left -->'.
"\n".
'<div class="side-nav"><div id="id-left">'.
"\n";
2931 if (!is_object(
$form)) {
2935 if (empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) {
2937 if ($conf->browser->layout ==
'phone') {
2938 $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1;
2942 $arrayresult =
null;
2943 include DOL_DOCUMENT_ROOT.
'/core/ajax/selectsearchbox.php';
2945 if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
2946 $searchform .=
$form->selectArrayFilter(
'searchselectcombo', $arrayresult, $selected,
'', 1, 0, (empty($conf->global->MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY) ? 1 : 0),
'vmenusearchselectcombo', 1, $langs->trans(
"Search"), 1);
2948 if (is_array($arrayresult)) {
2949 foreach ($arrayresult as $key => $val) {
2950 $searchform .=
printSearchForm($val[
'url'], $val[
'url'], $val[
'label'],
'maxwidth125',
'sall', (empty($val[
'shortcut']) ?
'' : $val[
'shortcut']),
'searchleft'.$key, $val[
'img']);
2956 $parameters = array(
'searchform' => $searchform);
2957 $reshook = $hookmanager->executeHooks(
'printSearchForm', $parameters);
2958 if (empty($reshook)) {
2959 $searchform .= $hookmanager->resPrint;
2961 $searchform = $hookmanager->resPrint;
2965 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax)) {
2966 $urltosearch = DOL_URL_ROOT.
'/core/search_page.php?showtitlebefore=1';
2967 $searchform =
'<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="'.$urltosearch.
'" accesskey="s" alt="'.
dol_escape_htmltag($langs->trans(
"ShowSearchFields")).
'">'.$langs->trans(
"Search").
'...</a></div></div>';
2968 } elseif ($conf->use_javascript_ajax && !empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
2969 $searchform =
'<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="'.dol_escape_htmltag($langs->trans(
"ShowSearchFields")).
'">'.$langs->trans(
"Search").
'...</a></div><div id="divsearchforms2" style="display: none">'.$searchform.
'</div>';
2970 $searchform .=
'<script>
2971 jQuery(document).ready(function () {
2972 jQuery("#divsearchforms1").click(function(){
2973 jQuery("#divsearchforms2").toggle();
2977 $searchform .=
'</div>';
2982 print
'<!-- Begin left menu -->'.
"\n";
2984 print
'<div class="vmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ?
'' :
' title="Left menu"').
'>'.
"\n\n";
2987 $menumanager->menu_array = $menu_array_before;
2988 $menumanager->menu_array_after = $menu_array_after;
2989 $menumanager->showmenu(
'left', array(
'searchform'=>$searchform));
2993 print
"<!-- Begin Help Block-->\n";
2994 print
'<div id="blockvmenuhelp" class="blockvmenuhelp">'.
"\n";
2997 if (!empty($conf->global->MAIN_SHOW_VERSION)) {
2998 $doliurl =
'https://www.dolibarr.org';
3000 if (preg_match(
'/fr/i', $langs->defaultlang)) {
3001 $doliurl =
'https://www.dolibarr.fr';
3003 if (preg_match(
'/es/i', $langs->defaultlang)) {
3004 $doliurl =
'https://www.dolibarr.es';
3006 if (preg_match(
'/de/i', $langs->defaultlang)) {
3007 $doliurl =
'https://www.dolibarr.de';
3009 if (preg_match(
'/it/i', $langs->defaultlang)) {
3010 $doliurl =
'https://www.dolibarr.it';
3012 if (preg_match(
'/gr/i', $langs->defaultlang)) {
3013 $doliurl =
'https://www.dolibarr.gr';
3016 $appli = constant(
'DOL_APPLICATION_TITLE');
3017 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
3018 $appli = $conf->global->MAIN_APPLICATION_TITLE; $doliurl =
'';
3019 if (preg_match(
'/\d\.\d/', $appli)) {
3020 if (!preg_match(
'/'.preg_quote(DOL_VERSION).
'/', $appli)) {
3021 $appli .=
" (".DOL_VERSION.
")";
3024 $appli .=
" ".DOL_VERSION;
3027 $appli .=
" ".DOL_VERSION;
3029 print
'<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
3031 print
'<a class="help" target="_blank" rel="noopener noreferrer" href="'.$doliurl.
'">';
3033 print
'<span class="help">';
3041 print
'</div>'.
"\n";
3045 if (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) {
3046 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3048 if ($conf->global->MAIN_BUGTRACK_ENABLELINK ==
'github') {
3049 $bugbaseurl =
'https://github.com/Dolibarr/dolibarr/issues/new?labels=Bug';
3050 $bugbaseurl .=
'&title=';
3051 $bugbaseurl .= urlencode(
"Bug: ");
3052 $bugbaseurl .=
'&body=';
3053 $bugbaseurl .= urlencode(
"# Instructions\n");
3054 $bugbaseurl .= urlencode(
"*This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.*\n");
3055 $bugbaseurl .= urlencode(
"*Please:*\n");
3056 $bugbaseurl .= urlencode(
"- *replace the bracket enclosed texts with meaningful information*\n");
3057 $bugbaseurl .= urlencode(
"- *remove any unused sub-section*\n");
3058 $bugbaseurl .= urlencode(
"\n");
3059 $bugbaseurl .= urlencode(
"\n");
3060 $bugbaseurl .= urlencode(
"# Bug\n");
3061 $bugbaseurl .= urlencode(
"[*Short description*]\n");
3062 $bugbaseurl .= urlencode(
"\n");
3063 $bugbaseurl .= urlencode(
"## Environment\n");
3064 $bugbaseurl .= urlencode(
"- **Version**: ".DOL_VERSION.
"\n");
3065 $bugbaseurl .= urlencode(
"- **OS**: ".php_uname(
's').
"\n");
3066 $bugbaseurl .= urlencode(
"- **Web server**: ".$_SERVER[
"SERVER_SOFTWARE"].
"\n");
3067 $bugbaseurl .= urlencode(
"- **PHP**: ".php_sapi_name().
' '.phpversion().
"\n");
3068 $bugbaseurl .= urlencode(
"- **Database**: ".$db::LABEL.
' '.$db->getVersion().
"\n");
3069 $bugbaseurl .= urlencode(
"- **URL(s)**: ".$_SERVER[
"REQUEST_URI"].
"\n");
3070 $bugbaseurl .= urlencode(
"\n");
3071 $bugbaseurl .= urlencode(
"## Expected and actual behavior\n");
3072 $bugbaseurl .= urlencode(
"[*Verbose description*]\n");
3073 $bugbaseurl .= urlencode(
"\n");
3074 $bugbaseurl .= urlencode(
"## Steps to reproduce the behavior\n");
3075 $bugbaseurl .= urlencode(
"[*Verbose description*]\n");
3076 $bugbaseurl .= urlencode(
"\n");
3077 $bugbaseurl .= urlencode(
"## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…)\n");
3078 $bugbaseurl .= urlencode(
"[*Files*]\n");
3079 $bugbaseurl .= urlencode(
"\n");
3081 $bugbaseurl .= urlencode(
"\n");
3082 $bugbaseurl .= urlencode(
"## Report\n");
3083 } elseif (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) {
3084 $bugbaseurl = $conf->global->MAIN_BUGTRACK_ENABLELINK;
3090 $parameters = array(
'bugbaseurl' => $bugbaseurl);
3091 $reshook = $hookmanager->executeHooks(
'printBugtrackInfo', $parameters);
3092 if (empty($reshook)) {
3093 $bugbaseurl .= $hookmanager->resPrint;
3095 $bugbaseurl = $hookmanager->resPrint;
3098 print
'<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">';
3099 print
'<a class="help" target="_blank" rel="noopener noreferrer" href="'.$bugbaseurl.
'"><i class="fas fa-bug"></i> '.$langs->trans(
"FindBug").
'</a>';
3104 print
"<!-- End Help Block-->\n";
3108 print
"<!-- End left menu -->\n";
3112 $parameters = array();
3113 $reshook = $hookmanager->executeHooks(
'printLeftBlock', $parameters);
3114 print $hookmanager->resPrint;
3116 print
'</div></div> <!-- End side-nav id-left -->';
3120 print
'<!-- Begin right area -->'.
"\n";
3122 if (empty($leftmenuwithoutmainarea)) {
3136 global $conf, $langs, $hookmanager;
3138 if (empty($conf->dol_hide_leftmenu)) {
3139 print
'<div id="id-right">';
3144 print
'<!-- Begin div class="fiche" -->'.
"\n".
'<div class="fiche">'.
"\n";
3146 $hookmanager->initHooks(array(
'main'));
3147 $parameters = array();
3148 $reshook = $hookmanager->executeHooks(
'printMainArea', $parameters);
3149 print $hookmanager->resPrint;
3151 if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
3152 print
info_admin($langs->trans(
"WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED), 0, 0, 1,
'warning maintenancemode');
3156 if (!empty($conf->global->SHOW_SOCINFO_ON_PRINT) &&
GETPOST(
'optioncss',
'aZ09') ==
'print' && empty(
GETPOST(
'disable_show_socinfo_on_print',
'az09'))) {
3157 $parameters = array();
3158 $reshook = $hookmanager->executeHooks(
'showSocinfoOnPrint', $parameters);
3159 if (empty($reshook)) {
3160 print
'<!-- Begin show mysoc info header -->'.
"\n";
3161 print
'<div id="mysoc-info-header">'.
"\n";
3162 print
'<table class="centpercent div-table-responsive">'.
"\n";
3164 print
'<tr><td rowspan="0" class="width20p">';
3165 if ($conf->global->MAIN_SHOW_LOGO && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($conf->global->MAIN_INFO_SOCIETE_LOGO)) {
3166 print
'<img id="mysoc-info-header-logo" style="max-width:100%" alt="" src="'.DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode(
'logos/'.
dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_LOGO)).
'">';
3168 print
'</td><td rowspan="0" class="width50p"></td></tr>'.
"\n";
3169 print
'<tr><td class="titre bold">'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM).
'</td></tr>'.
"\n";
3170 print
'<tr><td>'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ADDRESS).
'<br>'.
dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP).
' '.
dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN).
'</td></tr>'.
"\n";
3171 if (!empty($conf->global->MAIN_INFO_SOCIETE_TEL)) {
3172 print
'<tr><td style="padding-left: 1em" class="small">'.$langs->trans(
"Phone").
' : '.
dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).
'</td></tr>';
3174 if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL)) {
3175 print
'<tr><td style="padding-left: 1em" class="small">'.$langs->trans(
"Email").
' : '.
dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).
'</td></tr>';
3177 if (!empty($conf->global->MAIN_INFO_SOCIETE_WEB)) {
3178 print
'<tr><td style="padding-left: 1em" class="small">'.$langs->trans(
"Web").
' : '.
dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB).
'</td></tr>';
3181 print
'</table>'.
"\n";
3182 print
'</div>'.
"\n";
3183 print
'<!-- End show mysoc info header -->'.
"\n";
3202 if (preg_match(
'/^http/i', $helppagename)) {
3204 $helpbaseurl =
'%s';
3205 $helppage = $helppagename;
3210 if (preg_match(
'/^es/i', $langs->defaultlang)) {
3211 $helpbaseurl =
'http://wiki.dolibarr.org/index.php/%s';
3212 if (preg_match(
'/ES:([^|]+)/i', $helppagename, $reg)) {
3213 $helppage = $reg[1];
3216 if (preg_match(
'/^fr/i', $langs->defaultlang)) {
3217 $helpbaseurl =
'http://wiki.dolibarr.org/index.php/%s';
3218 if (preg_match(
'/FR:([^|]+)/i', $helppagename, $reg)) {
3219 $helppage = $reg[1];
3222 if (empty($helppage)) {
3223 $helpbaseurl =
'http://wiki.dolibarr.org/index.php/%s';
3224 if (preg_match(
'/EN:([^|]+)/i', $helppagename, $reg)) {
3225 $helppage = $reg[1];
3230 return array(
'helpbaseurl'=>$helpbaseurl,
'helppage'=>$helppage,
'mode'=>$mode);
3250 function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey =
'', $prefhtmlinputname =
'', $img =
'', $showtitlebefore = 0, $autofocus = 0)
3252 global $conf, $langs, $user;
3255 $ret .=
'<form action="'.$urlaction.
'" method="post" class="searchform nowraponall tagtr">';
3256 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
3257 $ret .=
'<input type="hidden" name="mode" value="search">';
3258 $ret .=
'<input type="hidden" name="savelogin" value="'.dol_escape_htmltag($user->login).
'">';
3259 if ($showtitlebefore) {
3260 $ret .=
'<div class="tagtd left">'.$title.
'</div> ';
3262 $ret .=
'<div class="tagtd">';
3263 $ret .=
img_picto(
'', $img,
'',
false, 0, 0,
'',
'paddingright width20');
3264 $ret .=
'<input type="text" class="flat '.$htmlmorecss.
'"';
3265 $ret .=
' style="background-repeat: no-repeat; background-position: 3px;"';
3266 $ret .= ($accesskey ?
' accesskey="'.$accesskey.
'"' :
'');
3267 $ret .=
' placeholder="'.strip_tags($title).
'"';
3268 $ret .= ($autofocus ?
' autofocus' :
'');
3269 $ret .=
' name="'.$htmlinputname.
'" id="'.$prefhtmlinputname.$htmlinputname.
'" />';
3270 $ret .=
'<button type="submit" class="button bordertransp" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">';
3271 $ret .=
'<span class="fa fa-search"></span>';
3272 $ret .=
'</button>';
3274 $ret .=
"</form>\n";
3279 if (!function_exists(
"llxFooter")) {
3290 function llxFooter($comment =
'', $zone =
'private', $disabledoutputofmessages = 0)
3292 global $conf, $db, $langs, $user, $mysoc, $object, $hookmanager;
3293 global $delayedhtmlcontent;
3294 global $contextpage, $page, $limit, $mode;
3295 global $dolibarr_distrib;
3297 $ext =
'layout='.$conf->browser->layout.
'&version='.urlencode(DOL_VERSION);
3304 if (is_object($user) && !empty($user->lastsearch_values_tmp) && is_array($user->lastsearch_values_tmp)) {
3306 foreach ($user->lastsearch_values_tmp as $key => $val) {
3307 unset($_SESSION[
'lastsearch_values_tmp_'.$key]);
3308 if (count($val) && empty($_POST[
'button_removefilter']) && empty($_POST[
'button_removefilter_x'])) {
3309 if (empty($val[
'sortfield'])) {
3310 unset($val[
'sortfield']);
3312 if (empty($val[
'sortorder'])) {
3313 unset($val[
'sortorder']);
3315 dol_syslog(
'Save lastsearch_values_tmp_'.$key.
'='.json_encode($val, 0).
" (systematic recording of last search criterias)");
3316 $_SESSION[
'lastsearch_values_tmp_'.$key] = json_encode($val);
3317 unset($_SESSION[
'lastsearch_values_'.$key]);
3323 $relativepathstring = $_SERVER[
"PHP_SELF"];
3325 if (constant(
'DOL_URL_ROOT')) {
3326 $relativepathstring = preg_replace(
'/^'.preg_quote(constant(
'DOL_URL_ROOT'),
'/').
'/',
'', $relativepathstring);
3328 $relativepathstring = preg_replace(
'/^\//',
'', $relativepathstring);
3329 $relativepathstring = preg_replace(
'/^custom\//',
'', $relativepathstring);
3330 if (preg_match(
'/list\.php$/', $relativepathstring)) {
3331 unset($_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring]);
3332 unset($_SESSION[
'lastsearch_page_tmp_'.$relativepathstring]);
3333 unset($_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring]);
3334 unset($_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring]);
3336 if (!empty($contextpage)) {
3337 $_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage;
3339 if (!empty($page) && $page > 0) {
3340 $_SESSION[
'lastsearch_page_tmp_'.$relativepathstring] = $page;
3342 if (!empty($limit) && $limit != $conf->liste_limit) {
3343 $_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring] = $limit;
3345 if (!empty($mode)) {
3346 $_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring] = $mode;
3349 unset($_SESSION[
'lastsearch_contextpage_'.$relativepathstring]);
3350 unset($_SESSION[
'lastsearch_page_'.$relativepathstring]);
3351 unset($_SESSION[
'lastsearch_limit_'.$relativepathstring]);
3352 unset($_SESSION[
'lastsearch_mode_'.$relativepathstring]);
3356 if (!empty($conf->global->MAIN_CORE_ERROR)) {
3358 if ($conf->use_javascript_ajax) {
3359 $title =
img_warning().
' '.$langs->trans(
'CoreErrorTitle');
3360 print
ajax_dialog($title, $langs->trans(
'CoreErrorMessage'));
3363 $msg =
img_warning().
' '.$langs->trans(
'CoreErrorMessage');
3364 print
'<div class="error">'.$msg.
'</div>';
3372 print
'</div> <!-- End div class="fiche" -->'.
"\n";
3374 if (empty($conf->dol_hide_leftmenu)) {
3375 print
'</div> <!-- End div id-right -->'.
"\n";
3378 if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) {
3379 print
'</div> <!-- End div id-container -->'.
"\n";
3384 print
'<!-- '.$comment.
' -->'.
"\n";
3389 if (!empty($delayedhtmlcontent)) {
3390 print $delayedhtmlcontent;
3393 if (!empty($conf->use_javascript_ajax)) {
3394 print
"\n".
'<!-- Includes JS Footer of Dolibarr -->'.
"\n";
3395 print
'<script src="'.DOL_URL_ROOT.
'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.($ext ?
'&'.$ext :
'').
'"></script>'.
"\n";
3399 if (
isModEnabled(
'blockedlog') && is_object($object) && !empty($object->id) && $object->id > 0 && $object->statut > 0) {
3400 if (in_array($object->element, array(
'facture'))) {
3401 print
"\n<!-- JS CODE TO ENABLE log when making a download or a preview of a document -->\n";
3404 jQuery(document).ready(
function () {
3405 $(
'a.documentpreview').click(
function() {
3406 $.post(
'<?php echo DOL_URL_ROOT."/blockedlog/ajax/block-add.php" ?>'
3408 id:<?php echo $object->id; ?>
3409 , element:
'<?php echo $object->element ?>'
3410 , action:
'DOC_PREVIEW'
3411 , token:
'<?php echo currentToken(); ?>'
3415 $(
'a.documentdownload').click(
function() {
3416 $.post(
'<?php echo DOL_URL_ROOT."/blockedlog/ajax/block-add.php" ?>'
3418 id:<?php echo $object->id; ?>
3419 , element:
'<?php echo $object->element ?>'
3420 , action:
'DOC_DOWNLOAD'
3421 , token:
'<?php echo currentToken(); ?>'
3432 print
"\n<!-- A div to allow dialog popup by jQuery('#dialogforpopup').dialog() -->\n";
3433 print
'<div id="dialogforpopup" style="display: none;"></div>'.
"\n";
3437 $forceping =
GETPOST(
'forceping',
'alpha');
3438 if (($_SERVER[
"PHP_SELF"] == DOL_URL_ROOT.
'/index.php') || $forceping) {
3440 $hash_unique_id = md5(
'dolibarr'.$conf->file->instance_unique_id);
3442 if (empty($conf->global->MAIN_FIRST_PING_OK_DATE)
3443 || (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID !=
'disabled'))
3446 if (strpos(
'alpha', DOL_VERSION) > 0 && !$forceping) {
3447 print
"\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It is an alpha version -->\n";
3448 } elseif (empty($_COOKIE[
'DOLINSTALLNOPING_'.$hash_unique_id]) || $forceping) {
3451 if (!empty($conf->global->MAIN_LAST_PING_KO_DATE) && substr($conf->global->MAIN_LAST_PING_KO_DATE, 0, 6) ==
dol_print_date(
dol_now(),
'%Y%m') && !$forceping) {
3452 print
"\n<!-- NO JS CODE TO ENABLE the anonymous Ping. An error already occured this month, we will try later. -->\n";
3454 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3456 print
"\n".
'<!-- Includes JS for Ping of Dolibarr forceping='.$forceping.
' MAIN_FIRST_PING_OK_DATE='.
getDolGlobalString(
"MAIN_FIRST_PING_OK_DATE").
' MAIN_FIRST_PING_OK_ID='.
getDolGlobalString(
"MAIN_FIRST_PING_OK_ID").
' MAIN_LAST_PING_KO_DATE='.
getDolGlobalString(
"MAIN_LAST_PING_KO_DATE").
' -->'.
"\n";
3457 print
"\n<!-- JS CODE TO ENABLE the anonymous Ping -->\n";
3458 $url_for_ping = (empty($conf->global->MAIN_URL_FOR_PING) ?
"https://ping.dolibarr.org/" : $conf->global->MAIN_URL_FOR_PING);
3460 $distrib =
'standard';
3461 if ($_SERVER[
"SERVER_ADMIN"] ==
'doliwamp@localhost') {
3462 $distrib =
'doliwamp';
3464 if (!empty($dolibarr_distrib)) {
3465 $distrib = $dolibarr_distrib;
3469 jQuery(document).ready(
function (tmp) {
3470 console.log(
"Try Ping with hash_unique_id is md5('dolibarr'+instance_unique_id)");
3473 url:
"<?php echo $url_for_ping ?>",
3478 hash_unique_id:
'<?php echo dol_escape_js($hash_unique_id); ?>',
3479 action:
'dolibarrping',
3480 version:
'<?php echo (float) DOL_VERSION; ?>',
3481 entity:
'<?php echo (int) $conf->entity; ?>',
3482 dbtype:
'<?php echo dol_escape_js($db->type); ?>',
3483 country_code:
'<?php echo $mysoc->country_code ? dol_escape_js($mysoc->country_code) : 'unknown
'; ?>',
3484 php_version:
'<?php echo dol_escape_js(phpversion()); ?>',
3485 os_version:
'<?php echo dol_escape_js(version_os('smr
')); ?>',
3486 distrib:
'<?php echo $distrib ? dol_escape_js($distrib) : 'unknown
'; ?>',
3487 token:
'notrequired'
3489 success:
function (data, status, xhr) {
3490 console.log(
"Ping ok");
3493 url:
'<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php
'; ?>',
3496 data: { hash_algo:
'md5', hash_unique_id:
'<?php echo dol_escape_js($hash_unique_id); ?>', action:
'firstpingok', token:
'<?php echo currentToken(); ?>' },
3499 error:
function (data,status,xhr) {
3500 console.log(
"Ping ko: " + data);
3503 url:
'<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php
'; ?>',
3506 data: { hash_algo:
'md5', hash_unique_id:
'<?php echo dol_escape_js($hash_unique_id); ?>', action:
'firstpingko', token:
'<?php echo currentToken(); ?>' },
3516 print
"\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It was disabled -->\n";
3517 include_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
3519 dolibarr_set_const($db,
'MAIN_FIRST_PING_OK_ID',
'disabled',
'chaine', 0,
'', $conf->entity);
3524 $reshook = $hookmanager->executeHooks(
'beforeBodyClose');
3526 print $hookmanager->resPrint;
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
ajax_dialog($title, $message, $w=350, $h=150)
Show an ajax dialog.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
printDropdownBookmarksList()
Add area with bookmarks in top menu.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_stringtotime($string, $gm=1)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
isHTTPS()
Return if we are using a HTTPS connexion Check HTTPS (no way to be modified by user but may be empty ...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
printCommonFooter($zone='private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
dol_print_profids($profID, $profIDtype, $countrycode='', $addcpButton=1, $separ=' ')
Format profIDs according to country.
getBrowserInfo($user_agent)
Return information about user browser.
dol_htmloutput_events($disabledoutputofmessages=0)
Print formated messages to output (Used to show messages on html output).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
left_menu($menu_array_before, $helppagename='', $notused='', $menu_array_after='', $leftmenuwithoutmainarea=0, $title='', $acceptdelayedhtml=0)
Show left menu bar.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
top_menu_quickadd()
Build the tooltip on top menu quick add.
analyseVarsForSqlAndScriptsInjection(&$var, $type)
Return true if security check on parameters are OK, false otherwise.
top_menu_user($hideloginname=0, $urllogout='')
Build the tooltip on user login.
testSqlAndScriptInject($val, $type)
Security: WAF layer for SQL Injection and XSS Injection (scripts) protection (Filters on GET,...
if(!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) realCharForNumericEntities($matches)
Return the real char for a numeric entities.
main_area($title='')
Begin main area.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
getHelpParamFor($helppagename, $langs)
Return helpbaseurl, helppage and mode.
top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $helppagename='')
Show an HTML header + a BODY + The top menu bar.
printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey='', $prefhtmlinputname='', $img='', $showtitlebefore=0, $autofocus=0)
Show a search area.
top_menu_search()
Build the tooltip on top menu tsearch.
printDropdownQuickadd()
Generate list of quickadd items.
top_menu_bookmark()
Build the tooltip on top menu bookmark.
div float
Buy price without taxes.
checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode, $context='')
Return a login if login/pass was successfull.
dol_hash($chain, $type='0')
Returns a hash (non reversible encryption) of a string.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.