🎨 Config file code formating

This commit is contained in:
Pierre Goiffon
2019-10-22 12:04:40 +02:00
parent 3f59141407
commit 4fe7cd5adc

View File

@@ -70,14 +70,14 @@ define('DEFAULT_ALLOWED_LOGIN_TYPES', 'form|external|basic');
define('DEFAULT_EXT_AUTH_VARIABLE', '$_SERVER[\'REMOTE_USER\']');
define('DEFAULT_ENCRYPTION_KEY', '@iT0pEncr1pti0n!'); // We'll use a random generated key later (if possible)
define('DEFAULT_ENCRYPTION_LIB', 'Mcrypt'); // We'll define the best encryption available later
/**
* Config
* configuration data (this class cannot not be localized, because it is responsible for loading the dictionaries)
*
* @package iTopORM
*
* @see \MetaModel::GetConfig() to get the config, if the metamodel was already loaded
* @see utils::GetConfig() to load config from the current env, if metamodel is not loaded
* @package iTopORM
*/
class Config
{
@@ -588,7 +588,7 @@ class Config
'Asia/Istanbul',
'Asia/Singapore',
'Africa/Casablanca',
'Australia/Sydney'
'Australia/Sydney',
),
'default' => 'Europe/Paris',
'value' => 'Europe/Paris',
@@ -1416,7 +1416,7 @@ class Config
//define default encryption params according to php install
$aEncryptParams = SimpleCrypt::GetNewDefaultParams();
$this->m_sEncryptionLibrary = isset($aEncryptParams['lib']) ? $aEncryptParams['lib'] : DEFAULT_ENCRYPTION_LIB;
$this->m_sEncryptionKey= isset($aEncryptParams['key']) ? $aEncryptParams['key'] : DEFAULT_ENCRYPTION_KEY;
$this->m_sEncryptionKey = isset($aEncryptParams['key']) ? $aEncryptParams['key'] : DEFAULT_ENCRYPTION_KEY;
$this->m_aModuleSettings = array();
@@ -1491,7 +1491,7 @@ class Config
$sNoise = trim(ob_get_contents());
ob_end_clean();
}
catch(Error $e)
catch (Error $e)
{
// PHP 7
throw new ConfigException('Error in configuration file',
@@ -1575,12 +1575,14 @@ class Config
}
/**
* @param string $sModule
* @see \MetaModel::GetModuleParameter()
*
* @param string $sProperty
* @param mixed $defaultvalue
*
* @param string $sModule
*
* @return mixed|null if present, value defined in the configuration file, if not module parameter from XML
* @see \MetaModel::GetModuleParameter()
*/
public function GetModuleSetting($sModule, $sProperty, $defaultvalue = null)
{
@@ -1594,12 +1596,14 @@ class Config
}
/**
* @param string $sModule
* @see \MetaModel::GetModuleSetting() to get from the configuration file first
*
* @param string $sProperty
* @param mixed $defaultvalue
*
* @param string $sModule
*
* @return mixed|null parameter value defined in the XML
* @see \MetaModel::GetModuleSetting() to get from the configuration file first
* @link https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Axml_reference#modules_parameters
*/
public function GetModuleParameter($sModule, $sProperty, $defaultvalue = null)
@@ -2048,7 +2052,7 @@ class Config
$this->Set('db_name', $sDBName);
$this->Set('db_subname', $aParamValues['db_prefix']);
$bDbTlsEnabled = (bool) $aParamValues['db_tls_enabled'];
$bDbTlsEnabled = (bool)$aParamValues['db_tls_enabled'];
if ($bDbTlsEnabled)
{
$this->Set('db_tls.enabled', $bDbTlsEnabled, 'UpdateFromParams');
@@ -2059,9 +2063,12 @@ class Config
$this->Set('db_tls.enabled', $bDbTlsEnabled, null);
}
$sDbTlsCa = $bDbTlsEnabled ? $aParamValues['db_tls_ca'] : null;
if (isset($sDbTlsCa) && !empty($sDbTlsCa)) {
if (isset($sDbTlsCa) && !empty($sDbTlsCa))
{
$this->Set('db_tls.ca', $sDbTlsCa, 'UpdateFromParams');
} else {
}
else
{
// empty parameter : we don't want it in the file
$this->Set('db_tls.ca', null, null);
}