218 if (is_array($var)) {
219 foreach ($var as $key => $value) {
223 http_response_code(403);
226 $ip = (empty($_SERVER[
'REMOTE_ADDR']) ?
'unknown' : $_SERVER[
'REMOTE_ADDR']);
228 $errormessage =
'Access refused to '.htmlentities($ip, ENT_COMPAT,
'UTF-8').
' by SQL or Script injection protection in main.inc.php:analyseVarsForSqlAndScriptsInjection type='.htmlentities($type, ENT_COMPAT,
'UTF-8');
230 $errormessage2 =
'paramkey='.htmlentities($key, ENT_COMPAT,
'UTF-8');
231 $errormessage2 .=
' paramvalue='.htmlentities($value, ENT_COMPAT,
'UTF-8');
232 $errormessage2 .=
' page='.htmlentities($_SERVER[
"REQUEST_URI"], ENT_COMPAT,
'UTF-8');
236 print
'Try to go back, fix data of your form and resubmit it. You can contact also your technical support.';
239 print $errormessage2;
243 if (function_exists(
'error_log')) {
244 error_log($errormessage.
' '.$errormessage2);
265if ((defined(
'NOREQUIREDB') || defined(
'NOREQUIRETRAN')) && !defined(
'NOREQUIREMENU')) {
266 print
'If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not set them.';
269if (defined(
'NOREQUIREUSER') && !defined(
'NOREQUIREMENU')) {
270 print
'If define NOREQUIREUSER is set, you must also set NOREQUIREMENU or not set it.';
275if (!defined(
'NOSCANPHPSELFFORINJECTION') && !empty($_SERVER[
"PHP_SELF"])) {
276 $morevaltochecklikepost = array($_SERVER[
"PHP_SELF"]);
280if (!defined(
'NOSCANGETFORINJECTION') && !empty($_SERVER[
"QUERY_STRING"])) {
284 $morevaltochecklikeget = array(urldecode($_SERVER[
"QUERY_STRING"]));
288if (!defined(
'NOSCANPOSTFORINJECTION')) {
293if (!empty($_SERVER[
'DOCUMENT_ROOT']) && substr($_SERVER[
'DOCUMENT_ROOT'], -6) !==
'htdocs') {
294 set_include_path($_SERVER[
'DOCUMENT_ROOT'].
'/htdocs');
298require_once
'filefunc.inc.php';
303if (!empty($_POST[
"DOL_AUTOSET_COOKIE"])) {
304 $tmpautoset = explode(
':', $_POST[
"DOL_AUTOSET_COOKIE"], 2);
305 $tmplist = explode(
',', $tmpautoset[1]);
306 $cookiearrayvalue = array();
307 foreach ($tmplist as $tmpkey) {
308 $postkey = $tmpautoset[0].
'_'.$tmpkey;
310 if (!empty($_POST[$postkey])) {
311 $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
314 $cookiename = $tmpautoset[0];
315 $cookievalue = json_encode($cookiearrayvalue);
317 if (PHP_VERSION_ID < 70300) {
318 setcookie($cookiename, empty($cookievalue) ?
'' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)),
'/', null, ((empty($dolibarr_main_force_https) &&
isHTTPS() === false) ? false : true), true);
321 $cookieparams = array(
322 'expires' => empty($cookievalue) ? 0 : (time() + (86400 * 354)),
325 'secure' => ((empty($dolibarr_main_force_https) &&
isHTTPS() === false) ? false : true),
329 setcookie($cookiename, empty($cookievalue) ?
'' : $cookievalue, $cookieparams);
331 if (empty($cookievalue)) {
332 unset($_COOKIE[$cookiename]);
338if (!empty($php_session_save_handler) && $php_session_save_handler ==
'db') {
339 require_once
'core/lib/phpsessionin'.$php_session_save_handler.
'.lib.php';
345 $prefix = dol_getprefix(
'');
346 $sessionname =
'DOLSESSID_'.$prefix;
347 $sessiontimeout =
'DOLSESSTIMEOUT_'.$prefix;
348if (!empty($_COOKIE[$sessiontimeout])) {
349 ini_set(
'session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
354if (!defined(
'NOSESSION')) {
355 if (PHP_VERSION_ID < 70300) {
356 session_set_cookie_params(0,
'/',
null, ((empty($dolibarr_main_force_https) &&
isHTTPS() ===
false) ?
false : true), true);
359 $sessioncookieparams = array(
363 'secure' => ((empty($dolibarr_main_force_https) &&
isHTTPS() ===
false) ?
false : true),
367 session_set_cookie_params($sessioncookieparams);
369 session_name($sessionname);
376 require_once
'master.inc.php';
384 if ((!session_id() || !isset($_SESSION[
"dol_login"])) && !isset($_POST[
"username"]) && !empty($_SERVER[
"GATEWAY_INTERFACE"])) {
386 } elseif (isset($_POST[
"username"]) && $_POST[
"username"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) {
388 } elseif (defined(
'NOREQUIREDB')) {
390 } elseif (defined(
'EVEN_IF_ONLY_LOGIN_ALLOWED')) {
392 } elseif (session_id() && isset($_SESSION[
"dol_login"]) && $_SESSION[
"dol_login"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) {
396 if (session_id() && isset($_SESSION[
"dol_login"]) && $_SESSION[
"dol_login"] != $conf->global->MAIN_ONLY_LOGIN_ALLOWED) {
397 print
'Sorry, your application is offline.'.
"\n";
398 print
'You are logged with user "'.$_SESSION[
"dol_login"].
'" and only administrator user "' .
getDolGlobalString(
'MAIN_ONLY_LOGIN_ALLOWED').
'" is allowed to connect for the moment.'.
"\n";
399 $nexturl = DOL_URL_ROOT.
'/user/logout.php?token='.newToken();
400 print
'Please try later or <a href="'.$nexturl.
'">click here to disconnect and change login user</a>...'.
"\n";
402 print
'Sorry, your application is offline. Only administrator user "' .
getDolGlobalString(
'MAIN_ONLY_LOGIN_ALLOWED').
'" is allowed to connect for the moment.'.
"\n";
403 $nexturl = DOL_URL_ROOT.
'/';
404 print
'Please try later or <a href="'.$nexturl.
'">click here to change login user</a>...'.
"\n";
412 register_shutdown_function(
'dol_shutdown');
415if (isModEnabled(
'debugbar') && !
GETPOST(
'dol_use_jmobile') && empty($_SESSION[
'dol_use_jmobile'])) {
417 include_once DOL_DOCUMENT_ROOT.
'/debugbar/class/DebugBar.php';
419 $renderer = $debugbar->getRenderer();
421 $conf->global->MAIN_HTML_HEADER =
'';
423 $conf->global->MAIN_HTML_HEADER .= $renderer->renderHead();
425 $debugbar[
'time']->startMeasure(
'pageaftermaster',
'Page generation (after environment init)');
429if (isset($_SERVER[
"HTTP_USER_AGENT"])) {
431 $conf->browser->name = $tmp[
'browsername'];
432 $conf->browser->os = $tmp[
'browseros'];
433 $conf->browser->version = $tmp[
'browserversion'];
434 $conf->browser->ua = $tmp[
'browserua'];
435 $conf->browser->layout = $tmp[
'layout'];
438 if ($conf->browser->layout ==
'phone') {
439 $conf->dol_no_mouse_hover = 1;
445 $conf->theme =
GETPOST(
'theme',
'aZ09');
446 $conf->css =
"/theme/".$conf->theme.
"/style.css.php";
450if (
GETPOST(
'textbrowser',
'int') || (!empty($conf->browser->name) && $conf->browser->name ==
'lynxlinks')) {
451 $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1;
456if (!empty($conf->file->main_force_https) && (empty($_SERVER[
"HTTPS"]) || $_SERVER[
"HTTPS"] !=
'on') && !defined(
'NOHTTPSREDIRECT')) {
458 if (is_numeric($conf->file->main_force_https)) {
459 if ($conf->file->main_force_https ==
'1' && !empty($_SERVER[
"SCRIPT_URI"])) {
460 if (preg_match(
'/^http:/i', $_SERVER[
"SCRIPT_URI"]) && !preg_match(
'/^https:/i', $_SERVER[
"SCRIPT_URI"])) {
461 $newurl = preg_replace(
'/^http:/i',
'https:', $_SERVER[
"SCRIPT_URI"]);
465 $newurl = preg_replace(
'/^http:/i',
'https:', DOL_MAIN_URL_ROOT).$_SERVER[
"REQUEST_URI"];
469 $newurl = $conf->file->main_force_https.$_SERVER[
"REQUEST_URI"];
474 dol_syslog(
"main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl);
475 header(
"Location: ".$newurl);
478 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);
482if (!defined(
'NOLOGIN') && !defined(
'NOIPCHECK') && !empty($dolibarr_main_restrict_ip)) {
483 $listofip = explode(
',', $dolibarr_main_restrict_ip);
485 foreach ($listofip as $ip) {
487 if ($ip == $_SERVER[
'REMOTE_ADDR']) {
493 print
'Access refused by IP protection. Your detected IP is '.$_SERVER[
'REMOTE_ADDR'];
499if (!defined(
'NOREQUIREHTML')) {
500 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
502if (!defined(
'NOREQUIREAJAX')) {
503 require_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
508 dol_syslog(
"main.inc: A previous install or upgrade was not complete. Redirect to install page.", LOG_WARNING);
509 header(
"Location: ".DOL_URL_ROOT.
"/install/index.php");
513if ((
getDolGlobalString(
'MAIN_VERSION_LAST_UPGRADE') && ($conf->global->MAIN_VERSION_LAST_UPGRADE != DOL_VERSION))
515 $versiontocompare = !
getDolGlobalString(
'MAIN_VERSION_LAST_UPGRADE') ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE;
516 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
517 $dolibarrversionlastupgrade = preg_split(
'/[.-]/', $versiontocompare);
518 $dolibarrversionprogram = preg_split(
'/[.-]/', DOL_VERSION);
519 $rescomp =
versioncompare($dolibarrversionprogram, $dolibarrversionlastupgrade);
521 if (!
getDolGlobalString(
'MAIN_NO_UPGRADE_REDIRECT_ON_LEVEL_3_CHANGE') || $rescomp < 3) {
523 dol_syslog(
"main.inc: database version ".$versiontocompare.
" is lower than programs version ".DOL_VERSION.
". Redirect to install/upgrade page.", LOG_WARNING);
524 header(
"Location: ".DOL_URL_ROOT.
"/install/index.php");
531if (!defined(
'NOTOKENRENEWAL') && !defined(
'NOSESSION')) {
533 if (!preg_match(
'/\.(css|js|json)\.php$/', $_SERVER[
"PHP_SELF"])) {
535 if (isset($_SESSION[
'newtoken'])) {
536 $_SESSION[
'token'] = $_SESSION[
'newtoken'];
539 if (!isset($_SESSION[
'newtoken']) ||
getDolGlobalInt(
'MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL')) {
543 $token =
dol_hash(uniqid(mt_rand(),
false),
'md5');
544 $_SESSION[
'newtoken'] = $token;
545 dol_syslog(
"NEW TOKEN generated by : ".$_SERVER[
'PHP_SELF'], LOG_DEBUG);
553if ((!defined(
'NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) &&
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN')) || defined(
'CSRFCHECK_WITH_TOKEN')) {
555 $sensitiveget =
false;
556 if ((GETPOSTISSET(
'massaction') ||
GETPOST(
'action',
'aZ09')) &&
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN') >= 3) {
558 if (GETPOSTISSET(
'massaction') || !in_array(
GETPOST(
'action',
'aZ09'), array(
'create',
'createsite',
'createcard',
'edit',
'editvalidator',
'file_manager',
'presend',
'presend_addmessage',
'preview',
'specimen'))) {
559 $sensitiveget =
true;
563 $arrayofactiontoforcetokencheck = array(
565 'doprev',
'donext',
'dvprev',
'dvnext',
566 'freezone',
'install',
569 if (in_array(
GETPOST(
'action',
'aZ09'), $arrayofactiontoforcetokencheck)) {
570 $sensitiveget =
true;
573 if (preg_match(
'/^(confirm_)?(add|classify|close|confirm|copy|del|disable|enable|remove|set|unset|update|save)/',
GETPOST(
'action',
'aZ09'))) {
574 $sensitiveget =
true;
581 (!empty($_SERVER[
'REQUEST_METHOD']) && $_SERVER[
'REQUEST_METHOD'] ==
'POST') ||
583 GETPOSTISSET(
'massaction') ||
584 ((GETPOSTISSET(
'actionlogin') || GETPOSTISSET(
'action')) && defined(
'CSRFCHECK_WITH_TOKEN'))
587 if (!
GETPOST(
'token',
'alpha') ||
GETPOST(
'token',
'alpha') ==
'notrequired') {
589 if (
GETPOST(
'uploadform',
'int')) {
590 dol_syslog(
"--- Access to ".(empty($_SERVER[
"REQUEST_METHOD"]) ?
'' : $_SERVER[
"REQUEST_METHOD"].
' ').$_SERVER[
"PHP_SELF"].
" refused. File size too large or not provided.");
591 $langs->loadLangs(array(
"errors",
"install"));
592 print $langs->trans(
"ErrorFileSizeTooLarge").
' ';
593 print $langs->trans(
"ErrorGoBackAndCorrectParameters");
595 http_response_code(403);
596 if (defined(
'CSRFCHECK_WITH_TOKEN')) {
597 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);
598 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";
600 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);
601 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";
602 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";
606 print
" into setup).\n";
613 $sessiontokenforthisurl = (empty($_SESSION[
'token']) ?
'' : $_SESSION[
'token']);
615 if (GETPOSTISSET(
'token') &&
GETPOST(
'token') !=
'notrequired' &&
GETPOST(
'token',
'alpha') != $sessiontokenforthisurl) {
616 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);
619 if (!defined(
'NOTOKENRENEWAL')) {
621 setEventMessages(
'SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry',
null,
'warnings',
'', 1);
624 if (isset($_POST[
'id'])) {
625 $savid = ((int) $_POST[
'id']);
628 unset($_GET[
'confirm']);
629 unset($_GET[
'action']);
630 unset($_GET[
'confirmmassaction']);
631 unset($_GET[
'massaction']);
632 unset($_GET[
'token']);
634 $_POST[
'id'] = ((int) $savid);
637 $_GET[
'errorcode'] =
'InvalidToken';
644if (GETPOSTISSET(
'disablemodules')) {
645 $_SESSION[
"disablemodules"] =
GETPOST(
'disablemodules',
'alpha');
647if (!empty($_SESSION[
"disablemodules"])) {
648 $modulepartkeys = array(
'css',
'js',
'tabs',
'triggers',
'login',
'substitutions',
'menus',
'theme',
'sms',
'tpl',
'barcode',
'models',
'societe',
'hooks',
'dir',
'syslog',
'tpllinkable',
'contactelement',
'moduleforexternal');
650 $disabled_modules = explode(
',', $_SESSION[
"disablemodules"]);
651 foreach ($disabled_modules as $module) {
653 if (empty($conf->$module)) {
656 $conf->$module->enabled =
false;
657 foreach ($modulepartkeys as $modulepartkey) {
658 unset($conf->modules_parts[$modulepartkey][$module]);
660 if ($module ==
'fournisseur') {
661 $conf->supplier_order->enabled = 0;
662 $conf->supplier_invoice->enabled = 0;
669 $modulepart = explode(
"/", $_SERVER[
"PHP_SELF"]);
670if (is_array($modulepart) && count($modulepart) > 0) {
671 foreach ($conf->modules as $module) {
672 if (in_array($module, $modulepart)) {
673 $modulepart = $module;
678if (is_array($modulepart)) {
688if (!defined(
'NOLOGIN')) {
692 if (defined(
'MAIN_AUTHENTICATION_MODE')) {
693 $dolibarr_main_authentication = constant(
'MAIN_AUTHENTICATION_MODE');
696 if (empty($dolibarr_main_authentication)) {
697 $dolibarr_main_authentication =
'dolibarr';
700 if ($dolibarr_main_authentication ==
'forceuser' && empty($dolibarr_auto_user)) {
701 $dolibarr_auto_user =
'auto';
705 $authmode = explode(
',', $dolibarr_main_authentication);
708 if (!count($authmode)) {
709 $langs->load(
'main');
710 dol_print_error(
'', $langs->trans(
"ErrorConfigParameterNotDefined",
'dolibarr_main_authentication'));
717 $resultFetchUser =
'';
719 if (!isset($_SESSION[
"dol_login"])) {
721 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
723 $dol_dst_observed =
GETPOST(
"dst_observed",
'int', 3);
724 $dol_dst_first =
GETPOST(
"dst_first",
'int', 3);
725 $dol_dst_second =
GETPOST(
"dst_second",
'int', 3);
726 $dol_screenwidth =
GETPOST(
"screenwidth",
'int', 3);
727 $dol_screenheight =
GETPOST(
"screenheight",
'int', 3);
728 $dol_hide_topmenu =
GETPOST(
'dol_hide_topmenu',
'int', 3);
729 $dol_hide_leftmenu =
GETPOST(
'dol_hide_leftmenu',
'int', 3);
730 $dol_optimize_smallscreen =
GETPOST(
'dol_optimize_smallscreen',
'int', 3);
731 $dol_no_mouse_hover =
GETPOST(
'dol_no_mouse_hover',
'int', 3);
732 $dol_use_jmobile =
GETPOST(
'dol_use_jmobile',
'int', 3);
736 if (!empty($dolibarr_main_demo) && $_SERVER[
'PHP_SELF'] == DOL_URL_ROOT.
'/index.php') {
737 if (empty($_SERVER[
'HTTP_REFERER']) || !preg_match(
'/public/', $_SERVER[
'HTTP_REFERER'])) {
738 dol_syslog(
"Call index page from another url than demo page (call is done from page ".(empty($_SERVER[
'HTTP_REFERER']) ?
'' : $_SERVER[
'HTTP_REFER']).
")");
740 $url .= ($url ?
'&' :
'').($dol_hide_topmenu ?
'dol_hide_topmenu='.$dol_hide_topmenu :
'');
741 $url .= ($url ?
'&' :
'').($dol_hide_leftmenu ?
'dol_hide_leftmenu='.$dol_hide_leftmenu :
'');
742 $url .= ($url ?
'&' :
'').($dol_optimize_smallscreen ?
'dol_optimize_smallscreen='.$dol_optimize_smallscreen :
'');
743 $url .= ($url ?
'&' :
'').($dol_no_mouse_hover ?
'dol_no_mouse_hover='.$dol_no_mouse_hover :
'');
744 $url .= ($url ?
'&' :
'').($dol_use_jmobile ?
'dol_use_jmobile='.$dol_use_jmobile :
'');
745 $url = DOL_URL_ROOT.
'/public/demo/index.php'.($url ?
'?'.$url :
'');
746 header(
"Location: ".$url);
753 $hookmanager->initHooks(array(
'login'));
754 $parameters = array();
755 $reshook = $hookmanager->executeHooks(
'beforeLoginAuthentication', $parameters, $user, $action);
762 if ($test &&
GETPOST(
"username",
"alpha", 2) &&
getDolGlobalString(
'MAIN_SECURITY_ENABLECAPTCHA') && !isset($_SESSION[
'dol_bypass_antispam'])) {
763 $sessionkey =
'dol_antispam_value';
764 $ok = (array_key_exists($sessionkey, $_SESSION) ===
true && (strtolower($_SESSION[$sessionkey]) === strtolower(
GETPOST(
'code',
'restricthtml'))));
768 dol_syslog(
'Bad value for code, connexion refused', LOG_NOTICE);
770 $langs->loadLangs(array(
'main',
'errors'));
772 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorBadValueForCode");
776 $user->context[
'audit'] =
'ErrorBadValueForCode - login='.GETPOST(
"username",
"alpha", 2);
779 $result = $user->call_trigger(
'USER_LOGIN_FAILED', $user);
787 $hookmanager->initHooks(array(
'login'));
788 $parameters = array(
'dol_authmode'=>$authmode,
'dol_loginmesg'=>$_SESSION[
"dol_loginmesg"]);
789 $reshook = $hookmanager->executeHooks(
'afterLoginFailed', $parameters, $user, $action);
798 $allowedmethodtopostusername = 3;
799 if (defined(
'MAIN_AUTHENTICATION_POST_METHOD')) {
800 $allowedmethodtopostusername = constant(
'MAIN_AUTHENTICATION_POST_METHOD');
803 $usertotest = (!empty($_COOKIE[
'login_dolibarr']) ? preg_replace(
'/[^a-zA-Z0-9_@\-\.]/',
'', $_COOKIE[
'login_dolibarr']) :
GETPOST(
"username",
"alpha", $allowedmethodtopostusername));
804 $passwordtotest =
GETPOST(
'password',
'none', $allowedmethodtopostusername);
805 $entitytotest = (
GETPOST(
'entity',
'int') ?
GETPOST(
'entity',
'int') : (!empty($conf->entity) ? $conf->entity : 1));
808 $goontestloop =
false;
809 if (isset($_SERVER[
"REMOTE_USER"]) && in_array(
'http', $authmode)) {
810 $goontestloop =
true;
812 if ($dolibarr_main_authentication ==
'forceuser' && !empty($dolibarr_auto_user)) {
813 $goontestloop =
true;
815 if (
GETPOST(
"username",
"alpha", $allowedmethodtopostusername)) {
816 $goontestloop =
true;
818 if (
GETPOST(
'openid_mode',
'alpha', 1)) {
819 $goontestloop =
true;
821 if (
GETPOST(
'beforeoauthloginredirect') ||
GETPOST(
'afteroauthloginreturn')) {
822 $goontestloop =
true;
824 if (!empty($_COOKIE[
'login_dolibarr'])) {
825 $goontestloop =
true;
828 if (!is_object($langs)) {
829 include_once DOL_DOCUMENT_ROOT.
'/core/class/translate.class.php';
832 if (defined(
'MAIN_LANG_DEFAULT')) {
833 $langcode = constant(
'MAIN_LANG_DEFAULT');
835 $langs->setDefaultLang($langcode);
841 if ($test && $goontestloop && (
GETPOST(
'actionlogin',
'aZ09') ==
'login' || $dolibarr_main_authentication !=
'dolibarr')) {
844 $oauthmodetotestarray = array(
'google');
845 foreach ($oauthmodetotestarray as $oauthmodetotest) {
846 if (in_array($oauthmodetotest.
'oauth', $authmode)) {
848 if (
GETPOST(
'beforeoauthloginredirect') == $oauthmodetotest ||
GETPOST(
'afteroauthloginreturn')) {
852 dol_syslog(
"User did not click on link for OAuth or is not on the OAuth return, so we disable check using ".$oauthmodetotest);
853 foreach ($authmode as $tmpkey => $tmpval) {
854 if ($tmpval == $oauthmodetotest.
'oauth') {
855 unset($authmode[$tmpkey]);
864 if ($login ===
'--bad-login-validity--') {
871 $dol_authmode = $conf->authmode;
872 $dol_tz = empty($_POST[
"tz"]) ? (empty($_SESSION[
"tz"]) ?
'' : $_SESSION[
"tz"]) : $_POST[
"tz"];
873 $dol_tz_string = empty($_POST[
"tz_string"]) ? (empty($_SESSION[
"tz_string"]) ?
'' : $_SESSION[
"tz_string"]) : $_POST[
"tz_string"];
874 $dol_tz_string = preg_replace(
'/\s*\(.+\)$/',
'', $dol_tz_string);
875 $dol_tz_string = preg_replace(
'/,/',
'/', $dol_tz_string);
876 $dol_tz_string = preg_replace(
'/\s/',
'_', $dol_tz_string);
879 $dol_dst_first = empty($_POST[
"dst_first"]) ? (empty($_SESSION[
"dst_first"]) ?
'' : $_SESSION[
"dst_first"]) : $_POST[
"dst_first"];
880 $dol_dst_second = empty($_POST[
"dst_second"]) ? (empty($_SESSION[
"dst_second"]) ?
'' : $_SESSION[
"dst_second"]) : $_POST[
"dst_second"];
881 if ($dol_dst_first && $dol_dst_second) {
882 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
886 if ($datenow >= $datefirst && $datenow < $datesecond) {
890 $dol_screenheight = empty($_POST[
"screenheight"]) ? (empty($_SESSION[
"dol_screenheight"]) ?
'' : $_SESSION[
"dol_screenheight"]) : $_POST[
"screenheight"];
891 $dol_screenwidth = empty($_POST[
"screenwidth"]) ? (empty($_SESSION[
"dol_screenwidth"]) ?
'' : $_SESSION[
"dol_screenwidth"]) : $_POST[
"screenwidth"];
896 dol_syslog(
'Bad password, connexion refused (see a previous notice message for more info)', LOG_NOTICE);
898 $langs->loadLangs(array(
'main',
'errors'));
902 if (empty($_SESSION[
"dol_loginmesg"])) {
903 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorBadLoginPassword");
907 $user->context[
'audit'] = $langs->trans(
"ErrorBadLoginPassword").
' - login='.
GETPOST(
"username",
"alpha", 2);
910 $result = $user->call_trigger(
'USER_LOGIN_FAILED', $user);
918 $hookmanager->initHooks(array(
'login'));
919 $parameters = array(
'dol_authmode'=>$dol_authmode,
'dol_loginmesg'=>$_SESSION[
"dol_loginmesg"]);
920 $reshook = $hookmanager->executeHooks(
'afterLoginFailed', $parameters, $user, $action);
930 if (!$login || (in_array(
'ldap', $authmode) && empty($passwordtotest))) {
932 dol_syslog(
"--- Access to ".(empty($_SERVER[
"REQUEST_METHOD"]) ?
'' : $_SERVER[
"REQUEST_METHOD"].
' ').$_SERVER[
"PHP_SELF"].
" - action=".
GETPOST(
'action',
'aZ09').
" - actionlogin=".
GETPOST(
'actionlogin',
'aZ09').
" - showing the login form and exit", LOG_NOTICE);
933 if (defined(
'NOREDIRECTBYMAINTOLOGIN')) {
938 return 'ERROR_NOT_LOGGED';
940 if (!empty($_SERVER[
"HTTP_USER_AGENT"]) && $_SERVER[
"HTTP_USER_AGENT"] ==
'securitytest') {
941 http_response_code(401);
943 dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc :
''));
948 $resultFetchUser = $user->fetch(
'', $login,
'', 1, ($entitytotest > 0 ? $entitytotest : -1));
949 if ($resultFetchUser <= 0 || $user->isNotIntoValidityDateRange()) {
950 dol_syslog(
'User not found or not valid, connexion refused');
952 session_set_cookie_params(0,
'/',
null, (empty($dolibarr_main_force_https) ?
false : true), true);
953 session_name($sessionname);
956 if ($resultFetchUser == 0) {
958 $langs->loadLangs(array(
'main',
'errors'));
960 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorCantLoadUserFromDolibarrDatabase", $login);
962 $user->context[
'audit'] =
'ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
963 } elseif ($resultFetchUser < 0) {
964 $_SESSION[
"dol_loginmesg"] = $user->error;
966 $user->context[
'audit'] = $user->error;
969 $langs->loadLangs(array(
'main',
'errors'));
971 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorLoginDateValidity");
973 $user->context[
'audit'] = $langs->trans(
"ErrorLoginDateValidity").
' - login='.$login;
977 $result = $user->call_trigger(
'USER_LOGIN_FAILED', $user);
986 $hookmanager->initHooks(array(
'login'));
987 $parameters = array(
'dol_authmode'=>$dol_authmode,
'dol_loginmesg'=>$_SESSION[
"dol_loginmesg"]);
988 $reshook = $hookmanager->executeHooks(
'afterLoginFailed', $parameters, $user, $action);
993 $paramsurl = array();
994 if (
GETPOST(
'textbrowser',
'int')) {
995 $paramsurl[] =
'textbrowser='.GETPOST(
'textbrowser',
'int');
998 $paramsurl[] =
'nojs='.GETPOST(
'nojs',
'int');
1000 if (
GETPOST(
'lang',
'aZ09')) {
1001 $paramsurl[] =
'lang='.GETPOST(
'lang',
'aZ09');
1003 header(
'Location: '.DOL_URL_ROOT.
'/index.php'.(count($paramsurl) ?
'?'.implode(
'&', $paramsurl) :
''));
1007 if (!empty($user->conf->MAIN_LANG_DEFAULT)) {
1008 $langs->setDefaultLang($user->conf->MAIN_LANG_DEFAULT);
1013 $login = $_SESSION[
"dol_login"];
1014 $entity = isset($_SESSION[
"dol_entity"]) ? $_SESSION[
"dol_entity"] : 0;
1015 dol_syslog(
"- This is an already logged session. _SESSION['dol_login']=".$login.
" _SESSION['dol_entity']=".$entity, LOG_DEBUG);
1017 $resultFetchUser = $user->fetch(
'', $login,
'', 1, ($entity > 0 ? $entity : -1));
1021 if ($resultFetchUser <= 0
1022 || ($user->flagdelsessionsbefore && !empty($_SESSION[
"dol_logindate"]) && $user->flagdelsessionsbefore > $_SESSION[
"dol_logindate"])
1023 || ($user->status != $user::STATUS_ENABLED)
1024 || ($user->isNotIntoValidityDateRange())) {
1025 if ($resultFetchUser <= 0) {
1027 dol_syslog(
"Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING);
1028 } elseif ($user->flagdelsessionsbefore && !empty($_SESSION[
"dol_logindate"]) && $user->flagdelsessionsbefore > $_SESSION[
"dol_logindate"]) {
1030 dol_syslog(
"The user has a date for session invalidation = ".$user->flagdelsessionsbefore.
" and a session date = ".$_SESSION[
"dol_logindate"].
". We must invalidate its sessions.");
1031 } elseif ($user->status != $user::STATUS_ENABLED) {
1036 dol_syslog(
"The user login has a validity between [".$user->datestartvalidity.
" and ".$user->dateendvalidity.
"], curren date is ".
dol_now());
1039 session_set_cookie_params(0,
'/',
null, (empty($dolibarr_main_force_https) ?
false : true), true);
1040 session_name($sessionname);
1043 if ($resultFetchUser == 0) {
1044 $langs->loadLangs(array(
'main',
'errors'));
1046 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorCantLoadUserFromDolibarrDatabase", $login);
1048 $user->context[
'audit'] =
'ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
1049 } elseif ($resultFetchUser < 0) {
1050 $_SESSION[
"dol_loginmesg"] = $user->error;
1052 $user->context[
'audit'] = $user->error;
1054 $langs->loadLangs(array(
'main',
'errors'));
1056 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorSessionInvalidatedAfterPasswordChange");
1058 $user->context[
'audit'] =
'ErrorUserSessionWasInvalidated - login='.$login;
1062 $result = $user->call_trigger(
'USER_LOGIN_FAILED', $user);
1070 $hookmanager->initHooks(array(
'login'));
1071 $parameters = array(
'dol_authmode' => (isset($dol_authmode) ? $dol_authmode :
''),
'dol_loginmesg' => $_SESSION[
"dol_loginmesg"]);
1072 $reshook = $hookmanager->executeHooks(
'afterLoginFailed', $parameters, $user, $action);
1077 $paramsurl = array();
1078 if (
GETPOST(
'textbrowser',
'int')) {
1079 $paramsurl[] =
'textbrowser='.GETPOST(
'textbrowser',
'int');
1082 $paramsurl[] =
'nojs='.GETPOST(
'nojs',
'int');
1084 if (
GETPOST(
'lang',
'aZ09')) {
1085 $paramsurl[] =
'lang='.GETPOST(
'lang',
'aZ09');
1088 header(
'Location: '.DOL_URL_ROOT.
'/index.php'.(count($paramsurl) ?
'?'.implode(
'&', $paramsurl) :
''));
1092 $hookmanager->initHooks(array(
'main'));
1095 if (!empty($_GET[
'save_lastsearch_values']) && !empty($_SERVER[
"HTTP_REFERER"])) {
1096 $relativepathstring = preg_replace(
'/\?.*$/',
'', $_SERVER[
"HTTP_REFERER"]);
1097 $relativepathstring = preg_replace(
'/^https?:\/\/[^\/]*/',
'', $relativepathstring);
1099 if (constant(
'DOL_URL_ROOT')) {
1100 $relativepathstring = preg_replace(
'/^'.preg_quote(constant(
'DOL_URL_ROOT'),
'/').
'/',
'', $relativepathstring);
1102 $relativepathstring = preg_replace(
'/^\//',
'', $relativepathstring);
1103 $relativepathstring = preg_replace(
'/^custom\//',
'', $relativepathstring);
1107 if (!empty($_SESSION[
'lastsearch_values_tmp_'.$relativepathstring])) {
1108 $_SESSION[
'lastsearch_values_'.$relativepathstring] = $_SESSION[
'lastsearch_values_tmp_'.$relativepathstring];
1109 unset($_SESSION[
'lastsearch_values_tmp_'.$relativepathstring]);
1111 if (!empty($_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring])) {
1112 $_SESSION[
'lastsearch_contextpage_'.$relativepathstring] = $_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring];
1113 unset($_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring]);
1115 if (!empty($_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit) {
1116 $_SESSION[
'lastsearch_limit_'.$relativepathstring] = $_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring];
1117 unset($_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring]);
1119 if (!empty($_SESSION[
'lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION[
'lastsearch_page_tmp_'.$relativepathstring] > 0) {
1120 $_SESSION[
'lastsearch_page_'.$relativepathstring] = $_SESSION[
'lastsearch_page_tmp_'.$relativepathstring];
1121 unset($_SESSION[
'lastsearch_page_tmp_'.$relativepathstring]);
1123 if (!empty($_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring])) {
1124 $_SESSION[
'lastsearch_mode_'.$relativepathstring] = $_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring];
1125 unset($_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring]);
1128 if (!empty($_GET[
'save_pageforbacktolist']) && !empty($_SERVER[
"HTTP_REFERER"])) {
1129 if (empty($_SESSION[
'pageforbacktolist'])) {
1130 $pageforbacktolistarray = array();
1132 $pageforbacktolistarray = $_SESSION[
'pageforbacktolist'];
1134 $tmparray = explode(
':', $_GET[
'save_pageforbacktolist'], 2);
1135 if (!empty($tmparray[0]) && !empty($tmparray[1])) {
1136 $pageforbacktolistarray[$tmparray[0]] = $tmparray[1];
1137 $_SESSION[
'pageforbacktolist'] = $pageforbacktolistarray;
1142 $parameters = array();
1143 $reshook = $hookmanager->executeHooks(
'updateSession', $parameters, $user, $action);
1152 if (!isset($_SESSION[
"dol_login"])) {
1157 $_SESSION[
"dol_login"] = $user->login;
1158 $_SESSION[
"dol_logindate"] =
dol_now(
'gmt');
1159 $_SESSION[
"dol_authmode"] = isset($dol_authmode) ? $dol_authmode :
'';
1160 $_SESSION[
"dol_tz"] = isset($dol_tz) ? $dol_tz :
'';
1161 $_SESSION[
"dol_tz_string"] = isset($dol_tz_string) ? $dol_tz_string :
'';
1162 $_SESSION[
"dol_dst"] = isset($dol_dst) ? $dol_dst :
'';
1163 $_SESSION[
"dol_dst_observed"] = isset($dol_dst_observed) ? $dol_dst_observed :
'';
1164 $_SESSION[
"dol_dst_first"] = isset($dol_dst_first) ? $dol_dst_first :
'';
1165 $_SESSION[
"dol_dst_second"] = isset($dol_dst_second) ? $dol_dst_second :
'';
1166 $_SESSION[
"dol_screenwidth"] = isset($dol_screenwidth) ? $dol_screenwidth :
'';
1167 $_SESSION[
"dol_screenheight"] = isset($dol_screenheight) ? $dol_screenheight :
'';
1169 $_SESSION[
"dol_entity"] = $conf->entity;
1171 if (!empty($dol_hide_topmenu)) {
1172 $_SESSION[
'dol_hide_topmenu'] = $dol_hide_topmenu;
1174 if (!empty($dol_hide_leftmenu)) {
1175 $_SESSION[
'dol_hide_leftmenu'] = $dol_hide_leftmenu;
1177 if (!empty($dol_optimize_smallscreen)) {
1178 $_SESSION[
'dol_optimize_smallscreen'] = $dol_optimize_smallscreen;
1180 if (!empty($dol_no_mouse_hover)) {
1181 $_SESSION[
'dol_no_mouse_hover'] = $dol_no_mouse_hover;
1183 if (!empty($dol_use_jmobile)) {
1184 $_SESSION[
'dol_use_jmobile'] = $dol_use_jmobile;
1187 dol_syslog(
"This is a new started user session. _SESSION['dol_login']=".$_SESSION[
"dol_login"].
" Session id=".session_id());
1191 $user->update_last_login_date();
1193 $loginfo =
'TZ='.$_SESSION[
"dol_tz"].
';TZString='.$_SESSION[
"dol_tz_string"].
';Screen='.$_SESSION[
"dol_screenwidth"].
'x'.$_SESSION[
"dol_screenheight"];
1194 $loginfo .=
' - authmode='.$dol_authmode.
' - entity='.$conf->entity;
1197 $user->context[
'audit'] = $loginfo;
1198 $user->context[
'authentication_method'] = $dol_authmode;
1201 $result = $user->call_trigger(
'USER_LOGIN', $user);
1209 $hookmanager->initHooks(array(
'login'));
1210 $parameters = array(
'dol_authmode'=>$dol_authmode,
'dol_loginfo'=>$loginfo);
1211 $reshook = $hookmanager->executeHooks(
'afterLogin', $parameters, $user, $action);
1219 dol_print_error($db,
'Error in some triggers USER_LOGIN or in some hooks afterLogin');
1226 $landingpage = (empty($user->conf->MAIN_LANDING_PAGE) ? (!
getDolGlobalString(
'MAIN_LANDING_PAGE') ?
'' : $conf->global->MAIN_LANDING_PAGE) : $user->
conf->MAIN_LANDING_PAGE);
1227 if (!empty($landingpage)) {
1229 if ($_SERVER[
"PHP_SELF"] != $newpath) {
1230 header(
'Location: '.$newpath);
1239 $user->rights->user->user->lire = 1;
1240 $user->rights->user->user->creer = 1;
1241 $user->rights->user->user->password = 1;
1242 $user->rights->user->user->supprimer = 1;
1243 $user->rights->user->self->creer = 1;
1244 $user->rights->user->self->password = 1;
1248 if (!$user->hasRight(
'user',
'user_advance')) {
1249 $user->rights->user->user_advance =
new stdClass();
1251 if (!$user->hasRight(
'user',
'self_advance')) {
1252 $user->rights->user->self_advance =
new stdClass();
1254 if (!$user->hasRight(
'user',
'group_advance')) {
1255 $user->rights->user->group_advance =
new stdClass();
1258 $user->rights->user->user_advance->readperms = 1;
1259 $user->rights->user->user_advance->write = 1;
1260 $user->rights->user->self_advance->readperms = 1;
1261 $user->rights->user->self_advance->writeperms = 1;
1262 $user->rights->user->group_advance->read = 1;
1263 $user->rights->user->group_advance->readperms = 1;
1264 $user->rights->user->group_advance->write = 1;
1265 $user->rights->user->group_advance->delete = 1;
1274 if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) {
1275 $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT;
1277 if (isset($user->conf->PRODUIT_LIMIT_SIZE)) {
1278 $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE;
1283 $conf->theme = $user->conf->MAIN_THEME;
1284 $conf->css =
"/theme/".$conf->theme.
"/style.css.php";
1288 if (!empty($user) && method_exists($user,
'loadDefaultValues') && !defined(
'NODEFAULTVALUES')) {
1289 $user->loadDefaultValues();
1295if (
GETPOST(
'theme',
'aZ09')) {
1296 $conf->theme =
GETPOST(
'theme',
'aZ09', 1);
1297 $conf->css =
"/theme/".$conf->theme.
"/style.css.php";
1302 $conf->use_javascript_ajax = 0;
1304 if (!empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) {
1305 $conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT;
1310if (!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') && !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1311 $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = $user->conf->MAIN_OPTIMIZEFORTEXTBROWSER;
1315 $conf->global->MAIN_OPTIMIZEFORCOLORBLIND = empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND) ?
'' : $user->conf->MAIN_OPTIMIZEFORCOLORBLIND;
1318if (
GETPOST(
'dol_hide_leftmenu',
'int') || !empty($_SESSION[
'dol_hide_leftmenu'])) {
1319 $conf->dol_hide_leftmenu = 1;
1321if (
GETPOST(
'dol_hide_topmenu',
'int') || !empty($_SESSION[
'dol_hide_topmenu'])) {
1322 $conf->dol_hide_topmenu = 1;
1324if (
GETPOST(
'dol_optimize_smallscreen',
'int') || !empty($_SESSION[
'dol_optimize_smallscreen'])) {
1325 $conf->dol_optimize_smallscreen = 1;
1327if (
GETPOST(
'dol_no_mouse_hover',
'int') || !empty($_SESSION[
'dol_no_mouse_hover'])) {
1328 $conf->dol_no_mouse_hover = 1;
1330if (
GETPOST(
'dol_use_jmobile',
'int') || !empty($_SESSION[
'dol_use_jmobile'])) {
1331 $conf->dol_use_jmobile = 1;
1334if (!empty($conf->browser->layout) && $conf->browser->layout !=
'classic') {
1335 $conf->dol_no_mouse_hover = 1;
1339if ((!empty($conf->browser->layout) && $conf->browser->layout ==
'phone')
1340 || (!empty($_SESSION[
'dol_screenwidth']) && $_SESSION[
'dol_screenwidth'] < 400)
1341 || (!empty($_SESSION[
'dol_screenheight']) && $_SESSION[
'dol_screenheight'] < 400
1344 $conf->dol_optimize_smallscreen = 1;
1347 $conf->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = 0;
1351if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array(
'bureau2crea',
'cameleo',
'amarok'))) {
1352 $conf->theme =
'eldy';
1353 $conf->css =
"/theme/".$conf->theme.
"/style.css.php";
1356if (!defined(
'NOREQUIRETRAN')) {
1357 if (!
GETPOST(
'lang',
'aZ09')) {
1359 if (!empty($user->conf->MAIN_LANG_DEFAULT)) {
1362 if ($langs->getDefaultLang() != $user->conf->MAIN_LANG_DEFAULT) {
1363 $langs->setDefaultLang($user->conf->MAIN_LANG_DEFAULT);
1369if (!defined(
'NOLOGIN')) {
1372 if (!$user->login) {
1377 if ($user->statut < 1) {
1379 $langs->loadLangs(array(
"errors",
"other"));
1380 dol_syslog(
"Authentication KO as login is disabled", LOG_NOTICE);
1388 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);
1393if (!defined(
'NOREQUIRETRAN')) {
1395 $langs->loadLangs(array(
'main',
'dict'));
1399 $bc = array(0=>
'class="impair"', 1=>
'class="pair"');
1400 $bcdd = array(0=>
'class="drag drop oddeven"', 1=>
'class="drag drop oddeven"');
1401 $bcnd = array(0=>
'class="nodrag nodrop nohover"', 1=>
'class="nodrag nodrop nohoverpair"');
1402 $bctag = array(0=>
'class="impair tagtr"', 1=>
'class="pair tagtr"');
1405 $mesg =
''; $warning =
''; $error = 0;
1407 $mesgs = array(); $warnings = array(); $errors = array();
1410if (empty($conf->browser->firefox)) {
1411 define(
'ROWS_1', 1);
1412 define(
'ROWS_2', 2);
1413 define(
'ROWS_3', 3);
1414 define(
'ROWS_4', 4);
1415 define(
'ROWS_5', 5);
1416 define(
'ROWS_6', 6);
1417 define(
'ROWS_7', 7);
1418 define(
'ROWS_8', 8);
1419 define(
'ROWS_9', 9);
1421 define(
'ROWS_1', 0);
1422 define(
'ROWS_2', 1);
1423 define(
'ROWS_3', 2);
1424 define(
'ROWS_4', 3);
1425 define(
'ROWS_5', 4);
1426 define(
'ROWS_6', 5);
1427 define(
'ROWS_7', 6);
1428 define(
'ROWS_8', 7);
1429 define(
'ROWS_9', 8);
1432 $heightforframes = 50;
1435if (!defined(
'NOREQUIREMENU')) {
1436 if (empty($user->socid)) {
1437 $conf->standard_menu = (!
getDolGlobalString(
'MAIN_MENU_STANDARD_FORCED') ? (!
getDolGlobalString(
'MAIN_MENU_STANDARD') ?
'eldy_menu.php' : $conf->global->MAIN_MENU_STANDARD) : $conf->global->MAIN_MENU_STANDARD_FORCED);
1440 $conf->standard_menu = (!
getDolGlobalString(
'MAIN_MENUFRONT_STANDARD_FORCED') ? (!
getDolGlobalString(
'MAIN_MENUFRONT_STANDARD') ?
'eldy_menu.php' : $conf->global->MAIN_MENUFRONT_STANDARD) : $conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
1444 $file_menu = $conf->standard_menu;
1445 if (
GETPOST(
'menu',
'alpha')) {
1446 $file_menu =
GETPOST(
'menu',
'alpha');
1448 if (!class_exists(
'MenuManager')) {
1450 $dirmenus = array_merge(array(
"/core/menus/"), (array) $conf->modules_parts[
'menus']);
1451 foreach ($dirmenus as $dirmenu) {
1453 if (class_exists(
'MenuManager')) {
1457 if (!class_exists(
'MenuManager')) {
1458 dol_syslog(
"You define a menu manager '".$file_menu.
"' that can not be loaded.", LOG_WARNING);
1459 $file_menu =
'eldy_menu.php';
1460 include_once DOL_DOCUMENT_ROOT.
"/core/menus/standard/".$file_menu;
1463 $menumanager =
new MenuManager($db, empty($user->socid) ? 0 : 1);
1467if (!empty(
GETPOST(
'seteventmessages',
'alpha'))) {
1468 $message =
GETPOST(
'seteventmessages',
'alpha');
1469 $messages = explode(
',', $message);
1470 foreach ($messages as $key => $msg) {
1471 $tmp = explode(
':', $msg);
1478if (!function_exists(
"llxHeader")) {
1499 function llxHeader($head =
'', $title =
'', $help_url =
'', $target =
'', $disablejs = 0, $disablehead = 0, $arrayofjs =
'', $arrayofcss =
'', $morequerystring =
'', $morecssonbody =
'', $replacemainareaby =
'', $disablenofollow = 0, $disablenoindex = 0)
1501 global $conf, $hookmanager;
1503 $parameters = array(
1506 'help_url' =>& $help_url,
1507 'target' =>& $target,
1508 'disablejs' =>& $disablejs,
1509 'disablehead' =>& $disablehead,
1510 'arrayofjs' =>& $arrayofjs,
1511 'arrayofcss' =>& $arrayofcss,
1512 'morequerystring' =>& $morequerystring,
1513 'morecssonbody' =>& $morecssonbody,
1514 'replacemainareaby' =>& $replacemainareaby,
1515 'disablenofollow' =>& $disablenofollow,
1516 'disablenoindex' =>& $disablenoindex
1519 $reshook = $hookmanager->executeHooks(
'llxHeader', $parameters);
1521 print $hookmanager->resPrint;
1526 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, $disablenofollow, $disablenoindex);
1528 $tmpcsstouse =
'sidebar-collapse'.($morecssonbody ?
' '.$morecssonbody :
'');
1530 if ($conf->theme ==
'md' && !in_array($conf->browser->layout, array(
'phone',
'tablet')) && !
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER')) {
1532 if ($mainmenu !=
'website') {
1533 $tmpcsstouse = $morecssonbody;
1538 $tmpcsstouse .=
' colorblind-'.strip_tags($conf->global->MAIN_OPTIMIZEFORCOLORBLIND);
1541 print
'<body id="mainbody" class="'.$tmpcsstouse.
'">'.
"\n";
1544 if ((empty($conf->dol_hide_topmenu) ||
GETPOST(
'dol_invisible_topmenu',
'int')) && !
GETPOST(
'dol_openinpopup',
'aZ09')) {
1545 top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring, $help_url);
1548 if (empty($conf->dol_hide_leftmenu) && !
GETPOST(
'dol_openinpopup',
'aZ09')) {
1549 left_menu(array(), $help_url,
'',
'', 1, $title, 1);
1553 if ($replacemainareaby) {
1554 print $replacemainareaby;
1708function top_htmlhead($head, $title =
'', $disablejs = 0, $disablehead = 0, $arrayofjs = array(), $arrayofcss = array(), $disableforlogin = 0, $disablenofollow = 0, $disablenoindex = 0)
1710 global $db, $conf, $langs, $user, $mysoc, $hookmanager;
1714 if (empty($conf->css)) {
1715 $conf->css =
'/theme/eldy/style.css.php';
1718 print
'<!doctype html>'.
"\n";
1720 print
'<html lang="'.substr($langs->defaultlang, 0, 2).
'">'.
"\n";
1723 if (empty($disablehead)) {
1724 if (!is_object($hookmanager)) {
1725 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
1728 $hookmanager->initHooks(array(
"main"));
1730 $ext =
'layout='.(empty($conf->browser->layout) ?
'' : $conf->browser->layout).
'&version='.urlencode(DOL_VERSION);
1734 if (
GETPOST(
'dol_basehref',
'alpha')) {
1735 print
'<base href="'.dol_escape_htmltag(
GETPOST(
'dol_basehref',
'alpha')).
'">'.
"\n";
1739 print
'<meta charset="utf-8">'.
"\n";
1740 print
'<meta name="robots" content="'.($disablenoindex ?
'index' :
'noindex').($disablenofollow ?
',follow' :
',nofollow').
'">'.
"\n";
1741 print
'<meta name="viewport" content="width=device-width, initial-scale=1.0">'.
"\n";
1742 print
'<meta name="author" content="Dolibarr Development Team">'.
"\n";
1743 print
'<meta name="anti-csrf-newtoken" content="'.newToken().
'">'.
"\n";
1744 print
'<meta name="anti-csrf-currenttoken" content="'.currentToken().
'">'.
"\n";
1746 print
'<meta name="MAIN_FEATURES_LEVEL" content="'.getDolGlobalInt(
'MAIN_FEATURES_LEVEL').
'">'.
"\n";
1749 $favicon = DOL_URL_ROOT.
'/theme/dolibarr_256x256_color.png';
1750 if (!empty($mysoc->logo_squarred_mini)) {
1751 $favicon = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode(
'logos/thumbs/'.$mysoc->logo_squarred_mini);
1756 if (empty($conf->dol_use_jmobile)) {
1757 print
'<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.
'"/>'.
"\n";
1765 $manifest = DOL_URL_ROOT.
'/theme/'.$conf->theme.
'/manifest.json.php';
1766 if (!empty($manifest)) {
1767 print
'<link rel="manifest" href="'.$manifest.
'" />'.
"\n";
1772 print
'<meta name="theme-color" content="rgb(' .
getDolGlobalString(
'THEME_ELDY_TOPMENU_BACK1').
')">'.
"\n";
1776 if (
GETPOST(
'autorefresh',
'int') > 0) {
1777 print
'<meta http-equiv="refresh" content="'.GETPOST(
'autorefresh',
'int').
'">';
1781 $appli = constant(
'DOL_APPLICATION_TITLE');
1783 $appli = $conf->global->MAIN_APPLICATION_TITLE;
1788 if ($title &&
getDolGlobalString(
'MAIN_HTML_TITLE') && preg_match(
'/noapp/', $conf->global->MAIN_HTML_TITLE)) {
1796 $parameters = array(
'title'=>$titletoshow);
1797 $result = $hookmanager->executeHooks(
'setHtmlTitle', $parameters);
1799 $titletoshow = $hookmanager->resPrint;
1801 $titletoshow .= $hookmanager->resPrint;
1809 if (
GETPOST(
'version',
'int')) {
1810 $ext =
'version='.GETPOST(
'version',
'int');
1813 if (
GETPOST(
'dol_resetcache')) {
1814 include_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
1818 $themeparam =
'?lang='.$langs->defaultlang.
'&theme='.$conf->theme.(GETPOST(
'optioncss',
'aZ09') ?
'&optioncss='.GETPOST(
'optioncss',
'aZ09', 1) :
'').(empty($user->id) ?
'' : (
'&userid='.$user->id)).
'&entity='.$conf->entity;
1820 $themeparam .= ($ext ?
'&'.$ext :
'').
'&revision='.
getDolGlobalInt(
"MAIN_IHM_PARAMS_REV");
1821 if (GETPOSTISSET(
'dol_hide_topmenu')) {
1822 $themeparam .=
'&dol_hide_topmenu='.GETPOST(
'dol_hide_topmenu',
'int');
1824 if (GETPOSTISSET(
'dol_hide_leftmenu')) {
1825 $themeparam .=
'&dol_hide_leftmenu='.GETPOST(
'dol_hide_leftmenu',
'int');
1827 if (GETPOSTISSET(
'dol_optimize_smallscreen')) {
1828 $themeparam .=
'&dol_optimize_smallscreen='.GETPOST(
'dol_optimize_smallscreen',
'int');
1830 if (GETPOSTISSET(
'dol_no_mouse_hover')) {
1831 $themeparam .=
'&dol_no_mouse_hover='.GETPOST(
'dol_no_mouse_hover',
'int');
1833 if (GETPOSTISSET(
'dol_use_jmobile')) {
1834 $themeparam .=
'&dol_use_jmobile='.GETPOST(
'dol_use_jmobile',
'int'); $conf->dol_use_jmobile =
GETPOST(
'dol_use_jmobile',
'int');
1836 if (GETPOSTISSET(
'THEME_DARKMODEENABLED')) {
1837 $themeparam .=
'&THEME_DARKMODEENABLED='.GETPOST(
'THEME_DARKMODEENABLED',
'int');
1839 if (GETPOSTISSET(
'THEME_SATURATE_RATIO')) {
1840 $themeparam .=
'&THEME_SATURATE_RATIO='.GETPOST(
'THEME_SATURATE_RATIO',
'int');
1844 print
'<link rel="preconnect" href="https://fonts.gstatic.com">'.
"\n";
1845 print
'<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@200;300;400;500;600&display=swap" rel="stylesheet">'.
"\n";
1848 if (!defined(
'DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) {
1849 print
'<!-- Includes CSS for JQuery (Ajax library) -->'.
"\n";
1850 $jquerytheme =
'base';
1852 $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
1854 if (constant(
'JS_JQUERY_UI')) {
1855 print
'<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.
'css/'.$jquerytheme.
'/jquery-ui.min.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1857 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/includes/jquery/css/'.$jquerytheme.
'/jquery-ui.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1859 if (!defined(
'DISABLE_JQUERY_JNOTIFY')) {
1860 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1862 if (!defined(
'DISABLE_SELECT2') && (
getDolGlobalString(
'MAIN_USE_JQUERY_MULTISELECT') || defined(
'REQUIRE_JQUERY_MULTISELECT'))) {
1863 $tmpplugin = !
getDolGlobalString(
'MAIN_USE_JQUERY_MULTISELECT') ?constant(
'REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1864 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/includes/jquery/plugins/'.$tmpplugin.
'/dist/css/'.$tmpplugin.
'.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1868 if (!defined(
'DISABLE_FONT_AWSOME')) {
1869 print
'<!-- Includes CSS for font awesome -->'.
"\n";
1870 $fontawesome_directory =
getDolGlobalString(
'MAIN_FONTAWESOME_DIRECTORY',
'/theme/common/fontawesome-5');
1871 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.$fontawesome_directory.
'/css/all.min.css'.($ext ?
'?'.$ext :
'').
'">'.
"\n";
1874 print
'<!-- Includes CSS for Dolibarr theme -->'.
"\n";
1878 if (!empty($conf->modules_parts[
'theme'])) {
1879 foreach ($conf->modules_parts[
'theme'] as $reldir) {
1882 $themesubdir = $reldir;
1889 print
'<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.
'">'.
"\n";
1891 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";
1895 if (!empty($conf->modules_parts[
'css'])) {
1896 $arraycss = (array) $conf->modules_parts[
'css'];
1897 foreach ($arraycss as $modcss => $filescss) {
1898 $filescss = (array) $filescss;
1899 foreach ($filescss as $cssfile) {
1900 if (empty($cssfile)) {
1901 dol_syslog(
"Warning: module ".$modcss.
" declared a css path file into its descriptor that is empty.", LOG_WARNING);
1905 if ($urlforcss && $urlforcss !=
'/') {
1906 print
'<!-- Includes CSS added by module '.$modcss.
' -->'.
"\n".
'<link rel="stylesheet" type="text/css" href="'.$urlforcss;
1908 if (!preg_match(
'/\.css$/i', $cssfile)) {
1913 dol_syslog(
"Warning: module ".$modcss.
" declared a css path file for a file we can't find.", LOG_WARNING);
1919 if (is_array($arrayofcss)) {
1920 foreach ($arrayofcss as $cssfile) {
1921 if (preg_match(
'/^(http|\/\/)/i', $cssfile)) {
1922 $urltofile = $cssfile;
1926 print
'<!-- Includes CSS added by page -->'.
"\n".
'<link rel="stylesheet" type="text/css" title="default" href="'.$urltofile;
1928 if (!preg_match(
'/\.css$/i', $cssfile)) {
1938 print
'<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.
'/theme/custom.css.php'.($ext ?
'?'.$ext :
'').
'&revision='.
getDolGlobalInt(
"MAIN_IHM_PARAMS_REV").
'">'.
"\n";
1942 if (!defined(
'DISABLE_JQUERY') && !$disablejs && !empty($conf->use_javascript_ajax)) {
1944 print
'<!-- Includes JS for JQuery -->'.
"\n";
1945 if (defined(
'JS_JQUERY') && constant(
'JS_JQUERY')) {
1946 print
'<script nonce="'.getNonce().
'" src="'.JS_JQUERY.
'jquery.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1948 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/includes/jquery/js/jquery.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1950 if (defined(
'JS_JQUERY_UI') && constant(
'JS_JQUERY_UI')) {
1951 print
'<script nonce="'.getNonce().
'" src="'.JS_JQUERY_UI.
'jquery-ui.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1953 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/includes/jquery/js/jquery-ui.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1956 if (!
getDolGlobalString(
'MAIN_DISABLE_JQUERY_JNOTIFY') && !defined(
'DISABLE_JQUERY_JNOTIFY')) {
1957 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1960 if (empty($disableforlogin) && !defined(
'DISABLE_JQUERY_TABLEDND')) {
1961 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1965 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/includes/nnnick/chartjs/dist/chart.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1969 if (
getDolGlobalString(
'MAIN_USE_JQUERY_JEDITABLE') && !defined(
'DISABLE_JQUERY_JEDITABLE')) {
1970 print
'<!-- JS to manage editInPlace feature -->'.
"\n";
1971 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jeditable/jquery.jeditable.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1972 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1973 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1974 print
'<script>'.
"\n";
1975 print
'var urlSaveInPlace = \''.DOL_URL_ROOT.
'/core/ajax/saveinplace.php\';'.
"\n";
1976 print
'var urlLoadInPlace = \''.DOL_URL_ROOT.
'/core/ajax/loadinplace.php\';'.
"\n";
1977 print
'var tooltipInPlace = \''.$langs->transnoentities(
'ClickToEdit').
'\';
'."\n"; // Added in title attribute of span
1978 print 'var placeholderInPlace = \
' \';'.
"\n";
1979 print
'var cancelInPlace = \''.$langs->trans(
"Cancel").
'\';
'."\n";
1980 print 'var submitInPlace = \
''.$langs->trans(
'Ok').
'\';
'."\n";
1981 print 'var indicatorInPlace = \
'<img src="'.DOL_URL_ROOT.
"/theme/".$conf->theme.
"/img/working.gif".
'">\';'.
"\n";
1982 print
'var withInPlace = 300;';
1983 print
'</script>'.
"\n";
1984 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/core/js/editinplace.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1985 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1988 if (
getDolGlobalString(
'MAIN_USE_JQUERY_TIMEPICKER') || defined(
'REQUIRE_JQUERY_TIMEPICKER')) {
1989 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/timepicker/jquery-ui-timepicker-addon.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1990 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/core/js/timepicker.js.php?lang='.$langs->defaultlang.($ext ?
'&'.$ext :
'').
'"></script>'.
"\n";
1992 if (!defined(
'DISABLE_SELECT2') && (
getDolGlobalString(
'MAIN_USE_JQUERY_MULTISELECT') || defined(
'REQUIRE_JQUERY_MULTISELECT'))) {
1994 $tmpplugin = !
getDolGlobalString(
'MAIN_USE_JQUERY_MULTISELECT') ?constant(
'REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1995 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/'.$tmpplugin.
'/dist/js/'.$tmpplugin.
'.full.min.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
1997 if (!defined(
'DISABLE_MULTISELECT')) {
1998 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/multiselect/jquery.multi-select.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
2002 if (!$disablejs && !empty($conf->use_javascript_ajax)) {
2004 if (empty($disableforlogin) && (isModEnabled(
'fckeditor') && (!
getDolGlobalString(
'FCKEDITOR_EDITORNAME') ||
getDolGlobalString(
'FCKEDITOR_EDITORNAME') ==
'ckeditor') && !defined(
'DISABLE_CKEDITOR')) || defined(
'FORCE_CKEDITOR')) {
2005 print
'<!-- Includes JS for CKEditor -->'.
"\n";
2006 $pathckeditor = DOL_URL_ROOT.
'/includes/ckeditor/ckeditor/';
2007 $jsckeditor =
'ckeditor.js';
2008 if (constant(
'JS_CKEDITOR')) {
2010 $pathckeditor = constant(
'JS_CKEDITOR');
2012 print
'<script nonce="'.getNonce().
'">';
2013 print
'/* enable ckeditor by main.inc.php */';
2014 print
'var CKEDITOR_BASEPATH = \''.dol_escape_js($pathckeditor).
'\';
'."\n";
2015 print 'var ckeditorConfig = \
''.dol_escape_js(
dol_buildpath($themesubdir.
'/theme/'.$conf->theme.
'/ckeditor/config.js'.($ext ?
'?'.$ext :
''), 1)).
'\';
'."\n"; // $themesubdir='' in standard usage
2016 print 'var ckeditorFilebrowserBrowseUrl = \
''.DOL_URL_ROOT.
'/core/filemanagerdol/browser/default/browser.php?Connector='.DOL_URL_ROOT.
'/core/filemanagerdol/connectors/php/connector.php\';'.
"\n";
2017 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";
2018 print
'</script>'.
"\n";
2019 print
'<script src="'.$pathckeditor.$jsckeditor.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
2021 if (
GETPOST(
'mode',
'aZ09') ==
'Full_inline') {
2022 print
'CKEDITOR.disableAutoInline = false;'.
"\n";
2024 print
'CKEDITOR.disableAutoInline = true;'.
"\n";
2026 print
'</script>'.
"\n";
2030 if (!defined(
'NOBROWSERNOTIF') && !defined(
'NOREQUIREMENU') && !defined(
'NOLOGIN')) {
2031 $enablebrowsernotif =
false;
2033 $enablebrowsernotif =
true;
2035 if ($conf->browser->layout ==
'phone') {
2036 $enablebrowsernotif =
false;
2038 if ($enablebrowsernotif) {
2039 print
'<!-- Includes JS of Dolibarr (browser layout = '.$conf->browser->layout.
')-->'.
"\n";
2040 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/core/js/lib_notification.js.php'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
2045 print
'<!-- Includes JS of Dolibarr -->'.
"\n";
2046 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/core/js/lib_head.js.php?lang='.$langs->defaultlang.($ext ?
'&'.$ext :
'').
'"></script>'.
"\n";
2049 if (!empty($conf->modules_parts[
'js'])) {
2050 $arrayjs = (array) $conf->modules_parts[
'js'];
2051 foreach ($arrayjs as $modjs => $filesjs) {
2052 $filesjs = (array) $filesjs;
2053 foreach ($filesjs as $jsfile) {
2056 if ($urlforjs && $urlforjs !=
'/') {
2057 print
'<!-- Include JS added by module '.$modjs.
'-->'.
"\n";
2058 print
'<script nonce="'.getNonce().
'" src="'.$urlforjs.((strpos($jsfile,
'?') ===
false) ?
'?' :
'&').
'lang='.$langs->defaultlang.
'"></script>'.
"\n";
2060 dol_syslog(
"Warning: module ".$modjs.
" declared a js path file for a file we can't find.", LOG_WARNING);
2066 if (is_array($arrayofjs)) {
2067 print
'<!-- Includes JS added by page -->'.
"\n";
2068 foreach ($arrayofjs as $jsfile) {
2069 if (preg_match(
'/^(http|\/\/)/i', $jsfile)) {
2070 print
'<script nonce="'.getNonce().
'" src="'.$jsfile.((strpos($jsfile,
'?') ===
false) ?
'?' :
'&').
'lang='.$langs->defaultlang.
'"></script>'.
"\n";
2072 print
'<script nonce="'.getNonce().
'" src="'.
dol_buildpath($jsfile, 1).((strpos($jsfile,
'?') ===
false) ?
'?' :
'&').
'lang='.$langs->defaultlang.
'"></script>'.
"\n";
2080 $theme_js =
dol_buildpath(
'/theme/'.$conf->theme.
'/'.$conf->theme.
'.js', 0);
2081 if (file_exists($theme_js)) {
2082 print
'<script nonce="'.getNonce().
'" src="'.DOL_URL_ROOT.
'/theme/'.$conf->theme.
'/'.$conf->theme.
'.js'.($ext ?
'?'.$ext :
'').
'"></script>'.
"\n";
2086 if (!empty($head)) {
2093 $parameters = array();
2094 $result = $hookmanager->executeHooks(
'addHtmlHeader', $parameters);
2095 print $hookmanager->resPrint;
2097 print
"</head>\n\n";
2100 $conf->headerdone = 1;
3164function left_menu($menu_array_before, $helppagename =
'', $notused =
'', $menu_array_after = array(), $leftmenuwithoutmainarea = 0, $title =
'', $acceptdelayedhtml = 0)
3166 global $user, $conf, $langs, $db, $form;
3167 global $hookmanager, $menumanager;
3171 if (!empty($menu_array_before)) {
3172 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);
3175 if (empty($conf->dol_hide_leftmenu) && (!defined(
'NOREQUIREMENU') || !constant(
'NOREQUIREMENU'))) {
3177 $hookmanager->initHooks(array(
'leftblock'));
3179 print
"\n".
'<!-- Begin side-nav id-left -->'.
"\n".
'<div class="side-nav"><div id="id-left">'.
"\n";
3182 if (!is_object($form)) {
3183 $form =
new Form($db);
3188 if ($conf->browser->layout ==
'phone') {
3189 $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1;
3193 $arrayresult = array();
3194 include DOL_DOCUMENT_ROOT.
'/core/ajax/selectsearchbox.php';
3199 $stringforfirstkey = $langs->trans(
"KeyboardShortcut");
3200 if ($conf->browser->name ==
'chrome') {
3201 $stringforfirstkey .=
' ALT +';
3202 } elseif ($conf->browser->name ==
'firefox') {
3203 $stringforfirstkey .=
' ALT + SHIFT +';
3205 $stringforfirstkey .=
' CTL +';
3208 $searchform .= $form->selectArrayFilter(
'searchselectcombo', $arrayresult, $selected,
'accesskey="s"', 1, 0, (!
getDolGlobalString(
'MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY') ? 1 : 0),
'vmenusearchselectcombo', 1, $langs->trans(
"Search"), 1, $stringforfirstkey.
' s');
3210 if (is_array($arrayresult)) {
3211 foreach ($arrayresult as $key => $val) {
3212 $searchform .=
printSearchForm($val[
'url'], $val[
'url'], $val[
'label'],
'maxwidth125',
'search_all', (empty($val[
'shortcut']) ?
'' : $val[
'shortcut']),
'searchleft'.$key, $val[
'img']);
3218 $parameters = array(
'searchform' => $searchform);
3219 $reshook = $hookmanager->executeHooks(
'printSearchForm', $parameters);
3220 if (empty($reshook)) {
3221 $searchform .= $hookmanager->resPrint;
3223 $searchform = $hookmanager->resPrint;
3227 if (
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') || empty($conf->use_javascript_ajax)) {
3228 $urltosearch = DOL_URL_ROOT.
'/core/search_page.php?showtitlebefore=1';
3229 $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>';
3230 } elseif ($conf->use_javascript_ajax &&
getDolGlobalString(
'MAIN_USE_OLD_SEARCH_FORM')) {
3231 $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>';
3232 $searchform .=
'<script>
3233 jQuery(document).ready(function () {
3234 jQuery("#divsearchforms1").click(function(){
3235 jQuery("#divsearchforms2").toggle();
3239 $searchform .=
'</div>';
3243 $searchform .=
'<script>
3244 jQuery(document).keydown(function(e){
3245 if( e.which === 70 && e.ctrlKey && e.shiftKey ){
3246 console.log(\'control + shift + f : trigger open global-search dropdown\');
3247 openGlobalSearchDropDown();
3249 if( (e.which === 83 || e.which === 115) && e.altKey ){
3250 console.log(\'alt + s : trigger open global-search dropdown\');
3251 openGlobalSearchDropDown();
3255 var openGlobalSearchDropDown = function() {
3256 jQuery("#searchselectcombo").select2(\'open\');
3262 print
'<!-- Begin left menu -->'.
"\n";
3264 print
'<div class="vmenu"'.(!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'' :
' title="Left menu"').
'>'.
"\n\n";
3267 $menumanager->menu_array = $menu_array_before;
3268 $menumanager->menu_array_after = $menu_array_after;
3269 $menumanager->showmenu(
'left', array(
'searchform'=>$searchform));
3273 print
"<!-- Begin Help Block-->\n";
3274 print
'<div id="blockvmenuhelp" class="blockvmenuhelp">'.
"\n";
3278 $doliurl =
'https://www.dolibarr.org';
3280 if (preg_match(
'/fr/i', $langs->defaultlang)) {
3281 $doliurl =
'https://www.dolibarr.fr';
3283 if (preg_match(
'/es/i', $langs->defaultlang)) {
3284 $doliurl =
'https://www.dolibarr.es';
3286 if (preg_match(
'/de/i', $langs->defaultlang)) {
3287 $doliurl =
'https://www.dolibarr.de';
3289 if (preg_match(
'/it/i', $langs->defaultlang)) {
3290 $doliurl =
'https://www.dolibarr.it';
3292 if (preg_match(
'/gr/i', $langs->defaultlang)) {
3293 $doliurl =
'https://www.dolibarr.gr';
3296 $appli = constant(
'DOL_APPLICATION_TITLE');
3298 $appli = $conf->global->MAIN_APPLICATION_TITLE; $doliurl =
'';
3299 if (preg_match(
'/\d\.\d/', $appli)) {
3300 if (!preg_match(
'/'.preg_quote(DOL_VERSION).
'/', $appli)) {
3301 $appli .=
" (".DOL_VERSION.
")";
3304 $appli .=
" ".DOL_VERSION;
3307 $appli .=
" ".DOL_VERSION;
3309 print
'<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
3311 print
'<a class="help" target="_blank" rel="noopener noreferrer" href="'.$doliurl.
'">';
3313 print
'<span class="help">';
3321 print
'</div>'.
"\n";
3326 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3329 $bugbaseurl =
'https://github.com/Dolibarr/dolibarr/issues/new?labels=Bug';
3330 $bugbaseurl .=
'&title=';
3331 $bugbaseurl .= urlencode(
"Bug: ");
3332 $bugbaseurl .=
'&body=';
3333 $bugbaseurl .= urlencode(
"# Instructions\n");
3334 $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");
3335 $bugbaseurl .= urlencode(
"*Please:*\n");
3336 $bugbaseurl .= urlencode(
"- *replace the bracket enclosed texts with meaningful information*\n");
3337 $bugbaseurl .= urlencode(
"- *remove any unused sub-section*\n");
3338 $bugbaseurl .= urlencode(
"\n");
3339 $bugbaseurl .= urlencode(
"\n");
3340 $bugbaseurl .= urlencode(
"# Bug\n");
3341 $bugbaseurl .= urlencode(
"[*Short description*]\n");
3342 $bugbaseurl .= urlencode(
"\n");
3343 $bugbaseurl .= urlencode(
"## Environment\n");
3344 $bugbaseurl .= urlencode(
"- **Version**: ".DOL_VERSION.
"\n");
3345 $bugbaseurl .= urlencode(
"- **OS**: ".php_uname(
's').
"\n");
3346 $bugbaseurl .= urlencode(
"- **Web server**: ".$_SERVER[
"SERVER_SOFTWARE"].
"\n");
3347 $bugbaseurl .= urlencode(
"- **PHP**: ".php_sapi_name().
' '.phpversion().
"\n");
3348 $bugbaseurl .= urlencode(
"- **Database**: ".$db::LABEL.
' '.$db->getVersion().
"\n");
3349 $bugbaseurl .= urlencode(
"- **URL(s)**: ".$_SERVER[
"REQUEST_URI"].
"\n");
3350 $bugbaseurl .= urlencode(
"\n");
3351 $bugbaseurl .= urlencode(
"## Expected and actual behavior\n");
3352 $bugbaseurl .= urlencode(
"[*Verbose description*]\n");
3353 $bugbaseurl .= urlencode(
"\n");
3354 $bugbaseurl .= urlencode(
"## Steps to reproduce the behavior\n");
3355 $bugbaseurl .= urlencode(
"[*Verbose description*]\n");
3356 $bugbaseurl .= urlencode(
"\n");
3357 $bugbaseurl .= urlencode(
"## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…)\n");
3358 $bugbaseurl .= urlencode(
"[*Files*]\n");
3359 $bugbaseurl .= urlencode(
"\n");
3361 $bugbaseurl .= urlencode(
"\n");
3362 $bugbaseurl .= urlencode(
"## Report\n");
3364 $bugbaseurl = $conf->global->MAIN_BUGTRACK_ENABLELINK;
3370 $parameters = array(
'bugbaseurl' => $bugbaseurl);
3371 $reshook = $hookmanager->executeHooks(
'printBugtrackInfo', $parameters);
3372 if (empty($reshook)) {
3373 $bugbaseurl .= $hookmanager->resPrint;
3375 $bugbaseurl = $hookmanager->resPrint;
3378 print
'<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">';
3379 print
'<a class="help" target="_blank" rel="noopener noreferrer" href="'.$bugbaseurl.
'"><i class="fas fa-bug"></i> '.$langs->trans(
"FindBug").
'</a>';
3384 print
"<!-- End Help Block-->\n";
3388 print
"<!-- End left menu -->\n";
3392 $parameters = array();
3393 $reshook = $hookmanager->executeHooks(
'printLeftBlock', $parameters);
3394 print $hookmanager->resPrint;
3396 print
'</div></div> <!-- End side-nav id-left -->';
3400 print
'<!-- Begin right area -->'.
"\n";
3402 if (empty($leftmenuwithoutmainarea)) {
3536function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey =
'', $prefhtmlinputname =
'', $img =
'', $showtitlebefore = 0, $autofocus = 0)
3538 global $langs, $user;
3541 $ret .=
'<form action="'.$urlaction.
'" method="post" class="searchform nowraponall tagtr">';
3542 $ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
3543 $ret .=
'<input type="hidden" name="savelogin" value="'.dol_escape_htmltag($user->login).
'">';
3544 if ($showtitlebefore) {
3545 $ret .=
'<div class="tagtd left">'.$title.
'</div> ';
3547 $ret .=
'<div class="tagtd">';
3548 $ret .=
img_picto(
'', $img,
'',
false, 0, 0,
'',
'paddingright width20');
3549 $ret .=
'<input type="text" class="flat '.$htmlmorecss.
'"';
3550 $ret .=
' style="background-repeat: no-repeat; background-position: 3px;"';
3551 $ret .= ($accesskey ?
' accesskey="'.$accesskey.
'"' :
'');
3552 $ret .=
' placeholder="'.strip_tags($title).
'"';
3553 $ret .= ($autofocus ?
' autofocus' :
'');
3554 $ret .=
' name="'.$htmlinputname.
'" id="'.$prefhtmlinputname.$htmlinputname.
'" />';
3555 $ret .=
'<button type="submit" class="button bordertransp" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">';
3556 $ret .=
'<span class="fa fa-search"></span>';
3557 $ret .=
'</button>';
3559 $ret .=
"</form>\n";
3564if (!function_exists(
"llxFooter")) {
3575 function llxFooter($comment =
'', $zone =
'private', $disabledoutputofmessages = 0)
3577 global $conf, $db, $langs, $user, $mysoc, $object, $hookmanager, $action;
3578 global $delayedhtmlcontent;
3579 global $contextpage, $page, $limit, $mode;
3580 global $dolibarr_distrib;
3582 $ext =
'layout='.urlencode($conf->browser->layout).
'&version='.urlencode(DOL_VERSION);
3586 $parameters = array();
3587 $reshook = $hookmanager->executeHooks(
'llxFooter', $parameters, $object, $action);
3588 if (empty($reshook)) {
3589 $llxfooter .= $hookmanager->resPrint;
3590 } elseif ($reshook > 0) {
3591 $llxfooter = $hookmanager->resPrint;
3602 if (is_object($user) && !empty($user->lastsearch_values_tmp) && is_array($user->lastsearch_values_tmp)) {
3604 foreach ($user->lastsearch_values_tmp as $key => $val) {
3605 unset($_SESSION[
'lastsearch_values_tmp_'.$key]);
3606 if (count($val) && empty($_POST[
'button_removefilter']) && empty($_POST[
'button_removefilter_x'])) {
3607 if (empty($val[
'sortfield'])) {
3608 unset($val[
'sortfield']);
3610 if (empty($val[
'sortorder'])) {
3611 unset($val[
'sortorder']);
3613 dol_syslog(
'Save lastsearch_values_tmp_'.$key.
'='.json_encode($val, 0).
" (systematic recording of last search criterias)");
3614 $_SESSION[
'lastsearch_values_tmp_'.$key] = json_encode($val);
3615 unset($_SESSION[
'lastsearch_values_'.$key]);
3621 $relativepathstring = $_SERVER[
"PHP_SELF"];
3623 if (constant(
'DOL_URL_ROOT')) {
3624 $relativepathstring = preg_replace(
'/^'.preg_quote(constant(
'DOL_URL_ROOT'),
'/').
'/',
'', $relativepathstring);
3626 $relativepathstring = preg_replace(
'/^\//',
'', $relativepathstring);
3627 $relativepathstring = preg_replace(
'/^custom\//',
'', $relativepathstring);
3628 if (preg_match(
'/list\.php$/', $relativepathstring)) {
3629 unset($_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring]);
3630 unset($_SESSION[
'lastsearch_page_tmp_'.$relativepathstring]);
3631 unset($_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring]);
3632 unset($_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring]);
3634 if (!empty($contextpage)) {
3635 $_SESSION[
'lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage;
3637 if (!empty($page) && $page > 0) {
3638 $_SESSION[
'lastsearch_page_tmp_'.$relativepathstring] = $page;
3640 if (!empty($limit) && $limit != $conf->liste_limit) {
3641 $_SESSION[
'lastsearch_limit_tmp_'.$relativepathstring] = $limit;
3643 if (!empty($mode)) {
3644 $_SESSION[
'lastsearch_mode_tmp_'.$relativepathstring] = $mode;
3647 unset($_SESSION[
'lastsearch_contextpage_'.$relativepathstring]);
3648 unset($_SESSION[
'lastsearch_page_'.$relativepathstring]);
3649 unset($_SESSION[
'lastsearch_limit_'.$relativepathstring]);
3650 unset($_SESSION[
'lastsearch_mode_'.$relativepathstring]);
3656 if ($conf->use_javascript_ajax) {
3657 $title =
img_warning().
' '.$langs->trans(
'CoreErrorTitle');
3658 print
ajax_dialog($title, $langs->trans(
'CoreErrorMessage'));
3661 $msg =
img_warning().
' '.$langs->trans(
'CoreErrorMessage');
3662 print
'<div class="error">'.$msg.
'</div>';
3670 print
'</div> <!-- End div class="fiche" -->'.
"\n";
3672 if (empty($conf->dol_hide_leftmenu) && !
GETPOST(
'dol_openinpopup')) {
3673 print
'</div> <!-- End div id-right -->'.
"\n";
3676 if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) {
3677 print
'</div> <!-- End div id-container -->'.
"\n";
3682 print
'<!-- '.$comment.
' -->'.
"\n";
3687 if (!empty($delayedhtmlcontent)) {
3688 print $delayedhtmlcontent;
3691 if (!empty($conf->use_javascript_ajax)) {
3692 print
"\n".
'<!-- Includes JS Footer of Dolibarr -->'.
"\n";
3693 print
'<script src="'.DOL_URL_ROOT.
'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.($ext ?
'&'.$ext :
'').
'"></script>'.
"\n";
3697 if (isModEnabled(
'blockedlog') && is_object($object) && !empty($object->id) && $object->id > 0) {
3698 if (in_array($object->element, array(
'facture')) && $object->statut > 0) {
3699 print
"\n<!-- JS CODE TO ENABLE log when making a download or a preview of a document -->\n";
3702 jQuery(document).ready(
function () {
3703 $(
'a.documentpreview').click(
function() {
3704 $.post(
'<?php echo DOL_URL_ROOT."/blockedlog/ajax/block-add.php" ?>'
3706 id:<?php echo $object->id; ?>
3707 , element:
'<?php echo $object->element ?>'
3708 , action:
'DOC_PREVIEW'
3709 , token:
'<?php echo currentToken(); ?>'
3713 $(
'a.documentdownload').click(
function() {
3714 $.post(
'<?php echo DOL_URL_ROOT."/blockedlog/ajax/block-add.php" ?>'
3716 id:<?php echo $object->id; ?>
3717 , element:
'<?php echo $object->element ?>'
3718 , action:
'DOC_DOWNLOAD'
3719 , token:
'<?php echo currentToken(); ?>'
3730 print
"\n<!-- A div to allow dialog popup by jQuery('#dialogforpopup').dialog() -->\n";
3731 print
'<div id="dialogforpopup" style="display: none;"></div>'.
"\n";
3735 $forceping =
GETPOST(
'forceping',
'alpha');
3736 if (($_SERVER[
"PHP_SELF"] == DOL_URL_ROOT.
'/index.php') || $forceping) {
3738 $hash_unique_id =
dol_hash(
'dolibarr'.$conf->file->instance_unique_id,
'sha256');
3741 || (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && (
getDolGlobalString(
'MAIN_FIRST_PING_OK_ID') !=
'disabled'))
3744 if (strpos(
'alpha', DOL_VERSION) > 0 && !$forceping) {
3745 print
"\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It is an alpha version -->\n";
3746 } elseif (empty($_COOKIE[
'DOLINSTALLNOPING_'.$hash_unique_id]) || $forceping) {
3750 print
"\n<!-- NO JS CODE TO ENABLE the anonymous Ping. An error already occured this month, we will try later. -->\n";
3752 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3754 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";
3755 print
"\n<!-- JS CODE TO ENABLE the anonymous Ping -->\n";
3756 $url_for_ping = (!
getDolGlobalString(
'MAIN_URL_FOR_PING') ?
"https://ping.dolibarr.org/" : $conf->global->MAIN_URL_FOR_PING);
3758 $distrib =
'standard';
3759 if ($_SERVER[
"SERVER_ADMIN"] ==
'doliwamp@localhost') {
3760 $distrib =
'doliwamp';
3762 if (!empty($dolibarr_distrib)) {
3763 $distrib = $dolibarr_distrib;
3767 jQuery(document).ready(
function (tmp) {
3768 console.log(
"Try Ping with hash_unique_id is dol_hash('dolibarr'+instance_unique_id, 'sha256')");
3771 url:
"<?php echo $url_for_ping ?>",
3775 hash_algo:
'dol_hash-sha256',
3776 hash_unique_id:
'<?php echo dol_escape_js($hash_unique_id); ?>',
3777 action:
'dolibarrping',
3778 version:
'<?php echo (float) DOL_VERSION; ?>',
3779 entity:
'<?php echo (int) $conf->entity; ?>',
3780 dbtype:
'<?php echo dol_escape_js($db->type); ?>',
3781 country_code:
'<?php echo $mysoc->country_code ? dol_escape_js($mysoc->country_code) : 'unknown
'; ?>',
3782 php_version:
'<?php echo dol_escape_js(phpversion()); ?>',
3783 os_version:
'<?php echo dol_escape_js(version_os('smr
')); ?>',
3784 db_version:
'<?php echo dol_escape_js(version_db()); ?>',
3785 distrib:
'<?php echo $distrib ? dol_escape_js($distrib) : 'unknown
'; ?>',
3786 token:
'notrequired'
3788 success:
function (data,
status, xhr) {
3789 console.log(
"Ping ok");
3792 url:
'<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php
'; ?>',
3795 data: { hash_algo:
'dol_hash-sha256', hash_unique_id:
'<?php echo dol_escape_js($hash_unique_id); ?>', action:
'firstpingok', token:
'<?php echo currentToken(); ?>' },
3798 error:
function (data,
status,xhr) {
3799 console.log(
"Ping ko: " + data);
3802 url:
'<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php
'; ?>',
3805 data: { hash_algo:
'dol_hash-sha256', hash_unique_id:
'<?php echo dol_escape_js($hash_unique_id); ?>', action:
'firstpingko', token:
'<?php echo currentToken(); ?>' },
3815 print
"\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It was disabled -->\n";
3816 include_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
3818 dolibarr_set_const($db,
'MAIN_FIRST_PING_OK_ID',
'disabled',
'chaine', 0,
'', $conf->entity);
3823 $parameters = array();
3824 $reshook = $hookmanager->executeHooks(
'beforeBodyClose', $parameters);
3826 print $hookmanager->resPrint;