diff --git a/htdocs/public/webportal/webportal.main.inc.php b/htdocs/public/webportal/webportal.main.inc.php index c00f1c30935..de198b4a494 100644 --- a/htdocs/public/webportal/webportal.main.inc.php +++ b/htdocs/public/webportal/webportal.main.inc.php @@ -2,6 +2,7 @@ /* Copyright (C) 2023-2024 Laurent Destailleur * Copyright (C) 2023-2024 Lionel Vessiller * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,13 +24,27 @@ * \brief Main include file for WebPortal */ -if (!defined('WEBPORTAL')) { define('WEBPORTAL', 1); } -if (!defined('NOLOGIN')) { define('NOLOGIN', 1); } -if (!defined('NOREQUIREUSER')) { define('NOREQUIREUSER', 1); } -if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', 1); } -if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', 1); } -if (!defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) { define('EVEN_IF_ONLY_LOGIN_ALLOWED', 1); } -if (!defined('NOIPCHECK')) { define('NOIPCHECK', 1); } +if (!defined('WEBPORTAL')) { + define('WEBPORTAL', 1); +} +if (!defined('NOLOGIN')) { + define('NOLOGIN', 1); +} +if (!defined('NOREQUIREUSER')) { + define('NOREQUIREUSER', 1); +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', 1); +} +if (!defined('NOREQUIRESOC')) { + define('NOREQUIRESOC', 1); +} +if (!defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) { + define('EVEN_IF_ONLY_LOGIN_ALLOWED', 1); +} +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', 1); +} if (!function_exists('dol_getprefix')) { @@ -45,7 +60,7 @@ if (!function_exists('dol_getprefix')) { function dol_getprefix($mode = '') { global $dolibarr_main_instance_unique_id, - $dolibarr_main_cookie_cryptkey; // This is loaded by filefunc.inc.php + $dolibarr_main_cookie_cryptkey; // This is loaded by filefunc.inc.php $tmp_instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : @@ -77,7 +92,7 @@ require_once DOL_DOCUMENT_ROOT . '/webportal/class/webportalpartnership.class.ph $prefix = dol_getprefix(''); $sessionname = 'WEBPORTAL_SESSID_' . $prefix; $sessiontimeout = 'WEBPORTAL_SESSTIMEOUT_' . $prefix; -if (!empty($_COOKIE[$sessiontimeout]) && session_status()===PHP_SESSION_NONE) { +if (!empty($_COOKIE[$sessiontimeout]) && session_status() === PHP_SESSION_NONE) { ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]); } @@ -131,7 +146,9 @@ if (!defined('WEBPORTAL_NOLOGIN') && !empty($context->controllerInstance->access } if (empty($password)) { $context->setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Password")), 'errors'); - if (empty($focus_element)) $focus_element = 'password'; + if (empty($focus_element)) { + $focus_element = 'password'; + } $error++; } // check security graphic code @@ -162,7 +179,7 @@ if (!defined('WEBPORTAL_NOLOGIN') && !empty($context->controllerInstance->access if (empty($webportal_logged_thirdparty_account_id)) { // Set cookie for timeout management if (getDolGlobalString('MAIN_SESSION_TIMEOUT')) { - setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, (empty($dolibarr_main_force_https) ? false : true), true); + setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", '', (empty($dolibarr_main_force_https) ? false : true), true); } $context->controller = 'login';