diff options
author | Aleksander Machniak <machniak@kolabsys.com> | 2015-03-10 10:15:55 (GMT) |
---|---|---|
committer | Aleksander Machniak <machniak@kolabsys.com> | 2015-03-10 10:15:55 (GMT) |
commit | c9ce8725de0241f58c50f39c68ec52bb1831de0a (patch) | |
tree | c8b495d852b7bfd2ff1221c7ce92372269f49464 | |
parent | cb8e60fc25af3bdf107a119c8f63050df37f1986 (diff) | |
download | kolab-chwala-c9ce8725de0241f58c50f39c68ec52bb1831de0a.tar.gz |
Fix compatibility with Rouncube 1.2 (#4819)
The code now supports both older and newer Roundcube versions.
-rw-r--r-- | lib/drivers/kolab/kolab_file_storage.php | 10 | ||||
-rw-r--r-- | lib/file_api.php | 15 |
2 files changed, 17 insertions, 8 deletions
diff --git a/lib/drivers/kolab/kolab_file_storage.php b/lib/drivers/kolab/kolab_file_storage.php index 9edc65b..c7cdc8a 100644 --- a/lib/drivers/kolab/kolab_file_storage.php +++ b/lib/drivers/kolab/kolab_file_storage.php @@ -56,8 +56,8 @@ class kolab_file_storage implements file_storage // WARNING: We can use only plugins that are prepared for this // e.g. are not using output or rcmail objects or // doesn't throw errors when using them - $plugins = (array)$this->rc->config->get('fileapi_plugins', array('kolab_auth')); - $required = array('libkolab'); + $plugins = (array) $this->rc->config->get('fileapi_plugins', array('kolab_auth')); + $plugins = array_unique(array_merge($plugins, array('libkolab'))); // Kolab WebDAV server supports plugins, no need to overwrite object if (!is_a($this->rc->plugins, 'rcube_plugin_api')) { @@ -66,7 +66,11 @@ class kolab_file_storage implements file_storage $this->rc->plugins->init($this, ''); } - $this->rc->plugins->load_plugins($plugins, $required); + // this way we're compatible with Roundcube Framework 1.2 + // we can't use load_plugins() here + foreach ($plugins as $plugin) { + $this->rc->plugins->load_plugin($plugin, true); + } $this->init(); } diff --git a/lib/file_api.php b/lib/file_api.php index 484093b..a458b8d 100644 --- a/lib/file_api.php +++ b/lib/file_api.php @@ -134,14 +134,19 @@ class file_api extends file_api_core ini_set('session.use_cookies', 0); ini_set('session.serialize_handler', 'php'); - // use database for storing session data - $this->session = new rcube_session($rcube->get_dbh(), $this->conf); + // Roundcube Framework >= 1.2 + if (in_array('factory', get_class_methods('rcube_session'))) { + $this->session = rcube_session::factory($this->conf); + } + // Rouncube Framework < 1.2 + else { + $this->session = new rcube_session($rcube->get_dbh(), $this->conf); + $this->session->set_secret($this->conf->get('des_key') . dirname($_SERVER['SCRIPT_NAME'])); + $this->session->set_ip_check($this->conf->get('ip_check')); + } $this->session->register_gc_handler(array($rcube, 'gc')); - $this->session->set_secret($this->conf->get('des_key') . dirname($_SERVER['SCRIPT_NAME'])); - $this->session->set_ip_check($this->conf->get('ip_check')); - // this is needed to correctly close session in shutdown function $rcube->session = $this->session; } |