From 2d487172027a9ce87d882e406396dce489833e3c Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Mon, 13 Mar 2017 11:18:40 +0100 Subject: [PATCH] Add configuration variable per portal see BT#12383 If multiple_access_urls is set then you can setup a configuration value per value. Example: $_configuration['session_lifetime'][2] = false; to affect only URL id 2 --- main/inc/lib/api.lib.php | 14 ++++++++++++++ main/install/configuration.dist.php | 8 ++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index c9e2c271d2..d90e46e0e6 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -7504,15 +7504,29 @@ function api_warn_hosting_contact($limitName) } /** + * Gets value of a variable from app/config/configuration.php * @param string $variable + * * @return bool|mixed */ function api_get_configuration_value($variable) { global $_configuration; + // Check the current url id, id = 1 by default + $urlId = isset($_configuration['access_url']) ? (int) $_configuration['access_url'] : 1; + + // Check if variable exists if (isset($_configuration[$variable])) { + if (is_array($_configuration[$variable])) { + // Check if it exists for the sub portal + if (array_key_exists($urlId, $_configuration[$variable])) { + return $_configuration[$variable][$urlId]; + } + } + return $_configuration[$variable]; } + return false; } diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php index 28ef02f2e9..2f64aec095 100755 --- a/main/install/configuration.dist.php +++ b/main/install/configuration.dist.php @@ -137,7 +137,7 @@ $_configuration['cdn'] = array( /** * Misc. settings */ -// security word for password recovery +// Security word for password recovery $_configuration['security_key'] = '{SECURITY_KEY}'; // Hash function method $_configuration['password_encryption'] = '{ENCRYPT_PASSWORD}'; @@ -146,10 +146,14 @@ $_configuration['session_stored_in_db'] = false; // Session lifetime $_configuration['session_lifetime'] = SESSION_LIFETIME; // Activation for multi-url access +// When enabling multi-url, settings can be configured by multi-url using a simple +// sub-element. E.g. $_configuration['session_lifetime'] = true; could be turned into +// something like $_configuration['session_lifetime'][2] = false; to affect only URL +// with ID 2. The ID can be found in the access_url table. //$_configuration['multiple_access_urls'] = true; $_configuration['software_name'] = 'Chamilo'; $_configuration['software_url'] = 'https://chamilo.org/'; -//Deny the elimination of users +// Deny the elimination of users $_configuration['deny_delete_users'] = false; // Version settings $_configuration['system_version'] = '{NEW_VERSION}';