Branch 'roundcubemail-plugins-kolab-3.1' - plugins/kolab_files
Aleksander Machniak
machniak at kolabsys.com
Fri Jan 24 14:12:30 CET 2014
plugins/kolab_files/kolab_files.php | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
New commits:
commit d7f14c5803ef8ed389369b8193d793d725b77746
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Fri Jan 24 14:11:24 2014 +0100
Support kolab_files_disabled and kolab_files_enabled config
diff --git a/plugins/kolab_files/kolab_files.php b/plugins/kolab_files/kolab_files.php
index 16f156e..ad9f284 100644
--- a/plugins/kolab_files/kolab_files.php
+++ b/plugins/kolab_files/kolab_files.php
@@ -52,7 +52,8 @@ class kolab_files extends rcube_plugin
// we use libkolab::http_request() from libkolab with its configuration
$this->require_plugin('libkolab');
- $this->ui();
+ // Load UI from startup hook
+ $this->add_hook('startup', array($this, 'startup'));
}
/**
@@ -61,6 +62,11 @@ class kolab_files extends rcube_plugin
private function engine()
{
if ($this->engine === null) {
+ // the files module can be enabled/disabled by the kolab_auth plugin
+ if ($this->rc->config->get('kolab_files_disabled') || !$this->rc->config->get('kolab_files_enabled', true)) {
+ return $this->engine = false;
+ }
+
$this->load_config();
$url = $this->rc->config->get('kolab_files_url');
@@ -78,6 +84,16 @@ class kolab_files extends rcube_plugin
}
/**
+ * Startup hook handler, initializes/enables Files UI
+ */
+ public function startup($args)
+ {
+ // call this from startup to give a chance to set
+ // kolab_files_enabled/disabled in kolab_auth plugin
+ $this->ui();
+ }
+
+ /**
* Adds elements of files API user interface
*/
private function ui()
More information about the commits
mailing list