diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 00fa42e21f0..12088239e9a 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -155,11 +155,6 @@ if (! empty($conf->file->mailing_limit_sendbyweb)) // If software has been locked. Only login $conf->global->MAIN_ONLY_LOGIN_ALLOWED is allowed. if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { - /*print '$_SERVER["GATEWAY_INTERFACE"]='.$_SERVER["GATEWAY_INTERFACE"].'
'; - print 'session_id()='.session_id().'
'; - print '$_SESSION["dol_login"]='.$_SESSION["dol_login"].'
'; - print '$conf->global->MAIN_ONLY_LOGIN_ALLOWED='.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.'
'; - exit;*/ $ok=0; if ((! session_id() || ! isset($_SESSION["dol_login"])) && ! isset($_POST["username"]) && ! empty($_SERVER["GATEWAY_INTERFACE"])) $ok=1; // We let working pages if not logged and inside a web browser (login form, to allow login by admin) elseif (isset($_POST["username"]) && $_POST["username"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) $ok=1; // We let working pages that is a login submission (login submit, to allow login by admin) @@ -205,20 +200,24 @@ if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC')) $mysoc->state_id=$conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT; $mysoc->note=empty($conf->global->MAIN_INFO_SOCIETE_NOTE)?'':$conf->global->MAIN_INFO_SOCIETE_NOTE; - // We define pays_id, pays_code and country - $tmp=explode(':',$conf->global->MAIN_INFO_SOCIETE_PAYS); - $country_id=$tmp[0]; - if (! empty($tmp[1])) // If $conf->global->MAIN_INFO_SOCIETE_PAYS is "id:code:label" + // We define country_id, country_code and country + $country_id=$country_code=$country_label=''; + if (! empty($conf->global->MAIN_INFO_SOCIETE_PAYS)) { - $country_code=$tmp[1]; - $country_label=$tmp[2]; - } - else // For backward compatibility - { - dol_syslog("Your country setup use an old syntax. Reedit it in setup area.", LOG_WARNING); - include_once(DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'); - $country_code=getCountry($country_id,2,$db); // This need a SQL request, but it's the old feature - $country_label=getCountry($country_id,0,$db); // This need a SQL request, but it's the old feature + $tmp=explode(':',$conf->global->MAIN_INFO_SOCIETE_PAYS); + $country_id=$tmp[0]; + if (! empty($tmp[1])) // If $conf->global->MAIN_INFO_SOCIETE_PAYS is "id:code:label" + { + $country_code=$tmp[1]; + $country_label=$tmp[2]; + } + else // For backward compatibility + { + dol_syslog("Your country setup use an old syntax. Reedit it using setup area.", LOG_WARNING); + include_once(DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'); + $country_code=getCountry($country_id,2,$db); // This need a SQL request, but it's the old feature + $country_label=getCountry($country_id,0,$db); // This need a SQL request, but it's the old feature + } } $mysoc->pays_id=$country_id; // TODO deprecated $mysoc->country_id=$country_id;