';
+ } // end if autocreateuser
print ' ';
print '
';
diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example
index 3e18ab26084..926bb2a137b 100644
--- a/htdocs/conf/conf.php.example
+++ b/htdocs/conf/conf.php.example
@@ -245,6 +245,15 @@ $dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62';
$dolibarr_main_authentication='dolibarr';
+// dolibarr_main_authentication_autocreateuser
+// ============================================
+// Auto-creation of Dolibarr users on first OIDC login.
+// Set to 1 to allow new user accounts to be created automatically
+// when a user authenticates via OpenID Connect but has no existing account.
+// IMPORTANT: This must be set here in conf.php, not via the database setup.
+$dolibarr_main_authentication_autocreateuser=0;
+
+
// Parameters used to setup LDAP authentication
// --------------------------------------------
// Uncomment them if dolibarr_main_authentication = 'ldap'
diff --git a/htdocs/core/lib/openid_connect.lib.php b/htdocs/core/lib/openid_connect.lib.php
index 79aedec82ac..1eae4997c19 100644
--- a/htdocs/core/lib/openid_connect.lib.php
+++ b/htdocs/core/lib/openid_connect.lib.php
@@ -17,26 +17,70 @@
*/
/**
- * \file htdocs/admin/openid_connect.php
+ * \file htdocs/core/lib/openid_connect.lib.php
* \ingroup openid_connect
- * \brief Functions for the module openid_connect
+ * \brief Library of functions for OpenID Connect authentication
*/
+require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
+
+
/**
- * return the current state
+ * Generate a self-verifiable state token for the OIDC authorization request.
*
- * @return string String containing the state
+ * Uses HMAC with the instance unique ID as secret so the state can be verified
+ * without depending on the original session. This is necessary because browsers
+ * with SameSite=Lax cookies do not send the session cookie on cross-site redirects
+ * from the OIDC provider, causing a new session to be created on the callback.
+ *
+ * @return string State token (format: nonce.signature)
*/
function openid_connect_get_state()
{
- return hash('sha256', session_id());
+ global $dolibarr_main_instance_unique_id;
+
+ $nonce = bin2hex(random_bytes(16));
+ $signature = hash_hmac('sha256', $nonce, $dolibarr_main_instance_unique_id);
+
+ return $nonce.'.'.$signature;
+}
+
+/**
+ * Verify an OIDC state token.
+ *
+ * Checks that the state was generated by this Dolibarr instance by recomputing
+ * the HMAC signature from the nonce and comparing it to the provided signature.
+ *
+ * @param string $state The state token to verify (format: nonce.signature)
+ * @return bool True if valid, false otherwise
+ */
+function openid_connect_verify_state($state)
+{
+ global $dolibarr_main_instance_unique_id;
+
+ if (empty($state)) {
+ return false;
+ }
+
+ $parts = explode('.', $state, 2);
+ if (count($parts) !== 2) {
+ return false;
+ }
+
+ $nonce = $parts[0];
+ $signature = $parts[1];
+
+ $expected = hash_hmac('sha256', $nonce, $dolibarr_main_instance_unique_id);
+
+ return hash_equals($expected, $signature);
}
/**
- * return the redirect url
+ * Return the OIDC callback redirect URL
*
- * @return string Redirect url
+ * @return string Redirect URL
*/
function openid_connect_get_redirect_url()
{
@@ -45,14 +89,116 @@ function openid_connect_get_redirect_url()
/**
- * Return authentication url
+ * Return the OIDC authorization URL
*
- * @return string Authentication url
+ * @return string Authorization URL
*/
function openid_connect_get_url()
{
- // Note: For the scope, we msut use rawurlencode instead of urlencode.
+ // Note: For the scope, we must use rawurlencode instead of urlencode.
$url = getDolGlobalString('MAIN_AUTHENTICATION_OIDC_AUTHORIZE_URL').'?client_id='.urlencode(getDolGlobalString('MAIN_AUTHENTICATION_OIDC_CLIENT_ID')).'&redirect_uri='.urlencode(openid_connect_get_redirect_url()).'&scope='.rawurlencode(getDolGlobalString('MAIN_AUTHENTICATION_OIDC_SCOPES')).'&response_type=code&state='.urlencode(openid_connect_get_state());
return $url;
}
+
+
+/**
+ * Create a Dolibarr user from OIDC userinfo claims.
+ *
+ * The login is sanitized to remove characters not allowed by Dolibarr (e.g. @ from emails).
+ * If the OIDC userinfo contains a preferred_username claim without bad characters, it is used instead.
+ *
+ * @param DoliDB $db Database handler
+ * @param stdClass $userinfo Decoded OIDC userinfo JSON (claims from json_decode)
+ * @param string $login Login value extracted from the configured claim
+ * @param int $entity Entity (multicompany) ID
+ * @return string|int Sanitized login string on success, negative int on failure
+ * @see check_user_password_openid_connect()
+ */
+function openid_connect_create_user($db, $userinfo, $login, $entity)
+{
+ // Read claim mapping configuration
+ $claim_email = getDolGlobalString('MAIN_AUTHENTICATION_OIDC_CLAIM_EMAIL', 'email');
+ $claim_firstname = getDolGlobalString('MAIN_AUTHENTICATION_OIDC_CLAIM_FIRSTNAME', 'given_name');
+ $claim_lastname = getDolGlobalString('MAIN_AUTHENTICATION_OIDC_CLAIM_LASTNAME', 'family_name');
+
+ // Sanitize login: Dolibarr rejects certain characters (default: ,@<>"')
+ $badChars = getDolGlobalString('MAIN_LOGIN_BADCHARUNAUTHORIZED', ',@<>"\'');
+ $sanitized_login = $login;
+
+ if (preg_match('/['.preg_quote($badChars, '/').']/', $login)) {
+ // First try preferred_username from OIDC (common standard claim)
+ if (property_exists($userinfo, 'preferred_username') && !empty($userinfo->preferred_username)) {
+ $preferred = $userinfo->preferred_username;
+ if (!preg_match('/['.preg_quote($badChars, '/').']/', $preferred)) {
+ $sanitized_login = $preferred;
+ }
+ }
+ // If still invalid (no preferred_username or it also has bad chars), extract local part of email
+ if (preg_match('/['.preg_quote($badChars, '/').']/', $sanitized_login) && strpos($sanitized_login, '@') !== false) {
+ $sanitized_login = substr($sanitized_login, 0, strpos($sanitized_login, '@'));
+ }
+ // Final fallback: replace any remaining bad characters
+ $sanitized_login = preg_replace('/['.preg_quote($badChars, '/').']/', '.', $sanitized_login);
+ }
+
+ $newuser = new User($db);
+ $newuser->login = $sanitized_login;
+ $newuser->entity = $entity;
+ $newuser->statut = 1; // Active
+ $newuser->status = 1; // Active (alias)
+
+ if (property_exists($userinfo, $claim_email)) {
+ $newuser->email = $userinfo->$claim_email;
+ }
+ if (property_exists($userinfo, $claim_firstname)) {
+ $newuser->firstname = $userinfo->$claim_firstname;
+ }
+ if (property_exists($userinfo, $claim_lastname)) {
+ $newuser->lastname = $userinfo->$claim_lastname;
+ }
+ // If no lastname from claims, use login as fallback (lastname is required)
+ if (empty($newuser->lastname)) {
+ $newuser->lastname = $login;
+ }
+
+ // Set a random password (user authenticates via OIDC, not locally)
+ $newuser->pass = getRandomPassword(true);
+
+ // Find the admin user to set as creator (configurable, default: user ID 1)
+ $creator_id = getDolGlobalInt('MAIN_AUTHENTICATION_OIDC_DEFAULT_CREATOR', 1);
+ if ($creator_id <= 0) {
+ $creator_id = 1;
+ }
+ $adminuser = new User($db);
+ $result_fetch = $adminuser->fetch($creator_id);
+ if ($result_fetch <= 0 || empty($adminuser->admin) || $adminuser->statut != 1) {
+ dol_syslog("openid_connect_create_user::Error: configured creator user ID=".$creator_id." is not a valid active admin", LOG_ERR);
+ return -2;
+ }
+
+ $db->begin();
+
+ $result_create = $newuser->create($adminuser);
+ if ($result_create < 0) {
+ $db->rollback();
+ dol_syslog("openid_connect_create_user::Error creating user: ".$newuser->error, LOG_ERR);
+ return $result_create;
+ }
+
+ // Add to default group if configured
+ $default_group = getDolGlobalInt('MAIN_AUTHENTICATION_OIDC_DEFAULT_GROUP');
+ if ($default_group > 0) {
+ $res_group = $newuser->SetInGroup($default_group, $entity);
+ if ($res_group < 0) {
+ dol_syslog("openid_connect_create_user::Warning: Error adding user to group ".$default_group.": ".$newuser->error, LOG_WARNING);
+ // Don't fail user creation if group assignment fails
+ }
+ }
+
+ $db->commit();
+
+ dol_syslog("openid_connect_create_user::User created id=".$result_create." login=".$sanitized_login);
+
+ return $sanitized_login;
+}
diff --git a/htdocs/core/login/functions_openid_connect.php b/htdocs/core/login/functions_openid_connect.php
index a097f92418f..9c633e3bbcf 100644
--- a/htdocs/core/login/functions_openid_connect.php
+++ b/htdocs/core/login/functions_openid_connect.php
@@ -63,24 +63,26 @@ function check_user_password_openid_connect($usertotest, $passwordtotest, $entit
$_SESSION["dol_loginmesg"] = "Not an OpenID Connect flow";
dol_syslog("functions_openid_connect::check_user_password_openid_connect::not an OIDC flow");
return false;
- } elseif (!GETPOSTISSET('state')) {
- // No state received
+ } elseif (empty($_SESSION['oidc_state'])) {
+ // No state in session (set by callback.php)
$_SESSION["dol_loginmesg"] = "Error in OAuth 2.0 flow (no state received)";
dol_syslog("functions_openid_connect::check_user_password_openid_connect::no state received", LOG_ERR);
return false;
- } elseif (!GETPOSTISSET('code')) {
- // No code received
+ } elseif (empty($_SESSION['oidc_code'])) {
+ // No code in session (set by callback.php)
$_SESSION["dol_loginmesg"] = "Error in OAuth 2.0 flow (no code received)";
dol_syslog("functions_openid_connect::check_user_password_openid_connect::no code received", LOG_ERR);
return false;
}
- $auth_code = GETPOST('code', 'password');
- $state = GETPOST('state', 'aZ09');
- dol_syslog('functions_openid_connect::check_user_password_openid_connect code='.$auth_code.' state='.$state);
+ // Read OIDC params from session and clear immediately (single-use)
+ $auth_code = $_SESSION['oidc_code'];
+ $state = $_SESSION['oidc_state'];
+ unset($_SESSION['oidc_code'], $_SESSION['oidc_state']);
+ dol_syslog('functions_openid_connect::check_user_password_openid_connect state='.$state);
- if ($state !== openid_connect_get_state()) {
- // State does not match
+ if (!openid_connect_verify_state($state)) {
+ // State signature invalid - not generated by this Dolibarr instance
$_SESSION["dol_loginmesg"] = "Error in OAuth 2.0 flow (state does not match)";
dol_syslog("functions_openid_connect::check_user_password_openid_connect::state does not match", LOG_ERR);
return false;
@@ -109,7 +111,7 @@ function check_user_password_openid_connect($usertotest, $passwordtotest, $entit
$_SESSION["dol_loginmesg"] = "Error in OAuth 2.0 flow (".$token_response['content'].")";
dol_syslog("functions_openid_connect::check_user_password_openid_connect::".$token_response['content'], LOG_ERR);
return false;
- } elseif ($token_content->error) {
+ } elseif (property_exists($token_content, 'error') && $token_content->error) {
// Got token response but content is an error
$_SESSION["dol_loginmesg"] = "Error in OAuth 2.0 flow (".$token_content->error_description.")";
dol_syslog("functions_openid_connect::check_user_password_openid_connect::".$token_content->error_description, LOG_ERR);
@@ -144,7 +146,7 @@ function check_user_password_openid_connect($usertotest, $passwordtotest, $entit
$_SESSION["dol_loginmesg"] = "OpenID Connect user info error: " . $userinfo_response['content'];
dol_syslog("functions_openid_connect::check_user_password_openid_connect::".$userinfo_response['content'], LOG_ERR);
return false;
- } elseif ($userinfo_content->error) {
+ } elseif (property_exists($userinfo_content, 'error') && $userinfo_content->error) {
// Got user info response but content is an error
$_SESSION["dol_loginmesg"] = "Error in OAuth 2.0 flow (".$userinfo_content->error_description.")";
dol_syslog("functions_openid_connect::check_user_password_openid_connect::".$userinfo_content->error_description, LOG_ERR);
@@ -181,8 +183,30 @@ function check_user_password_openid_connect($usertotest, $passwordtotest, $entit
}
$obj = $db->fetch_object($resql);
if (!$obj) {
- dol_syslog("functions_openid_connect::check_user_password_openid_connect::Error no result from the query");
- return false;
+ // User not found in Dolibarr - check if auto-creation is enabled
+ global $dolibarr_main_authentication_autocreateuser;
+ if (empty($dolibarr_main_authentication_autocreateuser)) {
+ $_SESSION["dol_loginmesg"] = "User not found in Dolibarr and auto-creation is disabled";
+ dol_syslog("functions_openid_connect::check_user_password_openid_connect::User not found, auto-creation disabled");
+ return false;
+ }
+
+ dol_syslog("functions_openid_connect::check_user_password_openid_connect::User not found, auto-creating from OIDC claims");
+
+ $claim_value = (string) $userinfo_content->$login_claim;
+ $result_create = openid_connect_create_user($db, $userinfo_content, $claim_value, $entity);
+ if (is_numeric($result_create) && $result_create < 0) {
+ $_SESSION["dol_loginmesg"] = "Error creating user from OIDC";
+ dol_syslog("functions_openid_connect::check_user_password_openid_connect::Error creating user, result=".$result_create, LOG_ERR);
+ return false;
+ }
+
+ // $result_create is the sanitized login string
+ $newlogin = $result_create;
+ dol_syslog("functions_openid_connect::check_user_password_openid_connect::User auto-created login=".$newlogin);
+
+ $_SESSION['OPENID_CONNECT'] = true;
+ return $newlogin;
}
$_SESSION['OPENID_CONNECT'] = true;
diff --git a/htdocs/core/modules/openid_connect/callback.php b/htdocs/core/modules/openid_connect/callback.php
index ce969b08482..1299a238f30 100644
--- a/htdocs/core/modules/openid_connect/callback.php
+++ b/htdocs/core/modules/openid_connect/callback.php
@@ -18,15 +18,22 @@
/**
* \file htdocs/core/modules/openid_connect/public/callback.php
* \ingroup openid_connect
- * \brief OpenID Connect: Authorization Code flow authentication
+ * \brief OpenID Connect: Authorization Code flow callback
+ *
+ * This page receives the authorization code from the OIDC provider and
+ * stores the OIDC parameters (code, state) in $_SESSION, then redirects
+ * to index.php via a same-site JS redirect (with tz detection from dst.js).
+ *
+ * The same-site redirect ensures the session cookie IS sent (SameSite=Lax
+ * allows same-site navigations). The OIDC code and state are transported
+ * via $_SESSION instead of GET parameters to avoid exposing them in
+ * web server access logs.
*/
-
define('NOLOGIN', '1');
-if (!defined('NOTOKENRENEWAL')) {
- define('NOTOKENRENEWAL', '1');
-}
+define('NOTOKENRENEWAL', '1');
+define('NOCSRFCHECK', 1);
require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
@@ -45,7 +52,7 @@ top_htmlhead('', '', 0, 0, $arrayofjs);
$prefix = dol_getprefix('');
-$callbackUrl = $_COOKIE["DOL_rollback_url_".$prefix]; // Was set by login page to $_SERVER['REQUEST_URI'] to allow come back to initial requested page
+$callbackUrl = isset($_COOKIE["DOL_rollback_url_".$prefix]) ? $_COOKIE["DOL_rollback_url_".$prefix] : '';
if (empty($callbackUrl) || !preg_match('/^\/[a-z0-9]/i', $callbackUrl)) {
// We accept only value that is an internal relative URL. URL starting with http are not allowed.
@@ -56,26 +63,41 @@ if ($callbackUrl === '/') {
} else {
dolSetCookie('DOL_rollback_url_'.dol_getprefix(''), "", time() + 1);
}
+
+// Get OIDC parameters from the provider's redirect (GET) and store in session
+$oidcState = GETPOST('state', 'aZ09');
+$oidcCode = GETPOST('code', 'password');
+
+// Store in $_SESSION so they are not exposed as GET params on the redirect to index.php
+$_SESSION['oidc_code'] = $oidcCode;
+$_SESSION['oidc_state'] = $oidcState;
?>
-
+
+
+
+
+
+
+
+
+
diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index 41ad7835344..114ca9b572f 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -184,7 +184,6 @@ if (getDolGlobalInt('MAIN_AUTHENTICATION_OIDC_ON', 0) > 0 && isset($conf->file->
if (empty($_COOKIE["DOL_rollback_url_$prefix"])) {
dolSetCookie('DOL_rollback_url_'.$prefix, $_SERVER['REQUEST_URI'], time() + 3600); // $_SERVER["REQUEST_URI"] is for example /mydolibarr/mypage.php
}
-
// Auto redirect if OpenID Connect is the only authentication
if ($conf->file->main_authentication === 'openid_connect') {
// Avoid redirection hell
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 62d084c93e1..8d9666dc7b5 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -2649,6 +2649,19 @@ MainAuthenticationOidcAutofillWithWellknowUrl=Base URL of your OpenID Connect pr
MainAuthenticationOidcAutofillButton=Populate from well-known URL
MainAuthenticationOpenIDUrlImgName=OpenID url image
MainAuthenticationOpenIDUrlImgDesc=Non-mandatory link to an image to use instead of text in login button
+MainAuthenticationOidcAutoCreateTitle=User Auto-Creation Settings
+MainAuthenticationOidcCreateUserName=Auto-create users
+MainAuthenticationOidcCreateUserDesc=Automatically create a Dolibarr user account on first OpenID Connect login if the user does not yet exist
+MainAuthenticationOidcDefaultCreatorName=Creator admin user
+MainAuthenticationOidcDefaultCreatorDesc=Admin user set as creator for auto-created accounts (default: first user). Must be an active admin.
+MainAuthenticationOidcDefaultGroupName=Default group
+MainAuthenticationOidcDefaultGroupDesc=Group to assign to automatically created users
+MainAuthenticationOidcClaimFirstnameName=First name claim
+MainAuthenticationOidcClaimFirstnameDesc=OIDC userinfo claim for first name (default: given_name)
+MainAuthenticationOidcClaimLastnameName=Last name claim
+MainAuthenticationOidcClaimLastnameDesc=OIDC userinfo claim for last name (default: family_name)
+MainAuthenticationOidcClaimEmailName=Email claim
+MainAuthenticationOidcClaimEmailDesc=OIDC userinfo claim for email (default: email)
BlackListWords=Blacklist of words
BlackListWordsHelp=List of words that will be completely removed from any answer. Words must be separated by a coma (",")
BlackListWordsAIHelp=This is a list of words that will be completely removed from the result of any AI requests
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index 14ac4a79e3f..ecc354d4266 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -168,6 +168,8 @@ ErrorPaymentModeDefinedToWithoutSetup=A payment mode was set to type %s but setu
ErrorPHPNeedModule=Error, your PHP must have module %s installed to use this feature.
ErrorOpenIDSetupConfNotComplete=For security purposes, you must also setup the Dolibarr config file conf.php to allow OpenID authentication
ErrorOpenIDSetupNotComplete=You setup Dolibarr config file to allow OpenID authentication, but URL of OpenID service is not defined into constant %s
+OIDCAutocreateUserDisabled=Auto-creation of users on OIDC login is currently disabled. To enable it, add $dolibarr_main_authentication_autocreateuser=1 to your conf.php file.
+OIDCAutocreateUserEnabled=Auto-creation of users on OIDC login is enabled ($dolibarr_main_authentication_autocreateuser=1 is set in conf.php).
ErrorWarehouseMustDiffers=Source and target warehouses must differs
ErrorBadFormat=Bad format!
ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Error, this member is not yet linked to any third party. Link member to an existing third party or create a new third party before creating subscription with invoice.
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 8a57776ff94..e866d645721 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -736,15 +736,16 @@ if (!defined('NOLOGIN')) {
if ($login) {
$dol_authmode = $conf->authmode; // This property is defined only when logged, to say what mode was successfully used
- $dol_tz = empty($_POST["tz"]) ? (empty($_SESSION["tz"]) ? '' : $_SESSION["tz"]) : $_POST["tz"];
- $dol_tz_string = empty($_POST["tz_string"]) ? (empty($_SESSION["tz_string"]) ? '' : $_SESSION["tz_string"]) : $_POST["tz_string"];
+ // Check POST first, then GET (for OIDC callback redirect), then SESSION
+ $dol_tz = empty($_POST["tz"]) ? (empty($_GET["tz"]) ? (empty($_SESSION["tz"]) ? '' : $_SESSION["tz"]) : (int) $_GET["tz"]) : $_POST["tz"];
+ $dol_tz_string = empty($_POST["tz_string"]) ? (empty($_GET["tz_string"]) ? (empty($_SESSION["tz_string"]) ? '' : $_SESSION["tz_string"]) : $_GET["tz_string"]) : $_POST["tz_string"];
$dol_tz_string = preg_replace('/\s*\(.+\)$/', '', $dol_tz_string);
$dol_tz_string = preg_replace('/,/', '/', $dol_tz_string);
$dol_tz_string = preg_replace('/\s/', '_', $dol_tz_string);
$dol_dst = 0;
- // Keep $_POST here. Do not use GETPOSTISSET
- $dol_dst_first = empty($_POST["dst_first"]) ? (empty($_SESSION["dst_first"]) ? '' : $_SESSION["dst_first"]) : $_POST["dst_first"];
- $dol_dst_second = empty($_POST["dst_second"]) ? (empty($_SESSION["dst_second"]) ? '' : $_SESSION["dst_second"]) : $_POST["dst_second"];
+ // Check POST first, then GET (for OIDC callback redirect), then SESSION
+ $dol_dst_first = empty($_POST["dst_first"]) ? (empty($_GET["dst_first"]) ? (empty($_SESSION["dst_first"]) ? '' : $_SESSION["dst_first"]) : (int) $_GET["dst_first"]) : $_POST["dst_first"];
+ $dol_dst_second = empty($_POST["dst_second"]) ? (empty($_GET["dst_second"]) ? (empty($_SESSION["dst_second"]) ? '' : $_SESSION["dst_second"]) : (int) $_GET["dst_second"]) : $_POST["dst_second"];
if ($dol_dst_first && $dol_dst_second) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$datenow = dol_now();
@@ -754,8 +755,8 @@ if (!defined('NOLOGIN')) {
$dol_dst = 1;
}
}
- $dol_screenheight = empty($_POST["screenheight"]) ? (empty($_SESSION["dol_screenheight"]) ? '' : $_SESSION["dol_screenheight"]) : $_POST["screenheight"];
- $dol_screenwidth = empty($_POST["screenwidth"]) ? (empty($_SESSION["dol_screenwidth"]) ? '' : $_SESSION["dol_screenwidth"]) : $_POST["screenwidth"];
+ $dol_screenheight = empty($_POST["screenheight"]) ? (empty($_GET["screenheight"]) ? (empty($_SESSION["dol_screenheight"]) ? '' : $_SESSION["dol_screenheight"]) : (int) $_GET["screenheight"]) : $_POST["screenheight"];
+ $dol_screenwidth = empty($_POST["screenwidth"]) ? (empty($_GET["screenwidth"]) ? (empty($_SESSION["dol_screenwidth"]) ? '' : $_SESSION["dol_screenwidth"]) : (int) $_GET["screenwidth"]) : $_POST["screenwidth"];
//print $datefirst.'-'.$datesecond.'-'.$datenow.'-'.$dol_tz.'-'.$dol_tzstring.'-'.$dol_dst.'-'.sdol_screenheight.'-'.sdol_screenwidth; exit;
}