diff --git a/.tx/config b/.tx/config index 581934bb..104cbb39 100644 --- a/.tx/config +++ b/.tx/config @@ -28,6 +28,11 @@ file_filter = plugins/kolab_delegation/localization/.inc source_file = plugins/kolab_delegation/localization/en_US.inc source_lang = en_US +[kolab.kolab_files] +file_filter = plugins/kolab_files/localization/.inc +source_file = plugins/kolab_files/localization/en_US.inc +source_lang = en_US + [kolab.kolab_folders] file_filter = plugins/kolab_folders/localization/.inc source_file = plugins/kolab_folders/localization/en_US.inc @@ -47,4 +52,3 @@ source_lang = en_US file_filter = plugins/libcalendaring/localization/.inc source_file = plugins/libcalendaring/localization/en_US.inc source_lang = en_US - diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php index db0c5db4..415c8e4e 100644 --- a/plugins/calendar/drivers/kolab/kolab_driver.php +++ b/plugins/calendar/drivers/kolab/kolab_driver.php @@ -875,8 +875,6 @@ class kolab_driver extends calendar_driver */ public function get_freebusy_list($email, $start, $end) { - require_once('HTTP/Request2.php'); - if (empty($email)/* || $end < time()*/) return false; @@ -889,14 +887,11 @@ class kolab_driver extends calendar_driver // ask kolab server first try { - $rcmail = rcube::get_instance(); - $request = new HTTP_Request2(kolab_storage::get_freebusy_url($email)); - $request->setConfig(array( + $request_config = array( 'store_body' => true, 'follow_redirects' => true, - 'ssl_verify_peer' => $rcmail->config->get('kolab_ssl_verify_peer', true), - )); - + ); + $request = libkolab::http_request(kolab_storage::get_freebusy_url($email), 'GET', $request_config); $response = $request->send(); // authentication required diff --git a/plugins/kolab_auth/kolab_auth.php b/plugins/kolab_auth/kolab_auth.php index b13ea930..fb3b0515 100644 --- a/plugins/kolab_auth/kolab_auth.php +++ b/plugins/kolab_auth/kolab_auth.php @@ -41,6 +41,9 @@ class kolab_auth extends rcube_plugin $this->add_hook('startup', array($this, 'startup')); $this->add_hook('user_create', array($this, 'user_create')); + // Hook for password change + $this->add_hook('password_ldap_bind', array($this, 'password_ldap_bind')); + // Hooks related to "Login As" feature $this->add_hook('template_object_loginform', array($this, 'login_form')); $this->add_hook('storage_connect', array($this, 'imap_connect')); @@ -448,6 +451,20 @@ class kolab_auth extends rcube_plugin return $args; } + /** + * Set user DN for password change (password plugin with ldap_simple driver) + */ + public function password_ldap_bind($args) + { + $args['user_dn'] = $_SESSION['kolab_dn']; + + $rcmail = rcube::get_instance(); + + $rcmail->config->set('password_ldap_method', 'user'); + + return $args; + } + /** * Sets SASL Proxy login/password for IMAP and Managesieve auth */ diff --git a/plugins/kolab_files/kolab_files.php b/plugins/kolab_files/kolab_files.php index 27500633..16f156ee 100644 --- a/plugins/kolab_files/kolab_files.php +++ b/plugins/kolab_files/kolab_files.php @@ -49,6 +49,9 @@ class kolab_files extends rcube_plugin $this->register_action('prefs', array($this, 'actions')); $this->register_action('open', array($this, 'actions')); + // we use libkolab::http_request() from libkolab with its configuration + $this->require_plugin('libkolab'); + $this->ui(); } diff --git a/plugins/kolab_files/lib/kolab_files_engine.php b/plugins/kolab_files/lib/kolab_files_engine.php index 419dcb0b..fc14e807 100644 --- a/plugins/kolab_files/lib/kolab_files_engine.php +++ b/plugins/kolab_files/lib/kolab_files_engine.php @@ -581,35 +581,23 @@ class kolab_files_engine $url = $this->url . '/api/'; if (!$this->request) { - require_once 'HTTP/Request2.php'; + $config = array( + 'store_body' => true, + 'follow_redirects' => true, + ); + $this->request = libkolab::http_request($url, 'GET', $config); + } + else { + // cleanup try { - $request = new HTTP_Request2(); - $request->setConfig(array( - 'store_body' => true, - 'follow_redirects' => true, - 'ssl_verify_peer' => $this->rc->config->get('kolab_ssl_verify_peer', true), - 'ssl_verify_host' => $this->rc->config->get('kolab_ssl_verify_host', true), - )); - - $this->request = $request; + $this->request->setBody(''); + $this->request->setUrl($url); + $this->request->setMethod(HTTP_Request2::METHOD_GET); } catch (Exception $e) { rcube::raise_error($e, true, true); } - - // proxy User-Agent string - $this->request->setHeader('user-agent', $_SERVER['HTTP_USER_AGENT']); - } - - // cleanup - try { - $this->request->setBody(''); - $this->request->setUrl($url); - $this->request->setMethod(HTTP_Request2::METHOD_GET); - } - catch (Exception $e) { - rcube::raise_error($e, true, true); } if ($token) { diff --git a/plugins/kolab_files/package.xml b/plugins/kolab_files/package.xml index dbe6e828..8ac6e5b7 100644 --- a/plugins/kolab_files/package.xml +++ b/plugins/kolab_files/package.xml @@ -68,6 +68,10 @@ 1.7.0 + + libkolab + http://kolabsys.com + diff --git a/plugins/libkolab/config.inc.php.dist b/plugins/libkolab/config.inc.php.dist index aa0c8d09..6260f52a 100644 --- a/plugins/libkolab/config.inc.php.dist +++ b/plugins/libkolab/config.inc.php.dist @@ -12,9 +12,6 @@ $rcmail_config['kolab_format_version'] = '3.0'; // Defaults to https:///freebusy $rcmail_config['kolab_freebusy_server'] = 'https:///'; -// Set this option to disable SSL certificate checks when triggering Free/Busy (enabled by default) -$rcmail_config['kolab_ssl_verify_peer'] = false; - // Enables listing of only subscribed folders. This e.g. will limit // folders in calendar view or available addressbooks $rcmail_config['kolab_use_subscriptions'] = false; @@ -23,4 +20,7 @@ $rcmail_config['kolab_use_subscriptions'] = false; // for displaying resource folder names (experimental!) $rcmail_config['kolab_custom_display_names'] = false; -?> +// Configuration of HTTP requests. +// See http://pear.php.net/manual/en/package.http.http-request2.config.php +// for list of supported configuration options (array keys) +$rcmail_config['kolab_http_request'] = array(); diff --git a/plugins/libkolab/lib/kolab_storage_folder.php b/plugins/libkolab/lib/kolab_storage_folder.php index ddb5b3c3..7da57ffb 100644 --- a/plugins/libkolab/lib/kolab_storage_folder.php +++ b/plugins/libkolab/lib/kolab_storage_folder.php @@ -1110,9 +1110,7 @@ class kolab_storage_folder require_once('HTTP/Request2.php'); try { - $rcmail = rcube::get_instance(); - $request = new HTTP_Request2($url); - $request->setConfig(array('ssl_verify_peer' => $rcmail->config->get('kolab_ssl_verify_peer', true))); + $request = libkolab::http_request($url); // set authentication credentials if ($auth_user && $auth_passwd) diff --git a/plugins/libkolab/libkolab.php b/plugins/libkolab/libkolab.php index b5ff968a..48a50331 100644 --- a/plugins/libkolab/libkolab.php +++ b/plugins/libkolab/libkolab.php @@ -27,6 +27,8 @@ class libkolab extends rcube_plugin { + static $http_requests = array(); + /** * Required startup method of a Roundcube plugin */ @@ -59,4 +61,66 @@ class libkolab extends rcube_plugin $p['fetch_headers'] = trim($p['fetch_headers'] .' X-KOLAB-TYPE X-KOLAB-MIME-VERSION'); return $p; } + + /** + * Wrapper function to load and initalize the HTTP_Request2 Object + * + * @param string|Net_Url2 Request URL + * @param string Request method ('OPTIONS','GET','HEAD','POST','PUT','DELETE','TRACE','CONNECT') + * @param array Configuration for this Request instance, that will be merged + * with default configuration + * + * @return HTTP_Request2 Request object + */ + public static function http_request($url = '', $method = 'GET', $config = array()) + { + $rcube = rcube::get_instance(); + $http_config = (array) $rcube->config->get('kolab_http_request'); + + // deprecated configuration options + if (empty($http_config)) { + foreach (array('ssl_verify_peer', 'ssl_verify_host') as $option) { + $value = $rcube->config->get('kolab_' . $option, true); + if (is_bool($value)) { + $http_config[$option] = $value; + } + } + } + + if (!empty($config)) { + $http_config = array_merge($http_config, $config); + } + + $key = md5(serialize($http_config)); + + if (!($request = self::$http_requests[$key])) { + // load HTTP_Request2 + require_once 'HTTP/Request2.php'; + + try { + $request = new HTTP_Request2(); + $request->setConfig($http_config); + } + catch (Exception $e) { + rcube::raise_error($e, true, true); + } + + // proxy User-Agent string + $request->setHeader('user-agent', $_SERVER['HTTP_USER_AGENT']); + + self::$http_requests[$key] = $request; + } + + // cleanup + try { + $request->setBody(''); + $request->setUrl($url); + $request->setMethod($method); + } + catch (Exception $e) { + rcube::raise_error($e, true, true); + } + + return $request; + } } diff --git a/plugins/owncloud/copy_to_owncload/apps/kolab_auth/appinfo/app.php b/plugins/owncloud/copy_to_owncloud/apps/kolab_auth/appinfo/app.php similarity index 100% rename from plugins/owncloud/copy_to_owncload/apps/kolab_auth/appinfo/app.php rename to plugins/owncloud/copy_to_owncloud/apps/kolab_auth/appinfo/app.php diff --git a/plugins/owncloud/copy_to_owncload/apps/kolab_auth/appinfo/info.xml b/plugins/owncloud/copy_to_owncloud/apps/kolab_auth/appinfo/info.xml similarity index 100% rename from plugins/owncloud/copy_to_owncload/apps/kolab_auth/appinfo/info.xml rename to plugins/owncloud/copy_to_owncloud/apps/kolab_auth/appinfo/info.xml diff --git a/plugins/owncloud/copy_to_owncload/apps/kolab_auth/appinfo/version b/plugins/owncloud/copy_to_owncloud/apps/kolab_auth/appinfo/version similarity index 100% rename from plugins/owncloud/copy_to_owncload/apps/kolab_auth/appinfo/version rename to plugins/owncloud/copy_to_owncloud/apps/kolab_auth/appinfo/version diff --git a/plugins/owncloud/copy_to_owncload/themes/kolab/core/css/styles.css b/plugins/owncloud/copy_to_owncloud/themes/kolab/core/css/styles.css similarity index 100% rename from plugins/owncloud/copy_to_owncload/themes/kolab/core/css/styles.css rename to plugins/owncloud/copy_to_owncloud/themes/kolab/core/css/styles.css diff --git a/plugins/owncloud/copy_to_owncload/themes/kolab/core/js/kolab.js b/plugins/owncloud/copy_to_owncloud/themes/kolab/core/js/kolab.js similarity index 100% rename from plugins/owncloud/copy_to_owncload/themes/kolab/core/js/kolab.js rename to plugins/owncloud/copy_to_owncloud/themes/kolab/core/js/kolab.js diff --git a/plugins/owncloud/copy_to_owncload/themes/kolab/core/templates/layout.user.php b/plugins/owncloud/copy_to_owncloud/themes/kolab/core/templates/layout.user.php similarity index 100% rename from plugins/owncloud/copy_to_owncload/themes/kolab/core/templates/layout.user.php rename to plugins/owncloud/copy_to_owncloud/themes/kolab/core/templates/layout.user.php diff --git a/plugins/owncloud/localization/de_DE.inc b/plugins/owncloud/localization/de_DE.inc index f5cb8fb8..b3482da4 100644 --- a/plugins/owncloud/localization/de_DE.inc +++ b/plugins/owncloud/localization/de_DE.inc @@ -1,6 +1,6 @@