Browse Source

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
jmontoyaa 8 years ago
parent
commit
2d48717202
2 changed files with 20 additions and 2 deletions
  1. 14 0
      main/inc/lib/api.lib.php
  2. 6 2
      main/install/configuration.dist.php

+ 14 - 0
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;
 }
 

+ 6 - 2
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}';