Skip to content

Commit

Permalink
[DAV][CalDAV] Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Aug 1, 2017
1 parent 201bbb9 commit f57a3aa
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
10 changes: 5 additions & 5 deletions apps/dav/lib/CalDAV/Activity/Provider/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,32 +168,32 @@ protected function getParameters(IEvent $event) {
case self::SUBJECT_UNSHARE_USER . '_self':
return [
'actor' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
];
case self::SUBJECT_SHARE_USER . '_you':
case self::SUBJECT_UNSHARE_USER . '_you':
return [
'user' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
];
case self::SUBJECT_SHARE_USER . '_by':
case self::SUBJECT_UNSHARE_USER . '_by':
return [
'user' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
'actor' => $this->generateUserParameter($parameters[2]),
];
case self::SUBJECT_SHARE_GROUP . '_you':
case self::SUBJECT_UNSHARE_GROUP . '_you':
return [
'group' => $this->generateGroupParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
];
case self::SUBJECT_SHARE_GROUP . '_by':
case self::SUBJECT_UNSHARE_GROUP . '_by':
return [
'group' => $this->generateGroupParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
'actor' => $this->generateUserParameter($parameters[2]),
];
}
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/CalDAV/Activity/Provider/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ protected function getParameters(IEvent $event) {
case self::SUBJECT_OBJECT_UPDATE . '_event':
return [
'actor' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
'event' => $this->generateObjectParameter($parameters[2]),
];
case self::SUBJECT_OBJECT_ADD . '_event_self':
case self::SUBJECT_OBJECT_DELETE . '_event_self':
case self::SUBJECT_OBJECT_UPDATE . '_event_self':
return [
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
'event' => $this->generateObjectParameter($parameters[2]),
];
}
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/CalDAV/Activity/Provider/Todo.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected function getParameters(IEvent $event) {
case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action':
return [
'actor' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
'todo' => $this->generateObjectParameter($parameters[2]),
];
case self::SUBJECT_OBJECT_ADD . '_todo_self':
Expand All @@ -104,7 +104,7 @@ protected function getParameters(IEvent $event) {
case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self':
case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self':
return [
'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]),
'calendar' => $this->generateCalendarParameter((int)$event->getObjectId(), $parameters[1]),
'todo' => $this->generateObjectParameter($parameters[2]),
];
}
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/BirthdayService.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ protected function getAllAffectedPrincipals($addressBookId) {
* @param string $cardData
* @param array $book
* @param int $calendarId
* @param string $type
* @param string[] $type
*/
private function updateCalendar($cardUri, $cardData, $book, $calendarId, $type) {
$objectUri = $book['uri'] . '-' . $cardUri . $type['postfix'] . '.ics';
Expand Down
9 changes: 5 additions & 4 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
use Sabre\VObject\DateTimeParser;
use Sabre\VObject\Reader;
use Sabre\VObject\Recur\EventIterator;
use Sabre\Uri;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;

Expand Down Expand Up @@ -318,7 +319,7 @@ function getCalendarsForUser($principalUri) {
}
}

list(, $name) = URLUtil::splitPath($row['principaluri']);
list(, $name) = Uri\split($row['principaluri']);
$uri = $row['uri'] . '_shared_by_' . $name;
$row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
$components = [];
Expand Down Expand Up @@ -432,7 +433,7 @@ public function getPublicCalendars() {
->execute();

while($row = $result->fetch()) {
list(, $name) = URLUtil::splitPath($row['principaluri']);
list(, $name) = Uri\split($row['principaluri']);
$row['displayname'] = $row['displayname'] . "($name)";
$components = [];
if ($row['components']) {
Expand Down Expand Up @@ -498,7 +499,7 @@ public function getPublicCalendar($uri) {
throw new NotFound('Node with name \'' . $uri . '\' could not be found');
}

list(, $name) = URLUtil::splitPath($row['principaluri']);
list(, $name) = Uri\split($row['principaluri']);
$row['displayname'] = $row['displayname'] . ' ' . "($name)";
$components = [];
if ($row['components']) {
Expand Down Expand Up @@ -2104,7 +2105,7 @@ protected function getCalendarObjectId($calendarId, $uri) {

private function convertPrincipal($principalUri, $toV2) {
if ($this->principalBackend->getPrincipalPrefix() === 'principals') {
list(, $name) = URLUtil::splitPath($principalUri);
list(, $name) = Uri\split($principalUri);
if ($toV2 === true) {
return "principals/users/$name";
}
Expand Down

0 comments on commit f57a3aa

Please sign in to comment.