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];
96 $val = html_entity_decode($val, ENT_QUOTES | ENT_HTML5);
98 $val = preg_replace_callback(
'/&#(x?[0-9][0-9a-f]+;?)/i',
function ($m) {
102 $val = preg_replace(
'/<!--[^>]*-->/',
'', $val);
103 $val = preg_replace(
'/[\r\n]/',
'', $val);
104 }
while ($oldval != $val);
115 $newval = preg_replace(
'/[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F]/u',
'', $val);
118 if ($newval != $val) {
125 if ($type == 1 || $type == 3) {
126 $inj += preg_match(
'/delete\s+from/i', $val);
127 $inj += preg_match(
'/create\s+table/i', $val);
128 $inj += preg_match(
'/insert\s+into/i', $val);
129 $inj += preg_match(
'/select\s+from/i', $val);
130 $inj += preg_match(
'/into\s+(outfile|dumpfile)/i', $val);
131 $inj += preg_match(
'/user\s*\(/i', $val);
132 $inj += preg_match(
'/information_schema/i', $val);
133 $inj += preg_match(
'/<svg/i', $val);
134 $inj += preg_match(
'/update[^&].*set.+=/i', $val);
135 $inj += preg_match(
'/union.+select/i', $val);
138 $inj += preg_match(
'/select|update|delete|truncate|replace|group\s+by|concat|count|from|union/i', $val);
141 $inj += preg_match(
'/updatexml\(/i', $val);
142 $inj += preg_match(
'/(\.\.%2f)+/i', $val);
143 $inj += preg_match(
'/\s@@/', $val);
146 $inj += preg_match(
'/<\/textarea/i', $val);
152 $inj += preg_match(
'/<audio/i', $val);
153 $inj += preg_match(
'/<embed/i', $val);
154 $inj += preg_match(
'/<iframe/i', $val);
155 $inj += preg_match(
'/<object/i', $val);
156 $inj += preg_match(
'/<script/i', $val);
157 $inj += preg_match(
'/Set\.constructor/i', $val);
158 if (!defined(
'NOSTYLECHECK')) {
159 $inj += preg_match(
'/<style/i', $val);
161 $inj += preg_match(
'/base\s+href/si', $val);
162 $inj += preg_match(
'/=data:/si', $val);
164 $inj += preg_match(
'/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $val);
165 $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);
166 $inj += preg_match(
'/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $val);
167 $inj += preg_match(
'/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $val);
168 $inj += preg_match(
'/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $val);
169 $inj += preg_match(
'/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $val);
172 $tmpval = preg_replace(
'/<[^<]+>/',
'', $val);
174 $inj += preg_match(
'/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $val);
175 $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);
176 $inj += preg_match(
'/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $tmpval);
177 $inj += preg_match(
'/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $tmpval);
178 $inj += preg_match(
'/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $tmpval);
179 $inj += preg_match(
'/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $tmpval);
182 $inj += preg_match(
'/:|:|:/i', $val);
183 $inj += preg_match(
'/javascript\s*:/i', $val);
184 $inj += preg_match(
'/vbscript\s*:/i', $val);
186 if ($type == 1 || $type == 3) {
187 $val = str_replace(
'enclosure="',
'enclosure=X', $val);
188 $inj += preg_match(
'/"/i', $val);
191 $inj += preg_match(
'/[:;"\'<>\?\(\){}\$%]/', $val);
206 if (is_array($var)) {
207 foreach ($var as $key => $value) {
212 $ip = (empty($_SERVER[
'REMOTE_ADDR']) ?
'unknown' : $_SERVER[
'REMOTE_ADDR']);
213 $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');
216 if (function_exists(
'error_log')) {
217 error_log($errormessage);
231 if ((defined(
'NOREQUIREDB') || defined(
'NOREQUIRETRAN')) && !defined(
'NOREQUIREMENU')) {
232 print
'If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not set them.';
235 if (defined(
'NOREQUIREUSER') && !defined(
'NOREQUIREMENU')) {
236 print
'If define NOREQUIREUSER is set, you must also set NOREQUIREMENU or not set it.';
241 if (!empty($_SERVER[
"PHP_SELF"])) {
242 $morevaltochecklikepost = array($_SERVER[
"PHP_SELF"]);
246 if (!defined(
'NOSCANGETFORINJECTION') && !empty($_SERVER[
"QUERY_STRING"])) {
250 $morevaltochecklikeget = array(urldecode($_SERVER[
"QUERY_STRING"]));
254 if (!defined(
'NOSCANPOSTFORINJECTION')) {
259 if (!empty($_SERVER[
'DOCUMENT_ROOT']) && substr($_SERVER[
'DOCUMENT_ROOT'], -6) !==
'htdocs') {
260 set_include_path($_SERVER[
'DOCUMENT_ROOT'].
'/htdocs');
265 require_once
'filefunc.inc.php';
270 if (!empty($_POST[
"DOL_AUTOSET_COOKIE"])) {
271 $tmpautoset = explode(
':', $_POST[
"DOL_AUTOSET_COOKIE"], 2);
272 $tmplist = explode(
',', $tmpautoset[1]);
273 $cookiearrayvalue = array();
274 foreach ($tmplist as $tmpkey) {
275 $postkey = $tmpautoset[0].
'_'.$tmpkey;
277 if (!empty($_POST[$postkey])) {
278 $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
281 $cookiename = $tmpautoset[0];
282 $cookievalue = json_encode($cookiearrayvalue);
284 if (PHP_VERSION_ID < 70300) {
285 setcookie($cookiename, empty($cookievalue) ?
'' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)),
'/', null, ((empty($dolibarr_main_force_https) &&
isHTTPS() ===
false) ?
false :
true),
true);
288 $cookieparams = array(
289 'expires' => empty($cookievalue) ? 0 : (time() + (86400 * 354)),
292 'secure' => ((empty($dolibarr_main_force_https) &&
isHTTPS() ===
false) ?
false :
true),
296 setcookie($cookiename, empty($cookievalue) ?
'' : $cookievalue, $cookieparams);
298 if (empty($cookievalue)) {
299 unset($_COOKIE[$cookiename]);
305 if (!empty($php_session_save_handler) && $php_session_save_handler ==
'db') {
306 require_once
'core/lib/phpsessionin'.$php_session_save_handler.
'.lib.php';
312 $prefix = dol_getprefix(
'');
313 $sessionname =
'DOLSESSID_'.$prefix;
314 $sessiontimeout =
'DOLSESSTIMEOUT_'.$prefix;
315 if (!empty($_COOKIE[$sessiontimeout])) {
316 ini_set(
'session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
321 if (!defined(
'NOSESSION')) {
322 if (PHP_VERSION_ID < 70300) {
323 session_set_cookie_params(0,
'/', null, ((empty($dolibarr_main_force_https) &&
isHTTPS() ===
false) ?
false :
true),
true);
326 $sessioncookieparams = array(
330 'secure' => ((empty($dolibarr_main_force_https) &&
isHTTPS() ===
false) ?
false :
true),
334 session_set_cookie_params($sessioncookieparams);
336 session_name($sessionname);
343 require_once
'master.inc.php';
346 if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
348 if ((!session_id() || !isset($_SESSION[
"dol_login"])) && !isset($_POST[
"username"]) && !empty($_SERVER[
"GATEWAY_INTERFACE"])) {
350 } elseif (isset($_POST[
"username"]) && $_POST[
"username"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) {
352 } elseif (defined(
'NOREQUIREDB')) {
354 } elseif (defined(
'EVEN_IF_ONLY_LOGIN_ALLOWED')) {
356 } elseif (session_id() && isset($_SESSION[
"dol_login"]) && $_SESSION[
"dol_login"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) {
360 if (session_id() && isset($_SESSION[
"dol_login"]) && $_SESSION[
"dol_login"] != $conf->global->MAIN_ONLY_LOGIN_ALLOWED) {
361 print
'Sorry, your application is offline.'.
"\n";
362 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";
363 $nexturl = DOL_URL_ROOT.
'/user/logout.php?token='.
newToken();
364 print
'Please try later or <a href="'.$nexturl.
'">click here to disconnect and change login user</a>...'.
"\n";
366 print
'Sorry, your application is offline. Only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.
'" is allowed to connect for the moment.'.
"\n";
367 $nexturl = DOL_URL_ROOT.
'/';
368 print
'Please try later or <a href="'.$nexturl.
'">click here to change login user</a>...'.
"\n";
376 register_shutdown_function(
'dol_shutdown');
379 if (
isModEnabled(
'debugbar') && !
GETPOST(
'dol_use_jmobile') && empty($_SESSION[
'dol_use_jmobile'])) {
381 include_once DOL_DOCUMENT_ROOT.
'/debugbar/class/DebugBar.php';
383 $renderer = $debugbar->getRenderer();
384 if (empty($conf->global->MAIN_HTML_HEADER)) {
385 $conf->global->MAIN_HTML_HEADER =
'';
387 $conf->global->MAIN_HTML_HEADER .= $renderer->renderHead();
389 $debugbar[
'time']->startMeasure(
'pageaftermaster',
'Page generation (after environment init)');
393 if (isset($_SERVER[
"HTTP_USER_AGENT"])) {
395 $conf->browser->name = $tmp[
'browsername'];
396 $conf->browser->os = $tmp[
'browseros'];
397 $conf->browser->version = $tmp[
'browserversion'];
398 $conf->browser->layout = $tmp[
'layout'];
401 if ($conf->browser->layout ==
'phone') {
402 $conf->dol_no_mouse_hover = 1;
407 if (
GETPOST(
'theme',
'aZ09')) {
408 $conf->theme =
GETPOST(
'theme',
'aZ09');
409 $conf->css =
"/theme/".$conf->theme.
"/style.css.php";
413 if (
GETPOST(
'textbrowser',
'int') || (!empty($conf->browser->name) && $conf->browser->name ==
'lynxlinks')) {
414 $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1;
419 if (!empty($conf->file->main_force_https) && (empty($_SERVER[
"HTTPS"]) || $_SERVER[
"HTTPS"] !=
'on')) {
421 if (is_numeric($conf->file->main_force_https)) {
422 if ($conf->file->main_force_https ==
'1' && !empty($_SERVER[
"SCRIPT_URI"])) {
423 if (preg_match(
'/^http:/i', $_SERVER[
"SCRIPT_URI"]) && !preg_match(
'/^https:/i', $_SERVER[
"SCRIPT_URI"])) {
424 $newurl = preg_replace(
'/^http:/i',
'https:', $_SERVER[
"SCRIPT_URI"]);
428 $newurl = preg_replace(
'/^http:/i',
'https:', DOL_MAIN_URL_ROOT).$_SERVER[
"REQUEST_URI"];
432 $newurl = $conf->file->main_force_https.$_SERVER[
"REQUEST_URI"];
437 dol_syslog(
"main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl);
438 header(
"Location: ".$newurl);
441 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);
445 if (!defined(
'NOLOGIN') && !defined(
'NOIPCHECK') && !empty($dolibarr_main_restrict_ip)) {
446 $listofip = explode(
',', $dolibarr_main_restrict_ip);
448 foreach ($listofip as $ip) {
450 if ($ip == $_SERVER[
'REMOTE_ADDR']) {
456 print
'Access refused by IP protection. Your detected IP is '.$_SERVER[
'REMOTE_ADDR'];
462 if (!defined(
'NOREQUIREHTML')) {
463 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
465 if (!defined(
'NOREQUIREAJAX')) {
466 require_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
470 if (!empty($conf->global->MAIN_NOT_INSTALLED) || !empty($conf->global->MAIN_NOT_UPGRADED)) {
471 dol_syslog(
"main.inc: A previous install or upgrade was not complete. Redirect to install page.", LOG_WARNING);
472 header(
"Location: ".DOL_URL_ROOT.
"/install/index.php");
476 if ((!empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ($conf->global->MAIN_VERSION_LAST_UPGRADE != DOL_VERSION))
477 || (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && !empty($conf->global->MAIN_VERSION_LAST_INSTALL) && ($conf->global->MAIN_VERSION_LAST_INSTALL != DOL_VERSION))) {
478 $versiontocompare = empty($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE;
479 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
480 $dolibarrversionlastupgrade = preg_split(
'/[.-]/', $versiontocompare);
481 $dolibarrversionprogram = preg_split(
'/[.-]/', DOL_VERSION);
482 $rescomp =
versioncompare($dolibarrversionprogram, $dolibarrversionlastupgrade);
484 if (empty($conf->global->MAIN_NO_UPGRADE_REDIRECT_ON_LEVEL_3_CHANGE) || $rescomp < 3) {
486 dol_syslog(
"main.inc: database version ".$versiontocompare.
" is lower than programs version ".DOL_VERSION.
". Redirect to install/upgrade page.", LOG_WARNING);
487 header(
"Location: ".DOL_URL_ROOT.
"/install/index.php");
494 if (!defined(
'NOTOKENRENEWAL') && !defined(
'NOSESSION')) {
496 if (!preg_match(
'/\.(css|js|json)\.php$/', $_SERVER[
"PHP_SELF"])) {
498 if (isset($_SESSION[
'newtoken'])) {
499 $_SESSION[
'token'] = $_SESSION[
'newtoken'];
502 if (!isset($_SESSION[
'newtoken']) ||
getDolGlobalInt(
'MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL')) {
504 $token =
dol_hash(uniqid(mt_rand(),
false),
'md5');
505 $_SESSION[
'newtoken'] = $token;
506 dol_syslog(
"NEW TOKEN generated by : ".$_SERVER[
'PHP_SELF'], LOG_DEBUG);
514 if ((!defined(
'NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) &&
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN')) || defined(
'CSRFCHECK_WITH_TOKEN')) {
516 $sensitiveget =
false;
519 if (
GETPOSTISSET(
'massaction') || !in_array(
GETPOST(
'action',
'aZ09'), array(
'create',
'file_manager',
'presend',
'presend_addmessage'))) {
520 $sensitiveget =
true;
524 $arrayofactiontoforcetokencheck = array(
526 'doprev',
'donext',
'dvprev',
'dvnext',
530 if (in_array(
GETPOST(
'action',
'aZ09'), $arrayofactiontoforcetokencheck)) {
531 $sensitiveget =
true;
533 if (preg_match(
'/^(add|classify|close|confirm|copy|del|disable|enable|remove|set|unset|update|save)/',
GETPOST(
'action',
'aZ09'))) {
534 $sensitiveget =
true;
541 $_SERVER[
'REQUEST_METHOD'] ==
'POST' ||
547 if (!
GETPOST(
'token',
'alpha') ||
GETPOST(
'token',
'alpha') ==
'notrequired') {
548 if (
GETPOST(
'uploadform',
'int')) {
549 dol_syslog(
"--- Access to ".(empty($_SERVER[
"REQUEST_METHOD"]) ?
'' : $_SERVER[
"REQUEST_METHOD"].
' ').$_SERVER[
"PHP_SELF"].
" refused. File size too large or not provided.");
550 $langs->loadLangs(array(
"errors",
"install"));
551 print $langs->trans(
"ErrorFileSizeTooLarge").
' ';
552 print $langs->trans(
"ErrorGoBackAndCorrectParameters");
555 http_response_code(403);
556 if (defined(
'CSRFCHECK_WITH_TOKEN')) {
557 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);
558 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";
560 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);
561 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";
562 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";
563 if (!empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) {
564 print
" instead of ".$conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN;
566 print
" into setup).\n";
573 $sessiontokenforthisurl = (empty($_SESSION[
'token']) ?
'' : $_SESSION[
'token']);
576 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);
579 setEventMessages(
'SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry', null,
'warnings');
581 if (isset($_POST[
'id'])) {
582 $savid = ((int) $_POST[
'id']);
587 unset($_GET[
'confirm']);
588 unset($_GET[
'action']);
589 unset($_GET[
'confirmmassaction']);
590 unset($_GET[
'massaction']);
591 unset($_GET[
'token']);
593 $_POST[
'id'] = ((int) $savid);
602 $_SESSION[
"disablemodules"] =
GETPOST(
'disablemodules',
'alpha');
604 if (!empty($_SESSION[
"disablemodules"])) {
605 $modulepartkeys = array(
'css',
'js',
'tabs',
'triggers',
'login',
'substitutions',
'menus',
'theme',
'sms',
'tpl',
'barcode',
'models',
'societe',
'hooks',
'dir',
'syslog',
'tpllinkable',
'contactelement',
'moduleforexternal');
607 $disabled_modules = explode(
',', $_SESSION[
"disablemodules"]);
608 foreach ($disabled_modules as $module) {
610 if (empty($conf->$module)) {
611 $conf->$module =
new stdClass();
613 $conf->$module->enabled =
false;
614 foreach ($modulepartkeys as $modulepartkey) {
615 unset($conf->modules_parts[$modulepartkey][$module]);
617 if ($module ==
'fournisseur') {
618 $conf->supplier_order->enabled = 0;
619 $conf->supplier_invoice->enabled = 0;
626 $modulepart = explode(
"/", $_SERVER[
"PHP_SELF"]);
627 if (is_array($modulepart) && count($modulepart) > 0) {
628 foreach ($conf->modules as $module) {
629 if (in_array($module, $modulepart)) {
630 $conf->modulepart = $module;
640 if (!defined(
'NOLOGIN')) {
644 if (defined(
'MAIN_AUTHENTICATION_MODE')) {
645 $dolibarr_main_authentication = constant(
'MAIN_AUTHENTICATION_MODE');
648 if (empty($dolibarr_main_authentication)) {
649 $dolibarr_main_authentication =
'http,dolibarr';
652 if ($dolibarr_main_authentication ==
'forceuser' && empty($dolibarr_auto_user)) {
653 $dolibarr_auto_user =
'auto';
657 $authmode = explode(
',', $dolibarr_main_authentication);
660 if (!count($authmode)) {
661 $langs->load(
'main');
662 dol_print_error(
'', $langs->trans(
"ErrorConfigParameterNotDefined",
'dolibarr_main_authentication'));
669 $resultFetchUser =
'';
671 if (!isset($_SESSION[
"dol_login"])) {
673 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
675 $dol_dst_observed =
GETPOST(
"dst_observed",
'int', 3);
676 $dol_dst_first =
GETPOST(
"dst_first",
'int', 3);
677 $dol_dst_second =
GETPOST(
"dst_second",
'int', 3);
678 $dol_screenwidth =
GETPOST(
"screenwidth",
'int', 3);
679 $dol_screenheight =
GETPOST(
"screenheight",
'int', 3);
680 $dol_hide_topmenu =
GETPOST(
'dol_hide_topmenu',
'int', 3);
681 $dol_hide_leftmenu =
GETPOST(
'dol_hide_leftmenu',
'int', 3);
682 $dol_optimize_smallscreen =
GETPOST(
'dol_optimize_smallscreen',
'int', 3);
683 $dol_no_mouse_hover =
GETPOST(
'dol_no_mouse_hover',
'int', 3);
684 $dol_use_jmobile =
GETPOST(
'dol_use_jmobile',
'int', 3);
688 if (!empty($dolibarr_main_demo) && $_SERVER[
'PHP_SELF'] == DOL_URL_ROOT.
'/index.php') {
689 if (empty($_SERVER[
'HTTP_REFERER']) || !preg_match(
'/public/', $_SERVER[
'HTTP_REFERER'])) {
690 dol_syslog(
"Call index page from another url than demo page (call is done from page ".$_SERVER[
'HTTP_REFERER'].
")");
692 $url .= ($url ?
'&' :
'').($dol_hide_topmenu ?
'dol_hide_topmenu='.$dol_hide_topmenu :
'');
693 $url .= ($url ?
'&' :
'').($dol_hide_leftmenu ?
'dol_hide_leftmenu='.$dol_hide_leftmenu :
'');
694 $url .= ($url ?
'&' :
'').($dol_optimize_smallscreen ?
'dol_optimize_smallscreen='.$dol_optimize_smallscreen :
'');
695 $url .= ($url ?
'&' :
'').($dol_no_mouse_hover ?
'dol_no_mouse_hover='.$dol_no_mouse_hover :
'');
696 $url .= ($url ?
'&' :
'').($dol_use_jmobile ?
'dol_use_jmobile='.$dol_use_jmobile :
'');
697 $url = DOL_URL_ROOT.
'/public/demo/index.php'.($url ?
'?'.$url :
'');
698 header(
"Location: ".$url);
705 $hookmanager->initHooks(array(
'login'));
706 $parameters = array();
707 $reshook = $hookmanager->executeHooks(
'beforeLoginAuthentication', $parameters, $user, $action);
714 if ($test &&
GETPOST(
"username",
"alpha", 2) && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) && !isset($_SESSION[
'dol_bypass_antispam'])) {
715 $sessionkey =
'dol_antispam_value';
716 $ok = (array_key_exists($sessionkey, $_SESSION) ===
true && (strtolower($_SESSION[$sessionkey]) === strtolower(
GETPOST(
'code',
'restricthtml'))));
720 dol_syslog(
'Bad value for code, connexion refused');
722 $langs->loadLangs(array(
'main',
'errors'));
724 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorBadValueForCode");
728 $user->trigger_mesg =
'ErrorBadValueForCode - login='.GETPOST(
"username",
"alpha", 2);
731 $result = $user->call_trigger(
'USER_LOGIN_FAILED', $user);
739 $hookmanager->initHooks(array(
'login'));
740 $parameters = array(
'dol_authmode'=>$authmode,
'dol_loginmesg'=>$_SESSION[
"dol_loginmesg"]);
741 $reshook = $hookmanager->executeHooks(
'afterLoginFailed', $parameters, $user, $action);
750 $allowedmethodtopostusername = 2;
751 if (defined(
'MAIN_AUTHENTICATION_POST_METHOD')) {
752 $allowedmethodtopostusername = constant(
'MAIN_AUTHENTICATION_POST_METHOD');
754 $usertotest = (!empty($_COOKIE[
'login_dolibarr']) ? preg_replace(
'/[^a-zA-Z0-9_\-]/',
'', $_COOKIE[
'login_dolibarr']) :
GETPOST(
"username",
"alpha", $allowedmethodtopostusername));
755 $passwordtotest =
GETPOST(
'password',
'none', $allowedmethodtopostusername);
756 $entitytotest = (
GETPOST(
'entity',
'int') ?
GETPOST(
'entity',
'int') : (!empty($conf->entity) ? $conf->entity : 1));
759 $goontestloop =
false;
760 if (isset($_SERVER[
"REMOTE_USER"]) && in_array(
'http', $authmode)) {
761 $goontestloop =
true;
763 if ($dolibarr_main_authentication ==
'forceuser' && !empty($dolibarr_auto_user)) {
764 $goontestloop =
true;
766 if (
GETPOST(
"username",
"alpha", $allowedmethodtopostusername) || !empty($_COOKIE[
'login_dolibarr']) ||
GETPOST(
'openid_mode',
'alpha', 1)) {
767 $goontestloop =
true;
770 if (!is_object($langs)) {
771 include_once DOL_DOCUMENT_ROOT.
'/core/class/translate.class.php';
773 $langcode = (
GETPOST(
'lang',
'aZ09', 1) ?
GETPOST(
'lang',
'aZ09', 1) : (empty($conf->global->MAIN_LANG_DEFAULT) ?
'auto' : $conf->global->MAIN_LANG_DEFAULT));
774 if (defined(
'MAIN_LANG_DEFAULT')) {
775 $langcode = constant(
'MAIN_LANG_DEFAULT');
777 $langs->setDefaultLang($langcode);
784 if ($test && $goontestloop && (
GETPOST(
'actionlogin',
'aZ09') ==
'login' || $dolibarr_main_authentication !=
'dolibarr')) {
786 if ($login ===
'--bad-login-validity--') {
793 $dol_authmode = $conf->authmode;
794 $dol_tz = $_POST[
"tz"];
795 $dol_tz_string = $_POST[
"tz_string"];
796 $dol_tz_string = preg_replace(
'/\s*\(.+\)$/',
'', $dol_tz_string);
797 $dol_tz_string = preg_replace(
'/,/',
'/', $dol_tz_string);
798 $dol_tz_string = preg_replace(
'/\s/',
'_', $dol_tz_string);
801 if (isset($_POST[
"dst_first"]) && isset($_POST[
"dst_second"])) {
802 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
806 if ($datenow >= $datefirst && $datenow < $datesecond) {
814 dol_syslog(
'Bad password, connexion refused', LOG_DEBUG);
816 $langs->loadLangs(array(
'main',
'errors'));
820 if (empty($_SESSION[
"dol_loginmesg"])) {
821 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorBadLoginPassword");
825 $user->trigger_mesg = $langs->trans(
"ErrorBadLoginPassword").
' - login='.
GETPOST(
"username",
"alpha", 2);
828 $result = $user->call_trigger(
'USER_LOGIN_FAILED', $user);
836 $hookmanager->initHooks(array(
'login'));
837 $parameters = array(
'dol_authmode'=>$dol_authmode,
'dol_loginmesg'=>$_SESSION[
"dol_loginmesg"]);
838 $reshook = $hookmanager->executeHooks(
'afterLoginFailed', $parameters, $user, $action);
848 if (!$login || (in_array(
'ldap', $authmode) && empty($passwordtotest))) {
850 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_INFO);
851 if (defined(
'NOREDIRECTBYMAINTOLOGIN')) {
852 return 'ERROR_NOT_LOGGED';
854 if ($_SERVER[
"HTTP_USER_AGENT"] ==
'securitytest') {
855 http_response_code(401);
857 dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc :
''));
862 $resultFetchUser = $user->fetch(
'', $login,
'', 1, ($entitytotest > 0 ? $entitytotest : -1));
863 if ($resultFetchUser <= 0) {
864 dol_syslog(
'User not found, connexion refused');
866 session_set_cookie_params(0,
'/', null, (empty($dolibarr_main_force_https) ?
false :
true),
true);
867 session_name($sessionname);
870 if ($resultFetchUser == 0) {
872 $langs->loadLangs(array(
'main',
'errors'));
874 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorCantLoadUserFromDolibarrDatabase", $login);
876 $user->trigger_mesg =
'ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
878 if ($resultFetchUser < 0) {
879 $_SESSION[
"dol_loginmesg"] = $user->error;
881 $user->trigger_mesg = $user->error;
885 $result = $user->call_trigger(
'USER_LOGIN_FAILED', $user);
894 $hookmanager->initHooks(array(
'login'));
895 $parameters = array(
'dol_authmode'=>$dol_authmode,
'dol_loginmesg'=>$_SESSION[
"dol_loginmesg"]);
896 $reshook = $hookmanager->executeHooks(
'afterLoginFailed', $parameters, $user, $action);
901 $paramsurl = array();
902 if (
GETPOST(
'textbrowser',
'int')) {
903 $paramsurl[] =
'textbrowser='.GETPOST(
'textbrowser',
'int');
906 $paramsurl[] =
'nojs='.GETPOST(
'nojs',
'int');
909 $paramsurl[] =
'lang='.GETPOST(
'lang',
'aZ09');
911 header(
'Location: '.DOL_URL_ROOT.
'/index.php'.(count($paramsurl) ?
'?'.implode(
'&', $paramsurl) :
''));
915 if (!empty($user->conf->MAIN_LANG_DEFAULT)) {
916 $langs->setDefaultLang($user->conf->MAIN_LANG_DEFAULT);
921 $login = $_SESSION[
"dol_login"];
922 $entity = isset($_SESSION[
"dol_entity"]) ? $_SESSION[
"dol_entity"] : 0;
923 dol_syslog(
"- This is an already logged session. _SESSION['dol_login']=".$login.
" _SESSION['dol_entity']=".$entity, LOG_DEBUG);
925 $resultFetchUser = $user->fetch(
'', $login,
'', 1, ($entity > 0 ? $entity : -1));
926 if ($resultFetchUser <= 0) {
928 dol_syslog(
"Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING);
930 session_set_cookie_params(0,
'/', null, (empty($dolibarr_main_force_https) ?
false :
true),
true);
931 session_name($sessionname);
934 if ($resultFetchUser == 0) {
936 $langs->loadLangs(array(
'main',
'errors'));
938 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorCantLoadUserFromDolibarrDatabase", $login);
940 $user->trigger_mesg =
'ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
942 if ($resultFetchUser < 0) {
943 $_SESSION[
"dol_loginmesg"] = $user->error;
945 $user->trigger_mesg = $user->error;
949 $result = $user->call_trigger(
'USER_LOGIN_FAILED', $user);
957 $hookmanager->initHooks(array(
'login'));
958 $parameters = array(
'dol_authmode'=>$dol_authmode,
'dol_loginmesg'=>$_SESSION[
"dol_loginmesg"]);
959 $reshook = $hookmanager->executeHooks(
'afterLoginFailed', $parameters, $user, $action);
964 $paramsurl = array();
965 if (
GETPOST(
'textbrowser',
'int')) {
966 $paramsurl[] =
'textbrowser='.GETPOST(
'textbrowser',
'int');
969 $paramsurl[] =
'nojs='.GETPOST(
'nojs',
'int');
972 $paramsurl[] =
'lang='.GETPOST(
'lang',
'aZ09');
974 header(
'Location: '.DOL_URL_ROOT.
'/index.php'.(count($paramsurl) ?
'?'.implode(
'&', $paramsurl) :
''));
978 $hookmanager->initHooks(array(
'main'));
981 if (!empty($_GET[
'save_lastsearch_values'])) {
982 $relativepathstring = preg_replace(
'/\?.*$/',
'', $_SERVER[
"HTTP_REFERER"]);
983 $relativepathstring = preg_replace(
'/^https?:\/\/[^\/]*/',
'', $relativepathstring);
985 if (constant(
'DOL_URL_ROOT')) {
986 $relativepathstring = preg_replace(
'/^'.preg_quote(constant(
'DOL_URL_ROOT'),
'/').
'/',
'', $relativepathstring);
988 $relativepathstring = preg_replace(
'/^\//',
'', $relativepathstring);
989 $relativepathstring = preg_replace(
'/^custom\//',
'', $relativepathstring);
993 if (!empty($_SESSION[
'lastsearch_values_tmp_'.$relativepathstring])) {
994 $_SESSION[
'lastsearch_values_'.$relativepathstring] = $_SESSION[
'lastsearch_values_tmp_'.$relativepathstring];
995 unset($_SESSION[
'lastsearch_values_tmp_'.$relativepathstring]);
997 if (!empty($_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring])) {
998 $_SESSION[
'lastsearch_contextpage_'.$relativepathstring] = $_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring];
999 unset($_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring]);
1001 if (!empty($_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit) {
1002 $_SESSION[
'lastsearch_limit_'.$relativepathstring] = $_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring];
1003 unset($_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring]);
1005 if (!empty($_SESSION[
'lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION[
'lastsearch_page_tmp_'.$relativepathstring] > 0) {
1006 $_SESSION[
'lastsearch_page_'.$relativepathstring] = $_SESSION[
'lastsearch_page_tmp_'.$relativepathstring];
1007 unset($_SESSION[
'lastsearch_page_tmp_'.$relativepathstring]);
1009 if (!empty($_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring])) {
1010 $_SESSION[
'lastsearch_mode_'.$relativepathstring] = $_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring];
1011 unset($_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring]);
1016 $reshook = $hookmanager->executeHooks(
'updateSession', array(), $user, $action);
1025 if (!isset($_SESSION[
"dol_login"])) {
1030 $_SESSION[
"dol_login"] = $user->login;
1031 $_SESSION[
"dol_authmode"] = isset($dol_authmode) ? $dol_authmode :
'';
1032 $_SESSION[
"dol_tz"] = isset($dol_tz) ? $dol_tz :
'';
1033 $_SESSION[
"dol_tz_string"] = isset($dol_tz_string) ? $dol_tz_string :
'';
1034 $_SESSION[
"dol_dst"] = isset($dol_dst) ? $dol_dst :
'';
1035 $_SESSION[
"dol_dst_observed"] = isset($dol_dst_observed) ? $dol_dst_observed :
'';
1036 $_SESSION[
"dol_dst_first"] = isset($dol_dst_first) ? $dol_dst_first :
'';
1037 $_SESSION[
"dol_dst_second"] = isset($dol_dst_second) ? $dol_dst_second :
'';
1038 $_SESSION[
"dol_screenwidth"] = isset($dol_screenwidth) ? $dol_screenwidth :
'';
1039 $_SESSION[
"dol_screenheight"] = isset($dol_screenheight) ? $dol_screenheight :
'';
1041 $_SESSION[
"dol_entity"] = $conf->entity;
1043 if (!empty($dol_hide_topmenu)) {
1044 $_SESSION[
'dol_hide_topmenu'] = $dol_hide_topmenu;
1046 if (!empty($dol_hide_leftmenu)) {
1047 $_SESSION[
'dol_hide_leftmenu'] = $dol_hide_leftmenu;
1049 if (!empty($dol_optimize_smallscreen)) {
1050 $_SESSION[
'dol_optimize_smallscreen'] = $dol_optimize_smallscreen;
1052 if (!empty($dol_no_mouse_hover)) {
1053 $_SESSION[
'dol_no_mouse_hover'] = $dol_no_mouse_hover;
1055 if (!empty($dol_use_jmobile)) {
1056 $_SESSION[
'dol_use_jmobile'] = $dol_use_jmobile;
1059 dol_syslog(
"This is a new started user session. _SESSION['dol_login']=".$_SESSION[
"dol_login"].
" Session id=".session_id());
1063 $user->update_last_login_date();
1065 $loginfo =
'TZ='.$_SESSION[
"dol_tz"].
';TZString='.$_SESSION[
"dol_tz_string"].
';Screen='.$_SESSION[
"dol_screenwidth"].
'x'.$_SESSION[
"dol_screenheight"];
1068 $user->trigger_mesg = $loginfo;
1071 $result = $user->call_trigger(
'USER_LOGIN', $user);
1079 $hookmanager->initHooks(array(
'login'));
1080 $parameters = array(
'dol_authmode'=>$dol_authmode,
'dol_loginfo'=>$loginfo);
1081 $reshook = $hookmanager->executeHooks(
'afterLogin', $parameters, $user, $action);
1089 dol_print_error($db,
'Error in some triggers USER_LOGIN or in some hooks afterLogin');
1096 $landingpage = (empty($user->conf->MAIN_LANDING_PAGE) ? (empty($conf->global->MAIN_LANDING_PAGE) ?
'' : $conf->global->MAIN_LANDING_PAGE) : $user->conf->MAIN_LANDING_PAGE);
1097 if (!empty($landingpage)) {
1099 if ($_SERVER[
"PHP_SELF"] != $newpath) {
1100 header(
'Location: '.$newpath);
1109 $user->rights->user->user->lire = 1;
1110 $user->rights->user->user->creer = 1;
1111 $user->rights->user->user->password = 1;
1112 $user->rights->user->user->supprimer = 1;
1113 $user->rights->user->self->creer = 1;
1114 $user->rights->user->self->password = 1;
1117 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
1118 if (empty($user->rights->user->user_advance)) {
1119 $user->rights->user->user_advance =
new stdClass();
1121 if (empty($user->rights->user->self_advance)) {
1122 $user->rights->user->self_advance =
new stdClass();
1124 if (empty($user->rights->user->group_advance)) {
1125 $user->rights->user->group_advance =
new stdClass();
1128 $user->rights->user->user_advance->readperms = 1;
1129 $user->rights->user->user_advance->write = 1;
1130 $user->rights->user->self_advance->readperms = 1;
1131 $user->rights->user->self_advance->writeperms = 1;
1132 $user->rights->user->group_advance->read = 1;
1133 $user->rights->user->group_advance->readperms = 1;
1134 $user->rights->user->group_advance->write = 1;
1135 $user->rights->user->group_advance->delete = 1;
1144 if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) {
1145 $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT;
1147 if (isset($user->conf->PRODUIT_LIMIT_SIZE)) {
1148 $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE;
1152 if (empty($conf->global->MAIN_FORCETHEME) && !empty($user->conf->MAIN_THEME)) {
1153 $conf->theme = $user->conf->MAIN_THEME;
1154 $conf->css =
"/theme/".$conf->theme.
"/style.css.php";
1158 if (!empty($user) && method_exists($user,
'loadDefaultValues')) {
1159 $user->loadDefaultValues();
1165 if (
GETPOST(
'theme',
'aZ09')) {
1166 $conf->theme =
GETPOST(
'theme',
'aZ09', 1);
1167 $conf->css =
"/theme/".$conf->theme.
"/style.css.php";
1172 $conf->use_javascript_ajax = 0;
1174 if (!empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) {
1175 $conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT;
1180 if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1181 $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = $user->conf->MAIN_OPTIMIZEFORTEXTBROWSER;
1185 $conf->global->MAIN_OPTIMIZEFORCOLORBLIND = empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND) ?
'' : $user->conf->MAIN_OPTIMIZEFORCOLORBLIND;
1188 if (
GETPOST(
'dol_hide_leftmenu',
'int') || !empty($_SESSION[
'dol_hide_leftmenu'])) {
1189 $conf->dol_hide_leftmenu = 1;
1191 if (
GETPOST(
'dol_hide_topmenu',
'int') || !empty($_SESSION[
'dol_hide_topmenu'])) {
1192 $conf->dol_hide_topmenu = 1;
1194 if (
GETPOST(
'dol_optimize_smallscreen',
'int') || !empty($_SESSION[
'dol_optimize_smallscreen'])) {
1195 $conf->dol_optimize_smallscreen = 1;
1197 if (
GETPOST(
'dol_no_mouse_hover',
'int') || !empty($_SESSION[
'dol_no_mouse_hover'])) {
1198 $conf->dol_no_mouse_hover = 1;
1200 if (
GETPOST(
'dol_use_jmobile',
'int') || !empty($_SESSION[
'dol_use_jmobile'])) {
1201 $conf->dol_use_jmobile = 1;
1203 if (!empty($conf->browser->layout) && $conf->browser->layout !=
'classic') {
1204 $conf->dol_no_mouse_hover = 1;
1206 if ((!empty($conf->browser->layout) && $conf->browser->layout ==
'phone')
1207 || (!empty($_SESSION[
'dol_screenwidth']) && $_SESSION[
'dol_screenwidth'] < 400)
1208 || (!empty($_SESSION[
'dol_screenheight']) && $_SESSION[
'dol_screenheight'] < 400)
1210 $conf->dol_optimize_smallscreen = 1;
1213 if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array(
'bureau2crea',
'cameleo',
'amarok'))) {
1214 $conf->theme =
'eldy';
1215 $conf->css =
"/theme/".$conf->theme.
"/style.css.php";
1218 if (!defined(
'NOREQUIRETRAN')) {
1219 if (!
GETPOST(
'lang',
'aZ09')) {
1221 if (!empty($user->conf->MAIN_LANG_DEFAULT)) {
1224 if ($langs->getDefaultLang() != $user->conf->MAIN_LANG_DEFAULT) {
1225 $langs->setDefaultLang($user->conf->MAIN_LANG_DEFAULT);
1231 if (!defined(
'NOLOGIN')) {
1234 if (!$user->login) {
1239 if ($user->statut < 1) {
1241 $langs->loadLangs(array(
"errors",
"other"));
1242 dol_syslog(
"Authentication KO as login is disabled", LOG_NOTICE);
1251 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);
1256 if (!defined(
'NOREQUIRETRAN')) {
1258 $langs->loadLangs(array(
'main',
'dict'));
1262 $bc = array(0=>
'class="impair"', 1=>
'class="pair"');
1263 $bcdd = array(0=>
'class="drag drop oddeven"', 1=>
'class="drag drop oddeven"');
1264 $bcnd = array(0=>
'class="nodrag nodrop nohover"', 1=>
'class="nodrag nodrop nohoverpair"');
1265 $bctag = array(0=>
'class="impair tagtr"', 1=>
'class="pair tagtr"');
1268 $mesg =
''; $warning =
''; $error = 0;
1270 $mesgs = array(); $warnings = array(); $errors = array();
1273 if (empty($conf->browser->firefox)) {
1274 define(
'ROWS_1', 1);
1275 define(
'ROWS_2', 2);
1276 define(
'ROWS_3', 3);
1277 define(
'ROWS_4', 4);
1278 define(
'ROWS_5', 5);
1279 define(
'ROWS_6', 6);
1280 define(
'ROWS_7', 7);
1281 define(
'ROWS_8', 8);
1282 define(
'ROWS_9', 9);
1284 define(
'ROWS_1', 0);
1285 define(
'ROWS_2', 1);
1286 define(
'ROWS_3', 2);
1287 define(
'ROWS_4', 3);
1288 define(
'ROWS_5', 4);
1289 define(
'ROWS_6', 5);
1290 define(
'ROWS_7', 6);
1291 define(
'ROWS_8', 7);
1292 define(
'ROWS_9', 8);
1295 $heightforframes = 50;
1298 if (!defined(
'NOREQUIREMENU')) {
1299 if (empty($user->socid)) {
1300 $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);
1303 $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);
1307 $file_menu = $conf->standard_menu;
1308 if (
GETPOST(
'menu',
'alpha')) {
1309 $file_menu =
GETPOST(
'menu',
'alpha');
1311 if (!class_exists(
'MenuManager')) {
1313 $dirmenus = array_merge(array(
"/core/menus/"), (array) $conf->modules_parts[
'menus']);
1314 foreach ($dirmenus as $dirmenu) {
1316 if (class_exists(
'MenuManager')) {
1320 if (!class_exists(
'MenuManager')) {
1321 dol_syslog(
"You define a menu manager '".$file_menu.
"' that can not be loaded.", LOG_WARNING);
1322 $file_menu =
'eldy_menu.php';
1323 include_once DOL_DOCUMENT_ROOT.
"/core/menus/standard/".$file_menu;
1326 $menumanager =
new MenuManager($db, empty($user->socid) ? 0 : 1);
1327 $menumanager->loadMenu();
1334 if (!function_exists(
"llxHeader")) {
1355 function llxHeader($head =
'', $title =
'',
$help_url =
'', $target =
'', $disablejs = 0, $disablehead = 0, $arrayofjs =
'', $arrayofcss =
'', $morequerystring =
'', $morecssonbody =
'', $replacemainareaby =
'', $disablenofollow = 0, $disablenoindex = 0)
1360 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, $disablenofollow, $disablenoindex);
1362 $tmpcsstouse =
'sidebar-collapse'.($morecssonbody ?
' '.$morecssonbody :
'');
1364 if ($conf->theme ==
'md' && !in_array($conf->browser->layout, array(
'phone',
'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1366 if ($mainmenu !=
'website') {
1367 $tmpcsstouse = $morecssonbody;
1371 if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) {
1372 $tmpcsstouse .=
' colorblind-'.strip_tags($conf->global->MAIN_OPTIMIZEFORCOLORBLIND);
1375 print
'<body id="mainbody" class="'.$tmpcsstouse.
'">'.
"\n";
1378 if ((empty($conf->dol_hide_topmenu) ||
GETPOST(
'dol_invisible_topmenu',
'int')) && !
GETPOST(
'dol_openinpopup',
'aZ09')) {
1379 top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring,
$help_url);
1382 if (empty($conf->dol_hide_leftmenu) && !
GETPOST(
'dol_openinpopup',
'aZ09')) {
1387 if ($replacemainareaby) {
1388 print $replacemainareaby;
1405 global $db, $conf, $hookmanager;
1407 if ($contenttype ==
'text/html') {
1408 header(
"Content-Type: text/html; charset=".$conf->file->character_set_client);
1410 header(
"Content-Type: ".$contenttype);
1414 header(
"X-Content-Type-Options: nosniff");
1415 if (!defined(
'XFRAMEOPTIONS_ALLOWALL')) {
1416 header(
"X-Frame-Options: SAMEORIGIN");
1418 header(
"X-Frame-Options: ALLOWALL");
1421 if (!defined(
'FORCECSP')) {
1428 $contentsecuritypolicy = empty($conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY) ?
'' : $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY;
1430 if (!is_object($hookmanager)) {
1431 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
1434 $hookmanager->initHooks(array(
"main"));
1436 $parameters = array(
'contentsecuritypolicy'=>$contentsecuritypolicy);
1437 $result = $hookmanager->executeHooks(
'setContentSecurityPolicy', $parameters);
1439 $contentsecuritypolicy = $hookmanager->resPrint;
1441 $contentsecuritypolicy .= $hookmanager->resPrint;
1444 if (!empty($contentsecuritypolicy)) {
1453 header(
"Content-Security-Policy: ".$contentsecuritypolicy);
1455 } elseif (constant(
'FORCECSP')) {
1456 header(
"Content-Security-Policy: ".constant(
'FORCECSP'));
1458 if ($forcenocache) {
1459 header(
"Cache-Control: no-cache, no-store, must-revalidate, max-age=0");
1478 function top_htmlhead($head, $title =
'', $disablejs = 0, $disablehead = 0, $arrayofjs =
'', $arrayofcss =
'', $disableforlogin = 0, $disablenofollow = 0, $disablenoindex = 0)
1480 global $db, $conf, $langs, $user, $mysoc, $hookmanager;
1484 if (empty($conf->css)) {
1485 $conf->css =
'/theme/eldy/style.css.php';
1488 print
'<!doctype html>'.
"\n";
1490 print
'<html lang="'.substr($langs->defaultlang, 0, 2).
'">'.
"\n";
1493 if (empty($disablehead)) {
1494 if (!is_object($hookmanager)) {
1497 $hookmanager->initHooks(array(
"main"));
1499 $ext =
'layout='.$conf->browser->layout.
'&version='.urlencode(DOL_VERSION);
1503 if (
GETPOST(
'dol_basehref',
'alpha')) {
1504 print
'<base href="'.dol_escape_htmltag(
GETPOST(
'dol_basehref',
'alpha')).
'">'.
"\n";
1508 print
'<meta charset="utf-8">'.
"\n";
1509 print
'<meta name="robots" content="'.($disablenoindex ?
'index' :
'noindex').($disablenofollow ?
',follow' :
',nofollow').
'">'.
"\n";
1510 print
'<meta name="viewport" content="width=device-width, initial-scale=1.0">'.
"\n";
1511 print
'<meta name="author" content="Dolibarr Development Team">'.
"\n";
1513 print
'<meta name="MAIN_FEATURES_LEVEL" content="'.getDolGlobalInt(
'MAIN_FEATURES_LEVEL').
'">'.
"\n";
1516 $favicon = DOL_URL_ROOT.
'/theme/dolibarr_256x256_color.png';
1517 if (!empty($mysoc->logo_squarred_mini)) {
1518 $favicon = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode(
'logos/thumbs/'.$mysoc->logo_squarred_mini);
1520 if (!empty($conf->global->MAIN_FAVICON_URL)) {
1521 $favicon = $conf->global->MAIN_FAVICON_URL;
1523 if (empty($conf->dol_use_jmobile)) {
1524 print
'<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.
'"/>'.
"\n";
1532 $manifest = DOL_URL_ROOT.
'/theme/'.$conf->theme.
'/manifest.json.php';
1533 if (!empty($manifest)) {
1534 print
'<link rel="manifest" href="'.$manifest.
'" />'.
"\n";
1537 if (!empty($conf->global->THEME_ELDY_TOPMENU_BACK1)) {
1539 print
'<meta name="theme-color" content="rgb('.$conf->global->THEME_ELDY_TOPMENU_BACK1.
')">'.
"\n";
1543 if (
GETPOST(
'autorefresh',
'int') > 0) {
1544 print
'<meta http-equiv="refresh" content="'.GETPOST(
'autorefresh',
'int').
'">';
1548 $appli = constant(
'DOL_APPLICATION_TITLE');
1549 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1550 $appli = $conf->global->MAIN_APPLICATION_TITLE;
1555 if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/noapp/', $conf->global->MAIN_HTML_TITLE)) {
1563 $parameters = array(
'title'=>$titletoshow);
1564 $result = $hookmanager->executeHooks(
'setHtmlTitle', $parameters);
1566 $titletoshow = $hookmanager->resPrint;
1568 $titletoshow .= $hookmanager->resPrint;
1576 if (
GETPOST(
'version',
'int')) {
1577 $ext =
'version='.GETPOST(
'version',
'int');
1580 if (
GETPOST(
'dol_resetcache')) {
1581 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", ((
int) $conf->global->MAIN_IHM_PARAMS_REV) + 1,
'chaine', 0,
'', $conf->entity);
1584 $themeparam =
'?lang='.$langs->defaultlang.
'&theme='.$conf->theme.(GETPOST(
'optioncss',
'aZ09') ?
'&optioncss='.GETPOST(
'optioncss',
'aZ09', 1) :
'').
'&userid='.$user->id.
'&entity='.$conf->entity;
1586 $themeparam .= ($ext ?
'&'.$ext :
'').
'&revision='.
getDolGlobalInt(
"MAIN_IHM_PARAMS_REV");
1588 $themeparam .=
'&dol_hide_topmenu='.GETPOST(
'dol_hide_topmenu',
'int');
1591 $themeparam .=
'&dol_hide_leftmenu='.GETPOST(
'dol_hide_leftmenu',
'int');
1594 $themeparam .=
'&dol_optimize_smallscreen='.GETPOST(
'dol_optimize_smallscreen',
'int');
1597 $themeparam .=
'&dol_no_mouse_hover='.GETPOST(
'dol_no_mouse_hover',
'int');
1600 $themeparam .=
'&dol_use_jmobile='.GETPOST(
'dol_use_jmobile',
'int'); $conf->dol_use_jmobile =
GETPOST(
'dol_use_jmobile',
'int');
1603 $themeparam .=
'&THEME_DARKMODEENABLED='.GETPOST(
'THEME_DARKMODEENABLED',
'int');
1606 $themeparam .=
'&THEME_SATURATE_RATIO='.GETPOST(
'THEME_SATURATE_RATIO',
'int');
1609 if (!empty($conf->global->MAIN_ENABLE_FONT_ROBOTO)) {
1610 print
'<link rel="preconnect" href="https://fonts.gstatic.com">'.
"\n";
1611 print
'<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@200;300;400;500;600&display=swap" rel="stylesheet">'.
"\n";
1614 if (!defined(
'DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) {
1615 print
'<!-- Includes CSS for JQuery (Ajax library) -->'.
"\n";
1616 $jquerytheme =
'base';
1617 if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) {
1618 $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
1620 if (constant(
'JS_JQUERY_UI')) {
1621 print
'<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.
'css/'.$jquerytheme.
'/jquery-ui.min.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1623 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/includes/jquery/css/'.$jquerytheme.
'/jquery-ui.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1625 if (!defined(
'DISABLE_JQUERY_JNOTIFY')) {
1626 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1628 if (!defined(
'DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined(
'REQUIRE_JQUERY_MULTISELECT'))) {
1629 $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ?constant(
'REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1630 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/includes/jquery/plugins/'.$tmpplugin.
'/dist/css/'.$tmpplugin.
'.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1634 if (!defined(
'DISABLE_FONT_AWSOME')) {
1635 print
'<!-- Includes CSS for font awesome -->'.
"\n";
1636 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/theme/common/fontawesome-5/css/all.min.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1637 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/theme/common/fontawesome-5/css/v4-shims.min.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1640 print
'<!-- Includes CSS for Dolibarr theme -->'.
"\n";
1644 if (!empty($conf->modules_parts[
'theme'])) {
1645 foreach ($conf->modules_parts[
'theme'] as $reldir) {
1648 $themesubdir = $reldir;
1655 print
'<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.
'">'.
"\n";
1656 if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME)) {
1657 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";
1661 if (!empty($conf->modules_parts[
'css'])) {
1662 $arraycss = (array) $conf->modules_parts[
'css'];
1663 foreach ($arraycss as $modcss => $filescss) {
1664 $filescss = (array) $filescss;
1665 foreach ($filescss as $cssfile) {
1666 if (empty($cssfile)) {
1667 dol_syslog(
"Warning: module ".$modcss.
" declared a css path file into its descriptor that is empty.", LOG_WARNING);
1671 if ($urlforcss && $urlforcss !=
'/') {
1672 print
'<!-- Includes CSS added by module '.$modcss.
' -->'.
"\n".
'<link rel="stylesheet" type="text/css" href="'.$urlforcss;
1674 if (!preg_match(
'/\.css$/i', $cssfile)) {
1679 dol_syslog(
"Warning: module ".$modcss.
" declared a css path file for a file we can't find.", LOG_WARNING);
1685 if (is_array($arrayofcss)) {
1686 foreach ($arrayofcss as $cssfile) {
1687 if (preg_match(
'/^(http|\/\/)/i', $cssfile)) {
1688 $urltofile = $cssfile;
1692 print
'<!-- Includes CSS added by page -->'.
"\n".
'<link rel="stylesheet" type="text/css" title="default" href="'.$urltofile;
1694 if (!preg_match(
'/\.css$/i', $cssfile)) {
1702 if (!defined(
'DISABLE_JQUERY') && !$disablejs && !empty($conf->use_javascript_ajax)) {
1704 print
'<!-- Includes JS for JQuery -->'.
"\n";
1705 if (defined(
'JS_JQUERY') && constant(
'JS_JQUERY')) {
1706 print
'<script src="'.JS_JQUERY.
'jquery.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1708 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/js/jquery.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1710 if (defined(
'JS_JQUERY_UI') && constant(
'JS_JQUERY_UI')) {
1711 print
'<script src="'.JS_JQUERY_UI.
'jquery-ui.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1713 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/js/jquery-ui.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1716 if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined(
'DISABLE_JQUERY_JNOTIFY')) {
1717 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1720 if (empty($disableforlogin) && !defined(
'DISABLE_JQUERY_TABLEDND')) {
1721 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1724 if (empty($disableforlogin) && (empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH ==
'chart') && !defined(
'DISABLE_JS_GRAPH')) {
1725 print
'<script src="'.DOL_URL_ROOT.
'/includes/nnnick/chartjs/dist/chart.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1729 if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !defined(
'DISABLE_JQUERY_JEDITABLE')) {
1730 print
'<!-- JS to manage editInPlace feature -->'.
"\n";
1731 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jeditable/jquery.jeditable.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1732 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1733 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1734 print
'<script>'.
"\n";
1735 print
'var urlSaveInPlace = \''.DOL_URL_ROOT.
'/core/ajax/saveinplace.php\';'.
"\n";
1736 print
'var urlLoadInPlace = \''.DOL_URL_ROOT.
'/core/ajax/loadinplace.php\';'.
"\n";
1737 print
'var tooltipInPlace = \''.$langs->transnoentities(
'ClickToEdit').
'\';
'."\n"; // Added in title attribute of span
1738 print 'var placeholderInPlace = \
' \';'.
"\n";
1739 print
'var cancelInPlace = \''.$langs->trans(
"Cancel").
'\';
'."\n";
1740 print 'var submitInPlace = \
''.$langs->trans(
'Ok').
'\';
'."\n";
1741 print 'var indicatorInPlace = \
'<img src="'.DOL_URL_ROOT.
"/theme/".$conf->theme.
"/img/working.gif".
'">\';'.
"\n";
1742 print
'var withInPlace = 300;';
1743 print
'</script>'.
"\n";
1744 print
'<script src="'.DOL_URL_ROOT.
'/core/js/editinplace.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1745 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1748 if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined(
'REQUIRE_JQUERY_TIMEPICKER')) {
1749 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/timepicker/jquery-ui-timepicker-addon.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1750 print
'<script src="'.DOL_URL_ROOT.
'/core/js/timepicker.js.php?lang='.$langs->defaultlang.($ext ?
'&'.$ext :
'').
'"></script>'.
"\n";
1752 if (!defined(
'DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined(
'REQUIRE_JQUERY_MULTISELECT'))) {
1754 $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ?constant(
'REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1755 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/'.$tmpplugin.
'/dist/js/'.$tmpplugin.
'.full.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1757 if (!defined(
'DISABLE_MULTISELECT')) {
1758 print
'<script src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/multiselect/jquery.multi-select.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1762 if (!$disablejs && !empty($conf->use_javascript_ajax)) {
1764 if (empty($disableforlogin) && (
isModEnabled(
'fckeditor') && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME ==
'ckeditor') && !defined(
'DISABLE_CKEDITOR')) || defined(
'FORCE_CKEDITOR')) {
1765 print
'<!-- Includes JS for CKEditor -->'.
"\n";
1766 $pathckeditor = DOL_URL_ROOT.
'/includes/ckeditor/ckeditor/';
1767 $jsckeditor =
'ckeditor.js';
1768 if (constant(
'JS_CKEDITOR')) {
1770 $pathckeditor = constant(
'JS_CKEDITOR');
1773 print
'/* enable ckeditor by main.inc.php */';
1774 print
'var CKEDITOR_BASEPATH = \''.dol_escape_js($pathckeditor).
'\';
'."\n";
1775 print 'var ckeditorConfig = \
''.dol_escape_js(
dol_buildpath($themesubdir.
'/theme/'.$conf->theme.
'/ckeditor/config.js'.($ext ?
'?'.$ext :
''), 1)).
'\';
'."\n"; // $themesubdir='' in standard usage
1776 print 'var ckeditorFilebrowserBrowseUrl = \
''.DOL_URL_ROOT.
'/core/filemanagerdol/browser/default/browser.php?Connector='.DOL_URL_ROOT.
'/core/filemanagerdol/connectors/php/connector.php\';'.
"\n";
1777 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";
1778 print
'</script>'.
"\n";
1779 print
'<script src="'.$pathckeditor.$jsckeditor.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1781 if (
GETPOST(
'mode',
'aZ09') ==
'Full_inline') {
1782 print
'CKEDITOR.disableAutoInline = false;'.
"\n";
1784 print
'CKEDITOR.disableAutoInline = true;'.
"\n";
1786 print
'</script>'.
"\n";
1790 if (!defined(
'NOBROWSERNOTIF') && !defined(
'NOREQUIREMENU') && !defined(
'NOLOGIN')) {
1791 $enablebrowsernotif =
false;
1792 if (
isModEnabled(
'agenda') && !empty($conf->global->AGENDA_REMINDER_BROWSER)) {
1793 $enablebrowsernotif =
true;
1795 if ($conf->browser->layout ==
'phone') {
1796 $enablebrowsernotif =
false;
1798 if ($enablebrowsernotif) {
1799 print
'<!-- Includes JS of Dolibarr (browser layout = '.$conf->browser->layout.
')-->'.
"\n";
1800 print
'<script src="'.DOL_URL_ROOT.
'/core/js/lib_notification.js.php'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1805 print
'<!-- Includes JS of Dolibarr -->'.
"\n";
1806 print
'<script src="'.DOL_URL_ROOT.
'/core/js/lib_head.js.php?lang='.$langs->defaultlang.($ext ?
'&'.$ext :
'').
'"></script>'.
"\n";
1809 if (!empty($conf->modules_parts[
'js'])) {
1810 $arrayjs = (array) $conf->modules_parts[
'js'];
1811 foreach ($arrayjs as $modjs => $filesjs) {
1812 $filesjs = (array) $filesjs;
1813 foreach ($filesjs as $jsfile) {
1816 if ($urlforjs && $urlforjs !=
'/') {
1817 print
'<!-- Include JS added by module '.$modjs.
'-->'.
"\n".
'<script src="'.$urlforjs.((strpos($jsfile,
'?') ===
false) ?
'?' :
'&').
'lang='.$langs->defaultlang.
'"></script>'.
"\n";
1819 dol_syslog(
"Warning: module ".$modjs.
" declared a js path file for a file we can't find.", LOG_WARNING);
1825 if (is_array($arrayofjs)) {
1826 print
'<!-- Includes JS added by page -->'.
"\n";
1827 foreach ($arrayofjs as $jsfile) {
1828 if (preg_match(
'/^(http|\/\/)/i', $jsfile)) {
1829 print
'<script src="'.$jsfile.((strpos($jsfile,
'?') ===
false) ?
'?' :
'&').
'lang='.$langs->defaultlang.
'"></script>'.
"\n";
1831 print
'<script src="'.dol_buildpath($jsfile, 1).((strpos($jsfile,
'?') ===
false) ?
'?' :
'&').
'lang='.$langs->defaultlang.
'"></script>'.
"\n";
1838 if (!empty($conf->global->ALLOW_THEME_JS)) {
1839 $theme_js =
dol_buildpath(
'/theme/'.$conf->theme.
'/'.$conf->theme.
'.js', 0);
1840 if (file_exists($theme_js)) {
1841 print
'<script src="'.DOL_URL_ROOT.
'/theme/'.$conf->theme.
'/'.$conf->theme.
'.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1845 if (!empty($head)) {
1848 if (!empty($conf->global->MAIN_HTML_HEADER)) {
1849 print $conf->global->MAIN_HTML_HEADER.
"\n";
1852 $parameters = array();
1853 $result = $hookmanager->executeHooks(
'addHtmlHeader', $parameters);
1854 print $hookmanager->resPrint;
1856 print
"</head>\n\n";
1859 $conf->headerdone = 1;
1879 function top_menu($head, $title =
'', $target =
'', $disablejs = 0, $disablehead = 0, $arrayofjs =
'', $arrayofcss =
'', $morequerystring =
'', $helppagename =
'')
1881 global $user, $conf, $langs, $db;
1882 global $dolibarr_main_authentication, $dolibarr_main_demo;
1883 global $hookmanager, $menumanager;
1888 $hookmanager->initHooks(array(
'toprightmenu'));
1893 if (empty($conf->headerdone)) {
1894 $disablenofollow = 0;
1895 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, $disablenofollow);
1896 print
'<body id="mainbody">';
1902 if ((empty($conf->dol_hide_topmenu) ||
GETPOST(
'dol_invisible_topmenu',
'int')) && (!defined(
'NOREQUIREMENU') || !constant(
'NOREQUIREMENU'))) {
1904 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
1908 print
"\n".
'<!-- Start top horizontal -->'.
"\n";
1910 print
'<header id="id-top" class="side-nav-vert'.(GETPOST(
'dol_invisible_topmenu',
'int') ?
' hidden' :
'').
'">';
1913 print
'<div id="tmenu_tooltip'.(empty($conf->global->MAIN_MENU_INVERT) ?
'' :
'invert').
'" class="tmenu">'.
"\n";
1914 $menumanager->atarget = $target;
1915 $menumanager->showmenu(
'top', array(
'searchform'=>$searchform));
1919 $appli = constant(
'DOL_APPLICATION_TITLE');
1920 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1921 $appli = $conf->global->MAIN_APPLICATION_TITLE;
1922 if (preg_match(
'/\d\.\d/', $appli)) {
1923 if (!preg_match(
'/'.preg_quote(DOL_VERSION).
'/', $appli)) {
1924 $appli .=
" (".DOL_VERSION.
")";
1927 $appli .=
" ".DOL_VERSION;
1930 $appli .=
" ".DOL_VERSION;
1934 $appli .=
"<br>".$langs->trans(
"LevelOfFeature").
': '.
getDolGlobalInt(
'MAIN_FEATURES_LEVEL');
1938 $logouthtmltext =
'';
1939 if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1941 if ($_SESSION[
"dol_authmode"] !=
'forceuser' && $_SESSION[
"dol_authmode"] !=
'http') {
1942 $logouthtmltext .= $langs->trans(
"Logout").
'<br>';
1944 $logouttext .=
'<a accesskey="l" href="'.DOL_URL_ROOT.
'/user/logout.php?token='.
newToken().
'">';
1945 $logouttext .=
img_picto($langs->trans(
'Logout'),
'sign-out',
'',
false, 0, 0,
'',
'atoplogin');
1946 $logouttext .=
'</a>';
1948 $logouthtmltext .= $langs->trans(
"NoLogoutProcessWithAuthMode", $_SESSION[
"dol_authmode"]);
1949 $logouttext .=
img_picto($langs->trans(
'Logout'),
'sign-out',
'',
false, 0, 0,
'',
'atoplogin opacitymedium');
1953 print
'<div class="login_block usedropdown">'.
"\n";
1955 $toprightmenu .=
'<div class="login_block_other">';
1958 $parameters = array();
1959 $result = $hookmanager->executeHooks(
'printTopRightMenu', $parameters);
1960 if (is_numeric($result)) {
1962 $toprightmenu .= $hookmanager->resPrint;
1964 $toprightmenu = $hookmanager->resPrint;
1967 $toprightmenu .= $result;
1972 $text =
'<a href="'.DOL_URL_ROOT.
'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="modulebuilder">';
1974 $text .=
'<span class="fa fa-bug atoplogin valignmiddle"></span>';
1976 $toprightmenu .=
$form->textwithtooltip(
'', $langs->trans(
"ModuleBuilder"), 2, 1, $text,
'login_block_elem', 2);
1980 if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1983 if (isset($_POST) && is_array($_POST)) {
1984 foreach ($_POST as $key => $value) {
1985 if ($key !==
'action' && $key !==
'password' && !is_array($value)) {
1986 $qs .=
'&'.$key.
'='.urlencode($value);
1990 $qs .= (($qs && $morequerystring) ?
'&' :
'').$morequerystring;
1991 $text =
'<a href="'.dol_escape_htmltag($_SERVER[
"PHP_SELF"]).
'?'.$qs.($qs ?
'&' :
'').
'optioncss=print" target="_blank" rel="noopener noreferrer">';
1993 $text .=
'<span class="fa fa-print atoplogin valignmiddle"></span>';
1995 $toprightmenu .=
$form->textwithtooltip(
'', $langs->trans(
"PrintContentArea"), 2, 1, $text,
'login_block_elem', 2);
1999 if (empty($conf->global->MAIN_HELP_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
2000 $langs->load(
"help");
2007 if (empty($helppagename)) {
2008 $helppagename =
'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios';
2010 $helppresent =
'helppresent';
2015 $helpbaseurl = $arrayres[
'helpbaseurl'];
2016 $helppage = $arrayres[
'helppage'];
2017 $mode = $arrayres[
'mode'];
2020 if ($helpbaseurl && $helppage) {
2022 $title = $langs->trans($mode ==
'wiki' ?
'GoToWikiHelpPage' :
'GoToHelpPage').
', ';
2023 if ($mode ==
'wiki') {
2024 $title .=
'<br>'.img_picto(
'',
'globe',
'class="pictofixedwidth"').$langs->trans(
"PageWiki").
' '.
dol_escape_htmltag(
'"'.strtr($helppage,
'_',
' ').
'"');
2026 $title .=
' <span class="opacitymedium">('.$langs->trans(
"DedicatedPageAvailable").
')</span>';
2028 $title .=
' <span class="opacitymedium">('.$langs->trans(
"HomePage").
')</span>';
2031 $text .=
'<a class="help" target="_blank" rel="noopener noreferrer" href="';
2032 if ($mode ==
'wiki') {
2033 $text .= sprintf($helpbaseurl, urlencode(html_entity_decode($helppage)));
2035 $text .= sprintf($helpbaseurl, $helppage);
2038 $text .=
'<span class="fa fa-question-circle atoplogin valignmiddle'.($helppresent ?
' '.$helppresent :
'').
'"></span>';
2039 $text .=
'<span class="fa fa-long-arrow-alt-up helppresentcircle'.($helppresent ?
'' :
' unvisible').
'"></span>';
2041 $toprightmenu .=
$form->textwithtooltip(
'', $title, 2, 1, $text,
'login_block_elem', 2);
2045 if (!empty($conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) {
2046 $langs->load(
'admin');
2047 $appli .=
'<br>'.$langs->trans(
"Database").
': '.$db->database_name;
2051 if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
2052 $text =
'<span class="aversion"><span class="hideonsmartphone small">'.DOL_VERSION.
'</span></span>';
2053 $toprightmenu .=
$form->textwithtooltip(
'', $appli, 2, 1, $text,
'login_block_elem', 2);
2057 $toprightmenu .=
$form->textwithtooltip(
'', $logouthtmltext, 2, 1, $logouttext,
'login_block_elem logout-btn', 2);
2059 $toprightmenu .=
'</div>';
2063 $toprightmenu .=
'<div class="login_block_user">';
2067 $toprightmenu .=
'<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">';
2069 if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) {
2074 if (!empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) {
2085 $toprightmenu .=
'</div></div>';
2087 $toprightmenu .=
'</div>'.
"\n";
2090 print $toprightmenu;
2097 print
'<div style="clear: both;"></div>';
2098 print
"<!-- End top horizontal menu -->\n\n";
2101 if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) {
2102 print
'<!-- Begin div id-container --><div id="id-container" class="id-container">';
2116 global $langs, $conf, $db, $hookmanager, $user, $mysoc;
2117 global $dolibarr_main_authentication, $dolibarr_main_demo;
2118 global $menumanager;
2120 $langs->load(
'companies');
2122 $userImage = $userDropDownImage =
'';
2123 if (!empty($user->photo)) {
2124 $userImage =
Form::showphoto(
'userphoto', $user, 0, 0, 0,
'photouserphoto userphoto',
'small', 0, 1);
2125 $userDropDownImage =
Form::showphoto(
'userphoto', $user, 0, 0, 0,
'dropdown-user-image',
'small', 0, 1);
2127 $nophoto =
'/public/theme/common/user_anonymous.png';
2128 if ($user->gender ==
'man') {
2129 $nophoto =
'/public/theme/common/user_man.png';
2131 if ($user->gender ==
'woman') {
2132 $nophoto =
'/public/theme/common/user_woman.png';
2135 $userImage =
'<img class="photo photouserphoto userphoto" alt="No photo" src="'.DOL_URL_ROOT.$nophoto.
'">';
2136 $userDropDownImage =
'<img class="photo dropdown-user-image" alt="No photo" src="'.DOL_URL_ROOT.$nophoto.
'">';
2140 $dropdownBody .=
'<span id="topmenulogincompanyinfo-btn"><i class="fa fa-caret-right"></i> '.$langs->trans(
"ShowCompanyInfos").
'</span>';
2141 $dropdownBody .=
'<div id="topmenulogincompanyinfo" >';
2143 if ($langs->transcountry(
"ProfId1", $mysoc->country_code) !=
'-') {
2146 if ($langs->transcountry(
"ProfId2", $mysoc->country_code) !=
'-') {
2149 if ($langs->transcountry(
"ProfId3", $mysoc->country_code) !=
'-') {
2152 if ($langs->transcountry(
"ProfId4", $mysoc->country_code) !=
'-') {
2155 if ($langs->transcountry(
"ProfId5", $mysoc->country_code) !=
'-') {
2158 if ($langs->transcountry(
"ProfId6", $mysoc->country_code) !=
'-') {
2162 $dropdownBody .=
'<br><b>'.$langs->trans(
"Country").
'</b>: <span>'.($mysoc->country_code ? $langs->trans(
"Country".$mysoc->country_code) :
'').
'</span>';
2164 $dropdownBody .=
'</div>';
2166 $dropdownBody .=
'<br>';
2167 $dropdownBody .=
'<span id="topmenuloginmoreinfo-btn"><i class="fa fa-caret-right"></i> '.$langs->trans(
"ShowMoreInfos").
'</span>';
2168 $dropdownBody .=
'<div id="topmenuloginmoreinfo" >';
2171 if (!empty($user->admin)) {
2172 $dropdownBody .=
'<br><b>'.$langs->trans(
"Administrator").
'</b>: '.
yn($user->admin);
2174 if (!empty($user->socid)) {
2175 $thirdpartystatic =
new Societe($db);
2176 $thirdpartystatic->fetch($user->socid);
2177 $companylink =
' '.$thirdpartystatic->getNomUrl(2);
2178 $company =
' ('.$langs->trans(
"Company").
': '.$thirdpartystatic->name.
')';
2180 $type = ($user->socid ? $langs->trans(
"External").$company : $langs->trans(
"Internal"));
2181 $dropdownBody .=
'<br><b>'.$langs->trans(
"Type").
':</b> '.$type;
2182 $dropdownBody .=
'<br><b>'.$langs->trans(
"Status").
'</b>: '.$user->getLibStatut(0);
2183 $dropdownBody .=
'<br>';
2185 $dropdownBody .=
'<br><u>'.$langs->trans(
"Session").
'</u>';
2186 $dropdownBody .=
'<br><b>'.$langs->trans(
"IPAddress").
'</b>: '.
dol_escape_htmltag($_SERVER[
"REMOTE_ADDR"]);
2187 if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) {
2188 $dropdownBody .=
'<br><b>'.$langs->trans(
"ConnectedOnMultiCompany").
':</b> '.$conf->entity.
' (user entity '.$user->entity.
')';
2190 $dropdownBody .=
'<br><b>'.$langs->trans(
"AuthenticationMode").
':</b> '.$_SESSION[
"dol_authmode"].(empty($dolibarr_main_demo) ?
'' :
' (demo)');
2191 $dropdownBody .=
'<br><b>'.$langs->trans(
"ConnectedSince").
':</b> '.
dol_print_date($user->datelastlogin,
"dayhour",
'tzuser');
2192 $dropdownBody .=
'<br><b>'.$langs->trans(
"PreviousConnexion").
':</b> '.
dol_print_date($user->datepreviouslogin,
"dayhour",
'tzuser');
2193 $dropdownBody .=
'<br><b>'.$langs->trans(
"CurrentTheme").
':</b> '.$conf->theme;
2194 $dropdownBody .=
'<br><b>'.$langs->trans(
"CurrentMenuManager").
':</b> '.(isset($menumanager) ? $menumanager->name :
'unknown');
2196 $dropdownBody .=
'<br><b>'.$langs->trans(
"CurrentUserLanguage").
':</b> '.($langFlag ? $langFlag.
' ' :
'').$langs->getDefaultLang();
2198 $tz = (int) $_SESSION[
'dol_tz'] + (
int) $_SESSION[
'dol_dst'];
2199 $dropdownBody .=
'<br><b>'.$langs->trans(
"ClientTZ").
':</b> '.($tz ? ($tz >= 0 ?
'+' :
'').$tz :
'');
2200 $dropdownBody .=
' ('.$_SESSION[
'dol_tz_string'].
')';
2205 $dropdownBody .=
'<br><b>'.$langs->trans(
"Browser").
':</b> '.$conf->browser->name.($conf->browser->version ?
' '.$conf->browser->version :
'').
' ('.
dol_escape_htmltag($_SERVER[
'HTTP_USER_AGENT']).
')';
2206 $dropdownBody .=
'<br><b>'.$langs->trans(
"Layout").
':</b> '.$conf->browser->layout;
2207 $dropdownBody .=
'<br><b>'.$langs->trans(
"Screen").
':</b> '.$_SESSION[
'dol_screenwidth'].
' x '.$_SESSION[
'dol_screenheight'];
2208 if ($conf->browser->layout ==
'phone') {
2209 $dropdownBody .=
'<br><b>'.$langs->trans(
"Phone").
':</b> '.$langs->trans(
"Yes");
2211 if (!empty($_SESSION[
"disablemodules"])) {
2212 $dropdownBody .=
'<br><b>'.$langs->trans(
"DisabledModules").
':</b> <br>'.join(
', ', explode(
',', $_SESSION[
"disablemodules"]));
2214 $dropdownBody .=
'</div>';
2217 $parameters = array(
'user'=>$user,
'langs' => $langs);
2218 $result = $hookmanager->executeHooks(
'printTopRightMenuLoginDropdownBody', $parameters);
2219 if (is_numeric($result)) {
2221 $dropdownBody .= $hookmanager->resPrint;
2223 $dropdownBody = $hookmanager->resPrint;
2227 if (empty($urllogout)) {
2228 $urllogout = DOL_URL_ROOT.
'/user/logout.php?token='.
newToken();
2230 $logoutLink =
'<a accesskey="l" href="'.$urllogout.
'" class="button-top-menu-dropdown" ><i class="fa fa-sign-out-alt"></i> '.$langs->trans(
"Logout").
'</a>';
2231 $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>';
2234 $profilName = $user->getFullName($langs).
' ('.$user->login.
')';
2236 if (!empty($user->admin)) {
2237 $profilName =
'<i class="far fa-star classfortooltip" title="'.$langs->trans(
"Administrator").
'" ></i> '.$profilName;
2241 $appli = constant(
'DOL_APPLICATION_TITLE');
2242 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
2243 $appli = $conf->global->MAIN_APPLICATION_TITLE;
2244 if (preg_match(
'/\d\.\d/', $appli)) {
2245 if (!preg_match(
'/'.preg_quote(DOL_VERSION).
'/', $appli)) {
2246 $appli .=
" (".DOL_VERSION.
")";
2249 $appli .=
" ".DOL_VERSION;
2252 $appli .=
" ".DOL_VERSION;
2255 if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
2256 $btnUser =
'<!-- div for user link -->
2257 <div id="topmenu-login-dropdown" class="userimg atoplogin dropdown user user-menu inline-block">
2258 <a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$user->id.
'" class="dropdown-toggle login-dropdown-a" data-toggle="dropdown">
2259 '.$userImage.(empty($user->photo) ?
'<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone paddingleft">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).
'</span>' :
'').
'
2261 <div class="dropdown-menu">
2263 <div class="user-header">
2264 '.$userDropDownImage.
'
2266 '.$profilName.
'<br>';
2267 if ($user->datelastlogin) {
2268 $title = $langs->trans(
"ConnectedSince").
' : '.
dol_print_date($user->datelastlogin,
"dayhour",
'tzuser');
2269 if ($user->datepreviouslogin) {
2270 $title .=
'<br>'.$langs->trans(
"PreviousConnexion").
' : '.
dol_print_date($user->datepreviouslogin,
"dayhour",
'tzuser');
2273 $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>';
2274 if ($user->datepreviouslogin) {
2275 $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>';
2284 <div class="user-body">'.$dropdownBody.
'</div>
2287 <div class="user-footer">
2288 <div class="pull-left">
2291 <div class="pull-right">
2294 <div style="clear:both;"></div>
2300 $btnUser =
'<!-- div for user link -->
2301 <div id="topmenu-login-dropdown" class="userimg atoplogin dropdown user user-menu inline-block">
2302 <a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$user->id.
'">
2304 <span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone">'.
dol_trunc($user->firstname ? $user->firstname : $user->login, 10).
'</span>
2309 if (!defined(
'JS_JQUERY_DISABLE_DROPDOWN') && !empty($conf->use_javascript_ajax)) {
2311 <!-- Code to show/hide the user drop-down -->
2313 $( document ).ready(function() {
2314 $(document).on("click", function(event) {
2315 if (!$(event.target).closest("#topmenu-login-dropdown").length) {
2316 //console.log("close login dropdown");
2318 $("#topmenu-login-dropdown").removeClass("open");
2323 if ($conf->theme !=
'md') {
2325 $("#topmenu-login-dropdown .dropdown-toggle").on("click", function(event) {
2326 console.log("toggle login dropdown");
2327 event.preventDefault();
2328 $("#topmenu-login-dropdown").toggleClass("open");
2331 $("#topmenulogincompanyinfo-btn").on("click", function() {
2332 console.log("Clik on topmenulogincompanyinfo-btn");
2333 $("#topmenulogincompanyinfo").slideToggle();
2336 $("#topmenuloginmoreinfo-btn").on("click", function() {
2337 console.log("Clik on topmenuloginmoreinfo-btn");
2338 $("#topmenuloginmoreinfo").slideToggle();
2362 $html .=
'<!-- div for quick add link -->
2363 <div id="topmenu-quickadd-dropdown" class="atoplogin dropdown inline-block">
2364 <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>
2368 <!-- Code to show/hide the user drop-down -->
2370 $( document ).ready(function() {
2371 $(document).on("click", function(event) {
2372 if (!$(event.target).closest("#topmenu-quickadd-dropdown").length) {
2374 $("#topmenu-quickadd-dropdown").removeClass("open");
2377 $("#topmenu-quickadd-dropdown .dropdown-toggle").on("click", function(event) {
2378 openQuickAddDropDown();
2381 $(document).keydown(function(e){
2382 if( e.which === 76 && e.ctrlKey && e.shiftKey ){
2383 console.log(\'control + shift + l : trigger open quick add dropdown\');
2384 openQuickAddDropDown();
2389 var openQuickAddDropDown = function() {
2390 event.preventDefault();
2391 $("#topmenu-quickadd-dropdown").toggleClass("open");
2392 //$("#top-quickadd-search-input").focus();
2407 global $conf, $user, $langs, $hookmanager;
2412 "url" =>
"/adherents/card.php?action=create&mainmenu=members",
2413 "title" =>
"MenuNewMember@members",
2414 "name" =>
"Adherent@members",
2415 "picto" =>
"object_member",
2416 "activation" => !empty($conf->adherent->enabled) && $user->rights->adherent->creer,
2420 "url" =>
"/societe/card.php?action=create&mainmenu=companies",
2421 "title" =>
"MenuNewThirdParty@companies",
2422 "name" =>
"ThirdParty@companies",
2423 "picto" =>
"object_company",
2424 "activation" => !empty($conf->societe->enabled) && $user->rights->societe->creer,
2428 "url" =>
"/contact/card.php?action=create&mainmenu=companies",
2429 "title" =>
"NewContactAddress@companies",
2430 "name" =>
"Contact@companies",
2431 "picto" =>
"object_contact",
2432 "activation" => !empty($conf->societe->enabled) && $user->rights->societe->contact->creer,
2436 "url" =>
"/comm/propal/card.php?action=create&mainmenu=commercial",
2437 "title" =>
"NewPropal@propal",
2438 "name" =>
"Proposal@propal",
2439 "picto" =>
"object_propal",
2440 "activation" => !empty($conf->propal->enabled) && $user->rights->propale->creer,
2445 "url" =>
"/commande/card.php?action=create&mainmenu=commercial",
2446 "title" =>
"NewOrder@orders",
2447 "name" =>
"Order@orders",
2448 "picto" =>
"object_order",
2449 "activation" => !empty($conf->commande->enabled) && $user->rights->commande->creer,
2453 "url" =>
"/compta/facture/card.php?action=create&mainmenu=billing",
2454 "title" =>
"NewBill@bills",
2455 "name" =>
"Bill@bills",
2456 "picto" =>
"object_bill",
2457 "activation" =>
isModEnabled(
'facture') && $user->rights->facture->creer,
2461 "url" =>
"/contrat/card.php?action=create&mainmenu=commercial",
2462 "title" =>
"NewContractSubscription@contracts",
2463 "name" =>
"Contract@contracts",
2464 "picto" =>
"object_contract",
2465 "activation" => !empty($conf->contrat->enabled) && $user->rights->contrat->creer,
2469 "url" =>
"/supplier_proposal/card.php?action=create&mainmenu=commercial",
2470 "title" =>
"SupplierProposalNew@supplier_proposal",
2471 "name" =>
"SupplierProposal@supplier_proposal",
2472 "picto" =>
"supplier_proposal",
2473 "activation" => !empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer,
2477 "url" =>
"/fourn/commande/card.php?action=create&mainmenu=commercial",
2478 "title" =>
"NewSupplierOrderShort@orders",
2479 "name" =>
"SupplierOrder@orders",
2480 "picto" =>
"supplier_order",
2481 "activation" => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->creer) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->creer),
2485 "url" =>
"/fourn/facture/card.php?action=create&mainmenu=billing",
2486 "title" =>
"NewBill@bills",
2487 "name" =>
"SupplierBill@bills",
2488 "picto" =>
"supplier_invoice",
2489 "activation" => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->creer) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->creer),
2493 "url" =>
"/product/card.php?action=create&type=0&mainmenu=products",
2494 "title" =>
"NewProduct@products",
2495 "name" =>
"Product@products",
2496 "picto" =>
"object_product",
2497 "activation" => !empty($conf->product->enabled) && $user->rights->produit->creer,
2501 "url" =>
"/product/card.php?action=create&type=1&mainmenu=products",
2502 "title" =>
"NewService@products",
2503 "name" =>
"Service@products",
2504 "picto" =>
"object_service",
2505 "activation" => !empty($conf->service->enabled) && $user->rights->service->creer,
2509 "url" =>
"/user/card.php?action=create&type=1&mainmenu=home",
2510 "title" =>
"AddUser@users",
2511 "name" =>
"User@users",
2513 "activation" => $user->rights->user->user->creer,
2519 $dropDownQuickAddHtml =
'';
2522 $dropDownQuickAddHtml .=
'<div class="quickadd-body dropdown-body">';
2523 $dropDownQuickAddHtml .=
'<div class="dropdown-quickadd-list">';
2526 $parameters = array();
2527 $hook_items = $items;
2528 $reshook = $hookmanager->executeHooks(
'menuDropdownQuickaddItems', $parameters, $hook_items);
2529 if (is_numeric($reshook) && !empty($hookmanager->results) && is_array($hookmanager->results)) {
2530 if ($reshook == 0) {
2531 $items[
'items'] = array_merge($items[
'items'], $hookmanager->results);
2533 $items = $hookmanager->results;
2537 $position = array();
2538 foreach ($items[
'items'] as $key => $row) {
2539 $position[$key] = $row[
'position'];
2541 $array1_sort_order = SORT_ASC;
2542 array_multisort($position, $array1_sort_order, $items[
'items']);
2545 foreach ($items[
'items'] as $item) {
2546 if (!$item[
'activation']) {
2549 $langs->load(explode(
'@', $item[
'title'])[1]);
2550 $langs->load(explode(
'@', $item[
'name'])[1]);
2551 $dropDownQuickAddHtml .=
'
2552 <a class="dropdown-item quickadd-item" href="'.DOL_URL_ROOT.$item[
'url'].
'" title="'.$langs->trans(explode(
'@', $item[
'title'])[0]).
'">
2553 '.
img_picto(
'', $item[
'picto'],
'style="width:18px;"') .
' ' . $langs->trans(explode(
'@', $item[
'name'])[0]) .
'</a>
2557 $dropDownQuickAddHtml .=
'</div>';
2558 $dropDownQuickAddHtml .=
'</div>';
2560 return $dropDownQuickAddHtml;
2570 global $langs, $conf, $db, $user;
2575 if (empty($conf->bookmark->enabled) || empty($user->rights->bookmark->lire)) {
2579 if (!defined(
'JS_JQUERY_DISABLE_DROPDOWN') && !empty($conf->use_javascript_ajax)) {
2580 include_once DOL_DOCUMENT_ROOT.
'/bookmarks/bookmarks.lib.php';
2581 $langs->load(
"bookmarks");
2583 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
2584 $html .=
'<div id="topmenu-bookmark-dropdown" class="dropdown inline-block">';
2588 $html .=
'<!-- div for bookmark link -->
2589 <div id="topmenu-bookmark-dropdown" class="dropdown inline-block">
2590 <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>
2591 <div class="dropdown-menu">
2597 <!-- Code to show/hide the bookmark drop-down -->
2599 $( document ).ready(function() {
2600 $(document).on("click", function(event) {
2601 if (!$(event.target).closest("#topmenu-bookmark-dropdown").length) {
2602 //console.log("close bookmark dropdown - we click outside");
2604 $("#topmenu-bookmark-dropdown").removeClass("open");
2608 $("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) {
2609 console.log("toggle bookmark dropdown");
2610 openBookMarkDropDown();
2614 $(document).keydown(function(e){
2615 if( e.which === 77 && e.ctrlKey && e.shiftKey ){
2616 console.log(\'control + shift + m : trigger open bookmark dropdown\');
2617 openBookMarkDropDown();
2622 var openBookMarkDropDown = function() {
2623 event.preventDefault();
2624 $("#topmenu-bookmark-dropdown").toggleClass("open");
2625 $("#top-bookmark-search-input").focus();
2643 global $langs, $conf, $db, $user, $hookmanager;
2648 $arrayresult = null;
2649 include DOL_DOCUMENT_ROOT.
'/core/ajax/selectsearchbox.php';
2651 $defaultAction =
'';
2652 $buttonList =
'<div class="dropdown-global-search-button-list" >';
2654 foreach ($arrayresult as $keyItem => $item) {
2655 if (empty($defaultAction)) {
2656 $defaultAction = $item[
'url'];
2658 $buttonList .=
'<button class="dropdown-item global-search-item" data-target="'.dol_escape_htmltag($item[
'url']).
'" >';
2659 $buttonList .= $item[
'text'];
2660 $buttonList .=
'</button>';
2662 $buttonList .=
'</div>';
2665 $searchInput =
'<input name="sall" id="top-global-search-input" class="dropdown-search-input" placeholder="'.$langs->trans(
'Search').
'" autocomplete="off" >';
2667 $dropDownHtml =
'<form id="top-menu-action-search" name="actionsearch" method="GET" action="'.$defaultAction.
'" >';
2670 <!-- search input -->
2671 <div class="dropdown-header search-dropdown-header">
2678 <div class="dropdown-body search-dropdown-body">
2683 $dropDownHtml .=
'</form>';
2686 $html .=
'<!-- div for Global Search -->
2687 <div id="topmenu-global-search-dropdown" class="atoplogin dropdown inline-block">
2688 <a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans(
'Search').
' ('.$langs->trans(
'SearchMenuShortCut').
')">
2689 <i class="fa fa-search" ></i>
2691 <div class="dropdown-menu dropdown-search">
2697 <!-- Code to show/hide the user drop-down -->
2699 $( document ).ready(function() {
2701 // prevent submiting form on press ENTER
2702 $("#top-global-search-input").keydown(function (e) {
2703 if (e.keyCode == 13) {
2704 var inputs = $(this).parents("form").eq(0).find(":button");
2705 if (inputs[inputs.index(this) + 1] != null) {
2706 inputs[inputs.index(this) + 1].focus();
2714 $(document).keydown(function(e) {
2715 // Get the focused element:
2716 var $focused = $(":focus");
2717 if($focused.length && $focused.hasClass("global-search-item")){
2719 // UP - move to the previous line
2720 if (e.keyCode == 38) {
2722 $focused.prev().focus();
2725 // DOWN - move to the next line
2726 if (e.keyCode == 40) {
2728 $focused.next().focus();
2734 // submit form action
2735 $(".dropdown-global-search-button-list .global-search-item").on("click", function(event) {
2736 $("#top-menu-action-search").attr("action", $(this).data("target"));
2737 $("#top-menu-action-search").submit();
2741 $(document).on("click", function(event) {
2742 if (!$(event.target).closest("#topmenu-global-search-dropdown").length) {
2743 console.log("click close search - we click outside");
2745 $("#topmenu-global-search-dropdown").removeClass("open");
2750 $("#topmenu-global-search-dropdown .dropdown-toggle").on("click", function(event) {
2751 console.log("toggle search dropdown");
2752 openGlobalSearchDropDown();
2756 $(document).keydown(function(e){
2757 if( e.which === 70 && e.ctrlKey && e.shiftKey ){
2758 console.log(\'control + shift + f : trigger open global-search dropdown\');
2759 openGlobalSearchDropDown();
2764 var openGlobalSearchDropDown = function() {
2765 $("#topmenu-global-search-dropdown").toggleClass("open");
2766 $("#top-global-search-input").focus();
2790 function left_menu($menu_array_before, $helppagename =
'', $notused =
'', $menu_array_after =
'', $leftmenuwithoutmainarea = 0, $title =
'', $acceptdelayedhtml = 0)
2792 global $user, $conf, $langs, $db,
$form;
2793 global $hookmanager, $menumanager;
2797 if (!empty($menu_array_before)) {
2798 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);
2801 if (empty($conf->dol_hide_leftmenu) && (!defined(
'NOREQUIREMENU') || !constant(
'NOREQUIREMENU'))) {
2803 $hookmanager->initHooks(array(
'searchform',
'leftblock'));
2805 print
"\n".
'<!-- Begin side-nav id-left -->'.
"\n".
'<div class="side-nav"><div id="id-left">'.
"\n";
2807 if ($conf->browser->layout ==
'phone') {
2808 $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1;
2813 if (!is_object($form)) {
2814 $form =
new Form($db);
2817 if (empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) {
2819 $arrayresult = null;
2820 include DOL_DOCUMENT_ROOT.
'/core/ajax/selectsearchbox.php';
2822 if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
2823 $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);
2825 if (is_array($arrayresult)) {
2826 foreach ($arrayresult as $key => $val) {
2827 $searchform .=
printSearchForm($val[
'url'], $val[
'url'], $val[
'label'],
'maxwidth125',
'sall', (empty($val[
'shortcut']) ?
'' : $val[
'shortcut']),
'searchleft'.$key, $val[
'img']);
2833 $parameters = array(
'searchform' => $searchform);
2834 $reshook = $hookmanager->executeHooks(
'printSearchForm', $parameters);
2835 if (empty($reshook)) {
2836 $searchform .= $hookmanager->resPrint;
2838 $searchform = $hookmanager->resPrint;
2842 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax)) {
2843 $urltosearch = DOL_URL_ROOT.
'/core/search_page.php?showtitlebefore=1';
2844 $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>';
2845 } elseif ($conf->use_javascript_ajax && !empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
2846 $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>';
2847 $searchform .=
'<script>
2848 jQuery(document).ready(function () {
2849 jQuery("#divsearchforms1").click(function(){
2850 jQuery("#divsearchforms2").toggle();
2854 $searchform .=
'</div>';
2859 print
'<!-- Begin left menu -->'.
"\n";
2861 print
'<div class="vmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ?
'' :
' title="Left menu"').
'>'.
"\n\n";
2864 $menumanager->menu_array = $menu_array_before;
2865 $menumanager->menu_array_after = $menu_array_after;
2866 $menumanager->showmenu(
'left', array(
'searchform'=>$searchform));
2870 print
"<!-- Begin Help Block-->\n";
2871 print
'<div id="blockvmenuhelp" class="blockvmenuhelp">'.
"\n";
2874 if (!empty($conf->global->MAIN_SHOW_VERSION)) {
2875 $doliurl =
'https://www.dolibarr.org';
2877 if (preg_match(
'/fr/i', $langs->defaultlang)) {
2878 $doliurl =
'https://www.dolibarr.fr';
2880 if (preg_match(
'/es/i', $langs->defaultlang)) {
2881 $doliurl =
'https://www.dolibarr.es';
2883 if (preg_match(
'/de/i', $langs->defaultlang)) {
2884 $doliurl =
'https://www.dolibarr.de';
2886 if (preg_match(
'/it/i', $langs->defaultlang)) {
2887 $doliurl =
'https://www.dolibarr.it';
2889 if (preg_match(
'/gr/i', $langs->defaultlang)) {
2890 $doliurl =
'https://www.dolibarr.gr';
2893 $appli = constant(
'DOL_APPLICATION_TITLE');
2894 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
2895 $appli = $conf->global->MAIN_APPLICATION_TITLE; $doliurl =
'';
2896 if (preg_match(
'/\d\.\d/', $appli)) {
2897 if (!preg_match(
'/'.preg_quote(DOL_VERSION).
'/', $appli)) {
2898 $appli .=
" (".DOL_VERSION.
")";
2901 $appli .=
" ".DOL_VERSION;
2904 $appli .=
" ".DOL_VERSION;
2906 print
'<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
2908 print
'<a class="help" target="_blank" rel="noopener noreferrer" href="'.$doliurl.
'">';
2910 print
'<span class="help">';
2918 print
'</div>'.
"\n";
2922 if (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) {
2923 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
2925 if ($conf->global->MAIN_BUGTRACK_ENABLELINK ==
'github') {
2926 $bugbaseurl =
'https://github.com/Dolibarr/dolibarr/issues/new?labels=Bug';
2927 $bugbaseurl .=
'&title=';
2928 $bugbaseurl .= urlencode(
"Bug: ");
2929 $bugbaseurl .=
'&body=';
2930 $bugbaseurl .= urlencode(
"# Instructions\n");
2931 $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");
2932 $bugbaseurl .= urlencode(
"*Please:*\n");
2933 $bugbaseurl .= urlencode(
"- *replace the bracket enclosed texts with meaningful information*\n");
2934 $bugbaseurl .= urlencode(
"- *remove any unused sub-section*\n");
2935 $bugbaseurl .= urlencode(
"\n");
2936 $bugbaseurl .= urlencode(
"\n");
2937 $bugbaseurl .= urlencode(
"# Bug\n");
2938 $bugbaseurl .= urlencode(
"[*Short description*]\n");
2939 $bugbaseurl .= urlencode(
"\n");
2940 $bugbaseurl .= urlencode(
"## Environment\n");
2941 $bugbaseurl .= urlencode(
"- **Version**: ".DOL_VERSION.
"\n");
2942 $bugbaseurl .= urlencode(
"- **OS**: ".php_uname(
's').
"\n");
2943 $bugbaseurl .= urlencode(
"- **Web server**: ".$_SERVER[
"SERVER_SOFTWARE"].
"\n");
2944 $bugbaseurl .= urlencode(
"- **PHP**: ".php_sapi_name().
' '.phpversion().
"\n");
2945 $bugbaseurl .= urlencode(
"- **Database**: ".$db::LABEL.
' '.$db->getVersion().
"\n");
2946 $bugbaseurl .= urlencode(
"- **URL(s)**: ".$_SERVER[
"REQUEST_URI"].
"\n");
2947 $bugbaseurl .= urlencode(
"\n");
2948 $bugbaseurl .= urlencode(
"## Expected and actual behavior\n");
2949 $bugbaseurl .= urlencode(
"[*Verbose description*]\n");
2950 $bugbaseurl .= urlencode(
"\n");
2951 $bugbaseurl .= urlencode(
"## Steps to reproduce the behavior\n");
2952 $bugbaseurl .= urlencode(
"[*Verbose description*]\n");
2953 $bugbaseurl .= urlencode(
"\n");
2954 $bugbaseurl .= urlencode(
"## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…)\n");
2955 $bugbaseurl .= urlencode(
"[*Files*]\n");
2956 $bugbaseurl .= urlencode(
"\n");
2958 $bugbaseurl .= urlencode(
"\n");
2959 $bugbaseurl .= urlencode(
"## Report\n");
2960 } elseif (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) {
2961 $bugbaseurl = $conf->global->MAIN_BUGTRACK_ENABLELINK;
2967 $parameters = array(
'bugbaseurl' => $bugbaseurl);
2968 $reshook = $hookmanager->executeHooks(
'printBugtrackInfo', $parameters);
2969 if (empty($reshook)) {
2970 $bugbaseurl .= $hookmanager->resPrint;
2972 $bugbaseurl = $hookmanager->resPrint;
2975 print
'<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">';
2976 print
'<a class="help" target="_blank" rel="noopener noreferrer" href="'.$bugbaseurl.
'">'.$langs->trans(
"FindBug").
'</a>';
2981 print
"<!-- End Help Block-->\n";
2985 print
"<!-- End left menu -->\n";
2989 $parameters = array();
2990 $reshook = $hookmanager->executeHooks(
'printLeftBlock', $parameters);
2991 print $hookmanager->resPrint;
2993 print
'</div></div> <!-- End side-nav id-left -->';
2997 print
'<!-- Begin right area -->'.
"\n";
2999 if (empty($leftmenuwithoutmainarea)) {
3013 global $conf, $langs, $hookmanager;
3015 if (empty($conf->dol_hide_leftmenu)) {
3016 print
'<div id="id-right">';
3021 print
'<!-- Begin div class="fiche" -->'.
"\n".
'<div class="fiche">'.
"\n";
3023 $hookmanager->initHooks(array(
'main'));
3024 $parameters = array();
3025 $reshook = $hookmanager->executeHooks(
'printMainArea', $parameters);
3026 print $hookmanager->resPrint;
3028 if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
3029 print
info_admin($langs->trans(
"WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED), 0, 0, 1,
'warning maintenancemode');
3033 if (!empty($conf->global->SHOW_SOCINFO_ON_PRINT) &&
GETPOST(
'optioncss',
'aZ09') ==
'print' && empty(
GETPOST(
'disable_show_socinfo_on_print',
'az09'))) {
3034 $parameters = array();
3035 $reshook = $hookmanager->executeHooks(
'showSocinfoOnPrint', $parameters);
3036 if (empty($reshook)) {
3037 print
'<!-- Begin show mysoc info header -->'.
"\n";
3038 print
'<div id="mysoc-info-header">'.
"\n";
3039 print
'<table class="centpercent div-table-responsive">'.
"\n";
3041 print
'<tr><td rowspan="0" class="width20p">';
3042 if ($conf->global->MAIN_SHOW_LOGO && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($conf->global->MAIN_INFO_SOCIETE_LOGO)) {
3043 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)).
'">';
3045 print
'</td><td rowspan="0" class="width50p"></td></tr>'.
"\n";
3046 print
'<tr><td class="titre bold">'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM).
'</td></tr>'.
"\n";
3047 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";
3048 if (!empty($conf->global->MAIN_INFO_SOCIETE_TEL)) {
3049 print
'<tr><td style="padding-left: 1em" class="small">'.$langs->trans(
"Phone").
' : '.
dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).
'</td></tr>';
3051 if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL)) {
3052 print
'<tr><td style="padding-left: 1em" class="small">'.$langs->trans(
"Email").
' : '.
dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).
'</td></tr>';
3054 if (!empty($conf->global->MAIN_INFO_SOCIETE_WEB)) {
3055 print
'<tr><td style="padding-left: 1em" class="small">'.$langs->trans(
"Web").
' : '.
dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB).
'</td></tr>';
3058 print
'</table>'.
"\n";
3059 print
'</div>'.
"\n";
3060 print
'<!-- End show mysoc info header -->'.
"\n";
3079 if (preg_match(
'/^http/i', $helppagename)) {
3081 $helpbaseurl =
'%s';
3082 $helppage = $helppagename;
3087 if (preg_match(
'/^es/i', $langs->defaultlang)) {
3088 $helpbaseurl =
'http://wiki.dolibarr.org/index.php/%s';
3089 if (preg_match(
'/ES:([^|]+)/i', $helppagename, $reg)) {
3090 $helppage = $reg[1];
3093 if (preg_match(
'/^fr/i', $langs->defaultlang)) {
3094 $helpbaseurl =
'http://wiki.dolibarr.org/index.php/%s';
3095 if (preg_match(
'/FR:([^|]+)/i', $helppagename, $reg)) {
3096 $helppage = $reg[1];
3099 if (empty($helppage)) {
3100 $helpbaseurl =
'http://wiki.dolibarr.org/index.php/%s';
3101 if (preg_match(
'/EN:([^|]+)/i', $helppagename, $reg)) {
3102 $helppage = $reg[1];
3107 return array(
'helpbaseurl'=>$helpbaseurl,
'helppage'=>$helppage,
'mode'=>$mode);
3127 function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey =
'', $prefhtmlinputname =
'', $img =
'', $showtitlebefore = 0, $autofocus = 0)
3129 global $conf, $langs, $user;
3132 $ret .=
'<form action="'.$urlaction.
'" method="post" class="searchform nowraponall tagtr">';
3133 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
3134 $ret .=
'<input type="hidden" name="mode" value="search">';
3135 $ret .=
'<input type="hidden" name="savelogin" value="'.dol_escape_htmltag($user->login).
'">';
3136 if ($showtitlebefore) {
3137 $ret .=
'<div class="tagtd left">'.$title.
'</div> ';
3139 $ret .=
'<div class="tagtd">';
3140 $ret .=
img_picto(
'', $img,
'',
false, 0, 0,
'',
'paddingright width20');
3141 $ret .=
'<input type="text" class="flat '.$htmlmorecss.
'"';
3142 $ret .=
' style="background-repeat: no-repeat; background-position: 3px;"';
3143 $ret .= ($accesskey ?
' accesskey="'.$accesskey.
'"' :
'');
3144 $ret .=
' placeholder="'.strip_tags($title).
'"';
3145 $ret .= ($autofocus ?
' autofocus' :
'');
3146 $ret .=
' name="'.$htmlinputname.
'" id="'.$prefhtmlinputname.$htmlinputname.
'" />';
3147 $ret .=
'<button type="submit" class="button bordertransp" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">';
3148 $ret .=
'<span class="fa fa-search"></span>';
3149 $ret .=
'</button>';
3151 $ret .=
"</form>\n";
3156 if (!function_exists(
"llxFooter")) {
3167 function llxFooter($comment =
'', $zone =
'private', $disabledoutputofmessages = 0)
3169 global $conf, $db, $langs, $user, $mysoc, $object, $hookmanager;
3170 global $delayedhtmlcontent;
3171 global $contextpage, $page, $limit, $mode;
3172 global $dolibarr_distrib;
3174 $ext =
'layout='.$conf->browser->layout.
'&version='.urlencode(DOL_VERSION);
3181 if (is_object($user) && !empty($user->lastsearch_values_tmp) && is_array($user->lastsearch_values_tmp)) {
3183 foreach ($user->lastsearch_values_tmp as $key => $val) {
3184 unset($_SESSION[
'lastsearch_values_tmp_'.$key]);
3185 if (count($val) && empty($_POST[
'button_removefilter']) && empty($_POST[
'button_removefilter_x'])) {
3186 if (empty($val[
'sortfield'])) {
3187 unset($val[
'sortfield']);
3189 if (empty($val[
'sortorder'])) {
3190 unset($val[
'sortorder']);
3192 dol_syslog(
'Save lastsearch_values_tmp_'.$key.
'='.json_encode($val, 0).
" (systematic recording of last search criterias)");
3193 $_SESSION[
'lastsearch_values_tmp_'.$key] = json_encode($val);
3194 unset($_SESSION[
'lastsearch_values_'.$key]);
3200 $relativepathstring = $_SERVER[
"PHP_SELF"];
3202 if (constant(
'DOL_URL_ROOT')) {
3203 $relativepathstring = preg_replace(
'/^'.preg_quote(constant(
'DOL_URL_ROOT'),
'/').
'/',
'', $relativepathstring);
3205 $relativepathstring = preg_replace(
'/^\//',
'', $relativepathstring);
3206 $relativepathstring = preg_replace(
'/^custom\//',
'', $relativepathstring);
3207 if (preg_match(
'/list\.php$/', $relativepathstring)) {
3208 unset($_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring]);
3209 unset($_SESSION[
'lastsearch_page_tmp_'.$relativepathstring]);
3210 unset($_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring]);
3211 unset($_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring]);
3213 if (!empty($contextpage)) {
3214 $_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage;
3216 if (!empty($page) && $page > 0) {
3217 $_SESSION[
'lastsearch_page_tmp_'.$relativepathstring] = $page;
3219 if (!empty($limit) && $limit != $conf->liste_limit) {
3220 $_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring] = $limit;
3222 if (!empty($mode)) {
3223 $_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring] = $mode;
3226 unset($_SESSION[
'lastsearch_contextpage_'.$relativepathstring]);
3227 unset($_SESSION[
'lastsearch_page_'.$relativepathstring]);
3228 unset($_SESSION[
'lastsearch_limit_'.$relativepathstring]);
3229 unset($_SESSION[
'lastsearch_mode_'.$relativepathstring]);
3233 if (!empty($conf->global->MAIN_CORE_ERROR)) {
3235 if ($conf->use_javascript_ajax) {
3236 $title =
img_warning().
' '.$langs->trans(
'CoreErrorTitle');
3237 print
ajax_dialog($title, $langs->trans(
'CoreErrorMessage'));
3240 $msg =
img_warning().
' '.$langs->trans(
'CoreErrorMessage');
3241 print
'<div class="error">'.$msg.
'</div>';
3249 print
'</div> <!-- End div class="fiche" -->'.
"\n";
3251 if (empty($conf->dol_hide_leftmenu)) {
3252 print
'</div> <!-- End div id-right -->'.
"\n";
3255 if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) {
3256 print
'</div> <!-- End div id-container -->'.
"\n";
3261 print
'<!-- '.$comment.
' -->'.
"\n";
3266 if (!empty($delayedhtmlcontent)) {
3267 print $delayedhtmlcontent;
3270 if (!empty($conf->use_javascript_ajax)) {
3271 print
"\n".
'<!-- Includes JS Footer of Dolibarr -->'.
"\n";
3272 print
'<script src="'.DOL_URL_ROOT.
'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.($ext ?
'&'.$ext :
'').
'"></script>'.
"\n";
3276 if (!empty($conf->blockedlog->enabled) && is_object($object) && !empty($object->id) && $object->id > 0 && $object->statut > 0) {
3277 if (in_array($object->element, array(
'facture'))) {
3278 print
"\n<!-- JS CODE TO ENABLE log when making a download or a preview of a document -->\n";
3281 jQuery(document).ready(
function () {
3282 $(
'a.documentpreview').click(
function() {
3283 $.post(
'<?php echo DOL_URL_ROOT."/blockedlog/ajax/block-add.php" ?>'
3285 id:<?php echo $object->id; ?>
3286 , element:
'<?php echo $object->element ?>'
3287 , action:
'DOC_PREVIEW'
3288 , token:
'<?php echo currentToken(); ?>'
3292 $(
'a.documentdownload').click(
function() {
3293 $.post(
'<?php echo DOL_URL_ROOT."/blockedlog/ajax/block-add.php" ?>'
3295 id:<?php echo $object->id; ?>
3296 , element:
'<?php echo $object->element ?>'
3297 , action:
'DOC_DOWNLOAD'
3298 , token:
'<?php echo currentToken(); ?>'
3309 print
"\n<!-- A div to allow dialog popup by jQuery('#dialogforpopup').dialog() -->\n";
3310 print
'<div id="dialogforpopup" style="display: none;"></div>'.
"\n";
3314 $forceping =
GETPOST(
'forceping',
'alpha');
3315 if (($_SERVER[
"PHP_SELF"] == DOL_URL_ROOT.
'/index.php') || $forceping) {
3317 $hash_unique_id = md5(
'dolibarr'.$conf->file->instance_unique_id);
3319 if (empty($conf->global->MAIN_FIRST_PING_OK_DATE)
3320 || (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID !=
'disabled'))
3323 if (strpos(
'alpha', DOL_VERSION) > 0 && !$forceping) {
3324 print
"\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It is an alpha version -->\n";
3325 } elseif (empty($_COOKIE[
'DOLINSTALLNOPING_'.$hash_unique_id]) || $forceping) {
3328 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) {
3329 print
"\n<!-- NO JS CODE TO ENABLE the anonymous Ping. An error already occured this month, we will try later. -->\n";
3331 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3333 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";
3334 print
"\n<!-- JS CODE TO ENABLE the anonymous Ping -->\n";
3335 $url_for_ping = (empty($conf->global->MAIN_URL_FOR_PING) ?
"https://ping.dolibarr.org/" : $conf->global->MAIN_URL_FOR_PING);
3337 $distrib =
'standard';
3338 if ($_SERVER[
"SERVER_ADMIN"] ==
'doliwamp@localhost') {
3339 $distrib =
'doliwamp';
3341 if (!empty($dolibarr_distrib)) {
3342 $distrib = $dolibarr_distrib;
3346 jQuery(document).ready(
function (tmp) {
3347 console.log(
"Try Ping with hash_unique_id is md5('dolibarr'+instance_unique_id)");
3350 url:
"<?php echo $url_for_ping ?>",
3355 hash_unique_id:
'<?php echo dol_escape_js($hash_unique_id); ?>',
3356 action:
'dolibarrping',
3357 version:
'<?php echo (float) DOL_VERSION; ?>',
3358 entity:
'<?php echo (int) $conf->entity; ?>',
3359 dbtype:
'<?php echo dol_escape_js($db->type); ?>',
3360 country_code:
'<?php echo $mysoc->country_code ? dol_escape_js($mysoc->country_code) : 'unknown
'; ?>',
3361 php_version:
'<?php echo dol_escape_js(phpversion()); ?>',
3362 os_version:
'<?php echo dol_escape_js(version_os('smr
')); ?>',
3363 distrib:
'<?php echo $distrib ? dol_escape_js($distrib) : 'unknown
'; ?>',
3364 token:
'notrequired'
3366 success:
function (data, status, xhr) {
3367 console.log(
"Ping ok");
3370 url:
'<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php
'; ?>',
3373 data: { hash_algo:
'md5', hash_unique_id:
'<?php echo dol_escape_js($hash_unique_id); ?>', action:
'firstpingok', token:
'<?php echo currentToken(); ?>' },
3376 error:
function (data,status,xhr) {
3377 console.log(
"Ping ko: " + data);
3380 url:
'<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php
'; ?>',
3383 data: { hash_algo:
'md5', hash_unique_id:
'<?php echo dol_escape_js($hash_unique_id); ?>', action:
'firstpingko', token:
'<?php echo currentToken(); ?>' },
3393 print
"\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It was disabled -->\n";
3394 include_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
3396 dolibarr_set_const($db,
'MAIN_FIRST_PING_OK_ID',
'disabled',
'chaine', 0,
'', $conf->entity);
3401 $reshook = $hookmanager->executeHooks(
'beforeBodyClose');
3403 print $hookmanager->resPrint;
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dol_hash($chain, $type= '0')
Returns a hash of a string.
dol_htmloutput_events($disabledoutputofmessages=0)
Print formated messages to output (Used to show messages on html output).
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding= 'UTF-8', $double_encode=false)
Replace htmlentities functions.
printCommonFooter($zone= 'private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
top_menu($head, $title= '', $target= '', $disablejs=0, $disablehead=0, $arrayofjs= '', $arrayofcss= '', $morequerystring= '', $helppagename= '')
Show an HTML header + a BODY + The top menu bar.
dol_now($mode= 'auto')
Return date for now.
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).
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default= '')
Return dolibarr global constant string value.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
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...
top_menu_search()
Build the tooltip on top menu tsearch.
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...
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
Class to manage third parties objects (customers, suppliers, prospects...)
top_menu_bookmark()
Build the tooltip on top menu bookmark.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= 'hideonsmartphone', $textfordropdown= '')
Show information for admin users or standard users.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
getBrowserInfo($user_agent)
Return information about user browser.
Class to manage translations.
ajax_dialog($title, $message, $w=350, $h=150)
Show an ajax dialog.
left_menu($menu_array_before, $helppagename= '', $notused= '', $menu_array_after= '', $leftmenuwithoutmainarea=0, $title= '', $acceptdelayedhtml=0)
Show left menu bar.
getHelpParamFor($helppagename, $langs)
Return helpbaseurl, helppage and mode.
if(!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) realCharForNumericEntities($matches)
Return the real char for a numeric entities.
top_menu_user($hideloginname=0, $urllogout= '')
Build the tooltip on user login.
div float
Buy price without taxes.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
testSqlAndScriptInject($val, $type)
Security: WAF layer for SQL Injection and XSS Injection (scripts) protection (Filters on GET...
checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode, $context= '')
Return a login if login/pass was successfull.
isHTTPS()
Return if we are using a HTTPS connexion Check HTTPS (no way to be modified by user but may be empty ...
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
printDropdownQuickadd()
Generate list of quickadd items.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
top_htmlhead($head, $title= '', $disablejs=0, $disablehead=0, $arrayofjs= '', $arrayofcss= '', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
isModEnabled($module)
Is Dolibarr module enabled.
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. ...
main_area($title= '')
Begin main area.
printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey= '', $prefhtmlinputname= '', $img= '', $showtitlebefore=0, $autofocus=0)
Show a search area.
picto_from_langcode($codelang, $moreatt= '', $notitlealt=0)
Return img flag of country for a language code or country code.
printDropdownBookmarksList()
Add area with bookmarks in top menu.
top_menu_quickadd()
Build the tooltip on top menu quick add.
dol_print_profids($profID, $profIDtype, $countrycode= '', $addcpButton=1, $separ= ' ')
Format profIDs according to country.
analyseVarsForSqlAndScriptsInjection(&$var, $type)
Return true if security check on parameters are OK, false otherwise.