mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
remove space and code syntax
This commit is contained in:
parent
7677edf41d
commit
93aa12a573
|
|
@ -28,17 +28,22 @@
|
|||
*/
|
||||
|
||||
// Just to define version DOL_VERSION
|
||||
if (!defined('DOL_INC_FOR_VERSION_ERROR')) define('DOL_INC_FOR_VERSION_ERROR', '1');
|
||||
if (!defined('DOL_INC_FOR_VERSION_ERROR')) {
|
||||
define('DOL_INC_FOR_VERSION_ERROR', '1');
|
||||
}
|
||||
require_once '../filefunc.inc.php';
|
||||
|
||||
|
||||
|
||||
// Define DOL_DOCUMENT_ROOT and ADODB_PATH used for install/upgrade process
|
||||
if (!defined('DOL_DOCUMENT_ROOT')) define('DOL_DOCUMENT_ROOT', '..');
|
||||
if (!defined('ADODB_PATH'))
|
||||
{
|
||||
if (!defined('DOL_DOCUMENT_ROOT')) {
|
||||
define('DOL_DOCUMENT_ROOT', '..');
|
||||
}
|
||||
if (!defined('ADODB_PATH')) {
|
||||
$foundpath = DOL_DOCUMENT_ROOT.'/includes/adodbtime/';
|
||||
if (!is_dir($foundpath)) $foundpath = '/usr/share/php/adodb/';
|
||||
if (!is_dir($foundpath)) {
|
||||
$foundpath = '/usr/share/php/adodb/';
|
||||
}
|
||||
define('ADODB_PATH', $foundpath);
|
||||
}
|
||||
|
||||
|
|
@ -49,15 +54,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once ADODB_PATH.'adodb-time.inc.php';
|
||||
|
||||
$conf = new Conf();
|
||||
$conf = new Conf();
|
||||
|
||||
// Force $_REQUEST["logtohtml"]
|
||||
$_REQUEST["logtohtml"] = 1;
|
||||
|
||||
// Correction PHP_SELF (ex pour apache via caudium) car PHP_SELF doit valoir URL relative
|
||||
// et non path absolu.
|
||||
if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"])
|
||||
{
|
||||
if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"]) {
|
||||
$_SERVER["PHP_SELF"] = $_SERVER["DOCUMENT_URI"];
|
||||
}
|
||||
|
||||
|
|
@ -76,19 +80,21 @@ $conffiletoshow = "htdocs/conf/conf.php";
|
|||
|
||||
|
||||
// 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
|
||||
if ($result)
|
||||
{
|
||||
if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type = 'mysqli'; // For backward compatibility
|
||||
if ($result) {
|
||||
if (empty($dolibarr_main_db_type)) {
|
||||
$dolibarr_main_db_type = 'mysqli'; // 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) : DOL_DOCUMENT_ROOT.'/../documents';
|
||||
|
|
@ -98,25 +104,31 @@ if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) >
|
|||
$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);
|
||||
}
|
||||
// Load database driver
|
||||
if ($result)
|
||||
{
|
||||
if (!empty($dolibarr_main_document_root) && !empty($dolibarr_main_db_type))
|
||||
{
|
||||
if ($result) {
|
||||
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)
|
||||
{
|
||||
if (!$result) {
|
||||
$includeconferror = 'ErrorBadValueForDolibarrMainDBType';
|
||||
}
|
||||
}
|
||||
|
|
@ -130,7 +142,9 @@ if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) >
|
|||
$conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
|
||||
|
||||
// Define prefix
|
||||
if (!isset($dolibarr_main_db_prefix) || !$dolibarr_main_db_prefix) $dolibarr_main_db_prefix = 'llx_';
|
||||
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
|
||||
|
|
@ -138,42 +152,51 @@ define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_r
|
|||
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 ''
|
||||
if ($suburi == '/') {
|
||||
$suburi = ''; // If $suburi is /, it is now ''
|
||||
}
|
||||
define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
|
||||
|
||||
|
||||
if (empty($conf->file->character_set_client)) $conf->file->character_set_client = "utf-8";
|
||||
if (empty($conf->db->character_set)) $conf->db->character_set = 'utf8';
|
||||
if (empty($conf->db->dolibarr_main_db_collation)) $conf->db->dolibarr_main_db_collation = 'utf8_unicode_ci';
|
||||
if (empty($conf->db->dolibarr_main_db_encryption)) $conf->db->dolibarr_main_db_encryption = 0;
|
||||
if (empty($conf->db->dolibarr_main_db_cryptkey)) $conf->db->dolibarr_main_db_cryptkey = '';
|
||||
if (empty($conf->db->user)) $conf->db->user = '';
|
||||
if (empty($conf->file->character_set_client)) {
|
||||
$conf->file->character_set_client = "utf-8";
|
||||
}
|
||||
if (empty($conf->db->character_set)) {
|
||||
$conf->db->character_set = 'utf8';
|
||||
}
|
||||
if (empty($conf->db->dolibarr_main_db_collation)) {
|
||||
$conf->db->dolibarr_main_db_collation = 'utf8_unicode_ci';
|
||||
}
|
||||
if (empty($conf->db->dolibarr_main_db_encryption)) {
|
||||
$conf->db->dolibarr_main_db_encryption = 0;
|
||||
}
|
||||
if (empty($conf->db->dolibarr_main_db_cryptkey)) {
|
||||
$conf->db->dolibarr_main_db_cryptkey = '';
|
||||
}
|
||||
if (empty($conf->db->user)) {
|
||||
$conf->db->user = '';
|
||||
}
|
||||
|
||||
// Define array of document root directories
|
||||
$conf->file->dol_document_root = array(DOL_DOCUMENT_ROOT);
|
||||
if (!empty($dolibarr_main_document_root_alt))
|
||||
{
|
||||
if (!empty($dolibarr_main_document_root_alt)) {
|
||||
// dolibarr_main_document_root_alt contains several directories
|
||||
$values = preg_split('/[;,]/', $dolibarr_main_document_root_alt);
|
||||
foreach ($values as $value)
|
||||
{
|
||||
foreach ($values as $value) {
|
||||
$conf->file->dol_document_root[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Security check (old method, when directory is renamed /install.lock)
|
||||
if (preg_match('/install\.lock/i', $_SERVER["SCRIPT_FILENAME"]))
|
||||
{
|
||||
if (!is_object($langs))
|
||||
{
|
||||
if (preg_match('/install\.lock/i', $_SERVER["SCRIPT_FILENAME"])) {
|
||||
if (!is_object($langs)) {
|
||||
$langs = new Translate('..', $conf);
|
||||
$langs->setDefaultLang('auto');
|
||||
}
|
||||
$langs->load("install");
|
||||
print $langs->trans("YouTryInstallDisabledByDirLock");
|
||||
if (!empty($dolibarr_main_url_root))
|
||||
{
|
||||
if (!empty($dolibarr_main_url_root)) {
|
||||
print 'Click on following link, <a href="'.$dolibarr_main_url_root.'/admin/index.php?mainmenu=home&leftmenu=setup'.(GETPOSTISSET("login") ? '&username='.urlencode(GETPOST("login")) : '').'">';
|
||||
print $langs->trans("ClickHereToGoToApp");
|
||||
print '</a>';
|
||||
|
|
@ -187,17 +210,14 @@ if (constant('DOL_DATA_ROOT') === null) {
|
|||
// Try to detect any lockfile in the default documents path
|
||||
$lockfile = '../../documents/install.lock';
|
||||
}
|
||||
if (@file_exists($lockfile))
|
||||
{
|
||||
if (!isset($langs) || !is_object($langs))
|
||||
{
|
||||
if (@file_exists($lockfile)) {
|
||||
if (!isset($langs) || !is_object($langs)) {
|
||||
$langs = new Translate('..', $conf);
|
||||
$langs->setDefaultLang('auto');
|
||||
}
|
||||
$langs->load("install");
|
||||
print $langs->trans("YouTryInstallDisabledByFileLock");
|
||||
if (!empty($dolibarr_main_url_root))
|
||||
{
|
||||
if (!empty($dolibarr_main_url_root)) {
|
||||
print $langs->trans("ClickOnLinkOrRemoveManualy").'<br>';
|
||||
print '<a href="'.$dolibarr_main_url_root.'/admin/index.php?mainmenu=home&leftmenu=setup'.(GETPOSTISSET("login") ? '&username='.urlencode(GETPOST("login")) : '').'">';
|
||||
print $langs->trans("ClickHereToGoToApp");
|
||||
|
|
@ -212,42 +232,55 @@ if (@file_exists($lockfile))
|
|||
// Force usage of log file for install and upgrades
|
||||
$conf->syslog->enabled = 1;
|
||||
$conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG');
|
||||
if (!defined('SYSLOG_HANDLERS')) define('SYSLOG_HANDLERS', '["mod_syslog_file"]');
|
||||
if (!defined('SYSLOG_FILE')) // To avoid warning on systems with constant already defined
|
||||
{
|
||||
if (@is_writable('/tmp')) define('SYSLOG_FILE', '/tmp/dolibarr_install.log');
|
||||
elseif (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) define('SYSLOG_FILE', $_ENV["TMP"].'/dolibarr_install.log');
|
||||
elseif (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) define('SYSLOG_FILE', $_ENV["TEMP"].'/dolibarr_install.log');
|
||||
elseif (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp
|
||||
elseif (@is_writable('../../')) define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others
|
||||
if (!defined('SYSLOG_HANDLERS')) {
|
||||
define('SYSLOG_HANDLERS', '["mod_syslog_file"]');
|
||||
}
|
||||
if (!defined('SYSLOG_FILE')) { // To avoid warning on systems with constant already defined
|
||||
if (@is_writable('/tmp')) {
|
||||
define('SYSLOG_FILE', '/tmp/dolibarr_install.log');
|
||||
} elseif (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) {
|
||||
define('SYSLOG_FILE', $_ENV["TMP"].'/dolibarr_install.log');
|
||||
} elseif (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) {
|
||||
define('SYSLOG_FILE', $_ENV["TEMP"].'/dolibarr_install.log');
|
||||
} elseif (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) {
|
||||
define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp
|
||||
} elseif (@is_writable('../../')) {
|
||||
define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others
|
||||
}
|
||||
//print 'SYSLOG_FILE='.SYSLOG_FILE;exit;
|
||||
}
|
||||
if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
|
||||
if (!defined('SYSLOG_FILE_NO_ERROR')) define('SYSLOG_FILE_NO_ERROR', 1);
|
||||
if (defined('SYSLOG_FILE')) {
|
||||
$conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
|
||||
}
|
||||
if (!defined('SYSLOG_FILE_NO_ERROR')) {
|
||||
define('SYSLOG_FILE_NO_ERROR', 1);
|
||||
}
|
||||
// We init log handler for install
|
||||
$handlers = array('mod_syslog_file');
|
||||
foreach ($handlers as $handler)
|
||||
{
|
||||
foreach ($handlers as $handler) {
|
||||
$file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php';
|
||||
if (!file_exists($file))
|
||||
{
|
||||
if (!file_exists($file)) {
|
||||
throw new Exception('Missing log handler file '.$handler.'.php');
|
||||
}
|
||||
|
||||
require_once $file;
|
||||
$loghandlerinstance = new $handler();
|
||||
if (!$loghandlerinstance instanceof LogHandlerInterface)
|
||||
{
|
||||
if (!$loghandlerinstance instanceof LogHandlerInterface) {
|
||||
throw new Exception('Log handler does not extend LogHandlerInterface');
|
||||
}
|
||||
|
||||
if (empty($conf->loghandlers[$handler])) $conf->loghandlers[$handler] = $loghandlerinstance;
|
||||
if (empty($conf->loghandlers[$handler])) {
|
||||
$conf->loghandlers[$handler] = $loghandlerinstance;
|
||||
}
|
||||
}
|
||||
|
||||
// Define object $langs
|
||||
$langs = new Translate('..', $conf);
|
||||
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09'));
|
||||
else $langs->setDefaultLang('auto');
|
||||
if (GETPOST('lang', 'aZ09')) {
|
||||
$langs->setDefaultLang(GETPOST('lang', 'aZ09'));
|
||||
} else {
|
||||
$langs->setDefaultLang('auto');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -268,7 +301,9 @@ function conf($dolibarr_main_document_root)
|
|||
global $character_set_client;
|
||||
|
||||
$return = include_once $dolibarr_main_document_root.'/core/class/conf.class.php';
|
||||
if (!$return) return -1;
|
||||
if (!$return) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$conf = new Conf();
|
||||
$conf->db->type = trim($dolibarr_main_db_type);
|
||||
|
|
@ -279,51 +314,73 @@ function conf($dolibarr_main_document_root)
|
|||
$conf->db->pass = trim($dolibarr_main_db_pass);
|
||||
|
||||
// Mysql driver support has been removed in favor of mysqli
|
||||
if ($conf->db->type == 'mysql') $conf->db->type = 'mysqli';
|
||||
if (empty($character_set_client)) $character_set_client = "UTF-8";
|
||||
if ($conf->db->type == 'mysql') {
|
||||
$conf->db->type = 'mysqli';
|
||||
}
|
||||
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 == 'mysqli' ? 'utf8' : '');
|
||||
if (empty($dolibarr_main_db_character_set)) {
|
||||
$dolibarr_main_db_character_set = ($conf->db->type == 'mysqli' ? 'utf8' : '');
|
||||
}
|
||||
$conf->db->character_set = $dolibarr_main_db_character_set;
|
||||
if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation = ($conf->db->type == 'mysqli' ? 'utf8_unicode_ci' : '');
|
||||
if (empty($dolibarr_main_db_collation)) {
|
||||
$dolibarr_main_db_collation = ($conf->db->type == 'mysqli' ? 'utf8_unicode_ci' : '');
|
||||
}
|
||||
$conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation;
|
||||
if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption = 0;
|
||||
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;
|
||||
|
||||
// Force usage of log file for install and upgrades
|
||||
$conf->syslog->enabled = 1;
|
||||
$conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG');
|
||||
if (!defined('SYSLOG_HANDLERS')) define('SYSLOG_HANDLERS', '["mod_syslog_file"]');
|
||||
if (!defined('SYSLOG_FILE')) // To avoid warning on systems with constant already defined
|
||||
{
|
||||
if (@is_writable('/tmp')) define('SYSLOG_FILE', '/tmp/dolibarr_install.log');
|
||||
elseif (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) define('SYSLOG_FILE', $_ENV["TMP"].'/dolibarr_install.log');
|
||||
elseif (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) define('SYSLOG_FILE', $_ENV["TEMP"].'/dolibarr_install.log');
|
||||
elseif (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp
|
||||
elseif (@is_writable('../../')) define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others
|
||||
if (!defined('SYSLOG_HANDLERS')) {
|
||||
define('SYSLOG_HANDLERS', '["mod_syslog_file"]');
|
||||
}
|
||||
if (!defined('SYSLOG_FILE')) { // To avoid warning on systems with constant already defined
|
||||
if (@is_writable('/tmp')) {
|
||||
define('SYSLOG_FILE', '/tmp/dolibarr_install.log');
|
||||
} elseif (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) {
|
||||
define('SYSLOG_FILE', $_ENV["TMP"].'/dolibarr_install.log');
|
||||
} elseif (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) {
|
||||
define('SYSLOG_FILE', $_ENV["TEMP"].'/dolibarr_install.log');
|
||||
} elseif (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) {
|
||||
define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp
|
||||
} elseif (@is_writable('../../')) {
|
||||
define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others
|
||||
}
|
||||
//print 'SYSLOG_FILE='.SYSLOG_FILE;exit;
|
||||
}
|
||||
if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
|
||||
if (!defined('SYSLOG_FILE_NO_ERROR')) define('SYSLOG_FILE_NO_ERROR', 1);
|
||||
if (defined('SYSLOG_FILE')) {
|
||||
$conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
|
||||
}
|
||||
if (!defined('SYSLOG_FILE_NO_ERROR')) {
|
||||
define('SYSLOG_FILE_NO_ERROR', 1);
|
||||
}
|
||||
// We init log handler for install
|
||||
$handlers = array('mod_syslog_file');
|
||||
foreach ($handlers as $handler)
|
||||
{
|
||||
foreach ($handlers as $handler) {
|
||||
$file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php';
|
||||
if (!file_exists($file))
|
||||
{
|
||||
if (!file_exists($file)) {
|
||||
throw new Exception('Missing log handler file '.$handler.'.php');
|
||||
}
|
||||
|
||||
require_once $file;
|
||||
$loghandlerinstance = new $handler();
|
||||
if (!$loghandlerinstance instanceof LogHandlerInterface)
|
||||
{
|
||||
if (!$loghandlerinstance instanceof LogHandlerInterface) {
|
||||
throw new Exception('Log handler does not extend LogHandlerInterface');
|
||||
}
|
||||
|
||||
if (empty($conf->loghandlers[$handler])) $conf->loghandlers[$handler] = $loghandlerinstance;
|
||||
if (empty($conf->loghandlers[$handler])) {
|
||||
$conf->loghandlers[$handler] = $loghandlerinstance;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
@ -351,8 +408,7 @@ function pHeader($subtitle, $next, $action = 'set', $param = '', $forcejqueryurl
|
|||
|
||||
$jquerytheme = 'base';
|
||||
|
||||
if ($forcejqueryurl)
|
||||
{
|
||||
if ($forcejqueryurl) {
|
||||
$jQueryCustomPath = $forcejqueryurl;
|
||||
$jQueryUiCustomPath = $forcejqueryurl;
|
||||
} else {
|
||||
|
|
@ -373,14 +429,23 @@ function pHeader($subtitle, $next, $action = 'set', $param = '', $forcejqueryurl
|
|||
print '<link rel="stylesheet" type="text/css" href="default.css">'."\n";
|
||||
|
||||
print '<!-- Includes CSS for JQuery -->'."\n";
|
||||
if ($jQueryUiCustomPath) print '<link rel="stylesheet" type="text/css" href="'.$jQueryUiCustomPath.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
|
||||
else print '<link rel="stylesheet" type="text/css" href="../includes/jquery/css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
|
||||
if ($jQueryUiCustomPath) {
|
||||
print '<link rel="stylesheet" type="text/css" href="'.$jQueryUiCustomPath.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
|
||||
} else {
|
||||
print '<link rel="stylesheet" type="text/css" href="../includes/jquery/css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
|
||||
}
|
||||
|
||||
print '<!-- Includes JS for JQuery -->'."\n";
|
||||
if ($jQueryCustomPath) print '<script type="text/javascript" src="'.$jQueryCustomPath.'jquery.min.js"></script>'."\n";
|
||||
else print '<script type="text/javascript" src="../includes/jquery/js/jquery.min.js"></script>'."\n";
|
||||
if ($jQueryUiCustomPath) print '<script type="text/javascript" src="'.$jQueryUiCustomPath.'jquery-ui.min.js"></script>'."\n";
|
||||
else print '<script type="text/javascript" src="../includes/jquery/js/jquery-ui.min.js"></script>'."\n";
|
||||
if ($jQueryCustomPath) {
|
||||
print '<script type="text/javascript" src="'.$jQueryCustomPath.'jquery.min.js"></script>'."\n";
|
||||
} else {
|
||||
print '<script type="text/javascript" src="../includes/jquery/js/jquery.min.js"></script>'."\n";
|
||||
}
|
||||
if ($jQueryUiCustomPath) {
|
||||
print '<script type="text/javascript" src="'.$jQueryUiCustomPath.'jquery-ui.min.js"></script>'."\n";
|
||||
} else {
|
||||
print '<script type="text/javascript" src="../includes/jquery/js/jquery-ui.min.js"></script>'."\n";
|
||||
}
|
||||
|
||||
print '<title>'.$langs->trans("DolibarrSetup").'</title>'."\n";
|
||||
print '</head>'."\n";
|
||||
|
|
@ -399,7 +464,9 @@ function pHeader($subtitle, $next, $action = 'set', $param = '', $forcejqueryurl
|
|||
print '</span>'."\n";
|
||||
|
||||
print '<form name="forminstall" style="width: 100%" action="'.$next.'.php'.($param ? '?'.$param : '').'" method="POST"';
|
||||
if ($next == 'step5') print ' autocomplete="off"';
|
||||
if ($next == 'step5') {
|
||||
print ' autocomplete="off"';
|
||||
}
|
||||
print '>'."\n";
|
||||
print '<input type="hidden" name="testpost" value="ok">'."\n";
|
||||
print '<input type="hidden" name="action" value="'.$action.'">'."\n";
|
||||
|
|
@ -427,11 +494,9 @@ function pFooter($nonext = 0, $setuplang = '', $jscheckfunction = '', $withpleas
|
|||
print '</td></tr></table>'."\n";
|
||||
print '</td></tr></table>'."\n";
|
||||
|
||||
if (!$nonext || ($nonext == '2'))
|
||||
{
|
||||
if (!$nonext || ($nonext == '2')) {
|
||||
print '<div class="nextbutton" id="nextbutton">';
|
||||
if ($nonext == '2')
|
||||
{
|
||||
if ($nonext == '2') {
|
||||
print '<span class="warning">';
|
||||
print $langs->trans("ErrorFoundDuringMigration", isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"].'&ignoreerrors=1' : '');
|
||||
print '</span>';
|
||||
|
|
@ -439,25 +504,26 @@ function pFooter($nonext = 0, $setuplang = '', $jscheckfunction = '', $withpleas
|
|||
}
|
||||
|
||||
print '<input type="submit" '.($nonext == '2' ? 'disabled="disabled" ' : '').'value="'.$langs->trans("NextStep").' ->"';
|
||||
if ($jscheckfunction) print ' onClick="return '.$jscheckfunction.'();"';
|
||||
if ($jscheckfunction) {
|
||||
print ' onClick="return '.$jscheckfunction.'();"';
|
||||
}
|
||||
print '></div>';
|
||||
if ($withpleasewait) print '<div style="visibility: hidden;" class="pleasewait" id="pleasewait"><br>'.$langs->trans("NextStepMightLastALongTime").'<br><br><div class="blinkwait">'.$langs->trans("PleaseBePatient").'</div></div>';
|
||||
if ($withpleasewait) {
|
||||
print '<div style="visibility: hidden;" class="pleasewait" id="pleasewait"><br>'.$langs->trans("NextStepMightLastALongTime").'<br><br><div class="blinkwait">'.$langs->trans("PleaseBePatient").'</div></div>';
|
||||
}
|
||||
}
|
||||
if ($setuplang)
|
||||
{
|
||||
if ($setuplang) {
|
||||
print '<input type="hidden" name="selectlang" value="'.$setuplang.'">';
|
||||
}
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
// If there is some logs in buffer to show
|
||||
if (isset($conf->logbuffer) && count($conf->logbuffer))
|
||||
{
|
||||
if (isset($conf->logbuffer) && count($conf->logbuffer)) {
|
||||
print "\n";
|
||||
print "<!-- Start of log output\n";
|
||||
//print '<div class="hidden">'."\n";
|
||||
foreach ($conf->logbuffer as $logline)
|
||||
{
|
||||
foreach ($conf->logbuffer as $logline) {
|
||||
print $logline."<br>\n";
|
||||
}
|
||||
//print '</div>'."\n";
|
||||
|
|
@ -478,7 +544,9 @@ function pFooter($nonext = 0, $setuplang = '', $jscheckfunction = '', $withpleas
|
|||
*/
|
||||
function dolibarr_install_syslog($message, $level = LOG_DEBUG)
|
||||
{
|
||||
if (!defined('LOG_DEBUG')) define('LOG_DEBUG', 6);
|
||||
if (!defined('LOG_DEBUG')) {
|
||||
define('LOG_DEBUG', 6);
|
||||
}
|
||||
dol_syslog($message, $level);
|
||||
}
|
||||
|
||||
|
|
@ -491,8 +559,7 @@ function detect_dolibarr_main_document_root()
|
|||
{
|
||||
// If PHP is in CGI mode, SCRIPT_FILENAME is PHP's path.
|
||||
// Since that's not what we want, we suggest $_SERVER["DOCUMENT_ROOT"]
|
||||
if ($_SERVER["SCRIPT_FILENAME"] == 'php' || preg_match('/[\\/]php$/i', $_SERVER["SCRIPT_FILENAME"]) || preg_match('/php\.exe$/i', $_SERVER["SCRIPT_FILENAME"]))
|
||||
{
|
||||
if ($_SERVER["SCRIPT_FILENAME"] == 'php' || preg_match('/[\\/]php$/i', $_SERVER["SCRIPT_FILENAME"]) || preg_match('/php\.exe$/i', $_SERVER["SCRIPT_FILENAME"])) {
|
||||
$dolibarr_main_document_root = $_SERVER["DOCUMENT_ROOT"];
|
||||
|
||||
if (!preg_match('/[\\/]dolibarr[\\/]htdocs$/i', $dolibarr_main_document_root)) {
|
||||
|
|
@ -529,11 +596,11 @@ function detect_dolibarr_main_url_root()
|
|||
// If defined (Ie: Apache with Linux)
|
||||
if (isset($_SERVER["SCRIPT_URI"])) {
|
||||
$dolibarr_main_url_root = $_SERVER["SCRIPT_URI"];
|
||||
} // If defined (Ie: Apache with Caudium)
|
||||
elseif (isset($_SERVER["SERVER_URL"]) && isset($_SERVER["DOCUMENT_URI"])) {
|
||||
} elseif (isset($_SERVER["SERVER_URL"]) && isset($_SERVER["DOCUMENT_URI"])) {
|
||||
// If defined (Ie: Apache with Caudium)
|
||||
$dolibarr_main_url_root = $_SERVER["SERVER_URL"].$_SERVER["DOCUMENT_URI"];
|
||||
} // If SCRIPT_URI, SERVER_URL, DOCUMENT_URI not defined (Ie: Apache 2.0.44 for Windows)
|
||||
else {
|
||||
} else {
|
||||
// If SCRIPT_URI, SERVER_URL, DOCUMENT_URI not defined (Ie: Apache 2.0.44 for Windows)
|
||||
$proto = ((!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') || (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443)) ? 'https' : 'http';
|
||||
if (!empty($_SERVER["HTTP_HOST"])) {
|
||||
$serverport = $_SERVER["HTTP_HOST"];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user