Page MenuHomePhorge

D3908.1775277104.diff
No OneTemporary

Authored By
Unknown
Size
13 KB
Referenced Files
None
Subscribers
None

D3908.1775277104.diff

diff --git a/plugins/calendar/config.inc.php.dist b/plugins/calendar/config.inc.php.dist
--- a/plugins/calendar/config.inc.php.dist
+++ b/plugins/calendar/config.inc.php.dist
@@ -28,6 +28,9 @@
// backend type (database, kolab, caldav)
$config['calendar_driver'] = "database";
+// CalDAV server location (required when calendar_driver = caldav)
+$config['calendar_caldav_server'] = "http://localhost";
+
// default calendar view (agendaDay, agendaWeek, month)
$config['calendar_default_view'] = "agendaWeek";
diff --git a/plugins/calendar/skins/elastic/templates/calendar.html b/plugins/calendar/skins/elastic/templates/calendar.html
--- a/plugins/calendar/skins/elastic/templates/calendar.html
+++ b/plugins/calendar/skins/elastic/templates/calendar.html
@@ -8,9 +8,11 @@
<div class="header">
<a class="button icon back-content-button" href="#back" data-hidden="big"><span class="inner"><roundcube:label name="back" /></span></a>
<span id="aria-label-calendars" class="header-title"><roundcube:label name="calendar.calendars" /></span>
+ <roundcube:if condition="env:calendar_driver != 'caldav'" />
<roundcube:button name="calendaractionsmenu" id="calendaroptionsmenulink" type="link"
title="calendar.calendaractions" class="button icon sidebar-menu" data-popup="calendaractions-menu"
innerClass="inner" label="actions" />
+ <roundcube:endif />
</div>
<roundcube:object name="libkolab.folder_search_form" id="calendarlistsearch" wrapper="searchbar menu"
ariatag="h2" label="calsearchform" label-domain="calendar" buttontitle="findcalendars" />
@@ -141,11 +143,9 @@
<div id="calendaractions-menu" class="popupmenu">
<h3 id="aria-label-calendaroptions" class="voice"><roundcube:label name="calendar.calendaractions" /></h3>
<ul class="menu listing" role="menu" aria-labelledby="aria-label-calendaroptions">
- <roundcube:if condition="env:calendar_driver != 'caldav'" />
<roundcube:button type="link-menuitem" command="calendar-create" label="calendar.addcalendar" class="create disabled" classAct="create active" />
<roundcube:button type="link-menuitem" command="calendar-edit" label="calendar.editcalendar" class="edit disabled" classAct="edit active" />
<roundcube:button type="link-menuitem" command="calendar-delete" label="calendar.deletecalendar" class="delete disabled" classAct="delete active" />
- <roundcube:endif />
<roundcube:if condition="env:calendar_driver == 'kolab'" />
<roundcube:button type="link-menuitem" command="calendar-remove" label="calendar.removelist" class="remove disabled" classAct="remove active" />
<roundcube:endif />
diff --git a/plugins/libcalendaring/libvcalendar.php b/plugins/libcalendaring/libvcalendar.php
--- a/plugins/libcalendaring/libvcalendar.php
+++ b/plugins/libcalendaring/libvcalendar.php
@@ -1353,6 +1353,9 @@
if (!empty($ex['thisandfuture'])) {
$recurrence_id->add('RANGE', 'THISANDFUTURE');
}
+
+ $ex['uid'] = $ve->UID;
+
$this->_to_ical($ex, $vcal, $get_attachment, $recurrence_id);
}
}
diff --git a/plugins/libkolab/SQL/mysql.initial.sql b/plugins/libkolab/SQL/mysql.initial.sql
--- a/plugins/libkolab/SQL/mysql.initial.sql
+++ b/plugins/libkolab/SQL/mysql.initial.sql
@@ -1,10 +1,3 @@
-/**
- * libkolab database schema
- *
- * @author Thomas Bruederli
- * @licence GNU AGPL
- */
-
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `kolab_folders`;
diff --git a/plugins/libkolab/SQL/oracle.initial.sql b/plugins/libkolab/SQL/oracle.initial.sql
--- a/plugins/libkolab/SQL/oracle.initial.sql
+++ b/plugins/libkolab/SQL/oracle.initial.sql
@@ -1,10 +1,3 @@
-/**
- * libkolab database schema
- *
- * @author Aleksander Machniak
- * @licence GNU AGPL
- */
-
CREATE TABLE "kolab_folders" (
"folder_id" number NOT NULL PRIMARY KEY,
"resource" VARCHAR(255) NOT NULL,
diff --git a/plugins/libkolab/SQL/sqlite.initial.sql b/plugins/libkolab/SQL/sqlite.initial.sql
--- a/plugins/libkolab/SQL/sqlite.initial.sql
+++ b/plugins/libkolab/SQL/sqlite.initial.sql
@@ -1,10 +1,3 @@
-/**
- * libkolab database schema
- *
- * @author Thomas Bruederli
- * @licence GNU AGPL
- */
-
CREATE TABLE kolab_folders (
folder_id INTEGER NOT NULL PRIMARY KEY,
resource VARCHAR(255) NOT NULL,
diff --git a/plugins/libkolab/lib/kolab_dav_client.php b/plugins/libkolab/lib/kolab_dav_client.php
--- a/plugins/libkolab/lib/kolab_dav_client.php
+++ b/plugins/libkolab/lib/kolab_dav_client.php
@@ -25,6 +25,8 @@
{
public $url;
+ protected $user;
+ protected $password;
protected $rc;
protected $responseHeaders = [];
@@ -33,8 +35,22 @@
*/
public function __construct($url)
{
- $this->url = $url;
$this->rc = rcube::get_instance();
+
+ $parsedUrl = parse_url($url);
+
+ if (!empty($parsedUrl['user']) && !empty($parsedUrl['pass'])) {
+ $this->user = rawurldecode($parsedUrl['user']);
+ $this->password = rawurldecode($parsedUrl['pass']);
+
+ $url = str_replace(rawurlencode($this->user) . ':' . rawurlencode($this->password) . '@', '', $url);
+ }
+ else {
+ $this->user = $this->rc->user->get_username();
+ $this->password = $this->rc->decrypt($_SESSION['password']);
+ }
+
+ $this->url = $url;
}
/**
@@ -60,7 +76,7 @@
$request = $this->initRequest($this->url . $path, $method, $request_config);
- $request->setAuth($this->rc->user->get_username(), $this->rc->decrypt($_SESSION['password']));
+ $request->setAuth($this->user, $this->password);
if ($body) {
$request->setBody($body);
@@ -144,7 +160,7 @@
'VCARD' => 'addressbooks',
];
- $principal_href = '/' . $roots[$component] . '/' . $this->rc->user->get_username();
+ $principal_href = '/' . $roots[$component] . '/' . rawurlencode($this->user);
$body = '<?xml version="1.0" encoding="utf-8"?>'
. '<d:propfind xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:a="http://apple.com/ns/ical/">'
@@ -470,8 +486,10 @@
$http_config = array_merge($http_config, $config);
}
- // load HTTP_Request2
- require_once 'HTTP/Request2.php';
+ // load HTTP_Request2 (support both composer-installed and system-installed package)
+ if (!class_exists('HTTP_Request2')) {
+ require_once 'HTTP/Request2.php';
+ }
try {
$request = new HTTP_Request2();
diff --git a/plugins/libkolab/lib/kolab_storage_dav.php b/plugins/libkolab/lib/kolab_storage_dav.php
--- a/plugins/libkolab/lib/kolab_storage_dav.php
+++ b/plugins/libkolab/lib/kolab_storage_dav.php
@@ -227,7 +227,7 @@
*
* @return string Name of the folder-object
*/
- public function object_name($folder, &$folder_ns = null)
+ public static function object_name($folder, &$folder_ns = null)
{
// TODO: Shared folders
$folder_ns = 'personal';
diff --git a/plugins/libkolab/lib/kolab_storage_dav_cache.php b/plugins/libkolab/lib/kolab_storage_dav_cache.php
--- a/plugins/libkolab/lib/kolab_storage_dav_cache.php
+++ b/plugins/libkolab/lib/kolab_storage_dav_cache.php
@@ -138,7 +138,7 @@
// Determine objects to fetch or delete
$new_index = [];
$update_index = [];
- $old_index = $this->current_index(); // uid -> etag
+ $old_index = $this->folder_index(); // uid -> etag
$chunk_size = 20; // max numer of objects per DAV request
foreach ($dav_index as $object) {
@@ -162,7 +162,7 @@
// Fetch new objects and store in DB
if (!empty($new_index)) {
foreach (array_chunk($new_index, $chunk_size, true) as $chunk) {
- $objects = $this->folder->dav->getData($this->folder->href, $chunk);
+ $objects = $this->folder->dav->getData($this->folder->href, $this->folder->get_dav_type(), $chunk);
if (!is_array($objects)) {
rcube::raise_error([
@@ -190,7 +190,7 @@
// Fetch updated objects and store in DB
if (!empty($update_index)) {
foreach (array_chunk($update_index, $chunk_size, true) as $chunk) {
- $objects = $this->folder->dav->getData($this->folder->href, $chunk);
+ $objects = $this->folder->dav->getData($this->folder->href, $this->folder->get_dav_type(), $chunk);
if (!is_array($objects)) {
rcube::raise_error([
@@ -229,7 +229,7 @@
/**
* Return current folder index (uid -> etag)
*/
- protected function current_index()
+ protected function folder_index()
{
// read cache index
$sql_result = $this->db->query(
@@ -251,8 +251,9 @@
*
* @param string Object UID
* @param string Object type to read
+ * @param string Unused (kept for compat. with the parent class)
*/
- public function get($uid, $type = null)
+ public function get($uid, $type = null, $unused = null)
{
if ($this->ready) {
$this->_read_folder_data();
@@ -283,8 +284,9 @@
*
* @param string Object UID
* @param array|false Hash array with object properties to save or false to delete the cache entry
+ * @param string Unused (kept for compat. with the parent class)
*/
- public function set($uid, $object)
+ public function set($uid, $object, $unused = null)
{
// remove old entry
if ($this->ready) {
@@ -307,8 +309,9 @@
*
* @param mixed Hash array with object properties to save or false to delete the cache entry
* @param string Optional old message UID (for update)
+ * @param string Unused (kept for compat. with the parent class)
*/
- public function save($object, $olduid = null)
+ public function save($object, $olduid = null, $unused = null)
{
// write to cache
if ($this->ready) {
@@ -359,8 +362,10 @@
*
* @param string Entry's UID
* @param kolab_storage_folder Target storage folder instance
+ * @param string Unused (kept for compat. with the parent class)
+ * @param string Unused (kept for compat. with the parent class)
*/
- public function move($uid, $target)
+ public function move($uid, $target, $unused1 = null, $unused2 = null)
{
// TODO
}
diff --git a/plugins/libkolab/lib/kolab_storage_dav_folder.php b/plugins/libkolab/lib/kolab_storage_dav_folder.php
--- a/plugins/libkolab/lib/kolab_storage_dav_folder.php
+++ b/plugins/libkolab/lib/kolab_storage_dav_folder.php
@@ -42,8 +42,8 @@
$this->valid = true;
list($this->type, $suffix) = explode('.', $type_annotation);
- $this->default = $suffix == 'default';
- $this->subtype = $this->default ? '' : $suffix;
+ $this->default = $suffix == 'default';
+ $this->subtype = $this->default ? '' : $suffix;
// Init cache
$this->cache = kolab_storage_dav_cache::factory($this);
@@ -140,6 +140,11 @@
$host = preg_replace('|^https?://|', 'dav://' . urlencode($this->get_owner(true)) . '@', $this->dav->url);
$path = $this->href[0] == '/' ? $this->href : "/{$this->href}";
+ $host_path = parse_url($host, PHP_URL_PATH);
+ if ($host_path && strpos($path, $host_path) === 0) {
+ $path = substr($path, strlen($host_path));
+ }
+
$this->resource_uri = unslashify($host) . $path;
return $this->resource_uri;
@@ -425,16 +430,17 @@
*
* @param string The object UID to fetch
* @param string The object type expected (use wildcard '*' to accept all types)
+ * @param string Unused (kept for compat. with the parent class)
*
* @return mixed Hash array representing the Kolab object, a kolab_format instance or false if not found
*/
- public function read_object($uid, $type = null)
+ public function read_object($uid, $type = null, $folder = null)
{
if (!$this->valid) {
return false;
}
- $href = $this->object_location($uid);
+ $href = $this->object_location($uid);
$objects = $this->dav->getData($this->href, $this->get_dav_type(), [$href]);
if (!is_array($objects) || count($objects) != 1) {
@@ -484,7 +490,6 @@
if ($this->type == 'event') {
$ical = libcalendaring::get_ical();
-
if (!empty($object['exceptions'])) {
$object['recurrence']['EXCEPTIONS'] = $object['exceptions'];
}
diff --git a/plugins/libkolab/libkolab.php b/plugins/libkolab/libkolab.php
--- a/plugins/libkolab/libkolab.php
+++ b/plugins/libkolab/libkolab.php
@@ -235,8 +235,10 @@
$key = md5(serialize($http_config));
if (!($request = self::$http_requests[$key])) {
- // load HTTP_Request2
- require_once 'HTTP/Request2.php';
+ // load HTTP_Request2 (support both composer-installed and system-installed package)
+ if (!class_exists('HTTP_Request2')) {
+ require_once 'HTTP/Request2.php';
+ }
try {
$request = new HTTP_Request2();

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 4, 4:31 AM (4 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823585
Default Alt Text
D3908.1775277104.diff (13 KB)

Event Timeline