From 0bd316096880a8dbd0b936b5e2cb91b92a9825bb Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 1 Jun 2011 10:18:44 +0200 Subject: [PATCH] - Add possibility to set global Horde config --- plugins/kolab_core/config.inc.php.dist | 3 +++ plugins/kolab_core/rcube_kolab.php | 22 ++++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/plugins/kolab_core/config.inc.php.dist b/plugins/kolab_core/config.inc.php.dist index a07a2689..888820a4 100644 --- a/plugins/kolab_core/config.inc.php.dist +++ b/plugins/kolab_core/config.inc.php.dist @@ -8,4 +8,7 @@ $rcmail_config['kolab']['ldap']['basedn'] = 'dc=kolabserver,dc=local'; $rcmail_config['kolab']['ldap']['phpdn'] = 'cn=nobody,cn=internal,dc=kolabserver,dc=local'; $rcmail_config['kolab']['ldap']['phppw'] = ''; +// Global Horde classes configuration (e.g. Cache settings) +$rcmail_config['kolab']['global'] = array(); + ?> diff --git a/plugins/kolab_core/rcube_kolab.php b/plugins/kolab_core/rcube_kolab.php index edace4c8..82428eff 100644 --- a/plugins/kolab_core/rcube_kolab.php +++ b/plugins/kolab_core/rcube_kolab.php @@ -18,19 +18,19 @@ class rcube_kolab { private static $horde_auth; private static $ready = false; - - + + /** * Setup the environment needed by the Kolab_* classes to access Kolab data */ public static function setup() { global $conf; - + // setup already done if (self::$horde_auth) return; - + $rcmail = rcmail::get_instance(); // get password of logged user @@ -38,7 +38,14 @@ class rcube_kolab // load ldap credentials from local config $conf['kolab'] = $rcmail->config->get('kolab'); - + + // Set global Horde config (e.g. Cache settings) + if (!empty($conf['kolab']['global'])) { + $conf = array_merge($conf, $conf['kolab']['global']); + unset($conf['kolab']['global']); + } + + // Re-set LDAP/IMAP host config $conf['kolab']['ldap'] += array('server' => 'ldap://' . $_SESSION['imap_host'] . ':389'); $conf['kolab']['imap'] += array('server' => $_SESSION['imap_host'], 'port' => $_SESSION['imap_port']); @@ -54,12 +61,11 @@ class rcube_kolab Auth::setCredential('password', $pwd); self::$ready = true; } - + NLS::setCharset('UTF-8'); String::setDefaultCharset('UTF-8'); } - - + /** * Get instance of a Kolab (XML) format object *