28 if (!defined(
'DOL_DOCUMENT_ROOT')) {
29 define(
'DOL_DOCUMENT_ROOT',
'..');
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/translate.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
38 $conf =
new stdClass();
39 $conf->global =
new stdClass();
40 $conf->file =
new stdClass();
41 $conf->db =
new stdClass();
42 $conf->syslog =
new stdClass();
45 $_REQUEST[
"logtohtml"] = 1;
49 if (isset($_SERVER[
"DOCUMENT_URI"]) && $_SERVER[
"DOCUMENT_URI"]) {
50 $_SERVER[
"PHP_SELF"] = $_SERVER[
"DOCUMENT_URI"];
54 $includeconferror =
'';
57 $conffiletoshowshort =
"conf.php";
59 $conffile =
"../conf/conf.php";
60 $conffiletoshow =
"htdocs/conf/conf.php";
62 if (!file_exists($conffile)) {
63 $conffile =
"/etc/dolibarr/conf.php";
64 $conffiletoshow =
"/etc/dolibarr/conf.php";
69 if (!defined(
'DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > 8) {
70 $result = include_once $conffile;
72 if (empty($dolibarr_main_db_type)) {
73 $dolibarr_main_db_type =
'mysql';
77 if ($dolibarr_main_db_type ==
'mysql') {
78 $dolibarr_main_db_type =
'mysqli';
81 if (empty($dolibarr_main_db_port) && ($dolibarr_main_db_type ==
'mysqli')) {
82 $dolibarr_main_db_port =
'3306';
86 $dolibarr_main_data_root = isset($dolibarr_main_data_root) ?trim($dolibarr_main_data_root) :
'';
87 $dolibarr_main_url_root = isset($dolibarr_main_url_root) ?trim($dolibarr_main_url_root) :
'';
88 $dolibarr_main_url_root_alt = isset($dolibarr_main_url_root_alt) ?trim($dolibarr_main_url_root_alt) :
'';
89 $dolibarr_main_document_root = isset($dolibarr_main_document_root) ?trim($dolibarr_main_document_root) :
'';
90 $dolibarr_main_document_root_alt = isset($dolibarr_main_document_root_alt) ?trim($dolibarr_main_document_root_alt) :
'';
93 if (!empty($dolibarr_main_document_root) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_document_root)) {
94 $dolibarr_main_document_root = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_document_root);
96 if (!empty($dolibarr_main_url_root) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_url_root)) {
97 $dolibarr_main_url_root = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_url_root);
99 if (!empty($dolibarr_main_data_root) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_data_root)) {
100 $dolibarr_main_data_root = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_data_root);
102 if (!empty($dolibarr_main_document_root_alt) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_document_root_alt)) {
103 $dolibarr_main_document_root_alt = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_document_root_alt);
105 if (!empty($dolibarr_main_url_root_alt) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_url_root_alt)) {
106 $dolibarr_main_url_root_alt = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_url_root_alt);
110 if (!empty($dolibarr_main_document_root)) {
111 $result =
conf($dolibarr_main_document_root);
115 if (!empty($dolibarr_main_document_root) && !empty($dolibarr_main_db_type)) {
116 $result = include_once $dolibarr_main_document_root.
"/core/db/".$dolibarr_main_db_type.
'.class.php';
118 $includeconferror =
'ErrorBadValueForDolibarrMainDBType';
122 $includeconferror =
'ErrorBadValueForDolibarrMainDocumentRoot';
125 $includeconferror =
'ErrorBadFormatForConfFile';
128 $conf->global->MAIN_LOGTOHTML = 1;
131 if (!isset($dolibarr_main_db_prefix) || !$dolibarr_main_db_prefix) {
132 $dolibarr_main_db_prefix =
'llx_';
134 define(
'MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix :
''));
136 define(
'DOL_CLASS_PATH',
'class/');
137 define(
'DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root :
''));
138 define(
'DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root :
''));
139 $uri = preg_replace(
'/^http(s?):\/\//i',
'', constant(
'DOL_MAIN_URL_ROOT'));
140 $suburi = strstr($uri,
'/');
141 if ($suburi ==
'/') {
144 define(
'DOL_URL_ROOT', $suburi);
146 if (empty($character_set_client)) {
147 $character_set_client =
"UTF-8";
149 $conf->file->character_set_client = strtoupper($character_set_client);
150 if (empty($dolibarr_main_db_character_set)) {
151 $dolibarr_main_db_character_set = ($conf->db->type ==
'mysqli' ?
'utf8' :
'');
153 $conf->db->character_set = $dolibarr_main_db_character_set;
154 if (empty($dolibarr_main_db_collation)) {
155 $dolibarr_main_db_collation = ($conf->db->type ==
'mysqli' ?
'utf8_unicode_ci' :
'');
157 $conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation;
158 if (empty($dolibarr_main_db_encryption)) {
159 $dolibarr_main_db_encryption = 0;
161 $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
162 if (empty($dolibarr_main_db_cryptkey)) {
163 $dolibarr_main_db_cryptkey =
'';
165 $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
167 if (empty($conf->db->user)) {
168 $conf->db->user =
'';
175 $langs->setDefaultLang(
GETPOST(
'lang',
'aZ09'));
177 $langs->setDefaultLang(
'auto');
180 $bc[
false] =
' class="bg1"';
181 $bc[
true] =
' class="bg2"';
190 function conf($dolibarr_main_document_root)
193 global $dolibarr_main_db_type;
194 global $dolibarr_main_db_host;
195 global $dolibarr_main_db_port;
196 global $dolibarr_main_db_name;
197 global $dolibarr_main_db_user;
198 global $dolibarr_main_db_pass;
199 global $character_set_client;
201 $return = include_once $dolibarr_main_document_root.
'/core/class/conf.class.php';
207 $conf->db->type = trim($dolibarr_main_db_type);
208 $conf->db->host = trim($dolibarr_main_db_host);
209 $conf->db->port = trim($dolibarr_main_db_port);
210 $conf->db->name = trim($dolibarr_main_db_name);
211 $conf->db->user = trim($dolibarr_main_db_user);
212 $conf->db->pass = trim($dolibarr_main_db_pass);
214 if (empty($conf->db->dolibarr_main_db_collation)) {
215 $conf->db->dolibarr_main_db_collation =
'utf8_unicode_ci';
230 function pHeader($soutitre, $next, $action =
'none')
232 global $conf, $langs;
234 $langs->loadLangs(array(
"main",
"admin"));
237 header(
"Content-type: text/html; charset=".$conf->file->character_set_client);
240 header(
"X-Content-Type-Options: nosniff");
241 header(
"X-Frame-Options: SAMEORIGIN");
243 print
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'.
"\n";
245 print
'<meta http-equiv="content-type" content="text/html; charset='.$conf->file->character_set_client.
'">'.
"\n";
246 print
'<meta name="robots" content="index,follow">'.
"\n";
247 print
'<meta name="viewport" content="width=device-width, initial-scale=1.0">'.
"\n";
248 print
'<meta name="keywords" content="help, center, dolibarr, doliwamp">'.
"\n";
249 print
'<meta name="description" content="Dolibarr help center">'.
"\n";
250 print
'<link rel="stylesheet" type="text/css" href="../install/default.css">'.
"\n";
251 print
'<title>'.$langs->trans(
"DolibarrHelpCenter").
'</title>'.
"\n";
252 print
'</head>'.
"\n";
254 print
'<body class="center">'.
"\n";
256 print
'<div class="noborder centpercent center valignmiddle inline-block">';
257 print
'<img src="helpcenter.png" alt="logohelpcenter" class="inline-block"><br><br>';
258 print
'<span class="titre inline-block">'.$soutitre.
'</span>'.
"\n";
269 function pFooter($nonext = 0, $setuplang =
'')
272 $langs->load(
"main");
273 $langs->load(
"admin");
275 print
'</body>'.
"\n";
276 print
'</html>'.
"\n";
Class to stock current configuration.
Class to manage translations.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
conf($dolibarr_main_document_root)
Load conf file (file must exists)
pHeader($subtitle, $next, $action='set', $param='', $forcejqueryurl='', $csstable='main-inside')
Show HTML header of install pages.
pFooter($nonext=0, $setuplang='', $jscheckfunction='', $withpleasewait=0, $morehtml='')
Print HTML footer of install pages.