summaryrefslogtreecommitdiff
path: root/lib/Kolab/CardDAV
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Kolab/CardDAV')
-rw-r--r--lib/Kolab/CardDAV/ContactsBackend.php14
-rw-r--r--lib/Kolab/CardDAV/LDAPDirectory.php9
2 files changed, 12 insertions, 11 deletions
diff --git a/lib/Kolab/CardDAV/ContactsBackend.php b/lib/Kolab/CardDAV/ContactsBackend.php
index cb0c448..a025d7d 100644
--- a/lib/Kolab/CardDAV/ContactsBackend.php
+++ b/lib/Kolab/CardDAV/ContactsBackend.php
@@ -274,7 +274,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
foreach ($storage->select($query) as $contact) {
$cards[] = array(
'id' => $contact['uid'],
- 'uri' => $contact['uid'] . '.vcf',
+ 'uri' => VObjectUtils::uid2uri($contact['uid'], '.vcf'),
'lastmodified' => is_a($contact['changed'], 'DateTime') ? $contact['changed']->format('U') : null,
'etag' => self::_get_etag($contact),
'size' => $contact['_size'],
@@ -299,7 +299,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
{
console(__METHOD__, $addressBookId, $cardUri);
- $uid = basename($cardUri, '.vcf');
+ $uid = VObjectUtils::uri2uid($cardUri, '.vcf');
// search all folders for the given card
if ($addressBookId == '__all__') {
@@ -319,7 +319,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
if ($contact) {
return array(
'id' => $contact['uid'],
- 'uri' => $contact['uid'] . '.vcf',
+ 'uri' => VObjectUtils::uid2uri($contact['uid'], '.vcf'),
'lastmodified' => is_a($contact['changed'], 'DateTime') ? $contact['changed']->format('U') : null,
'carddata' => $this->to_vcard($contact),
'etag' => self::_get_etag($contact),
@@ -356,7 +356,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
{
console(__METHOD__, $addressBookId, $cardUri, $cardData);
- $uid = basename($cardUri, '.vcf');
+ $uid = VObjectUtils::uri2uid($cardUri, '.vcf');
$storage = $this->get_storage_folder($addressBookId);
$object = $this->parse_vcard($cardData, $uid);
@@ -365,7 +365,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
}
// if URI doesn't match the content's UID, the object might already exist!
- $cardUri = $object['uid'] . '.vcf';
+ $cardUri = VObjectUtils::uid2uri($object['uid'], '.vcf');
if ($object['uid'] != $uid && $this->getCard($addressBookId, $cardUri)) {
Plugin::$redirect_basename = $cardUri;
return $this->updateCard($addressBookId, $cardUri, $cardData);
@@ -415,7 +415,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
{
console(__METHOD__, $addressBookId, $cardUri, $cardData);
- $uid = basename($cardUri, '.vcf');
+ $uid = VObjectUtils::uri2uid($cardUri, '.vcf');
$object = $this->parse_vcard($cardData, $uid);
// sanity check
@@ -485,7 +485,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
{
console(__METHOD__, $addressBookId, $cardUri);
- $uid = basename($cardUri, '.vcf');
+ $uid = VObjectUtils::uri2uid($cardUri, '.vcf');
if ($addressBookId == '__all__') {
$this->get_card_by_uid($uid, $storage);
diff --git a/lib/Kolab/CardDAV/LDAPDirectory.php b/lib/Kolab/CardDAV/LDAPDirectory.php
index 6b41755..ca175f2 100644
--- a/lib/Kolab/CardDAV/LDAPDirectory.php
+++ b/lib/Kolab/CardDAV/LDAPDirectory.php
@@ -33,6 +33,7 @@ use \rcube_ldap_generic;
use Sabre\DAV;
use Sabre\DAVACL;
use Sabre\CardDAV\Property;
+use Kolab\Utils\VObjectUtils;
/**
* CardDAV Directory Gateway implementation
@@ -126,7 +127,7 @@ class LDAPDirectory extends DAV\Collection implements \Sabre\CardDAV\IDirectory,
{
console(__METHOD__, $cardUri);
- $uid = basename($cardUri, '.vcf');
+ $uid = VObjectUtils::uri2uid($cardUri, '.vcf');
$record = null;
// get from cache
@@ -138,7 +139,7 @@ class LDAPDirectory extends DAV\Collection implements \Sabre\CardDAV\IDirectory,
if ($contact = $this->getContactObject($uid)) {
$obj = array(
'id' => $contact['uid'],
- 'uri' => $contact['uid'] . '.vcf',
+ 'uri' => VObjectUtils::uid2uri($contact['uid'], '.vcf'),
'lastmodified' => $contact['_timestamp'],
'carddata' => $this->carddavBackend->to_vcard($contact),
'etag' => self::_get_etag($contact),
@@ -199,7 +200,7 @@ class LDAPDirectory extends DAV\Collection implements \Sabre\CardDAV\IDirectory,
foreach ($cached_index as $uid => $c) {
$obj = array(
'id' => $uid,
- 'uri' => $uid . '.vcf',
+ 'uri' => VObjectUtils::uid2uri($uid, '.vcf'),
'etag' => $c[1],
'lastmodified' => $c[2],
);
@@ -233,7 +234,7 @@ class LDAPDirectory extends DAV\Collection implements \Sabre\CardDAV\IDirectory,
$obj = array(
'id' => $contact['uid'],
- 'uri' => $contact['uid'] . '.vcf',
+ 'uri' => VObjectUtils::uid2uri($contact['uid'], '.vcf'),
'lastmodified' => $contact['_timestamp'],
'carddata' => $this->carddavBackend->to_vcard($contact),
'etag' => self::_get_etag($contact),