38require_once
'filefunc.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/conf.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
49@phan-var-force ?string $dolibarr_main_db_prefix
50@phan-var-force ?string $dolibarr_main_db_encryption
51@phan-var-force ?string $dolibarr_main_db_cryptkey
52@phan-var-force ?string $dolibarr_main_limit_users
53@phan-var-force ?string $dolibarr_main_url_root_alt
56if (!function_exists(
'is_countable')) {
63 function is_countable(
$c)
65 return is_array(
$c) ||
$c instanceof Countable;
76$conf->db->host = empty($dolibarr_main_db_host) ?
'' : $dolibarr_main_db_host;
77$conf->db->port = empty($dolibarr_main_db_port) ?
'' : $dolibarr_main_db_port;
78$conf->db->name = empty($dolibarr_main_db_name) ?
'' : $dolibarr_main_db_name;
79$conf->db->user = empty($dolibarr_main_db_user) ?
'' : $dolibarr_main_db_user;
80$conf->db->pass = empty($dolibarr_main_db_pass) ?
'' : $dolibarr_main_db_pass;
81$conf->db->type = $dolibarr_main_db_type;
82$conf->db->prefix = $dolibarr_main_db_prefix;
83$conf->db->character_set = $dolibarr_main_db_character_set;
84$conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation;
85$conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
86$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
87if (defined(
'TEST_DB_FORCE_TYPE')) {
88 $conf->db->type = constant(
'TEST_DB_FORCE_TYPE');
92$conf->file->main_limit_users = $dolibarr_main_limit_users;
93$conf->file->mailing_limit_sendbyweb = empty($dolibarr_mailing_limit_sendbyweb) ? 0 : $dolibarr_mailing_limit_sendbyweb;
94$conf->file->mailing_limit_sendbycli = empty($dolibarr_mailing_limit_sendbycli) ? 0 : $dolibarr_mailing_limit_sendbycli;
95$conf->file->mailing_limit_sendbyday = empty($dolibarr_mailing_limit_sendbyday) ? 0 : $dolibarr_mailing_limit_sendbyday;
96$conf->file->main_authentication = empty($dolibarr_main_authentication) ?
'dolibarr' : $dolibarr_main_authentication;
97$conf->file->main_force_https = empty($dolibarr_main_force_https) ?
'' : $dolibarr_main_force_https;
98$conf->file->strict_mode = empty($dolibarr_strict_mode) ?
'' : $dolibarr_strict_mode;
99$conf->file->instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ?
'' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id;
101$conf->file->dol_document_root = array(
'main' => (
string) DOL_DOCUMENT_ROOT);
102$conf->file->dol_url_root = array(
'main' => (
string) DOL_URL_ROOT);
103if (!empty($dolibarr_main_document_root_alt)) {
105 $values = preg_split(
'/[;,]/', $dolibarr_main_document_root_alt);
107 foreach ($values as $value) {
108 $conf->file->dol_document_root[
'alt'.($i++)] = (
string) $value;
112 foreach ($values as $value) {
113 if (preg_match(
'/^http(s)?:/', $value)) {
116 print
'<b>Error:</b><br>'.
"\n";
117 print
'Wrong <b>$dolibarr_main_url_root_alt</b> value in <b>conf.php</b> file.<br>'.
"\n";
118 print
'We now use a relative path to $dolibarr_main_url_root to build alternate URLs.<br>'.
"\n";
119 print
'Value found: '.$value.
'<br>'.
"\n";
120 print
'Should be replaced by: '.$correct_value.
'<br>'.
"\n";
121 print
"Or something like following examples:<br>\n";
122 print
"\"/extensions\"<br>\n";
123 print
"\"/extensions1,/extensions2,...\"<br>\n";
124 print
"\"/../extensions\"<br>\n";
125 print
"\"/custom\"<br>\n";
128 $conf->file->dol_url_root[
'alt'.($i++)] = (
string) $value;
133if (!defined(
'NOREQUIREUSER')) {
134 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
136if (!defined(
'NOREQUIRETRAN')) {
137 require_once DOL_DOCUMENT_ROOT.
'/core/class/translate.class.php';
139if (!defined(
'NOREQUIRESOC')) {
140 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
147if (!defined(
'NOREQUIRETRAN')) {
155if (!defined(
'NOREQUIREDB')) {
160 if (!defined(
'USEDOLIBARREDITOR') && !defined(
'USEDOLIBARRSERVER') && !empty($_SERVER[
'SCRIPT_FILENAME']) && (strpos($_SERVER[
'SCRIPT_FILENAME'], DOL_DATA_ROOT.
'/website') === 0)) {
161 $sapi_type = php_sapi_name();
162 if (substr($sapi_type, 0, 3) !=
'cgi') {
163 http_response_code(503);
165 print
'<div class="center" style="text-align: center; margin: 100px;">';
166 if (is_object($langs)) {
167 $langs->setDefaultLang(
'auto');
168 $langs->load(
"website");
169 print $langs->trans(
"SorryWebsiteIsCurrentlyOffLine");
171 print
"SorryWebsiteIsCurrentlyOffLine";
183unset(
$conf->db->pass);
189if (!defined(
'NOREQUIREUSER')) {
190 $user =
new User($db);
204if (session_id() && !empty($_SESSION[
"dol_entity"])) {
206 $conf->entity = $_SESSION[
"dol_entity"];
207} elseif (!empty($_ENV[
"dol_entity"])) {
209 $conf->entity = $_ENV[
"dol_entity"];
210} elseif (GETPOSTISSET(
"loginfunction") && (
GETPOSTINT(
"entity") ||
GETPOSTINT(
"switchentity"))) {
213} elseif (defined(
'DOLENTITY') && is_numeric(constant(
'DOLENTITY'))) {
215 $conf->entity = constant(
'DOLENTITY');
218if (!is_numeric(
$conf->entity)) {
224 $conf->setValues($db);
228if (!defined(
'NOREQUIRETRAN')) {
230 if (defined(
'MAIN_LANG_DEFAULT')) {
231 $langcode = constant(
'MAIN_LANG_DEFAULT');
233 $langs->setDefaultLang($langcode);
237if (!defined(
'NOREQUIREDB') && !defined(
'NOREQUIRESOC') && $db !=
null) {
238 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
241 $mysoc->setMysoc($conf);
245 if ($mysoc->country_code ==
'DE' && !isset(
$conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
247 $conf->global->MAIN_INVERT_SENDER_RECIPIENT = 1;
249 if ($mysoc->country_code ==
'FR' && !isset(
$conf->global->INVOICE_CATEGORY_OF_OPERATION)) {
251 $conf->global->INVOICE_CATEGORY_OF_OPERATION = 1;
253 if ($mysoc->country_code ==
'FR' && !isset(
$conf->global->INVOICE_DISABLE_REPLACEMENT)) {
257 $conf->global->INVOICE_DISABLE_REPLACEMENT = 1;
259 if ($mysoc->country_code ==
'GR' && !isset(
$conf->global->INVOICE_DISABLE_REPLACEMENT)) {
261 $conf->global->INVOICE_DISABLE_REPLACEMENT = 1;
263 if ($mysoc->country_code ==
'GR' && !isset(
$conf->global->INVOICE_DISABLE_DEPOSIT)) {
265 $conf->global->INVOICE_DISABLE_DEPOSIT = 1;
267 if ($mysoc->country_code ==
'GR' && !isset(
$conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) {
269 $conf->global->INVOICE_CREDIT_NOTE_STANDALONE = 1;
271 if ($mysoc->country_code ==
'GR' && !isset(
$conf->global->INVOICE_SUBTYPE_ENABLED)) {
273 $conf->global->INVOICE_SUBTYPE_ENABLED = 1;
276 if (($mysoc->localtax1_assuj || $mysoc->localtax2_assuj) && !isset(
$conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX)) {
279 $conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX = 1;
global $dolibarr_main_url_root
Class to stock current configuration.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
$dolibarr_main_url_root_alt
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
getDoliDBInstance($type, $host, $user, $pass, $name, $port)
Return a DoliDB instance (database handler).
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...