summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2006-06-25 09:18:00 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2006-06-25 09:18:00 +0000
commita79b88a7ac4707b8f3284a0e519b715072127468 (patch)
tree03f998df10de86ba93284f7cbd3118e0d0ffed09 /roundcubemail/program/include
parent95850713f5d8ca00bd0307a1bf982fc73df2bc63 (diff)
Changed behavior to include host-specific configuration (Bug #1483849)
git-svn-id: https://svn.roundcube.net/trunk@263 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
-rw-r--r--roundcubemail/program/include/main.inc22
1 files changed, 22 insertions, 0 deletions
diff --git a/roundcubemail/program/include/main.inc b/roundcubemail/program/include/main.inc
index b68a0c2a0..c5370b144 100644
--- a/roundcubemail/program/include/main.inc
+++ b/roundcubemail/program/include/main.inc
@@ -42,6 +42,10 @@ function rcmail_startup($task='mail')
// load config file
include_once('config/main.inc.php');
$CONFIG = is_array($rcmail_config) ? $rcmail_config : array();
+
+ // load host-specific configuration
+ rcmail_load_host_config(&$CONFIG);
+
$CONFIG['skin_path'] = $CONFIG['skin_path'] ? preg_replace('/\/$/', '', $CONFIG['skin_path']) : 'skins/default';
// load db conf
@@ -126,6 +130,24 @@ function rcmail_startup($task='mail')
register_shutdown_function('rcmail_shutdown');
}
+
+
+// load a host-specific config file if configured
+function rcmail_load_host_config(&$config)
+ {
+ $fname = NULL;
+
+ if (is_array($config['include_host_config']))
+ $fname = $config['include_host_config'][$_SERVER['HTTP_HOST']];
+ else if (!empty($config['include_host_config']))
+ $fname = preg_replace('/[^a-z0-9\.\-_]/i', '', $_SERVER['HTTP_HOST']) . '.inc.php';
+
+ if ($fname && is_file('config/'.$fname))
+ {
+ include('config/'.$fname);
+ $config = array_merge($config, $rcmail_config);
+ }
+ }
// create authorization hash