99 '{DAV:}displayname' =>
'displayname',
100 '{urn:ietf:params:xml:ns:caldav}calendar-description' =>
'description',
101 '{urn:ietf:params:xml:ns:caldav}calendar-timezone' =>
'timezone',
102 '{http://apple.com/ns/ical/}calendar-order' =>
'calendarorder',
103 '{http://apple.com/ns/ical/}calendar-color' =>
'calendarcolor',
112 '{DAV:}displayname' =>
'displayname',
113 '{http://apple.com/ns/ical/}refreshrate' =>
'refreshrate',
114 '{http://apple.com/ns/ical/}calendar-order' =>
'calendarorder',
115 '{http://apple.com/ns/ical/}calendar-color' =>
'calendarcolor',
116 '{http://calendarserver.org/ns/}subscribed-strip-todos' =>
'striptodos',
117 '{http://calendarserver.org/ns/}subscribed-strip-alarms' =>
'stripalarms',
118 '{http://calendarserver.org/ns/}subscribed-strip-attachments' =>
'stripattachments',
158 $fields = array_values($this->propertyMap);
159 $fields[] =
'calendarid';
161 $fields[] =
'synctoken';
162 $fields[] =
'components';
163 $fields[] =
'principaluri';
164 $fields[] =
'transparent';
165 $fields[] =
'access';
168 $fields = implode(
', ', $fields);
169 $stmt = $this->pdo->prepare(<<<SQL
170 SELECT {$this->calendarInstancesTableName}.id as id, $fields FROM {$this->calendarInstancesTableName}
171 LEFT JOIN {$this->calendarTableName} ON
172 {$this->calendarInstancesTableName}.calendarid = {$this->calendarTableName}.id
173 WHERE principaluri = ? ORDER BY calendarorder ASC
176 $stmt->execute([$principalUri]);
179 while (
$row =
$stmt->fetch(\PDO::FETCH_ASSOC)) {
182 if (
$row[
'components']) {
183 $components = explode(
',',
$row[
'components']);
187 'id' => [(int)
$row[
'calendarid'], (
int)
$row[
'id']],
188 'uri' =>
$row[
'uri'],
189 'principaluri' =>
$row[
'principaluri'],
191 '{http://sabredav.org/ns}sync-token' =>
$row[
'synctoken'] ?
$row[
'synctoken'] :
'0',
192 '{' . CalDAV\
Plugin::NS_CALDAV .
'}supported-calendar-component-set' =>
new CalDAV\Xml\
Property\SupportedCalendarComponentSet($components),
194 'share-resource-uri' =>
'/ns/share/' . $row[
'calendarid'],
197 $calendar[
'share-access'] = (int)$row[
'access'];
199 if ($row[
'access'] > 1) {
206 $calendar[
'read-only'] = (int)$row[
'access'] === \
Sabre\DAV\Sharing\Plugin::ACCESS_READ;
209 foreach ($this->propertyMap as $xmlName => $dbName) {
241 ':principaluri' => $principalUri,
242 ':uri' => $calendarUri,
247 $sccs =
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
248 if (!isset($properties[$sccs])) {
250 $components =
'VEVENT,VTODO';
252 if (!($properties[$sccs] instanceof CalDAV\Xml\
Property\SupportedCalendarComponentSet)) {
253 throw new DAV\Exception(
'The ' . $sccs .
' property must be of type: \Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet');
255 $components = implode(
',', $properties[$sccs]->getValue());
258 if (isset($properties[$transp])) {
259 $values[
':transparent'] = $properties[$transp]->getValue() ===
'transparent' ? 1 : 0;
261 $stmt = $this->pdo->prepare(
"INSERT INTO " . $this->calendarTableName .
" (synctoken, components) VALUES (1, ?)");
262 $stmt->execute([$components]);
264 $calendarId = $this->pdo->lastInsertId(
265 $this->calendarTableName .
'_id_seq' 268 $values[
':calendarid'] = $calendarId;
270 foreach ($this->propertyMap as $xmlName => $dbName) {
271 if (isset($properties[$xmlName])) {
273 $values[
':' . $dbName] = $properties[$xmlName];
274 $fieldNames[] = $dbName;
278 $stmt = $this->pdo->prepare(
"INSERT INTO " . $this->calendarInstancesTableName .
" (" . implode(
', ', $fieldNames) .
") VALUES (" . implode(
', ', array_keys(
$values)) .
")");
284 $this->pdo->lastInsertId($this->calendarInstancesTableName .
'_id_seq')
307 if (!is_array($calendarId)) {
308 throw new \InvalidArgumentException(
'The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
310 list($calendarId, $instanceId) = $calendarId;
312 $supportedProperties = array_keys($this->propertyMap);
315 $propPatch->handle($supportedProperties,
function($mutations) use ($calendarId, $instanceId) {
317 foreach ($mutations as $propertyName => $propertyValue) {
319 switch ($propertyName) {
321 $fieldName =
'transparent';
322 $newValues[$fieldName] = $propertyValue->getValue() ===
'transparent';
325 $fieldName = $this->propertyMap[$propertyName];
326 $newValues[$fieldName] = $propertyValue;
332 foreach ($newValues as $fieldName => $value) {
333 $valuesSql[] = $fieldName .
' = ?';
336 $stmt = $this->pdo->prepare(
"UPDATE " . $this->calendarInstancesTableName .
" SET " . implode(
', ', $valuesSql) .
" WHERE id = ?");
337 $newValues[
'id'] = $instanceId;
338 $stmt->execute(array_values($newValues));
356 if (!is_array($calendarId)) {
357 throw new \InvalidArgumentException(
'The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
359 list($calendarId, $instanceId) = $calendarId;
361 $stmt = $this->pdo->prepare(
'SELECT access FROM ' . $this->calendarInstancesTableName .
' where id = ?');
362 $stmt->execute([$instanceId]);
363 $access = (int)
$stmt->fetchColumn();
365 if ($access === \
Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER) {
371 $stmt = $this->pdo->prepare(
'DELETE FROM ' . $this->calendarObjectTableName .
' WHERE calendarid = ?');
372 $stmt->execute([$calendarId]);
374 $stmt = $this->pdo->prepare(
'DELETE FROM ' . $this->calendarChangesTableName .
' WHERE calendarid = ?');
375 $stmt->execute([$calendarId]);
377 $stmt = $this->pdo->prepare(
'DELETE FROM ' . $this->calendarInstancesTableName .
' WHERE calendarid = ?');
378 $stmt->execute([$calendarId]);
380 $stmt = $this->pdo->prepare(
'DELETE FROM ' . $this->calendarTableName .
' WHERE id = ?');
381 $stmt->execute([$calendarId]);
389 $stmt = $this->pdo->prepare(
'DELETE FROM ' . $this->calendarInstancesTableName .
' WHERE id = ?');
390 $stmt->execute([$instanceId]);
430 if (!is_array($calendarId)) {
431 throw new \InvalidArgumentException(
'The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
433 list($calendarId, $instanceId) = $calendarId;
435 $stmt = $this->pdo->prepare(
'SELECT id, uri, lastmodified, etag, calendarid, size, componenttype FROM ' . $this->calendarObjectTableName .
' WHERE calendarid = ?');
436 $stmt->execute([$calendarId]);
439 foreach (
$stmt->fetchAll(\PDO::FETCH_ASSOC) as
$row) {
442 'uri' =>
$row[
'uri'],
443 'lastmodified' => (int)
$row[
'lastmodified'],
444 'etag' =>
'"' .
$row[
'etag'] .
'"',
445 'size' => (
int)
$row[
'size'],
446 'component' => strtolower(
$row[
'componenttype']),
472 if (!is_array($calendarId)) {
473 throw new \InvalidArgumentException(
'The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
475 list($calendarId, $instanceId) = $calendarId;
477 $stmt = $this->pdo->prepare(
'SELECT id, uri, lastmodified, etag, calendarid, size, calendardata, componenttype FROM ' . $this->calendarObjectTableName .
' WHERE calendarid = ? AND uri = ?');
478 $stmt->execute([$calendarId, $objectUri]);
481 if (!
$row)
return null;
485 'uri' =>
$row[
'uri'],
486 'lastmodified' => (int)
$row[
'lastmodified'],
487 'etag' =>
'"' .
$row[
'etag'] .
'"',
488 'size' => (
int)
$row[
'size'],
489 'calendardata' =>
$row[
'calendardata'],
490 'component' => strtolower(
$row[
'componenttype']),
509 if (!is_array($calendarId)) {
510 throw new \InvalidArgumentException(
'The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
512 list($calendarId, $instanceId) = $calendarId;
515 foreach (array_chunk($uris, 900) as $chunk) {
516 $query =
'SELECT id, uri, lastmodified, etag, calendarid, size, calendardata, componenttype FROM ' . $this->calendarObjectTableName .
' WHERE calendarid = ? AND uri IN (';
518 $query .= implode(
',', array_fill(0, count($chunk),
'?'));
522 $stmt->execute(array_merge([$calendarId], $chunk));
524 while (
$row =
$stmt->fetch(\PDO::FETCH_ASSOC)) {
528 'uri' =>
$row[
'uri'],
529 'lastmodified' => (int)
$row[
'lastmodified'],
530 'etag' =>
'"' .
$row[
'etag'] .
'"',
531 'size' => (
int)
$row[
'size'],
532 'calendardata' =>
$row[
'calendardata'],
533 'component' => strtolower(
$row[
'componenttype']),
563 if (!is_array($calendarId)) {
564 throw new \InvalidArgumentException(
'The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
566 list($calendarId, $instanceId) = $calendarId;
570 $stmt = $this->pdo->prepare(
'INSERT INTO ' . $this->calendarObjectTableName .
' (calendarid, uri, calendardata, lastmodified, etag, size, componenttype, firstoccurence, lastoccurence, uid) VALUES (?,?,?,?,?,?,?,?,?,?)');
578 $extraData[
'componentType'],
579 $extraData[
'firstOccurence'],
580 $extraData[
'lastOccurence'],
583 $this->
addChange($calendarId, $objectUri, 1);
585 return '"' . $extraData[
'etag'] .
'"';
609 if (!is_array($calendarId)) {
610 throw new \InvalidArgumentException(
'The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
612 list($calendarId, $instanceId) = $calendarId;
616 $stmt = $this->pdo->prepare(
'UPDATE ' . $this->calendarObjectTableName .
' SET calendardata = ?, lastmodified = ?, etag = ?, size = ?, componenttype = ?, firstoccurence = ?, lastoccurence = ?, uid = ? WHERE calendarid = ? AND uri = ?');
617 $stmt->execute([$calendarData, time(), $extraData[
'etag'], $extraData[
'size'], $extraData[
'componentType'], $extraData[
'firstOccurence'], $extraData[
'lastOccurence'], $extraData[
'uid'], $calendarId, $objectUri]);
619 $this->
addChange($calendarId, $objectUri, 2);
621 return '"' . $extraData[
'etag'] .
'"';
643 $componentType = null;
645 $firstOccurence = null;
646 $lastOccurence = null;
648 foreach ($vObject->getComponents() as $component) {
649 if ($component->name !==
'VTIMEZONE') {
650 $componentType = $component->name;
651 $uid = (string)$component->UID;
655 if (!$componentType) {
656 throw new \Sabre\DAV\Exception\BadRequest(
'Calendar objects must have a VJOURNAL, VEVENT or VTODO component');
658 if ($componentType ===
'VEVENT') {
659 $firstOccurence = $component->DTSTART->getDateTime()->getTimeStamp();
661 if (!isset($component->RRULE)) {
662 if (isset($component->DTEND)) {
663 $lastOccurence = $component->DTEND->getDateTime()->getTimeStamp();
664 } elseif (isset($component->DURATION)) {
665 $endDate = clone $component->DTSTART->getDateTime();
667 $lastOccurence = $endDate->getTimeStamp();
668 } elseif (!$component->DTSTART->hasTime()) {
669 $endDate = clone $component->DTSTART->getDateTime();
670 $endDate = $endDate->modify(
'+1 day');
671 $lastOccurence = $endDate->getTimeStamp();
673 $lastOccurence = $firstOccurence;
677 $maxDate = new \DateTime(self::MAX_DATE);
678 if ($it->isInfinite()) {
679 $lastOccurence = $maxDate->getTimeStamp();
681 $end = $it->getDtEnd();
682 while ($it->valid() &&
$end < $maxDate) {
683 $end = $it->getDtEnd();
687 $lastOccurence =
$end->getTimeStamp();
693 if ($firstOccurence < 0) $firstOccurence = 0;
694 if ($lastOccurence < 0) $lastOccurence = 0;
701 'etag' => md5($calendarData),
702 'size' => strlen($calendarData),
703 'componentType' => $componentType,
704 'firstOccurence' => $firstOccurence,
705 'lastOccurence' => $lastOccurence,
722 if (!is_array($calendarId)) {
723 throw new \InvalidArgumentException(
'The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
725 list($calendarId, $instanceId) = $calendarId;
727 $stmt = $this->pdo->prepare(
'DELETE FROM ' . $this->calendarObjectTableName .
' WHERE calendarid = ? AND uri = ?');
728 $stmt->execute([$calendarId, $objectUri]);
730 $this->
addChange($calendarId, $objectUri, 3);
788 if (!is_array($calendarId)) {
789 throw new \InvalidArgumentException(
'The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
791 list($calendarId, $instanceId) = $calendarId;
793 $componentType = null;
794 $requirePostFilter =
true;
798 if (!$filters[
'prop-filters'] && !$filters[
'comp-filters']) {
799 $requirePostFilter =
false;
803 if (count($filters[
'comp-filters']) > 0 && !$filters[
'comp-filters'][0][
'is-not-defined']) {
804 $componentType = $filters[
'comp-filters'][0][
'name'];
807 if (!$filters[
'prop-filters'] && !$filters[
'comp-filters'][0][
'comp-filters'] && !$filters[
'comp-filters'][0][
'time-range'] && !$filters[
'comp-filters'][0][
'prop-filters']) {
808 $requirePostFilter =
false;
811 if ($componentType ==
'VEVENT' && isset($filters[
'comp-filters'][0][
'time-range'])) {
812 $timeRange = $filters[
'comp-filters'][0][
'time-range'];
816 if (!$filters[
'prop-filters'] && !$filters[
'comp-filters'][0][
'comp-filters'] && !$filters[
'comp-filters'][0][
'prop-filters'] && (!$timeRange[
'start'] || !$timeRange[
'end'])) {
817 $requirePostFilter =
false;
823 if ($requirePostFilter) {
824 $query =
"SELECT uri, calendardata FROM " . $this->calendarObjectTableName .
" WHERE calendarid = :calendarid";
826 $query =
"SELECT uri FROM " . $this->calendarObjectTableName .
" WHERE calendarid = :calendarid";
830 'calendarid' => $calendarId,
833 if ($componentType) {
834 $query .=
" AND componenttype = :componenttype";
835 $values[
'componenttype'] = $componentType;
838 if ($timeRange && $timeRange[
'start']) {
839 $query .=
" AND lastoccurence > :startdate";
840 $values[
'startdate'] = $timeRange[
'start']->getTimeStamp();
842 if ($timeRange && $timeRange[
'end']) {
843 $query .=
" AND firstoccurence < :enddate";
844 $values[
'enddate'] = $timeRange[
'end']->getTimeStamp();
851 while (
$row =
$stmt->fetch(\PDO::FETCH_ASSOC)) {
852 if ($requirePostFilter) {
888 calendar_instances.uri AS calendaruri, calendarobjects.uri as objecturi
890 $this->calendarObjectTableName AS calendarobjects
892 $this->calendarInstancesTableName AS calendar_instances
893 ON calendarobjects.calendarid = calendar_instances.calendarid
895 calendar_instances.principaluri = ?
897 calendarobjects.uid = ?
901 $stmt->execute([$principalUri, $uid]);
903 if (
$row =
$stmt->fetch(\PDO::FETCH_ASSOC)) {
904 return $row[
'calendaruri'] .
'/' .
$row[
'objecturi'];
967 if (!is_array($calendarId)) {
968 throw new \InvalidArgumentException(
'The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
970 list($calendarId, $instanceId) = $calendarId;
973 $stmt = $this->pdo->prepare(
'SELECT synctoken FROM ' . $this->calendarTableName .
' WHERE id = ?');
974 $stmt->execute([$calendarId]);
975 $currentToken =
$stmt->fetchColumn(0);
977 if (is_null($currentToken))
return null;
980 'syncToken' => $currentToken,
988 $query =
"SELECT uri, operation FROM " . $this->calendarChangesTableName .
" WHERE synctoken >= ? AND synctoken < ? AND calendarid = ? ORDER BY synctoken";
989 if ($limit > 0)
$query .=
" LIMIT " . (int)$limit;
993 $stmt->execute([$syncToken, $currentToken, $calendarId]);
999 while (
$row =
$stmt->fetch(\PDO::FETCH_ASSOC)) {
1001 $changes[
$row[
'uri']] = $row[
'operation'];
1005 foreach ($changes as $uri => $operation) {
1007 switch ($operation) {
1022 $query =
"SELECT uri FROM " . $this->calendarObjectTableName .
" WHERE calendarid = ?";
1024 $stmt->execute([$calendarId]);
1026 $result[
'added'] =
$stmt->fetchAll(\PDO::FETCH_COLUMN);
1040 protected function addChange($calendarId, $objectUri, $operation) {
1042 $stmt = $this->pdo->prepare(
'INSERT INTO ' . $this->calendarChangesTableName .
' (uri, synctoken, calendarid, operation) SELECT ?, synctoken, ?, ? FROM ' . $this->calendarTableName .
' WHERE id = ?');
1049 $stmt = $this->pdo->prepare(
'UPDATE ' . $this->calendarTableName .
' SET synctoken = synctoken + 1 WHERE id = ?');
1089 $fields = array_values($this->subscriptionPropertyMap);
1092 $fields[] =
'source';
1093 $fields[] =
'principaluri';
1094 $fields[] =
'lastmodified';
1097 $fields = implode(
', ', $fields);
1098 $stmt = $this->pdo->prepare(
"SELECT " . $fields .
" FROM " . $this->calendarSubscriptionsTableName .
" WHERE principaluri = ? ORDER BY calendarorder ASC");
1099 $stmt->execute([$principalUri]);
1101 $subscriptions = [];
1102 while (
$row =
$stmt->fetch(\PDO::FETCH_ASSOC)) {
1106 'uri' =>
$row[
'uri'],
1107 'principaluri' =>
$row[
'principaluri'],
1108 'source' =>
$row[
'source'],
1109 'lastmodified' =>
$row[
'lastmodified'],
1114 foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
1115 if (!is_null(
$row[$dbName])) {
1116 $subscription[$xmlName] =
$row[$dbName];
1120 $subscriptions[] = $subscription;
1124 return $subscriptions;
1148 if (!isset($properties[
'{http://calendarserver.org/ns/}source'])) {
1149 throw new Forbidden(
'The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
1153 ':principaluri' => $principalUri,
1155 ':source' => $properties[
'{http://calendarserver.org/ns/}source']->getHref(),
1156 ':lastmodified' => time(),
1159 foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
1160 if (isset($properties[$xmlName])) {
1162 $values[
':' . $dbName] = $properties[$xmlName];
1163 $fieldNames[] = $dbName;
1167 $stmt = $this->pdo->prepare(
"INSERT INTO " . $this->calendarSubscriptionsTableName .
" (" . implode(
', ', $fieldNames) .
") VALUES (" . implode(
', ', array_keys(
$values)) .
")");
1170 return $this->pdo->lastInsertId(
1171 $this->calendarSubscriptionsTableName .
'_id_seq' 1194 $supportedProperties = array_keys($this->subscriptionPropertyMap);
1195 $supportedProperties[] =
'{http://calendarserver.org/ns/}source';
1197 $propPatch->handle($supportedProperties,
function($mutations) use ($subscriptionId) {
1201 foreach ($mutations as $propertyName => $propertyValue) {
1203 if ($propertyName ===
'{http://calendarserver.org/ns/}source') {
1204 $newValues[
'source'] = $propertyValue->getHref();
1206 $fieldName = $this->subscriptionPropertyMap[$propertyName];
1207 $newValues[$fieldName] = $propertyValue;
1214 foreach ($newValues as $fieldName => $value) {
1215 $valuesSql[] = $fieldName .
' = ?';
1218 $stmt = $this->pdo->prepare(
"UPDATE " . $this->calendarSubscriptionsTableName .
" SET " . implode(
', ', $valuesSql) .
", lastmodified = ? WHERE id = ?");
1219 $newValues[
'lastmodified'] = time();
1220 $newValues[
'id'] = $subscriptionId;
1221 $stmt->execute(array_values($newValues));
1237 $stmt = $this->pdo->prepare(
'DELETE FROM ' . $this->calendarSubscriptionsTableName .
' WHERE id = ?');
1238 $stmt->execute([$subscriptionId]);
1260 $stmt = $this->pdo->prepare(
'SELECT uri, calendardata, lastmodified, etag, size FROM ' . $this->schedulingObjectTableName .
' WHERE principaluri = ? AND uri = ?');
1261 $stmt->execute([$principalUri, $objectUri]);
1264 if (!
$row)
return null;
1267 'uri' =>
$row[
'uri'],
1268 'calendardata' =>
$row[
'calendardata'],
1269 'lastmodified' =>
$row[
'lastmodified'],
1270 'etag' =>
'"' .
$row[
'etag'] .
'"',
1271 'size' => (int)
$row[
'size'],
1289 $stmt = $this->pdo->prepare(
'SELECT id, calendardata, uri, lastmodified, etag, size FROM ' . $this->schedulingObjectTableName .
' WHERE principaluri = ?');
1290 $stmt->execute([$principalUri]);
1293 foreach (
$stmt->fetchAll(\PDO::FETCH_ASSOC) as
$row) {
1295 'calendardata' =>
$row[
'calendardata'],
1296 'uri' =>
$row[
'uri'],
1297 'lastmodified' =>
$row[
'lastmodified'],
1298 'etag' =>
'"' .
$row[
'etag'] .
'"',
1299 'size' => (int)
$row[
'size'],
1316 $stmt = $this->pdo->prepare(
'DELETE FROM ' . $this->schedulingObjectTableName .
' WHERE principaluri = ? AND uri = ?');
1317 $stmt->execute([$principalUri, $objectUri]);
1331 $stmt = $this->pdo->prepare(
'INSERT INTO ' . $this->schedulingObjectTableName .
' (principaluri, calendardata, uri, lastmodified, etag, size) VALUES (?, ?, ?, ?, ?, ?)');
1332 $stmt->execute([$principalUri, $objectData, $objectUri, time(), md5($objectData), strlen($objectData)]);
1345 if (!is_array($calendarId)) {
1346 throw new \InvalidArgumentException(
'The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
1348 $currentInvites = $this->
getInvites($calendarId);
1349 list($calendarId, $instanceId) = $calendarId;
1351 $removeStmt = $this->pdo->prepare(
"DELETE FROM " . $this->calendarInstancesTableName .
" WHERE calendarid = ? AND share_href = ? AND access IN (2,3)");
1352 $updateStmt = $this->pdo->prepare(
"UPDATE " . $this->calendarInstancesTableName .
" SET access = ?, share_displayname = ?, share_invitestatus = ? WHERE calendarid = ? AND share_href = ?");
1354 $insertStmt = $this->pdo->prepare(
' 1355 INSERT INTO ' . $this->calendarInstancesTableName .
' 1385 FROM ' . $this->calendarInstancesTableName .
' WHERE id = ?');
1387 foreach ($sharees as $sharee) {
1389 if ($sharee->access === \
Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS) {
1392 $removeStmt->execute([$calendarId, $sharee->href]);
1396 if (is_null($sharee->principal)) {
1406 foreach ($currentInvites as $oldSharee) {
1408 if ($oldSharee->href === $sharee->href) {
1410 $sharee->properties = array_merge(
1411 $oldSharee->properties,
1414 $updateStmt->execute([
1416 isset($sharee->properties[
'{DAV:}displayname']) ? $sharee->properties[
'{DAV:}displayname'] : null,
1417 $sharee->inviteStatus ?: $oldSharee->inviteStatus,
1426 $insertStmt->execute([
1432 isset($sharee->properties[
'{DAV:}displayname']) ? $sharee->properties[
'{DAV:}displayname'] : null,
1433 $sharee->inviteStatus ?: \
Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE,
1458 if (!is_array($calendarId)) {
1459 throw new \InvalidArgumentException(
'The value passed to getInvites() is expected to be an array with a calendarId and an instanceId');
1461 list($calendarId, $instanceId) = $calendarId;
1470 FROM {$this->calendarInstancesTableName}
1476 $stmt->execute([$calendarId]);
1479 while (
$row =
$stmt->fetch(\PDO::FETCH_ASSOC)) {
1483 'access' => (
int)
$row[
'access'],
1485 'inviteStatus' => (
int)$row[
'share_invitestatus'],
1487 !empty($row[
'share_displayname'])
1488 ? [
'{DAV:}displayname' => $row[
'share_displayname']]
1490 'principal' => $row[
'principaluri'],
1507 throw new DAV\Exception\NotImplemented(
'Not implemented');
getSchedulingObjects($principalUri)
Returns all scheduling objects for the inbox collection.
This class represents the {DAV:}sharee element.
getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit=null)
The getChanges method returns all the changes that have happened, since the specified syncToken in th...
getSubscriptionsForUser($principalUri)
Returns a list of subscriptions for a principal.
static parse($date, $referenceTz=null)
Parses either a Date or DateTime, or Duration value.
Adds support for sharing features to a CalDAV server.
updateCalendarObject($calendarId, $objectUri, $calendarData)
Updates an existing calendarobject, based on it's uri.
updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch)
Updates properties for a calendar.
This class represents a set of properties that are going to be updated.
encodePath($path)
Encodes the path of a url.
deleteSubscription($subscriptionId)
Deletes a subscription.
getInvites($calendarId)
Returns the list of people whom a calendar is shared with.
SupportedCalendarComponentSet property.
deleteCalendarObject($calendarId, $objectUri)
Deletes an existing calendar object.
$calendarSubscriptionsTableName
updateInvites($calendarId, array $sharees)
Updates the list of shares.
createSchedulingObject($principalUri, $objectUri, $objectData)
Creates a new scheduling object.
getMultipleCalendarObjects($calendarId, array $uris)
Returns a list of calendar objects.
const MAX_DATE
We need to specify a max date, because we need to stop somewhere
$calendarChangesTableName
getSchedulingObject($principalUri, $objectUri)
Returns a single scheduling object.
This class is used to determine new for a recurring event, when the next events occur.
getCalendarsForUser($principalUri)
Returns a list of calendars for a principal.
setPublishStatus($calendarId, $value)
Publishes a calendar.
schedule-calendar-transp property.
const NS_CALENDARSERVER
This is the namespace for the proprietary calendarserver extensions.
Every CalDAV backend must at least implement this interface.
addChange($calendarId, $objectUri, $operation)
Adds a change record to the calendarchanges table.
updateSubscription($subscriptionId, DAV\PropPatch $propPatch)
Updates a subscription.
$schedulingObjectTableName
getDenormalizedData($calendarData)
Parses some information from calendar objects, used for optimized calendar-queries.
deleteCalendar($calendarId)
Delete a calendar and all it's objects.
calendarQuery($calendarId, array $filters)
Performs a calendar-query on the contents of this calendar.
deleteSchedulingObject($principalUri, $objectUri)
Deletes a scheduling object.
getCalendarObjects($calendarId)
Returns all calendar objects within a calendar.
WebDAV-sync support for CalDAV backends.
createCalendar($principalUri, $calendarUri, array $properties)
Creates a new calendar for a principal.
__construct(\PDO $pdo)
Creates the backend.
getCalendarObjectByUID($principalUri, $uid)
Searches through all of a users calendars and calendar objects to find an object with a specific UID...
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
createCalendarObject($calendarId, $objectUri, $calendarData)
Creates a new calendar object.
static getUUID()
Returns a pseudo-random v4 UUID.
$calendarInstancesTableName
Implementing this interface adds CalDAV Scheduling support to your caldav server, as defined in rfc66...
validateFilterForObject(array $object, array $filters)
This method validates if a filter (as passed to calendarQuery) matches the given object.
getCalendarObject($calendarId, $objectUri)
Returns information from a single calendar object, based on it's object uri.
createSubscription($principalUri, $uri, array $properties)
Creates a new subscription for a principal.
const NS_CALDAV
This is the official CalDAV namespace.
Abstract Calendaring backend.