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';
48if (!function_exists(
'is_countable')) {
55 function is_countable($c)
57 return is_array($c) || $c instanceof Countable;
68$conf->db->host = empty($dolibarr_main_db_host) ?
'' : $dolibarr_main_db_host;
69$conf->db->port = empty($dolibarr_main_db_port) ?
'' : $dolibarr_main_db_port;
70$conf->db->name = empty($dolibarr_main_db_name) ?
'' : $dolibarr_main_db_name;
71$conf->db->user = empty($dolibarr_main_db_user) ?
'' : $dolibarr_main_db_user;
72$conf->db->pass = empty($dolibarr_main_db_pass) ?
'' : $dolibarr_main_db_pass;
73$conf->db->type = $dolibarr_main_db_type;
74$conf->db->prefix = $dolibarr_main_db_prefix;
75$conf->db->character_set = $dolibarr_main_db_character_set;
76$conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation;
77$conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
78$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
79if (defined(
'TEST_DB_FORCE_TYPE')) {
80 $conf->db->type = constant(
'TEST_DB_FORCE_TYPE');
84$conf->file->main_limit_users = $dolibarr_main_limit_users;
85$conf->file->mailing_limit_sendbyweb = empty($dolibarr_mailing_limit_sendbyweb) ? 0 : $dolibarr_mailing_limit_sendbyweb;
86$conf->file->mailing_limit_sendbycli = empty($dolibarr_mailing_limit_sendbycli) ? 0 : $dolibarr_mailing_limit_sendbycli;
87$conf->file->mailing_limit_sendbyday = empty($dolibarr_mailing_limit_sendbyday) ? 0 : $dolibarr_mailing_limit_sendbyday;
88$conf->file->main_authentication = empty($dolibarr_main_authentication) ?
'dolibarr' : $dolibarr_main_authentication;
89$conf->file->main_force_https = empty($dolibarr_main_force_https) ?
'' : $dolibarr_main_force_https;
90$conf->file->strict_mode = empty($dolibarr_strict_mode) ?
'' : $dolibarr_strict_mode;
91$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;
92$conf->file->dol_main_url_root = $dolibarr_main_url_root;
93$conf->file->dol_document_root = array(
'main' => (
string) DOL_DOCUMENT_ROOT);
94$conf->file->dol_url_root = array(
'main' => (
string) DOL_URL_ROOT);
95if (!empty($dolibarr_main_document_root_alt)) {
97 $values = preg_split(
'/[;,]/', $dolibarr_main_document_root_alt);
99 foreach ($values as $value) {
100 $conf->file->dol_document_root[
'alt'.($i++)] = (
string) $value;
104 foreach ($values as $value) {
105 if (preg_match(
'/^http(s)?:/', $value)) {
107 $correct_value = str_replace($dolibarr_main_url_root,
'', $value);
108 print
'<b>Error:</b><br>'.
"\n";
109 print
'Wrong <b>$dolibarr_main_url_root_alt</b> value in <b>conf.php</b> file.<br>'.
"\n";
110 print
'We now use a relative path to $dolibarr_main_url_root to build alternate URLs.<br>'.
"\n";
111 print
'Value found: '.$value.
'<br>'.
"\n";
112 print
'Should be replaced by: '.$correct_value.
'<br>'.
"\n";
113 print
"Or something like following examples:<br>\n";
114 print
"\"/extensions\"<br>\n";
115 print
"\"/extensions1,/extensions2,...\"<br>\n";
116 print
"\"/../extensions\"<br>\n";
117 print
"\"/custom\"<br>\n";
120 $conf->file->dol_url_root[
'alt'.($i++)] = (
string) $value;
125if (!defined(
'NOREQUIREUSER')) {
126 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
128if (!defined(
'NOREQUIRETRAN')) {
129 require_once DOL_DOCUMENT_ROOT.
'/core/class/translate.class.php';
131if (!defined(
'NOREQUIRESOC')) {
132 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
139if (!defined(
'NOREQUIRETRAN')) {
147if (!defined(
'NOREQUIREDB')) {
152 if (!defined(
'USEDOLIBARREDITOR') && !defined(
'USEDOLIBARRSERVER') && !empty($_SERVER[
'SCRIPT_FILENAME']) && (strpos($_SERVER[
'SCRIPT_FILENAME'], DOL_DATA_ROOT.
'/website') === 0)) {
153 $sapi_type = php_sapi_name();
154 if (substr($sapi_type, 0, 3) !=
'cgi') {
155 http_response_code(503);
157 print
'<div class="center" style="text-align: center; margin: 100px;">';
158 if (is_object($langs)) {
159 $langs->setDefaultLang(
'auto');
160 $langs->load(
"website");
161 print $langs->trans(
"SorryWebsiteIsCurrentlyOffLine");
163 print
"SorryWebsiteIsCurrentlyOffLine";
175unset(
$conf->db->pass);
181if (!defined(
'NOREQUIREUSER')) {
182 $user =
new User($db);
196if (session_id() && !empty($_SESSION[
"dol_entity"])) {
198 $conf->entity = $_SESSION[
"dol_entity"];
199} elseif (!empty($_ENV[
"dol_entity"])) {
201 $conf->entity = $_ENV[
"dol_entity"];
202} elseif (GETPOSTISSET(
"loginfunction") && (
GETPOSTINT(
"entity") ||
GETPOSTINT(
"switchentity"))) {
205} elseif (defined(
'DOLENTITY') && is_numeric(constant(
'DOLENTITY'))) {
207 $conf->entity = constant(
'DOLENTITY');
210if (!is_numeric(
$conf->entity)) {
215$conf->setValues($db);
218if (!defined(
'NOREQUIREDB') && !defined(
'NOREQUIRESOC')) {
219 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
222 $mysoc->setMysoc($conf);
226 if ($mysoc->country_code ==
'DE' && !isset(
$conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
228 $conf->global->MAIN_INVERT_SENDER_RECIPIENT = 1;
230 if ($mysoc->country_code ==
'FR' && !isset(
$conf->global->INVOICE_CATEGORY_OF_OPERATION)) {
232 $conf->global->INVOICE_CATEGORY_OF_OPERATION = 1;
234 if ($mysoc->country_code ==
'FR' && !isset(
$conf->global->INVOICE_DISABLE_REPLACEMENT)) {
238 $conf->global->INVOICE_DISABLE_REPLACEMENT = 1;
240 if ($mysoc->country_code ==
'GR' && !isset(
$conf->global->INVOICE_DISABLE_REPLACEMENT)) {
242 $conf->global->INVOICE_DISABLE_REPLACEMENT = 1;
244 if ($mysoc->country_code ==
'GR' && !isset(
$conf->global->INVOICE_DISABLE_DEPOSIT)) {
246 $conf->global->INVOICE_DISABLE_DEPOSIT = 1;
248 if ($mysoc->country_code ==
'GR' && !isset(
$conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) {
250 $conf->global->INVOICE_CREDIT_NOTE_STANDALONE = 1;
252 if ($mysoc->country_code ==
'GR' && !isset(
$conf->global->INVOICE_SUBTYPE_ENABLED)) {
254 $conf->global->INVOICE_SUBTYPE_ENABLED = 1;
257 if (($mysoc->localtax1_assuj || $mysoc->localtax2_assuj) && !isset(
$conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX)) {
260 $conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX = 1;
266if (!defined(
'NOREQUIRETRAN')) {
268 if (defined(
'MAIN_LANG_DEFAULT')) {
269 $langcode = constant(
'MAIN_LANG_DEFAULT');
271 $langs->setDefaultLang($langcode);
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...