|
@@ -66,87 +66,87 @@ if (!file_exists($conffile))
|
|
|
|
|
|
|
|
|
// Load conf file if it is already defined
|
|
|
-if (! defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > 8) // Test on filesize is to ensure that conf file is more that an empty template with just <?php in first line
|
|
|
+if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > 8) // Test on filesize is to ensure that conf file is more that an empty template with just <?php in first line
|
|
|
{
|
|
|
- $result=include_once $conffile; // Load conf file
|
|
|
+ $result = include_once $conffile; // Load conf file
|
|
|
if ($result)
|
|
|
{
|
|
|
- if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // For backward compatibility
|
|
|
+ if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type = 'mysql'; // For backward compatibility
|
|
|
|
|
|
//Mysql driver support has been removed in favor of mysqli
|
|
|
if ($dolibarr_main_db_type == 'mysql') {
|
|
|
$dolibarr_main_db_type = 'mysqli';
|
|
|
}
|
|
|
|
|
|
- if (empty($dolibarr_main_db_port) && ($dolibarr_main_db_type=='mysqli')) $dolibarr_main_db_port='3306'; // For backward compatibility
|
|
|
+ if (empty($dolibarr_main_db_port) && ($dolibarr_main_db_type == 'mysqli')) $dolibarr_main_db_port = '3306'; // For backward compatibility
|
|
|
|
|
|
// Clean parameters
|
|
|
- $dolibarr_main_data_root =isset($dolibarr_main_data_root)?trim($dolibarr_main_data_root):'';
|
|
|
- $dolibarr_main_url_root =isset($dolibarr_main_url_root)?trim($dolibarr_main_url_root):'';
|
|
|
- $dolibarr_main_url_root_alt =isset($dolibarr_main_url_root_alt)?trim($dolibarr_main_url_root_alt):'';
|
|
|
- $dolibarr_main_document_root =isset($dolibarr_main_document_root)?trim($dolibarr_main_document_root):'';
|
|
|
- $dolibarr_main_document_root_alt=isset($dolibarr_main_document_root_alt)?trim($dolibarr_main_document_root_alt):'';
|
|
|
+ $dolibarr_main_data_root = isset($dolibarr_main_data_root) ?trim($dolibarr_main_data_root) : '';
|
|
|
+ $dolibarr_main_url_root = isset($dolibarr_main_url_root) ?trim($dolibarr_main_url_root) : '';
|
|
|
+ $dolibarr_main_url_root_alt = isset($dolibarr_main_url_root_alt) ?trim($dolibarr_main_url_root_alt) : '';
|
|
|
+ $dolibarr_main_document_root = isset($dolibarr_main_document_root) ?trim($dolibarr_main_document_root) : '';
|
|
|
+ $dolibarr_main_document_root_alt = isset($dolibarr_main_document_root_alt) ?trim($dolibarr_main_document_root_alt) : '';
|
|
|
|
|
|
// Remove last / or \ on directories or url value
|
|
|
- if (! empty($dolibarr_main_document_root) && ! preg_match('/^[\\/]+$/', $dolibarr_main_document_root)) $dolibarr_main_document_root=preg_replace('/[\\/]+$/', '', $dolibarr_main_document_root);
|
|
|
- if (! empty($dolibarr_main_url_root) && ! preg_match('/^[\\/]+$/', $dolibarr_main_url_root)) $dolibarr_main_url_root=preg_replace('/[\\/]+$/', '', $dolibarr_main_url_root);
|
|
|
- if (! empty($dolibarr_main_data_root) && ! preg_match('/^[\\/]+$/', $dolibarr_main_data_root)) $dolibarr_main_data_root=preg_replace('/[\\/]+$/', '', $dolibarr_main_data_root);
|
|
|
- if (! empty($dolibarr_main_document_root_alt) && ! preg_match('/^[\\/]+$/', $dolibarr_main_document_root_alt)) $dolibarr_main_document_root_alt=preg_replace('/[\\/]+$/', '', $dolibarr_main_document_root_alt);
|
|
|
- if (! empty($dolibarr_main_url_root_alt) && ! preg_match('/^[\\/]+$/', $dolibarr_main_url_root_alt)) $dolibarr_main_url_root_alt=preg_replace('/[\\/]+$/', '', $dolibarr_main_url_root_alt);
|
|
|
+ if (!empty($dolibarr_main_document_root) && !preg_match('/^[\\/]+$/', $dolibarr_main_document_root)) $dolibarr_main_document_root = preg_replace('/[\\/]+$/', '', $dolibarr_main_document_root);
|
|
|
+ if (!empty($dolibarr_main_url_root) && !preg_match('/^[\\/]+$/', $dolibarr_main_url_root)) $dolibarr_main_url_root = preg_replace('/[\\/]+$/', '', $dolibarr_main_url_root);
|
|
|
+ if (!empty($dolibarr_main_data_root) && !preg_match('/^[\\/]+$/', $dolibarr_main_data_root)) $dolibarr_main_data_root = preg_replace('/[\\/]+$/', '', $dolibarr_main_data_root);
|
|
|
+ if (!empty($dolibarr_main_document_root_alt) && !preg_match('/^[\\/]+$/', $dolibarr_main_document_root_alt)) $dolibarr_main_document_root_alt = preg_replace('/[\\/]+$/', '', $dolibarr_main_document_root_alt);
|
|
|
+ if (!empty($dolibarr_main_url_root_alt) && !preg_match('/^[\\/]+$/', $dolibarr_main_url_root_alt)) $dolibarr_main_url_root_alt = preg_replace('/[\\/]+$/', '', $dolibarr_main_url_root_alt);
|
|
|
|
|
|
// Create conf object
|
|
|
- if (! empty($dolibarr_main_document_root))
|
|
|
+ if (!empty($dolibarr_main_document_root))
|
|
|
{
|
|
|
- $result=conf($dolibarr_main_document_root);
|
|
|
+ $result = conf($dolibarr_main_document_root);
|
|
|
}
|
|
|
// Load database driver
|
|
|
if ($result)
|
|
|
{
|
|
|
- if (! empty($dolibarr_main_document_root) && ! empty($dolibarr_main_db_type))
|
|
|
+ if (!empty($dolibarr_main_document_root) && !empty($dolibarr_main_db_type))
|
|
|
{
|
|
|
- $result=include_once $dolibarr_main_document_root . "/core/db/".$dolibarr_main_db_type.'.class.php';
|
|
|
- if (! $result)
|
|
|
+ $result = include_once $dolibarr_main_document_root."/core/db/".$dolibarr_main_db_type.'.class.php';
|
|
|
+ if (!$result)
|
|
|
{
|
|
|
- $includeconferror='ErrorBadValueForDolibarrMainDBType';
|
|
|
+ $includeconferror = 'ErrorBadValueForDolibarrMainDBType';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- $includeconferror='ErrorBadValueForDolibarrMainDocumentRoot';
|
|
|
+ $includeconferror = 'ErrorBadValueForDolibarrMainDocumentRoot';
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- $includeconferror='ErrorBadFormatForConfFile';
|
|
|
+ $includeconferror = 'ErrorBadFormatForConfFile';
|
|
|
}
|
|
|
}
|
|
|
$conf->global->MAIN_LOGTOHTML = 1;
|
|
|
|
|
|
// Define prefix
|
|
|
-if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_';
|
|
|
-define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix)?$dolibarr_main_db_prefix:''));
|
|
|
-
|
|
|
-define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir
|
|
|
-define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root)?$dolibarr_main_data_root:''));
|
|
|
-define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root)?$dolibarr_main_url_root:'')); // URL relative root
|
|
|
-$uri=preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http*
|
|
|
-$suburi = strstr($uri, '/'); // $suburi contains url without domain
|
|
|
-if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
|
|
|
-define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
|
|
|
-
|
|
|
-if (empty($character_set_client)) $character_set_client="UTF-8";
|
|
|
-$conf->file->character_set_client=strtoupper($character_set_client);
|
|
|
-if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set=($conf->db->type=='mysql'?'latin1':''); // Old installation
|
|
|
-$conf->db->character_set=$dolibarr_main_db_character_set;
|
|
|
-if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation=($conf->db->type=='mysql'?'latin1_swedish_ci':''); // Old installation
|
|
|
-$conf->db->dolibarr_main_db_collation=$dolibarr_main_db_collation;
|
|
|
-if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0;
|
|
|
+if (!isset($dolibarr_main_db_prefix) || !$dolibarr_main_db_prefix) $dolibarr_main_db_prefix = 'llx_';
|
|
|
+define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : ''));
|
|
|
+
|
|
|
+define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir
|
|
|
+define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : ''));
|
|
|
+define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : '')); // URL relative root
|
|
|
+$uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http*
|
|
|
+$suburi = strstr($uri, '/'); // $suburi contains url without domain
|
|
|
+if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
|
|
|
+define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
|
|
|
+
|
|
|
+if (empty($character_set_client)) $character_set_client = "UTF-8";
|
|
|
+$conf->file->character_set_client = strtoupper($character_set_client);
|
|
|
+if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set = ($conf->db->type == 'mysql' ? 'latin1' : ''); // Old installation
|
|
|
+$conf->db->character_set = $dolibarr_main_db_character_set;
|
|
|
+if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation = ($conf->db->type == 'mysql' ? 'latin1_swedish_ci' : ''); // Old installation
|
|
|
+$conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation;
|
|
|
+if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption = 0;
|
|
|
$conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
|
|
|
-if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey='';
|
|
|
+if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey = '';
|
|
|
$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
|
|
|
|
|
|
-if (empty($conf->db->user)) $conf->db->user='';
|
|
|
+if (empty($conf->db->user)) $conf->db->user = '';
|
|
|
|
|
|
|
|
|
// Defini objet langs
|