Merge branch 'master' of ssh://git.kolab.org/git/roundcubemail-plugins-kolab

This commit is contained in:
Thomas Bruederli 2013-10-01 11:55:44 +02:00
commit a361a30dcc
16 changed files with 113 additions and 40 deletions

View file

@ -28,6 +28,11 @@ file_filter = plugins/kolab_delegation/localization/<lang>.inc
source_file = plugins/kolab_delegation/localization/en_US.inc
source_lang = en_US
[kolab.kolab_files]
file_filter = plugins/kolab_files/localization/<lang>.inc
source_file = plugins/kolab_files/localization/en_US.inc
source_lang = en_US
[kolab.kolab_folders]
file_filter = plugins/kolab_folders/localization/<lang>.inc
source_file = plugins/kolab_folders/localization/en_US.inc
@ -47,4 +52,3 @@ source_lang = en_US
file_filter = plugins/libcalendaring/localization/<lang>.inc
source_file = plugins/libcalendaring/localization/en_US.inc
source_lang = en_US

View file

@ -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

View file

@ -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
*/

View file

@ -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();
}

View file

@ -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) {

View file

@ -68,6 +68,10 @@
<pearinstaller>
<min>1.7.0</min>
</pearinstaller>
<package>
<name>libkolab</name>
<uri>http://kolabsys.com</uri>
</package>
</required>
</dependencies>
<phprelease/>

View file

@ -12,9 +12,6 @@ $rcmail_config['kolab_format_version'] = '3.0';
// Defaults to https://<imap-server->/freebusy
$rcmail_config['kolab_freebusy_server'] = 'https://<some-host>/<freebusy-path>';
// 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();

View file

@ -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)

View file

@ -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;
}
}

View file

@ -1,6 +1,6 @@
<?php
$labels = array();
$labels['owncloud'] = 'Files';
$labels['owncloud'] = 'Dateien';
?>