Add support for Cyrus v3 Freebusy service
This commit is contained in:
parent
45088c23b9
commit
8e3561758a
5 changed files with 34 additions and 15 deletions
|
@ -2608,11 +2608,6 @@ $("#rcmfd_new_category").keypress(function(event) {
|
|||
if (!$end) $end = $start + 86400 * 30;
|
||||
if (!$interval) $interval = 60; // 1 hour
|
||||
|
||||
if (!$dte) {
|
||||
$dts = new DateTime('@'.$start);
|
||||
$dts->setTimezone($this->timezone);
|
||||
}
|
||||
|
||||
$fblist = $this->driver->get_freebusy_list($email, $start, $end);
|
||||
$slots = '';
|
||||
|
||||
|
@ -2661,7 +2656,9 @@ $("#rcmfd_new_category").keypress(function(event) {
|
|||
$t = $t_end;
|
||||
}
|
||||
|
||||
$dte = new DateTime('@'.$t_end);
|
||||
$dts = new DateTime('@' . $start);
|
||||
$dts->setTimezone($this->timezone);
|
||||
$dte = new DateTime('@' . $t_end);
|
||||
$dte->setTimezone($this->timezone);
|
||||
|
||||
// let this information be cached for 5min
|
||||
|
|
|
@ -475,7 +475,7 @@ class carddav_contacts extends rcube_addressbook
|
|||
$colname = $pos ? substr($col, 0, $pos) : $col;
|
||||
|
||||
foreach ((array)$contact[$col] as $val) {
|
||||
if ($advanced) {
|
||||
if (!empty($advanced)) {
|
||||
$found[$colname] = $this->compare_search_value($colname, $val, $value[array_search($colname, $fields)], $mode);
|
||||
}
|
||||
else {
|
||||
|
@ -485,8 +485,9 @@ class carddav_contacts extends rcube_addressbook
|
|||
}
|
||||
|
||||
// compare matches
|
||||
if (($advanced && count($found) >= $scount) ||
|
||||
(!$advanced && rcube_utils::words_match(mb_strtolower($contents), $value))) {
|
||||
if ((!empty($advanced) && count($found) >= $scount)
|
||||
|| (empty($advanced) && rcube_utils::words_match(mb_strtolower($contents), $value))
|
||||
) {
|
||||
$this->filter['ids'][] = $id;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@ $config['kolab_format_version'] = '3.0';
|
|||
|
||||
// Optional override of the URL to read and trigger Free/Busy information of Kolab users
|
||||
// Defaults to /freebusy or https://<imap-server->/freebusy
|
||||
// Note that we add <email>.ifb path automatically, with optional query parameeters.
|
||||
// You can prevent addition of path by specifying an URL with %u variable, e.g.
|
||||
// "https://dav.domain.tld/freebusy/user/%u" (works with Cyrus v3 Freebusy service).
|
||||
$config['kolab_freebusy_server'] = null;
|
||||
|
||||
// Enables listing of only subscribed folders. This e.g. will limit
|
||||
|
|
|
@ -277,10 +277,10 @@ class kolab_storage
|
|||
*/
|
||||
public static function get_freebusy_server()
|
||||
{
|
||||
self::setup();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
$url = 'https://' . $_SESSION['imap_host'] . '/freebusy';
|
||||
$url = self::$config->get('kolab_freebusy_server', $url);
|
||||
$url = $rcmail->config->get('kolab_freebusy_server', $url);
|
||||
$url = rcube_utils::resolve_url($url);
|
||||
|
||||
return unslashify($url);
|
||||
|
@ -301,19 +301,34 @@ class kolab_storage
|
|||
$param = array();
|
||||
$utc = new \DateTimeZone('UTC');
|
||||
|
||||
// https://www.calconnect.org/pubdocs/CD0903%20Freebusy%20Read%20URL.pdf
|
||||
|
||||
if ($start instanceof \DateTime) {
|
||||
$start->setTimezone($utc);
|
||||
$param['dtstart'] = $start->format('Ymd\THis\Z');
|
||||
$param['start'] = $param['dtstart'] = $start->format('Ymd\THis\Z');
|
||||
}
|
||||
|
||||
if ($end instanceof \DateTime) {
|
||||
$end->setTimezone($utc);
|
||||
$param['dtend'] = $end->format('Ymd\THis\Z');
|
||||
$param['end'] = $param['dtend'] = $end->format('Ymd\THis\Z');
|
||||
}
|
||||
|
||||
if (!empty($param)) {
|
||||
$query = '?' . http_build_query($param);
|
||||
}
|
||||
|
||||
return self::get_freebusy_server() . '/' . $email . '.ifb' . $query;
|
||||
$url = self::get_freebusy_server();
|
||||
|
||||
if (strpos($url, '%u')) {
|
||||
// Expected configured full URL, just replace the %u variable
|
||||
// Note: Cyrus v3 Free-Busy service does not use .ifb extension
|
||||
$url = str_replace('%u', rawurlencode($email), $url);
|
||||
}
|
||||
else {
|
||||
$url .= '/' . $email . '.ifb';
|
||||
}
|
||||
|
||||
return $url . $query;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -235,7 +235,10 @@ class libkolab extends rcube_plugin
|
|||
|
||||
$key = md5(serialize($http_config));
|
||||
|
||||
if (!($request = self::$http_requests[$key])) {
|
||||
if (!empty(self::$http_requests[$key])) {
|
||||
$request = self::$http_requests[$key];
|
||||
}
|
||||
else {
|
||||
// load HTTP_Request2 (support both composer-installed and system-installed package)
|
||||
if (!class_exists('HTTP_Request2')) {
|
||||
require_once 'HTTP/Request2.php';
|
||||
|
|
Loading…
Add table
Reference in a new issue