@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * |
| 204 | 204 | * By default this excludes the automatically generated birthday calendar |
| 205 | 205 | * |
| 206 | - * @param $principalUri |
|
| 206 | + * @param string $principalUri |
|
| 207 | 207 | * @param bool $excludeBirthday |
| 208 | 208 | * @return int |
| 209 | 209 | */ |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | /** |
| 376 | - * @param $principalUri |
|
| 376 | + * @param string $principalUri |
|
| 377 | 377 | * @return array |
| 378 | 378 | */ |
| 379 | 379 | public function getUsersOwnCalendars($principalUri) { |
@@ -1081,7 +1081,7 @@ discard block |
||
| 1081 | 1081 | * calendar-data. If the result of a subsequent GET to this object is not |
| 1082 | 1082 | * the exact same as this request body, you should omit the ETag. |
| 1083 | 1083 | * |
| 1084 | - * @param mixed $calendarId |
|
| 1084 | + * @param integer $calendarId |
|
| 1085 | 1085 | * @param string $objectUri |
| 1086 | 1086 | * @param string $calendarData |
| 1087 | 1087 | * @return string |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | * calendar-data. If the result of a subsequent GET to this object is not |
| 1150 | 1150 | * the exact same as this request body, you should omit the ETag. |
| 1151 | 1151 | * |
| 1152 | - * @param mixed $calendarId |
|
| 1152 | + * @param integer $calendarId |
|
| 1153 | 1153 | * @param string $objectUri |
| 1154 | 1154 | * @param string $calendarData |
| 1155 | 1155 | * @return string |
@@ -1917,7 +1917,7 @@ discard block |
||
| 1917 | 1917 | * @param string $principalUri |
| 1918 | 1918 | * @param string $uri |
| 1919 | 1919 | * @param array $properties |
| 1920 | - * @return mixed |
|
| 1920 | + * @return integer |
|
| 1921 | 1921 | */ |
| 1922 | 1922 | function createSubscription($principalUri, $uri, array $properties) { |
| 1923 | 1923 | |
@@ -2475,7 +2475,7 @@ discard block |
||
| 2475 | 2475 | |
| 2476 | 2476 | /** |
| 2477 | 2477 | * @param $subscriptionId |
| 2478 | - * @param $objectUri |
|
| 2478 | + * @param string $objectUri |
|
| 2479 | 2479 | * @param $calendarData |
| 2480 | 2480 | * @return string |
| 2481 | 2481 | * @throws DAV\Exception\BadRequest |
@@ -2553,7 +2553,7 @@ discard block |
||
| 2553 | 2553 | * return legacy endpoint principal name to new principal name |
| 2554 | 2554 | * |
| 2555 | 2555 | * @param $principalUri |
| 2556 | - * @param $toV2 |
|
| 2556 | + * @param boolean $toV2 |
|
| 2557 | 2557 | * @return string |
| 2558 | 2558 | */ |
| 2559 | 2559 | private function convertPrincipal($principalUri, $toV2) { |
@@ -73,2517 +73,2517 @@ |
||
| 73 | 73 | */ |
| 74 | 74 | class CalDavBackend extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport { |
| 75 | 75 | |
| 76 | - const PERSONAL_CALENDAR_URI = 'personal'; |
|
| 77 | - const PERSONAL_CALENDAR_NAME = 'Personal'; |
|
| 78 | - |
|
| 79 | - const RESOURCE_BOOKING_CALENDAR_URI = 'calendar'; |
|
| 80 | - const RESOURCE_BOOKING_CALENDAR_NAME = 'Calendar'; |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * We need to specify a max date, because we need to stop *somewhere* |
|
| 84 | - * |
|
| 85 | - * On 32 bit system the maximum for a signed integer is 2147483647, so |
|
| 86 | - * MAX_DATE cannot be higher than date('Y-m-d', 2147483647) which results |
|
| 87 | - * in 2038-01-19 to avoid problems when the date is converted |
|
| 88 | - * to a unix timestamp. |
|
| 89 | - */ |
|
| 90 | - const MAX_DATE = '2038-01-01'; |
|
| 91 | - |
|
| 92 | - const ACCESS_PUBLIC = 4; |
|
| 93 | - const CLASSIFICATION_PUBLIC = 0; |
|
| 94 | - const CLASSIFICATION_PRIVATE = 1; |
|
| 95 | - const CLASSIFICATION_CONFIDENTIAL = 2; |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * List of CalDAV properties, and how they map to database field names |
|
| 99 | - * Add your own properties by simply adding on to this array. |
|
| 100 | - * |
|
| 101 | - * Note that only string-based properties are supported here. |
|
| 102 | - * |
|
| 103 | - * @var array |
|
| 104 | - */ |
|
| 105 | - public $propertyMap = [ |
|
| 106 | - '{DAV:}displayname' => 'displayname', |
|
| 107 | - '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description', |
|
| 108 | - '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone', |
|
| 109 | - '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder', |
|
| 110 | - '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor', |
|
| 111 | - ]; |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * List of subscription properties, and how they map to database field names. |
|
| 115 | - * |
|
| 116 | - * @var array |
|
| 117 | - */ |
|
| 118 | - public $subscriptionPropertyMap = [ |
|
| 119 | - '{DAV:}displayname' => 'displayname', |
|
| 120 | - '{http://apple.com/ns/ical/}refreshrate' => 'refreshrate', |
|
| 121 | - '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder', |
|
| 122 | - '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor', |
|
| 123 | - '{http://calendarserver.org/ns/}subscribed-strip-todos' => 'striptodos', |
|
| 124 | - '{http://calendarserver.org/ns/}subscribed-strip-alarms' => 'stripalarms', |
|
| 125 | - '{http://calendarserver.org/ns/}subscribed-strip-attachments' => 'stripattachments', |
|
| 126 | - ]; |
|
| 127 | - |
|
| 128 | - /** @var array properties to index */ |
|
| 129 | - public static $indexProperties = ['CATEGORIES', 'COMMENT', 'DESCRIPTION', |
|
| 130 | - 'LOCATION', 'RESOURCES', 'STATUS', 'SUMMARY', 'ATTENDEE', 'CONTACT', |
|
| 131 | - 'ORGANIZER']; |
|
| 132 | - |
|
| 133 | - /** @var array parameters to index */ |
|
| 134 | - public static $indexParameters = [ |
|
| 135 | - 'ATTENDEE' => ['CN'], |
|
| 136 | - 'ORGANIZER' => ['CN'], |
|
| 137 | - ]; |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * @var string[] Map of uid => display name |
|
| 141 | - */ |
|
| 142 | - protected $userDisplayNames; |
|
| 143 | - |
|
| 144 | - /** @var IDBConnection */ |
|
| 145 | - private $db; |
|
| 146 | - |
|
| 147 | - /** @var Backend */ |
|
| 148 | - private $sharingBackend; |
|
| 149 | - |
|
| 150 | - /** @var Principal */ |
|
| 151 | - private $principalBackend; |
|
| 152 | - |
|
| 153 | - /** @var IUserManager */ |
|
| 154 | - private $userManager; |
|
| 155 | - |
|
| 156 | - /** @var ISecureRandom */ |
|
| 157 | - private $random; |
|
| 158 | - |
|
| 159 | - /** @var ILogger */ |
|
| 160 | - private $logger; |
|
| 161 | - |
|
| 162 | - /** @var EventDispatcherInterface */ |
|
| 163 | - private $dispatcher; |
|
| 164 | - |
|
| 165 | - /** @var bool */ |
|
| 166 | - private $legacyEndpoint; |
|
| 167 | - |
|
| 168 | - /** @var string */ |
|
| 169 | - private $dbObjectPropertiesTable = 'calendarobjects_props'; |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * CalDavBackend constructor. |
|
| 173 | - * |
|
| 174 | - * @param IDBConnection $db |
|
| 175 | - * @param Principal $principalBackend |
|
| 176 | - * @param IUserManager $userManager |
|
| 177 | - * @param IGroupManager $groupManager |
|
| 178 | - * @param ISecureRandom $random |
|
| 179 | - * @param ILogger $logger |
|
| 180 | - * @param EventDispatcherInterface $dispatcher |
|
| 181 | - * @param bool $legacyEndpoint |
|
| 182 | - */ |
|
| 183 | - public function __construct(IDBConnection $db, |
|
| 184 | - Principal $principalBackend, |
|
| 185 | - IUserManager $userManager, |
|
| 186 | - IGroupManager $groupManager, |
|
| 187 | - ISecureRandom $random, |
|
| 188 | - ILogger $logger, |
|
| 189 | - EventDispatcherInterface $dispatcher, |
|
| 190 | - $legacyEndpoint = false) { |
|
| 191 | - $this->db = $db; |
|
| 192 | - $this->principalBackend = $principalBackend; |
|
| 193 | - $this->userManager = $userManager; |
|
| 194 | - $this->sharingBackend = new Backend($this->db, $this->userManager, $groupManager, $principalBackend, 'calendar'); |
|
| 195 | - $this->random = $random; |
|
| 196 | - $this->logger = $logger; |
|
| 197 | - $this->dispatcher = $dispatcher; |
|
| 198 | - $this->legacyEndpoint = $legacyEndpoint; |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - /** |
|
| 202 | - * Return the number of calendars for a principal |
|
| 203 | - * |
|
| 204 | - * By default this excludes the automatically generated birthday calendar |
|
| 205 | - * |
|
| 206 | - * @param $principalUri |
|
| 207 | - * @param bool $excludeBirthday |
|
| 208 | - * @return int |
|
| 209 | - */ |
|
| 210 | - public function getCalendarsForUserCount($principalUri, $excludeBirthday = true) { |
|
| 211 | - $principalUri = $this->convertPrincipal($principalUri, true); |
|
| 212 | - $query = $this->db->getQueryBuilder(); |
|
| 213 | - $query->select($query->createFunction('COUNT(*)')) |
|
| 214 | - ->from('calendars') |
|
| 215 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); |
|
| 216 | - |
|
| 217 | - if ($excludeBirthday) { |
|
| 218 | - $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - return (int)$query->execute()->fetchColumn(); |
|
| 222 | - } |
|
| 223 | - |
|
| 224 | - /** |
|
| 225 | - * Returns a list of calendars for a principal. |
|
| 226 | - * |
|
| 227 | - * Every project is an array with the following keys: |
|
| 228 | - * * id, a unique id that will be used by other functions to modify the |
|
| 229 | - * calendar. This can be the same as the uri or a database key. |
|
| 230 | - * * uri, which the basename of the uri with which the calendar is |
|
| 231 | - * accessed. |
|
| 232 | - * * principaluri. The owner of the calendar. Almost always the same as |
|
| 233 | - * principalUri passed to this method. |
|
| 234 | - * |
|
| 235 | - * Furthermore it can contain webdav properties in clark notation. A very |
|
| 236 | - * common one is '{DAV:}displayname'. |
|
| 237 | - * |
|
| 238 | - * Many clients also require: |
|
| 239 | - * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set |
|
| 240 | - * For this property, you can just return an instance of |
|
| 241 | - * Sabre\CalDAV\Property\SupportedCalendarComponentSet. |
|
| 242 | - * |
|
| 243 | - * If you return {http://sabredav.org/ns}read-only and set the value to 1, |
|
| 244 | - * ACL will automatically be put in read-only mode. |
|
| 245 | - * |
|
| 246 | - * @param string $principalUri |
|
| 247 | - * @return array |
|
| 248 | - */ |
|
| 249 | - function getCalendarsForUser($principalUri) { |
|
| 250 | - $principalUriOriginal = $principalUri; |
|
| 251 | - $principalUri = $this->convertPrincipal($principalUri, true); |
|
| 252 | - $fields = array_values($this->propertyMap); |
|
| 253 | - $fields[] = 'id'; |
|
| 254 | - $fields[] = 'uri'; |
|
| 255 | - $fields[] = 'synctoken'; |
|
| 256 | - $fields[] = 'components'; |
|
| 257 | - $fields[] = 'principaluri'; |
|
| 258 | - $fields[] = 'transparent'; |
|
| 259 | - |
|
| 260 | - // Making fields a comma-delimited list |
|
| 261 | - $query = $this->db->getQueryBuilder(); |
|
| 262 | - $query->select($fields)->from('calendars') |
|
| 263 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 264 | - ->orderBy('calendarorder', 'ASC'); |
|
| 265 | - $stmt = $query->execute(); |
|
| 266 | - |
|
| 267 | - $calendars = []; |
|
| 268 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 269 | - |
|
| 270 | - $components = []; |
|
| 271 | - if ($row['components']) { |
|
| 272 | - $components = explode(',',$row['components']); |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - $calendar = [ |
|
| 276 | - 'id' => $row['id'], |
|
| 277 | - 'uri' => $row['uri'], |
|
| 278 | - 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 279 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 280 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 281 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 282 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 283 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 284 | - ]; |
|
| 285 | - |
|
| 286 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 287 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 288 | - } |
|
| 289 | - |
|
| 290 | - $this->addOwnerPrincipal($calendar); |
|
| 291 | - |
|
| 292 | - if (!isset($calendars[$calendar['id']])) { |
|
| 293 | - $calendars[$calendar['id']] = $calendar; |
|
| 294 | - } |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - $stmt->closeCursor(); |
|
| 298 | - |
|
| 299 | - // query for shared calendars |
|
| 300 | - $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); |
|
| 301 | - $principals = array_map(function($principal) { |
|
| 302 | - return urldecode($principal); |
|
| 303 | - }, $principals); |
|
| 304 | - $principals[]= $principalUri; |
|
| 305 | - |
|
| 306 | - $fields = array_values($this->propertyMap); |
|
| 307 | - $fields[] = 'a.id'; |
|
| 308 | - $fields[] = 'a.uri'; |
|
| 309 | - $fields[] = 'a.synctoken'; |
|
| 310 | - $fields[] = 'a.components'; |
|
| 311 | - $fields[] = 'a.principaluri'; |
|
| 312 | - $fields[] = 'a.transparent'; |
|
| 313 | - $fields[] = 's.access'; |
|
| 314 | - $query = $this->db->getQueryBuilder(); |
|
| 315 | - $result = $query->select($fields) |
|
| 316 | - ->from('dav_shares', 's') |
|
| 317 | - ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) |
|
| 318 | - ->where($query->expr()->in('s.principaluri', $query->createParameter('principaluri'))) |
|
| 319 | - ->andWhere($query->expr()->eq('s.type', $query->createParameter('type'))) |
|
| 320 | - ->setParameter('type', 'calendar') |
|
| 321 | - ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) |
|
| 322 | - ->execute(); |
|
| 323 | - |
|
| 324 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 325 | - while($row = $result->fetch()) { |
|
| 326 | - if ($row['principaluri'] === $principalUri) { |
|
| 327 | - continue; |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - $readOnly = (int) $row['access'] === Backend::ACCESS_READ; |
|
| 331 | - if (isset($calendars[$row['id']])) { |
|
| 332 | - if ($readOnly) { |
|
| 333 | - // New share can not have more permissions then the old one. |
|
| 334 | - continue; |
|
| 335 | - } |
|
| 336 | - if (isset($calendars[$row['id']][$readOnlyPropertyName]) && |
|
| 337 | - $calendars[$row['id']][$readOnlyPropertyName] === 0) { |
|
| 338 | - // Old share is already read-write, no more permissions can be gained |
|
| 339 | - continue; |
|
| 340 | - } |
|
| 341 | - } |
|
| 342 | - |
|
| 343 | - list(, $name) = Uri\split($row['principaluri']); |
|
| 344 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 345 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
| 346 | - $components = []; |
|
| 347 | - if ($row['components']) { |
|
| 348 | - $components = explode(',',$row['components']); |
|
| 349 | - } |
|
| 350 | - $calendar = [ |
|
| 351 | - 'id' => $row['id'], |
|
| 352 | - 'uri' => $uri, |
|
| 353 | - 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 354 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 355 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 356 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 357 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 358 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 359 | - $readOnlyPropertyName => $readOnly, |
|
| 360 | - ]; |
|
| 361 | - |
|
| 362 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 363 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 364 | - } |
|
| 365 | - |
|
| 366 | - $this->addOwnerPrincipal($calendar); |
|
| 367 | - |
|
| 368 | - $calendars[$calendar['id']] = $calendar; |
|
| 369 | - } |
|
| 370 | - $result->closeCursor(); |
|
| 371 | - |
|
| 372 | - return array_values($calendars); |
|
| 373 | - } |
|
| 374 | - |
|
| 375 | - /** |
|
| 376 | - * @param $principalUri |
|
| 377 | - * @return array |
|
| 378 | - */ |
|
| 379 | - public function getUsersOwnCalendars($principalUri) { |
|
| 380 | - $principalUri = $this->convertPrincipal($principalUri, true); |
|
| 381 | - $fields = array_values($this->propertyMap); |
|
| 382 | - $fields[] = 'id'; |
|
| 383 | - $fields[] = 'uri'; |
|
| 384 | - $fields[] = 'synctoken'; |
|
| 385 | - $fields[] = 'components'; |
|
| 386 | - $fields[] = 'principaluri'; |
|
| 387 | - $fields[] = 'transparent'; |
|
| 388 | - // Making fields a comma-delimited list |
|
| 389 | - $query = $this->db->getQueryBuilder(); |
|
| 390 | - $query->select($fields)->from('calendars') |
|
| 391 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 392 | - ->orderBy('calendarorder', 'ASC'); |
|
| 393 | - $stmt = $query->execute(); |
|
| 394 | - $calendars = []; |
|
| 395 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 396 | - $components = []; |
|
| 397 | - if ($row['components']) { |
|
| 398 | - $components = explode(',',$row['components']); |
|
| 399 | - } |
|
| 400 | - $calendar = [ |
|
| 401 | - 'id' => $row['id'], |
|
| 402 | - 'uri' => $row['uri'], |
|
| 403 | - 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 404 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 405 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 406 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 407 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 408 | - ]; |
|
| 409 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 410 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 411 | - } |
|
| 412 | - |
|
| 413 | - $this->addOwnerPrincipal($calendar); |
|
| 414 | - |
|
| 415 | - if (!isset($calendars[$calendar['id']])) { |
|
| 416 | - $calendars[$calendar['id']] = $calendar; |
|
| 417 | - } |
|
| 418 | - } |
|
| 419 | - $stmt->closeCursor(); |
|
| 420 | - return array_values($calendars); |
|
| 421 | - } |
|
| 422 | - |
|
| 423 | - |
|
| 424 | - /** |
|
| 425 | - * @param $uid |
|
| 426 | - * @return string |
|
| 427 | - */ |
|
| 428 | - private function getUserDisplayName($uid) { |
|
| 429 | - if (!isset($this->userDisplayNames[$uid])) { |
|
| 430 | - $user = $this->userManager->get($uid); |
|
| 431 | - |
|
| 432 | - if ($user instanceof IUser) { |
|
| 433 | - $this->userDisplayNames[$uid] = $user->getDisplayName(); |
|
| 434 | - } else { |
|
| 435 | - $this->userDisplayNames[$uid] = $uid; |
|
| 436 | - } |
|
| 437 | - } |
|
| 438 | - |
|
| 439 | - return $this->userDisplayNames[$uid]; |
|
| 440 | - } |
|
| 76 | + const PERSONAL_CALENDAR_URI = 'personal'; |
|
| 77 | + const PERSONAL_CALENDAR_NAME = 'Personal'; |
|
| 78 | + |
|
| 79 | + const RESOURCE_BOOKING_CALENDAR_URI = 'calendar'; |
|
| 80 | + const RESOURCE_BOOKING_CALENDAR_NAME = 'Calendar'; |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * We need to specify a max date, because we need to stop *somewhere* |
|
| 84 | + * |
|
| 85 | + * On 32 bit system the maximum for a signed integer is 2147483647, so |
|
| 86 | + * MAX_DATE cannot be higher than date('Y-m-d', 2147483647) which results |
|
| 87 | + * in 2038-01-19 to avoid problems when the date is converted |
|
| 88 | + * to a unix timestamp. |
|
| 89 | + */ |
|
| 90 | + const MAX_DATE = '2038-01-01'; |
|
| 91 | + |
|
| 92 | + const ACCESS_PUBLIC = 4; |
|
| 93 | + const CLASSIFICATION_PUBLIC = 0; |
|
| 94 | + const CLASSIFICATION_PRIVATE = 1; |
|
| 95 | + const CLASSIFICATION_CONFIDENTIAL = 2; |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * List of CalDAV properties, and how they map to database field names |
|
| 99 | + * Add your own properties by simply adding on to this array. |
|
| 100 | + * |
|
| 101 | + * Note that only string-based properties are supported here. |
|
| 102 | + * |
|
| 103 | + * @var array |
|
| 104 | + */ |
|
| 105 | + public $propertyMap = [ |
|
| 106 | + '{DAV:}displayname' => 'displayname', |
|
| 107 | + '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description', |
|
| 108 | + '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone', |
|
| 109 | + '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder', |
|
| 110 | + '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor', |
|
| 111 | + ]; |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * List of subscription properties, and how they map to database field names. |
|
| 115 | + * |
|
| 116 | + * @var array |
|
| 117 | + */ |
|
| 118 | + public $subscriptionPropertyMap = [ |
|
| 119 | + '{DAV:}displayname' => 'displayname', |
|
| 120 | + '{http://apple.com/ns/ical/}refreshrate' => 'refreshrate', |
|
| 121 | + '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder', |
|
| 122 | + '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor', |
|
| 123 | + '{http://calendarserver.org/ns/}subscribed-strip-todos' => 'striptodos', |
|
| 124 | + '{http://calendarserver.org/ns/}subscribed-strip-alarms' => 'stripalarms', |
|
| 125 | + '{http://calendarserver.org/ns/}subscribed-strip-attachments' => 'stripattachments', |
|
| 126 | + ]; |
|
| 127 | + |
|
| 128 | + /** @var array properties to index */ |
|
| 129 | + public static $indexProperties = ['CATEGORIES', 'COMMENT', 'DESCRIPTION', |
|
| 130 | + 'LOCATION', 'RESOURCES', 'STATUS', 'SUMMARY', 'ATTENDEE', 'CONTACT', |
|
| 131 | + 'ORGANIZER']; |
|
| 132 | + |
|
| 133 | + /** @var array parameters to index */ |
|
| 134 | + public static $indexParameters = [ |
|
| 135 | + 'ATTENDEE' => ['CN'], |
|
| 136 | + 'ORGANIZER' => ['CN'], |
|
| 137 | + ]; |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * @var string[] Map of uid => display name |
|
| 141 | + */ |
|
| 142 | + protected $userDisplayNames; |
|
| 143 | + |
|
| 144 | + /** @var IDBConnection */ |
|
| 145 | + private $db; |
|
| 146 | + |
|
| 147 | + /** @var Backend */ |
|
| 148 | + private $sharingBackend; |
|
| 149 | + |
|
| 150 | + /** @var Principal */ |
|
| 151 | + private $principalBackend; |
|
| 152 | + |
|
| 153 | + /** @var IUserManager */ |
|
| 154 | + private $userManager; |
|
| 155 | + |
|
| 156 | + /** @var ISecureRandom */ |
|
| 157 | + private $random; |
|
| 158 | + |
|
| 159 | + /** @var ILogger */ |
|
| 160 | + private $logger; |
|
| 161 | + |
|
| 162 | + /** @var EventDispatcherInterface */ |
|
| 163 | + private $dispatcher; |
|
| 164 | + |
|
| 165 | + /** @var bool */ |
|
| 166 | + private $legacyEndpoint; |
|
| 167 | + |
|
| 168 | + /** @var string */ |
|
| 169 | + private $dbObjectPropertiesTable = 'calendarobjects_props'; |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * CalDavBackend constructor. |
|
| 173 | + * |
|
| 174 | + * @param IDBConnection $db |
|
| 175 | + * @param Principal $principalBackend |
|
| 176 | + * @param IUserManager $userManager |
|
| 177 | + * @param IGroupManager $groupManager |
|
| 178 | + * @param ISecureRandom $random |
|
| 179 | + * @param ILogger $logger |
|
| 180 | + * @param EventDispatcherInterface $dispatcher |
|
| 181 | + * @param bool $legacyEndpoint |
|
| 182 | + */ |
|
| 183 | + public function __construct(IDBConnection $db, |
|
| 184 | + Principal $principalBackend, |
|
| 185 | + IUserManager $userManager, |
|
| 186 | + IGroupManager $groupManager, |
|
| 187 | + ISecureRandom $random, |
|
| 188 | + ILogger $logger, |
|
| 189 | + EventDispatcherInterface $dispatcher, |
|
| 190 | + $legacyEndpoint = false) { |
|
| 191 | + $this->db = $db; |
|
| 192 | + $this->principalBackend = $principalBackend; |
|
| 193 | + $this->userManager = $userManager; |
|
| 194 | + $this->sharingBackend = new Backend($this->db, $this->userManager, $groupManager, $principalBackend, 'calendar'); |
|
| 195 | + $this->random = $random; |
|
| 196 | + $this->logger = $logger; |
|
| 197 | + $this->dispatcher = $dispatcher; |
|
| 198 | + $this->legacyEndpoint = $legacyEndpoint; |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + /** |
|
| 202 | + * Return the number of calendars for a principal |
|
| 203 | + * |
|
| 204 | + * By default this excludes the automatically generated birthday calendar |
|
| 205 | + * |
|
| 206 | + * @param $principalUri |
|
| 207 | + * @param bool $excludeBirthday |
|
| 208 | + * @return int |
|
| 209 | + */ |
|
| 210 | + public function getCalendarsForUserCount($principalUri, $excludeBirthday = true) { |
|
| 211 | + $principalUri = $this->convertPrincipal($principalUri, true); |
|
| 212 | + $query = $this->db->getQueryBuilder(); |
|
| 213 | + $query->select($query->createFunction('COUNT(*)')) |
|
| 214 | + ->from('calendars') |
|
| 215 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); |
|
| 216 | + |
|
| 217 | + if ($excludeBirthday) { |
|
| 218 | + $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + return (int)$query->execute()->fetchColumn(); |
|
| 222 | + } |
|
| 223 | + |
|
| 224 | + /** |
|
| 225 | + * Returns a list of calendars for a principal. |
|
| 226 | + * |
|
| 227 | + * Every project is an array with the following keys: |
|
| 228 | + * * id, a unique id that will be used by other functions to modify the |
|
| 229 | + * calendar. This can be the same as the uri or a database key. |
|
| 230 | + * * uri, which the basename of the uri with which the calendar is |
|
| 231 | + * accessed. |
|
| 232 | + * * principaluri. The owner of the calendar. Almost always the same as |
|
| 233 | + * principalUri passed to this method. |
|
| 234 | + * |
|
| 235 | + * Furthermore it can contain webdav properties in clark notation. A very |
|
| 236 | + * common one is '{DAV:}displayname'. |
|
| 237 | + * |
|
| 238 | + * Many clients also require: |
|
| 239 | + * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set |
|
| 240 | + * For this property, you can just return an instance of |
|
| 241 | + * Sabre\CalDAV\Property\SupportedCalendarComponentSet. |
|
| 242 | + * |
|
| 243 | + * If you return {http://sabredav.org/ns}read-only and set the value to 1, |
|
| 244 | + * ACL will automatically be put in read-only mode. |
|
| 245 | + * |
|
| 246 | + * @param string $principalUri |
|
| 247 | + * @return array |
|
| 248 | + */ |
|
| 249 | + function getCalendarsForUser($principalUri) { |
|
| 250 | + $principalUriOriginal = $principalUri; |
|
| 251 | + $principalUri = $this->convertPrincipal($principalUri, true); |
|
| 252 | + $fields = array_values($this->propertyMap); |
|
| 253 | + $fields[] = 'id'; |
|
| 254 | + $fields[] = 'uri'; |
|
| 255 | + $fields[] = 'synctoken'; |
|
| 256 | + $fields[] = 'components'; |
|
| 257 | + $fields[] = 'principaluri'; |
|
| 258 | + $fields[] = 'transparent'; |
|
| 259 | + |
|
| 260 | + // Making fields a comma-delimited list |
|
| 261 | + $query = $this->db->getQueryBuilder(); |
|
| 262 | + $query->select($fields)->from('calendars') |
|
| 263 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 264 | + ->orderBy('calendarorder', 'ASC'); |
|
| 265 | + $stmt = $query->execute(); |
|
| 266 | + |
|
| 267 | + $calendars = []; |
|
| 268 | + while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 269 | + |
|
| 270 | + $components = []; |
|
| 271 | + if ($row['components']) { |
|
| 272 | + $components = explode(',',$row['components']); |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + $calendar = [ |
|
| 276 | + 'id' => $row['id'], |
|
| 277 | + 'uri' => $row['uri'], |
|
| 278 | + 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 279 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 280 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 281 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 282 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 283 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 284 | + ]; |
|
| 285 | + |
|
| 286 | + foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 287 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 288 | + } |
|
| 289 | + |
|
| 290 | + $this->addOwnerPrincipal($calendar); |
|
| 291 | + |
|
| 292 | + if (!isset($calendars[$calendar['id']])) { |
|
| 293 | + $calendars[$calendar['id']] = $calendar; |
|
| 294 | + } |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + $stmt->closeCursor(); |
|
| 298 | + |
|
| 299 | + // query for shared calendars |
|
| 300 | + $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); |
|
| 301 | + $principals = array_map(function($principal) { |
|
| 302 | + return urldecode($principal); |
|
| 303 | + }, $principals); |
|
| 304 | + $principals[]= $principalUri; |
|
| 305 | + |
|
| 306 | + $fields = array_values($this->propertyMap); |
|
| 307 | + $fields[] = 'a.id'; |
|
| 308 | + $fields[] = 'a.uri'; |
|
| 309 | + $fields[] = 'a.synctoken'; |
|
| 310 | + $fields[] = 'a.components'; |
|
| 311 | + $fields[] = 'a.principaluri'; |
|
| 312 | + $fields[] = 'a.transparent'; |
|
| 313 | + $fields[] = 's.access'; |
|
| 314 | + $query = $this->db->getQueryBuilder(); |
|
| 315 | + $result = $query->select($fields) |
|
| 316 | + ->from('dav_shares', 's') |
|
| 317 | + ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) |
|
| 318 | + ->where($query->expr()->in('s.principaluri', $query->createParameter('principaluri'))) |
|
| 319 | + ->andWhere($query->expr()->eq('s.type', $query->createParameter('type'))) |
|
| 320 | + ->setParameter('type', 'calendar') |
|
| 321 | + ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) |
|
| 322 | + ->execute(); |
|
| 323 | + |
|
| 324 | + $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 325 | + while($row = $result->fetch()) { |
|
| 326 | + if ($row['principaluri'] === $principalUri) { |
|
| 327 | + continue; |
|
| 328 | + } |
|
| 329 | + |
|
| 330 | + $readOnly = (int) $row['access'] === Backend::ACCESS_READ; |
|
| 331 | + if (isset($calendars[$row['id']])) { |
|
| 332 | + if ($readOnly) { |
|
| 333 | + // New share can not have more permissions then the old one. |
|
| 334 | + continue; |
|
| 335 | + } |
|
| 336 | + if (isset($calendars[$row['id']][$readOnlyPropertyName]) && |
|
| 337 | + $calendars[$row['id']][$readOnlyPropertyName] === 0) { |
|
| 338 | + // Old share is already read-write, no more permissions can be gained |
|
| 339 | + continue; |
|
| 340 | + } |
|
| 341 | + } |
|
| 342 | + |
|
| 343 | + list(, $name) = Uri\split($row['principaluri']); |
|
| 344 | + $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 345 | + $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
| 346 | + $components = []; |
|
| 347 | + if ($row['components']) { |
|
| 348 | + $components = explode(',',$row['components']); |
|
| 349 | + } |
|
| 350 | + $calendar = [ |
|
| 351 | + 'id' => $row['id'], |
|
| 352 | + 'uri' => $uri, |
|
| 353 | + 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 354 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 355 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 356 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 357 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 358 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 359 | + $readOnlyPropertyName => $readOnly, |
|
| 360 | + ]; |
|
| 361 | + |
|
| 362 | + foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 363 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 364 | + } |
|
| 365 | + |
|
| 366 | + $this->addOwnerPrincipal($calendar); |
|
| 367 | + |
|
| 368 | + $calendars[$calendar['id']] = $calendar; |
|
| 369 | + } |
|
| 370 | + $result->closeCursor(); |
|
| 371 | + |
|
| 372 | + return array_values($calendars); |
|
| 373 | + } |
|
| 374 | + |
|
| 375 | + /** |
|
| 376 | + * @param $principalUri |
|
| 377 | + * @return array |
|
| 378 | + */ |
|
| 379 | + public function getUsersOwnCalendars($principalUri) { |
|
| 380 | + $principalUri = $this->convertPrincipal($principalUri, true); |
|
| 381 | + $fields = array_values($this->propertyMap); |
|
| 382 | + $fields[] = 'id'; |
|
| 383 | + $fields[] = 'uri'; |
|
| 384 | + $fields[] = 'synctoken'; |
|
| 385 | + $fields[] = 'components'; |
|
| 386 | + $fields[] = 'principaluri'; |
|
| 387 | + $fields[] = 'transparent'; |
|
| 388 | + // Making fields a comma-delimited list |
|
| 389 | + $query = $this->db->getQueryBuilder(); |
|
| 390 | + $query->select($fields)->from('calendars') |
|
| 391 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 392 | + ->orderBy('calendarorder', 'ASC'); |
|
| 393 | + $stmt = $query->execute(); |
|
| 394 | + $calendars = []; |
|
| 395 | + while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 396 | + $components = []; |
|
| 397 | + if ($row['components']) { |
|
| 398 | + $components = explode(',',$row['components']); |
|
| 399 | + } |
|
| 400 | + $calendar = [ |
|
| 401 | + 'id' => $row['id'], |
|
| 402 | + 'uri' => $row['uri'], |
|
| 403 | + 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 404 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 405 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 406 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 407 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 408 | + ]; |
|
| 409 | + foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 410 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 411 | + } |
|
| 412 | + |
|
| 413 | + $this->addOwnerPrincipal($calendar); |
|
| 414 | + |
|
| 415 | + if (!isset($calendars[$calendar['id']])) { |
|
| 416 | + $calendars[$calendar['id']] = $calendar; |
|
| 417 | + } |
|
| 418 | + } |
|
| 419 | + $stmt->closeCursor(); |
|
| 420 | + return array_values($calendars); |
|
| 421 | + } |
|
| 422 | + |
|
| 423 | + |
|
| 424 | + /** |
|
| 425 | + * @param $uid |
|
| 426 | + * @return string |
|
| 427 | + */ |
|
| 428 | + private function getUserDisplayName($uid) { |
|
| 429 | + if (!isset($this->userDisplayNames[$uid])) { |
|
| 430 | + $user = $this->userManager->get($uid); |
|
| 431 | + |
|
| 432 | + if ($user instanceof IUser) { |
|
| 433 | + $this->userDisplayNames[$uid] = $user->getDisplayName(); |
|
| 434 | + } else { |
|
| 435 | + $this->userDisplayNames[$uid] = $uid; |
|
| 436 | + } |
|
| 437 | + } |
|
| 438 | + |
|
| 439 | + return $this->userDisplayNames[$uid]; |
|
| 440 | + } |
|
| 441 | 441 | |
| 442 | - /** |
|
| 443 | - * @return array |
|
| 444 | - */ |
|
| 445 | - public function getPublicCalendars() { |
|
| 446 | - $fields = array_values($this->propertyMap); |
|
| 447 | - $fields[] = 'a.id'; |
|
| 448 | - $fields[] = 'a.uri'; |
|
| 449 | - $fields[] = 'a.synctoken'; |
|
| 450 | - $fields[] = 'a.components'; |
|
| 451 | - $fields[] = 'a.principaluri'; |
|
| 452 | - $fields[] = 'a.transparent'; |
|
| 453 | - $fields[] = 's.access'; |
|
| 454 | - $fields[] = 's.publicuri'; |
|
| 455 | - $calendars = []; |
|
| 456 | - $query = $this->db->getQueryBuilder(); |
|
| 457 | - $result = $query->select($fields) |
|
| 458 | - ->from('dav_shares', 's') |
|
| 459 | - ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) |
|
| 460 | - ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC))) |
|
| 461 | - ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
|
| 462 | - ->execute(); |
|
| 463 | - |
|
| 464 | - while($row = $result->fetch()) { |
|
| 465 | - list(, $name) = Uri\split($row['principaluri']); |
|
| 466 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
| 467 | - $components = []; |
|
| 468 | - if ($row['components']) { |
|
| 469 | - $components = explode(',',$row['components']); |
|
| 470 | - } |
|
| 471 | - $calendar = [ |
|
| 472 | - 'id' => $row['id'], |
|
| 473 | - 'uri' => $row['publicuri'], |
|
| 474 | - 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 475 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 476 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 477 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 478 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 479 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 480 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 481 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 482 | - ]; |
|
| 483 | - |
|
| 484 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 485 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 486 | - } |
|
| 487 | - |
|
| 488 | - $this->addOwnerPrincipal($calendar); |
|
| 489 | - |
|
| 490 | - if (!isset($calendars[$calendar['id']])) { |
|
| 491 | - $calendars[$calendar['id']] = $calendar; |
|
| 492 | - } |
|
| 493 | - } |
|
| 494 | - $result->closeCursor(); |
|
| 495 | - |
|
| 496 | - return array_values($calendars); |
|
| 497 | - } |
|
| 498 | - |
|
| 499 | - /** |
|
| 500 | - * @param string $uri |
|
| 501 | - * @return array |
|
| 502 | - * @throws NotFound |
|
| 503 | - */ |
|
| 504 | - public function getPublicCalendar($uri) { |
|
| 505 | - $fields = array_values($this->propertyMap); |
|
| 506 | - $fields[] = 'a.id'; |
|
| 507 | - $fields[] = 'a.uri'; |
|
| 508 | - $fields[] = 'a.synctoken'; |
|
| 509 | - $fields[] = 'a.components'; |
|
| 510 | - $fields[] = 'a.principaluri'; |
|
| 511 | - $fields[] = 'a.transparent'; |
|
| 512 | - $fields[] = 's.access'; |
|
| 513 | - $fields[] = 's.publicuri'; |
|
| 514 | - $query = $this->db->getQueryBuilder(); |
|
| 515 | - $result = $query->select($fields) |
|
| 516 | - ->from('dav_shares', 's') |
|
| 517 | - ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) |
|
| 518 | - ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC))) |
|
| 519 | - ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
|
| 520 | - ->andWhere($query->expr()->eq('s.publicuri', $query->createNamedParameter($uri))) |
|
| 521 | - ->execute(); |
|
| 522 | - |
|
| 523 | - $row = $result->fetch(\PDO::FETCH_ASSOC); |
|
| 524 | - |
|
| 525 | - $result->closeCursor(); |
|
| 526 | - |
|
| 527 | - if ($row === false) { |
|
| 528 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
| 529 | - } |
|
| 530 | - |
|
| 531 | - list(, $name) = Uri\split($row['principaluri']); |
|
| 532 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
| 533 | - $components = []; |
|
| 534 | - if ($row['components']) { |
|
| 535 | - $components = explode(',',$row['components']); |
|
| 536 | - } |
|
| 537 | - $calendar = [ |
|
| 538 | - 'id' => $row['id'], |
|
| 539 | - 'uri' => $row['publicuri'], |
|
| 540 | - 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 541 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 542 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 543 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 544 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 545 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 546 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 547 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 548 | - ]; |
|
| 549 | - |
|
| 550 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 551 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 552 | - } |
|
| 553 | - |
|
| 554 | - $this->addOwnerPrincipal($calendar); |
|
| 555 | - |
|
| 556 | - return $calendar; |
|
| 557 | - |
|
| 558 | - } |
|
| 559 | - |
|
| 560 | - /** |
|
| 561 | - * @param string $principal |
|
| 562 | - * @param string $uri |
|
| 563 | - * @return array|null |
|
| 564 | - */ |
|
| 565 | - public function getCalendarByUri($principal, $uri) { |
|
| 566 | - $fields = array_values($this->propertyMap); |
|
| 567 | - $fields[] = 'id'; |
|
| 568 | - $fields[] = 'uri'; |
|
| 569 | - $fields[] = 'synctoken'; |
|
| 570 | - $fields[] = 'components'; |
|
| 571 | - $fields[] = 'principaluri'; |
|
| 572 | - $fields[] = 'transparent'; |
|
| 573 | - |
|
| 574 | - // Making fields a comma-delimited list |
|
| 575 | - $query = $this->db->getQueryBuilder(); |
|
| 576 | - $query->select($fields)->from('calendars') |
|
| 577 | - ->where($query->expr()->eq('uri', $query->createNamedParameter($uri))) |
|
| 578 | - ->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($principal))) |
|
| 579 | - ->setMaxResults(1); |
|
| 580 | - $stmt = $query->execute(); |
|
| 581 | - |
|
| 582 | - $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
|
| 583 | - $stmt->closeCursor(); |
|
| 584 | - if ($row === false) { |
|
| 585 | - return null; |
|
| 586 | - } |
|
| 587 | - |
|
| 588 | - $components = []; |
|
| 589 | - if ($row['components']) { |
|
| 590 | - $components = explode(',',$row['components']); |
|
| 591 | - } |
|
| 592 | - |
|
| 593 | - $calendar = [ |
|
| 594 | - 'id' => $row['id'], |
|
| 595 | - 'uri' => $row['uri'], |
|
| 596 | - 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 597 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 598 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 599 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 600 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 601 | - ]; |
|
| 602 | - |
|
| 603 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 604 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 605 | - } |
|
| 606 | - |
|
| 607 | - $this->addOwnerPrincipal($calendar); |
|
| 608 | - |
|
| 609 | - return $calendar; |
|
| 610 | - } |
|
| 611 | - |
|
| 612 | - /** |
|
| 613 | - * @param $calendarId |
|
| 614 | - * @return array|null |
|
| 615 | - */ |
|
| 616 | - public function getCalendarById($calendarId) { |
|
| 617 | - $fields = array_values($this->propertyMap); |
|
| 618 | - $fields[] = 'id'; |
|
| 619 | - $fields[] = 'uri'; |
|
| 620 | - $fields[] = 'synctoken'; |
|
| 621 | - $fields[] = 'components'; |
|
| 622 | - $fields[] = 'principaluri'; |
|
| 623 | - $fields[] = 'transparent'; |
|
| 624 | - |
|
| 625 | - // Making fields a comma-delimited list |
|
| 626 | - $query = $this->db->getQueryBuilder(); |
|
| 627 | - $query->select($fields)->from('calendars') |
|
| 628 | - ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))) |
|
| 629 | - ->setMaxResults(1); |
|
| 630 | - $stmt = $query->execute(); |
|
| 631 | - |
|
| 632 | - $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
|
| 633 | - $stmt->closeCursor(); |
|
| 634 | - if ($row === false) { |
|
| 635 | - return null; |
|
| 636 | - } |
|
| 637 | - |
|
| 638 | - $components = []; |
|
| 639 | - if ($row['components']) { |
|
| 640 | - $components = explode(',',$row['components']); |
|
| 641 | - } |
|
| 642 | - |
|
| 643 | - $calendar = [ |
|
| 644 | - 'id' => $row['id'], |
|
| 645 | - 'uri' => $row['uri'], |
|
| 646 | - 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 647 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 648 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 649 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 650 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 651 | - ]; |
|
| 652 | - |
|
| 653 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 654 | - $calendar[$xmlName] = $row[$dbName]; |
|
| 655 | - } |
|
| 656 | - |
|
| 657 | - $this->addOwnerPrincipal($calendar); |
|
| 658 | - |
|
| 659 | - return $calendar; |
|
| 660 | - } |
|
| 661 | - |
|
| 662 | - /** |
|
| 663 | - * @param $subscriptionId |
|
| 664 | - */ |
|
| 665 | - public function getSubscriptionById($subscriptionId) { |
|
| 666 | - $fields = array_values($this->subscriptionPropertyMap); |
|
| 667 | - $fields[] = 'id'; |
|
| 668 | - $fields[] = 'uri'; |
|
| 669 | - $fields[] = 'source'; |
|
| 670 | - $fields[] = 'principaluri'; |
|
| 671 | - $fields[] = 'lastmodified'; |
|
| 672 | - |
|
| 673 | - $query = $this->db->getQueryBuilder(); |
|
| 674 | - $query->select($fields) |
|
| 675 | - ->from('calendarsubscriptions') |
|
| 676 | - ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
|
| 677 | - ->orderBy('calendarorder', 'asc'); |
|
| 678 | - $stmt =$query->execute(); |
|
| 679 | - |
|
| 680 | - $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
|
| 681 | - $stmt->closeCursor(); |
|
| 682 | - if ($row === false) { |
|
| 683 | - return null; |
|
| 684 | - } |
|
| 685 | - |
|
| 686 | - $subscription = [ |
|
| 687 | - 'id' => $row['id'], |
|
| 688 | - 'uri' => $row['uri'], |
|
| 689 | - 'principaluri' => $row['principaluri'], |
|
| 690 | - 'source' => $row['source'], |
|
| 691 | - 'lastmodified' => $row['lastmodified'], |
|
| 692 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 693 | - ]; |
|
| 694 | - |
|
| 695 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 696 | - if (!is_null($row[$dbName])) { |
|
| 697 | - $subscription[$xmlName] = $row[$dbName]; |
|
| 698 | - } |
|
| 699 | - } |
|
| 700 | - |
|
| 701 | - return $subscription; |
|
| 702 | - } |
|
| 703 | - |
|
| 704 | - /** |
|
| 705 | - * Creates a new calendar for a principal. |
|
| 706 | - * |
|
| 707 | - * If the creation was a success, an id must be returned that can be used to reference |
|
| 708 | - * this calendar in other methods, such as updateCalendar. |
|
| 709 | - * |
|
| 710 | - * @param string $principalUri |
|
| 711 | - * @param string $calendarUri |
|
| 712 | - * @param array $properties |
|
| 713 | - * @return int |
|
| 714 | - * @suppress SqlInjectionChecker |
|
| 715 | - */ |
|
| 716 | - function createCalendar($principalUri, $calendarUri, array $properties) { |
|
| 717 | - $values = [ |
|
| 718 | - 'principaluri' => $this->convertPrincipal($principalUri, true), |
|
| 719 | - 'uri' => $calendarUri, |
|
| 720 | - 'synctoken' => 1, |
|
| 721 | - 'transparent' => 0, |
|
| 722 | - 'components' => 'VEVENT,VTODO', |
|
| 723 | - 'displayname' => $calendarUri |
|
| 724 | - ]; |
|
| 725 | - |
|
| 726 | - // Default value |
|
| 727 | - $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
|
| 728 | - if (isset($properties[$sccs])) { |
|
| 729 | - if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
|
| 730 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 731 | - } |
|
| 732 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
| 733 | - } |
|
| 734 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 735 | - if (isset($properties[$transp])) { |
|
| 736 | - $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
|
| 737 | - } |
|
| 738 | - |
|
| 739 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 740 | - if (isset($properties[$xmlName])) { |
|
| 741 | - $values[$dbName] = $properties[$xmlName]; |
|
| 742 | - } |
|
| 743 | - } |
|
| 744 | - |
|
| 745 | - $query = $this->db->getQueryBuilder(); |
|
| 746 | - $query->insert('calendars'); |
|
| 747 | - foreach($values as $column => $value) { |
|
| 748 | - $query->setValue($column, $query->createNamedParameter($value)); |
|
| 749 | - } |
|
| 750 | - $query->execute(); |
|
| 751 | - $calendarId = $query->getLastInsertId(); |
|
| 752 | - |
|
| 753 | - $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent( |
|
| 754 | - '\OCA\DAV\CalDAV\CalDavBackend::createCalendar', |
|
| 755 | - [ |
|
| 756 | - 'calendarId' => $calendarId, |
|
| 757 | - 'calendarData' => $this->getCalendarById($calendarId), |
|
| 758 | - ])); |
|
| 759 | - |
|
| 760 | - return $calendarId; |
|
| 761 | - } |
|
| 762 | - |
|
| 763 | - /** |
|
| 764 | - * Updates properties for a calendar. |
|
| 765 | - * |
|
| 766 | - * The list of mutations is stored in a Sabre\DAV\PropPatch object. |
|
| 767 | - * To do the actual updates, you must tell this object which properties |
|
| 768 | - * you're going to process with the handle() method. |
|
| 769 | - * |
|
| 770 | - * Calling the handle method is like telling the PropPatch object "I |
|
| 771 | - * promise I can handle updating this property". |
|
| 772 | - * |
|
| 773 | - * Read the PropPatch documentation for more info and examples. |
|
| 774 | - * |
|
| 775 | - * @param mixed $calendarId |
|
| 776 | - * @param PropPatch $propPatch |
|
| 777 | - * @return void |
|
| 778 | - */ |
|
| 779 | - function updateCalendar($calendarId, PropPatch $propPatch) { |
|
| 780 | - $supportedProperties = array_keys($this->propertyMap); |
|
| 781 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 782 | - |
|
| 783 | - /** |
|
| 784 | - * @suppress SqlInjectionChecker |
|
| 785 | - */ |
|
| 786 | - $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { |
|
| 787 | - $newValues = []; |
|
| 788 | - foreach ($mutations as $propertyName => $propertyValue) { |
|
| 789 | - |
|
| 790 | - switch ($propertyName) { |
|
| 791 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' : |
|
| 792 | - $fieldName = 'transparent'; |
|
| 793 | - $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
|
| 794 | - break; |
|
| 795 | - default : |
|
| 796 | - $fieldName = $this->propertyMap[$propertyName]; |
|
| 797 | - $newValues[$fieldName] = $propertyValue; |
|
| 798 | - break; |
|
| 799 | - } |
|
| 800 | - |
|
| 801 | - } |
|
| 802 | - $query = $this->db->getQueryBuilder(); |
|
| 803 | - $query->update('calendars'); |
|
| 804 | - foreach ($newValues as $fieldName => $value) { |
|
| 805 | - $query->set($fieldName, $query->createNamedParameter($value)); |
|
| 806 | - } |
|
| 807 | - $query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
|
| 808 | - $query->execute(); |
|
| 809 | - |
|
| 810 | - $this->addChange($calendarId, "", 2); |
|
| 811 | - |
|
| 812 | - $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent( |
|
| 813 | - '\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', |
|
| 814 | - [ |
|
| 815 | - 'calendarId' => $calendarId, |
|
| 816 | - 'calendarData' => $this->getCalendarById($calendarId), |
|
| 817 | - 'shares' => $this->getShares($calendarId), |
|
| 818 | - 'propertyMutations' => $mutations, |
|
| 819 | - ])); |
|
| 820 | - |
|
| 821 | - return true; |
|
| 822 | - }); |
|
| 823 | - } |
|
| 824 | - |
|
| 825 | - /** |
|
| 826 | - * Delete a calendar and all it's objects |
|
| 827 | - * |
|
| 828 | - * @param mixed $calendarId |
|
| 829 | - * @return void |
|
| 830 | - */ |
|
| 831 | - function deleteCalendar($calendarId) { |
|
| 832 | - $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', new GenericEvent( |
|
| 833 | - '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', |
|
| 834 | - [ |
|
| 835 | - 'calendarId' => $calendarId, |
|
| 836 | - 'calendarData' => $this->getCalendarById($calendarId), |
|
| 837 | - 'shares' => $this->getShares($calendarId), |
|
| 838 | - ])); |
|
| 839 | - |
|
| 840 | - $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ?'); |
|
| 841 | - $stmt->execute([$calendarId]); |
|
| 842 | - |
|
| 843 | - $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendars` WHERE `id` = ?'); |
|
| 844 | - $stmt->execute([$calendarId]); |
|
| 845 | - |
|
| 846 | - $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarchanges` WHERE `calendarid` = ?'); |
|
| 847 | - $stmt->execute([$calendarId]); |
|
| 848 | - |
|
| 849 | - $this->sharingBackend->deleteAllShares($calendarId); |
|
| 850 | - |
|
| 851 | - $query = $this->db->getQueryBuilder(); |
|
| 852 | - $query->delete($this->dbObjectPropertiesTable) |
|
| 853 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 854 | - ->execute(); |
|
| 855 | - } |
|
| 856 | - |
|
| 857 | - /** |
|
| 858 | - * Delete all of an user's shares |
|
| 859 | - * |
|
| 860 | - * @param string $principaluri |
|
| 861 | - * @return void |
|
| 862 | - */ |
|
| 863 | - function deleteAllSharesByUser($principaluri) { |
|
| 864 | - $this->sharingBackend->deleteAllSharesByUser($principaluri); |
|
| 865 | - } |
|
| 866 | - |
|
| 867 | - /** |
|
| 868 | - * Returns all calendar objects within a calendar. |
|
| 869 | - * |
|
| 870 | - * Every item contains an array with the following keys: |
|
| 871 | - * * calendardata - The iCalendar-compatible calendar data |
|
| 872 | - * * uri - a unique key which will be used to construct the uri. This can |
|
| 873 | - * be any arbitrary string, but making sure it ends with '.ics' is a |
|
| 874 | - * good idea. This is only the basename, or filename, not the full |
|
| 875 | - * path. |
|
| 876 | - * * lastmodified - a timestamp of the last modification time |
|
| 877 | - * * etag - An arbitrary string, surrounded by double-quotes. (e.g.: |
|
| 878 | - * '"abcdef"') |
|
| 879 | - * * size - The size of the calendar objects, in bytes. |
|
| 880 | - * * component - optional, a string containing the type of object, such |
|
| 881 | - * as 'vevent' or 'vtodo'. If specified, this will be used to populate |
|
| 882 | - * the Content-Type header. |
|
| 883 | - * |
|
| 884 | - * Note that the etag is optional, but it's highly encouraged to return for |
|
| 885 | - * speed reasons. |
|
| 886 | - * |
|
| 887 | - * The calendardata is also optional. If it's not returned |
|
| 888 | - * 'getCalendarObject' will be called later, which *is* expected to return |
|
| 889 | - * calendardata. |
|
| 890 | - * |
|
| 891 | - * If neither etag or size are specified, the calendardata will be |
|
| 892 | - * used/fetched to determine these numbers. If both are specified the |
|
| 893 | - * amount of times this is needed is reduced by a great degree. |
|
| 894 | - * |
|
| 895 | - * @param mixed $calendarId |
|
| 896 | - * @return array |
|
| 897 | - */ |
|
| 898 | - function getCalendarObjects($calendarId):array { |
|
| 899 | - return $this->commonGetCalendarObjects('calendarobjects', 'calendarid', $calendarId); |
|
| 900 | - } |
|
| 901 | - |
|
| 902 | - /** |
|
| 903 | - * @param mixed $subscriptionId |
|
| 904 | - * @return array |
|
| 905 | - */ |
|
| 906 | - public function getCachedCalendarObjects($subscriptionId):array { |
|
| 907 | - return $this->commonGetCalendarObjects('calendarsubscrobjects', 'subscriptionid', $subscriptionId); |
|
| 908 | - } |
|
| 909 | - |
|
| 910 | - /** |
|
| 911 | - * @param string $tablename |
|
| 912 | - * @param string $selector |
|
| 913 | - * @param mixed $id |
|
| 914 | - * @return array |
|
| 915 | - */ |
|
| 916 | - private function commonGetCalendarObjects(string $tablename, string $selector, $id):array { |
|
| 917 | - $query = $this->db->getQueryBuilder(); |
|
| 918 | - $query->select(['id', 'uri', 'lastmodified', 'etag', $selector, 'size', 'componenttype', 'classification']) |
|
| 919 | - ->from($tablename) |
|
| 920 | - ->where($query->expr()->eq($selector, $query->createNamedParameter($id))); |
|
| 921 | - $stmt = $query->execute(); |
|
| 922 | - |
|
| 923 | - $result = []; |
|
| 924 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 925 | - $result[] = [ |
|
| 926 | - 'id' => $row['id'], |
|
| 927 | - 'uri' => $row['uri'], |
|
| 928 | - 'lastmodified' => $row['lastmodified'], |
|
| 929 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 930 | - 'calendarid' => $row[$selector], |
|
| 931 | - 'size' => (int)$row['size'], |
|
| 932 | - 'component' => strtolower($row['componenttype']), |
|
| 933 | - 'classification'=> (int)$row['classification'] |
|
| 934 | - ]; |
|
| 935 | - } |
|
| 936 | - |
|
| 937 | - return $result; |
|
| 938 | - } |
|
| 939 | - |
|
| 940 | - /** |
|
| 941 | - * Returns information from a single calendar object, based on it's object |
|
| 942 | - * uri. |
|
| 943 | - * |
|
| 944 | - * The object uri is only the basename, or filename and not a full path. |
|
| 945 | - * |
|
| 946 | - * The returned array must have the same keys as getCalendarObjects. The |
|
| 947 | - * 'calendardata' object is required here though, while it's not required |
|
| 948 | - * for getCalendarObjects. |
|
| 949 | - * |
|
| 950 | - * This method must return null if the object did not exist. |
|
| 951 | - * |
|
| 952 | - * @param mixed $calendarId |
|
| 953 | - * @param string $objectUri |
|
| 954 | - * @return array|null |
|
| 955 | - */ |
|
| 956 | - function getCalendarObject($calendarId, $objectUri) { |
|
| 957 | - return $this->commonGetCalendarObject('calendarobjects', 'calendarid', $calendarId, $objectUri); |
|
| 958 | - } |
|
| 959 | - |
|
| 960 | - /** |
|
| 961 | - * @param $subscriptionId |
|
| 962 | - * @param $objectUri |
|
| 963 | - * @return array |
|
| 964 | - */ |
|
| 965 | - public function getCachedCalendarObject($subscriptionId, $objectUri) { |
|
| 966 | - return $this->commonGetCalendarObject('calendarsubscrobjects', 'subscriptionid', $subscriptionId, $objectUri); |
|
| 967 | - } |
|
| 968 | - |
|
| 969 | - /** |
|
| 970 | - * @param string $tablename |
|
| 971 | - * @param string $selector |
|
| 972 | - * @param $id |
|
| 973 | - * @param $objectUri |
|
| 974 | - * @return array |
|
| 975 | - */ |
|
| 976 | - private function commonGetCalendarObject(string $tablename, string $selector, $id, $objectUri):array { |
|
| 977 | - $query = $this->db->getQueryBuilder(); |
|
| 978 | - $query->select(['id', 'uri', 'lastmodified', 'etag', $selector, 'size', 'calendardata', 'componenttype', 'classification']) |
|
| 979 | - ->from($tablename) |
|
| 980 | - ->where($query->expr()->eq($selector, $query->createNamedParameter($id))) |
|
| 981 | - ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))); |
|
| 982 | - $stmt = $query->execute(); |
|
| 983 | - $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
|
| 984 | - |
|
| 985 | - if(!$row) { |
|
| 986 | - return null; |
|
| 987 | - } |
|
| 988 | - |
|
| 989 | - return [ |
|
| 990 | - 'id' => $row['id'], |
|
| 991 | - 'uri' => $row['uri'], |
|
| 992 | - 'lastmodified' => $row['lastmodified'], |
|
| 993 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 994 | - 'calendarid' => $row[$selector], |
|
| 995 | - 'size' => (int)$row['size'], |
|
| 996 | - 'calendardata' => $this->readBlob($row['calendardata']), |
|
| 997 | - 'component' => strtolower($row['componenttype']), |
|
| 998 | - 'classification'=> (int)$row['classification'] |
|
| 999 | - ]; |
|
| 1000 | - } |
|
| 1001 | - |
|
| 1002 | - /** |
|
| 1003 | - * Returns a list of calendar objects. |
|
| 1004 | - * |
|
| 1005 | - * This method should work identical to getCalendarObject, but instead |
|
| 1006 | - * return all the calendar objects in the list as an array. |
|
| 1007 | - * |
|
| 1008 | - * If the backend supports this, it may allow for some speed-ups. |
|
| 1009 | - * |
|
| 1010 | - * @param mixed $calendarId |
|
| 1011 | - * @param string[] $uris |
|
| 1012 | - * @return array |
|
| 1013 | - */ |
|
| 1014 | - function getMultipleCalendarObjects($calendarId, array $uris) { |
|
| 1015 | - return $this->commonGetMultipleCachedCalendarObjects('calendarobjects', 'calendarid', $calendarId, $uris); |
|
| 1016 | - } |
|
| 1017 | - |
|
| 1018 | - /** |
|
| 1019 | - * @param $subscripionId |
|
| 1020 | - * @param array $uris |
|
| 1021 | - * @return array |
|
| 1022 | - */ |
|
| 1023 | - function getMultipleCachedCalendarObjects($subscripionId, array $uris) { |
|
| 1024 | - return $this->commonGetMultipleCachedCalendarObjects('calendarsubscrobjects', 'subscriptionid', $subscripionId, $uris); |
|
| 1025 | - } |
|
| 1026 | - |
|
| 1027 | - /** |
|
| 1028 | - * @param string $tablename |
|
| 1029 | - * @param string $selector |
|
| 1030 | - * @param $id |
|
| 1031 | - * @param array $uris |
|
| 1032 | - * @return array |
|
| 1033 | - */ |
|
| 1034 | - private function commonGetMultipleCachedCalendarObjects(string $tablename, string $selector, $id, array $uris) { |
|
| 1035 | - if (empty($uris)) { |
|
| 1036 | - return []; |
|
| 1037 | - } |
|
| 1038 | - |
|
| 1039 | - $chunks = array_chunk($uris, 100); |
|
| 1040 | - $objects = []; |
|
| 1041 | - |
|
| 1042 | - $query = $this->db->getQueryBuilder(); |
|
| 1043 | - $query->select(['id', 'uri', 'lastmodified', 'etag', $selector, 'size', 'calendardata', 'componenttype', 'classification']) |
|
| 1044 | - ->from($tablename) |
|
| 1045 | - ->where($query->expr()->eq($selector, $query->createNamedParameter($id))) |
|
| 1046 | - ->andWhere($query->expr()->in('uri', $query->createParameter('uri'))); |
|
| 1047 | - |
|
| 1048 | - foreach ($chunks as $uris) { |
|
| 1049 | - $query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY); |
|
| 1050 | - $result = $query->execute(); |
|
| 1051 | - |
|
| 1052 | - while ($row = $result->fetch()) { |
|
| 1053 | - $objects[] = [ |
|
| 1054 | - 'id' => $row['id'], |
|
| 1055 | - 'uri' => $row['uri'], |
|
| 1056 | - 'lastmodified' => $row['lastmodified'], |
|
| 1057 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1058 | - 'calendarid' => $row[$selector], |
|
| 1059 | - 'size' => (int)$row['size'], |
|
| 1060 | - 'calendardata' => $this->readBlob($row['calendardata']), |
|
| 1061 | - 'component' => strtolower($row['componenttype']), |
|
| 1062 | - 'classification' => (int)$row['classification'] |
|
| 1063 | - ]; |
|
| 1064 | - } |
|
| 1065 | - $result->closeCursor(); |
|
| 1066 | - } |
|
| 1067 | - |
|
| 1068 | - return $objects; |
|
| 1069 | - } |
|
| 1070 | - |
|
| 1071 | - /** |
|
| 1072 | - * Creates a new calendar object. |
|
| 1073 | - * |
|
| 1074 | - * The object uri is only the basename, or filename and not a full path. |
|
| 1075 | - * |
|
| 1076 | - * It is possible return an etag from this function, which will be used in |
|
| 1077 | - * the response to this PUT request. Note that the ETag must be surrounded |
|
| 1078 | - * by double-quotes. |
|
| 1079 | - * |
|
| 1080 | - * However, you should only really return this ETag if you don't mangle the |
|
| 1081 | - * calendar-data. If the result of a subsequent GET to this object is not |
|
| 1082 | - * the exact same as this request body, you should omit the ETag. |
|
| 1083 | - * |
|
| 1084 | - * @param mixed $calendarId |
|
| 1085 | - * @param string $objectUri |
|
| 1086 | - * @param string $calendarData |
|
| 1087 | - * @return string |
|
| 1088 | - */ |
|
| 1089 | - function createCalendarObject($calendarId, $objectUri, $calendarData) { |
|
| 1090 | - $extraData = $this->getDenormalizedData($calendarData); |
|
| 1091 | - |
|
| 1092 | - $q = $this->db->getQueryBuilder(); |
|
| 1093 | - $q->select($q->createFunction('COUNT(*)')) |
|
| 1094 | - ->from('calendarobjects') |
|
| 1095 | - ->where($q->expr()->eq('calendarid', $q->createNamedParameter($calendarId))) |
|
| 1096 | - ->andWhere($q->expr()->eq('uid', $q->createNamedParameter($extraData['uid']))); |
|
| 1097 | - |
|
| 1098 | - $result = $q->execute(); |
|
| 1099 | - $count = (int) $result->fetchColumn(); |
|
| 1100 | - $result->closeCursor(); |
|
| 1101 | - |
|
| 1102 | - if ($count !== 0) { |
|
| 1103 | - throw new \Sabre\DAV\Exception\BadRequest('Calendar object with uid already exists in this calendar collection.'); |
|
| 1104 | - } |
|
| 1105 | - |
|
| 1106 | - $query = $this->db->getQueryBuilder(); |
|
| 1107 | - $query->insert('calendarobjects') |
|
| 1108 | - ->values([ |
|
| 1109 | - 'calendarid' => $query->createNamedParameter($calendarId), |
|
| 1110 | - 'uri' => $query->createNamedParameter($objectUri), |
|
| 1111 | - 'calendardata' => $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB), |
|
| 1112 | - 'lastmodified' => $query->createNamedParameter(time()), |
|
| 1113 | - 'etag' => $query->createNamedParameter($extraData['etag']), |
|
| 1114 | - 'size' => $query->createNamedParameter($extraData['size']), |
|
| 1115 | - 'componenttype' => $query->createNamedParameter($extraData['componentType']), |
|
| 1116 | - 'firstoccurence' => $query->createNamedParameter($extraData['firstOccurence']), |
|
| 1117 | - 'lastoccurence' => $query->createNamedParameter($extraData['lastOccurence']), |
|
| 1118 | - 'classification' => $query->createNamedParameter($extraData['classification']), |
|
| 1119 | - 'uid' => $query->createNamedParameter($extraData['uid']), |
|
| 1120 | - ]) |
|
| 1121 | - ->execute(); |
|
| 1122 | - |
|
| 1123 | - $this->updateProperties($calendarId, $objectUri, $calendarData); |
|
| 1124 | - |
|
| 1125 | - $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent( |
|
| 1126 | - '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', |
|
| 1127 | - [ |
|
| 1128 | - 'calendarId' => $calendarId, |
|
| 1129 | - 'calendarData' => $this->getCalendarById($calendarId), |
|
| 1130 | - 'shares' => $this->getShares($calendarId), |
|
| 1131 | - 'objectData' => $this->getCalendarObject($calendarId, $objectUri), |
|
| 1132 | - ] |
|
| 1133 | - )); |
|
| 1134 | - $this->addChange($calendarId, $objectUri, 1); |
|
| 1135 | - |
|
| 1136 | - return '"' . $extraData['etag'] . '"'; |
|
| 1137 | - } |
|
| 1138 | - |
|
| 1139 | - /** |
|
| 1140 | - * Updates an existing calendarobject, based on it's uri. |
|
| 1141 | - * |
|
| 1142 | - * The object uri is only the basename, or filename and not a full path. |
|
| 1143 | - * |
|
| 1144 | - * It is possible return an etag from this function, which will be used in |
|
| 1145 | - * the response to this PUT request. Note that the ETag must be surrounded |
|
| 1146 | - * by double-quotes. |
|
| 1147 | - * |
|
| 1148 | - * However, you should only really return this ETag if you don't mangle the |
|
| 1149 | - * calendar-data. If the result of a subsequent GET to this object is not |
|
| 1150 | - * the exact same as this request body, you should omit the ETag. |
|
| 1151 | - * |
|
| 1152 | - * @param mixed $calendarId |
|
| 1153 | - * @param string $objectUri |
|
| 1154 | - * @param string $calendarData |
|
| 1155 | - * @return string |
|
| 1156 | - */ |
|
| 1157 | - function updateCalendarObject($calendarId, $objectUri, $calendarData) { |
|
| 1158 | - $extraData = $this->getDenormalizedData($calendarData); |
|
| 1159 | - |
|
| 1160 | - $query = $this->db->getQueryBuilder(); |
|
| 1161 | - $query->update('calendarobjects') |
|
| 1162 | - ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) |
|
| 1163 | - ->set('lastmodified', $query->createNamedParameter(time())) |
|
| 1164 | - ->set('etag', $query->createNamedParameter($extraData['etag'])) |
|
| 1165 | - ->set('size', $query->createNamedParameter($extraData['size'])) |
|
| 1166 | - ->set('componenttype', $query->createNamedParameter($extraData['componentType'])) |
|
| 1167 | - ->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence'])) |
|
| 1168 | - ->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence'])) |
|
| 1169 | - ->set('classification', $query->createNamedParameter($extraData['classification'])) |
|
| 1170 | - ->set('uid', $query->createNamedParameter($extraData['uid'])) |
|
| 1171 | - ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 1172 | - ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 1173 | - ->execute(); |
|
| 1174 | - |
|
| 1175 | - $this->updateProperties($calendarId, $objectUri, $calendarData); |
|
| 1176 | - |
|
| 1177 | - $data = $this->getCalendarObject($calendarId, $objectUri); |
|
| 1178 | - if (is_array($data)) { |
|
| 1179 | - $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent( |
|
| 1180 | - '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', |
|
| 1181 | - [ |
|
| 1182 | - 'calendarId' => $calendarId, |
|
| 1183 | - 'calendarData' => $this->getCalendarById($calendarId), |
|
| 1184 | - 'shares' => $this->getShares($calendarId), |
|
| 1185 | - 'objectData' => $data, |
|
| 1186 | - ] |
|
| 1187 | - )); |
|
| 1188 | - } |
|
| 1189 | - $this->addChange($calendarId, $objectUri, 2); |
|
| 1190 | - |
|
| 1191 | - return '"' . $extraData['etag'] . '"'; |
|
| 1192 | - } |
|
| 1193 | - |
|
| 1194 | - /** |
|
| 1195 | - * @param int $calendarObjectId |
|
| 1196 | - * @param int $classification |
|
| 1197 | - */ |
|
| 1198 | - public function setClassification($calendarObjectId, $classification) { |
|
| 1199 | - if (!in_array($classification, [ |
|
| 1200 | - self::CLASSIFICATION_PUBLIC, self::CLASSIFICATION_PRIVATE, self::CLASSIFICATION_CONFIDENTIAL |
|
| 1201 | - ])) { |
|
| 1202 | - throw new \InvalidArgumentException(); |
|
| 1203 | - } |
|
| 1204 | - $query = $this->db->getQueryBuilder(); |
|
| 1205 | - $query->update('calendarobjects') |
|
| 1206 | - ->set('classification', $query->createNamedParameter($classification)) |
|
| 1207 | - ->where($query->expr()->eq('id', $query->createNamedParameter($calendarObjectId))) |
|
| 1208 | - ->execute(); |
|
| 1209 | - } |
|
| 1210 | - |
|
| 1211 | - /** |
|
| 1212 | - * Deletes an existing calendar object. |
|
| 1213 | - * |
|
| 1214 | - * The object uri is only the basename, or filename and not a full path. |
|
| 1215 | - * |
|
| 1216 | - * @param mixed $calendarId |
|
| 1217 | - * @param string $objectUri |
|
| 1218 | - * @return void |
|
| 1219 | - */ |
|
| 1220 | - function deleteCalendarObject($calendarId, $objectUri) { |
|
| 1221 | - $data = $this->getCalendarObject($calendarId, $objectUri); |
|
| 1222 | - if (is_array($data)) { |
|
| 1223 | - $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent( |
|
| 1224 | - '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', |
|
| 1225 | - [ |
|
| 1226 | - 'calendarId' => $calendarId, |
|
| 1227 | - 'calendarData' => $this->getCalendarById($calendarId), |
|
| 1228 | - 'shares' => $this->getShares($calendarId), |
|
| 1229 | - 'objectData' => $data, |
|
| 1230 | - ] |
|
| 1231 | - )); |
|
| 1232 | - } |
|
| 1233 | - |
|
| 1234 | - $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `uri` = ?'); |
|
| 1235 | - $stmt->execute([$calendarId, $objectUri]); |
|
| 1236 | - |
|
| 1237 | - $this->purgeProperties($calendarId, $data['id']); |
|
| 1238 | - |
|
| 1239 | - $this->addChange($calendarId, $objectUri, 3); |
|
| 1240 | - } |
|
| 1241 | - |
|
| 1242 | - /** |
|
| 1243 | - * Performs a calendar-query on the contents of this calendar. |
|
| 1244 | - * |
|
| 1245 | - * The calendar-query is defined in RFC4791 : CalDAV. Using the |
|
| 1246 | - * calendar-query it is possible for a client to request a specific set of |
|
| 1247 | - * object, based on contents of iCalendar properties, date-ranges and |
|
| 1248 | - * iCalendar component types (VTODO, VEVENT). |
|
| 1249 | - * |
|
| 1250 | - * This method should just return a list of (relative) urls that match this |
|
| 1251 | - * query. |
|
| 1252 | - * |
|
| 1253 | - * The list of filters are specified as an array. The exact array is |
|
| 1254 | - * documented by Sabre\CalDAV\CalendarQueryParser. |
|
| 1255 | - * |
|
| 1256 | - * Note that it is extremely likely that getCalendarObject for every path |
|
| 1257 | - * returned from this method will be called almost immediately after. You |
|
| 1258 | - * may want to anticipate this to speed up these requests. |
|
| 1259 | - * |
|
| 1260 | - * This method provides a default implementation, which parses *all* the |
|
| 1261 | - * iCalendar objects in the specified calendar. |
|
| 1262 | - * |
|
| 1263 | - * This default may well be good enough for personal use, and calendars |
|
| 1264 | - * that aren't very large. But if you anticipate high usage, big calendars |
|
| 1265 | - * or high loads, you are strongly advised to optimize certain paths. |
|
| 1266 | - * |
|
| 1267 | - * The best way to do so is override this method and to optimize |
|
| 1268 | - * specifically for 'common filters'. |
|
| 1269 | - * |
|
| 1270 | - * Requests that are extremely common are: |
|
| 1271 | - * * requests for just VEVENTS |
|
| 1272 | - * * requests for just VTODO |
|
| 1273 | - * * requests with a time-range-filter on either VEVENT or VTODO. |
|
| 1274 | - * |
|
| 1275 | - * ..and combinations of these requests. It may not be worth it to try to |
|
| 1276 | - * handle every possible situation and just rely on the (relatively |
|
| 1277 | - * easy to use) CalendarQueryValidator to handle the rest. |
|
| 1278 | - * |
|
| 1279 | - * Note that especially time-range-filters may be difficult to parse. A |
|
| 1280 | - * time-range filter specified on a VEVENT must for instance also handle |
|
| 1281 | - * recurrence rules correctly. |
|
| 1282 | - * A good example of how to interprete all these filters can also simply |
|
| 1283 | - * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct |
|
| 1284 | - * as possible, so it gives you a good idea on what type of stuff you need |
|
| 1285 | - * to think of. |
|
| 1286 | - * |
|
| 1287 | - * @param mixed $calendarId |
|
| 1288 | - * @param array $filters |
|
| 1289 | - * @return array |
|
| 1290 | - */ |
|
| 1291 | - function calendarQuery($calendarId, array $filters):array { |
|
| 1292 | - return $this->commonCalendarQuery('calendarobjects', 'calendarid', $calendarId, $filters); |
|
| 1293 | - } |
|
| 1294 | - |
|
| 1295 | - /** |
|
| 1296 | - * @param $subscriptionId |
|
| 1297 | - * @param array $filters |
|
| 1298 | - * @return array |
|
| 1299 | - */ |
|
| 1300 | - public function cachedCalendarQuery($subscriptionId, array $filters):array { |
|
| 1301 | - return $this->commonCalendarQuery('calendarsubscrobjects', 'subscriptionid', $subscriptionId, $filters); |
|
| 1302 | - } |
|
| 1303 | - |
|
| 1304 | - /** |
|
| 1305 | - * @param string $tablename |
|
| 1306 | - * @param string $selector |
|
| 1307 | - * @param $id |
|
| 1308 | - * @param array $filters |
|
| 1309 | - * @return array |
|
| 1310 | - */ |
|
| 1311 | - private function commonCalendarQuery(string $tablename, string $selector, $id, array $filters) { |
|
| 1312 | - $componentType = null; |
|
| 1313 | - $requirePostFilter = true; |
|
| 1314 | - $timeRange = null; |
|
| 1315 | - |
|
| 1316 | - // if no filters were specified, we don't need to filter after a query |
|
| 1317 | - if (!$filters['prop-filters'] && !$filters['comp-filters']) { |
|
| 1318 | - $requirePostFilter = false; |
|
| 1319 | - } |
|
| 1320 | - |
|
| 1321 | - // Figuring out if there's a component filter |
|
| 1322 | - if (count($filters['comp-filters']) > 0 && !$filters['comp-filters'][0]['is-not-defined']) { |
|
| 1323 | - $componentType = $filters['comp-filters'][0]['name']; |
|
| 1324 | - |
|
| 1325 | - // Checking if we need post-filters |
|
| 1326 | - if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['time-range'] && !$filters['comp-filters'][0]['prop-filters']) { |
|
| 1327 | - $requirePostFilter = false; |
|
| 1328 | - } |
|
| 1329 | - // There was a time-range filter |
|
| 1330 | - if ($componentType === 'VEVENT' && isset($filters['comp-filters'][0]['time-range'])) { |
|
| 1331 | - $timeRange = $filters['comp-filters'][0]['time-range']; |
|
| 1332 | - |
|
| 1333 | - // If start time OR the end time is not specified, we can do a |
|
| 1334 | - // 100% accurate mysql query. |
|
| 1335 | - if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['prop-filters'] && (!$timeRange['start'] || !$timeRange['end'])) { |
|
| 1336 | - $requirePostFilter = false; |
|
| 1337 | - } |
|
| 1338 | - } |
|
| 1339 | - |
|
| 1340 | - } |
|
| 1341 | - $columns = ['uri']; |
|
| 1342 | - if ($requirePostFilter) { |
|
| 1343 | - $columns = ['uri', 'calendardata']; |
|
| 1344 | - } |
|
| 1345 | - $query = $this->db->getQueryBuilder(); |
|
| 1346 | - $query->select($columns) |
|
| 1347 | - ->from($tablename) |
|
| 1348 | - ->where($query->expr()->eq($selector, $query->createNamedParameter($id))); |
|
| 1349 | - |
|
| 1350 | - if ($componentType) { |
|
| 1351 | - $query->andWhere($query->expr()->eq('componenttype', $query->createNamedParameter($componentType))); |
|
| 1352 | - } |
|
| 1353 | - |
|
| 1354 | - if ($timeRange && $timeRange['start']) { |
|
| 1355 | - $query->andWhere($query->expr()->gt('lastoccurence', $query->createNamedParameter($timeRange['start']->getTimeStamp()))); |
|
| 1356 | - } |
|
| 1357 | - if ($timeRange && $timeRange['end']) { |
|
| 1358 | - $query->andWhere($query->expr()->lt('firstoccurence', $query->createNamedParameter($timeRange['end']->getTimeStamp()))); |
|
| 1359 | - } |
|
| 1360 | - |
|
| 1361 | - $stmt = $query->execute(); |
|
| 1362 | - |
|
| 1363 | - $result = []; |
|
| 1364 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1365 | - if ($requirePostFilter) { |
|
| 1366 | - // validateFilterForObject will parse the calendar data |
|
| 1367 | - // catch parsing errors |
|
| 1368 | - try { |
|
| 1369 | - $matches = $this->validateFilterForObject($row, $filters); |
|
| 1370 | - } catch(ParseException $ex) { |
|
| 1371 | - $this->logger->logException($ex, [ |
|
| 1372 | - 'app' => 'dav', |
|
| 1373 | - 'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri'] |
|
| 1374 | - ]); |
|
| 1375 | - continue; |
|
| 1376 | - } catch (InvalidDataException $ex) { |
|
| 1377 | - $this->logger->logException($ex, [ |
|
| 1378 | - 'app' => 'dav', |
|
| 1379 | - 'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri'] |
|
| 1380 | - ]); |
|
| 1381 | - continue; |
|
| 1382 | - } |
|
| 1383 | - |
|
| 1384 | - if (!$matches) { |
|
| 1385 | - continue; |
|
| 1386 | - } |
|
| 1387 | - } |
|
| 1388 | - $result[] = $row['uri']; |
|
| 1389 | - } |
|
| 1390 | - |
|
| 1391 | - return $result; |
|
| 1392 | - } |
|
| 1393 | - |
|
| 1394 | - /** |
|
| 1395 | - * custom Nextcloud search extension for CalDAV |
|
| 1396 | - * |
|
| 1397 | - * @param string $principalUri |
|
| 1398 | - * @param array $filters |
|
| 1399 | - * @param integer|null $limit |
|
| 1400 | - * @param integer|null $offset |
|
| 1401 | - * @return array |
|
| 1402 | - */ |
|
| 1403 | - public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) { |
|
| 1404 | - $calendars = $this->getCalendarsForUser($principalUri); |
|
| 1405 | - $ownCalendars = []; |
|
| 1406 | - $sharedCalendars = []; |
|
| 1407 | - |
|
| 1408 | - $uriMapper = []; |
|
| 1409 | - |
|
| 1410 | - foreach($calendars as $calendar) { |
|
| 1411 | - if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { |
|
| 1412 | - $ownCalendars[] = $calendar['id']; |
|
| 1413 | - } else { |
|
| 1414 | - $sharedCalendars[] = $calendar['id']; |
|
| 1415 | - } |
|
| 1416 | - $uriMapper[$calendar['id']] = $calendar['uri']; |
|
| 1417 | - } |
|
| 1418 | - if (count($ownCalendars) === 0 && count($sharedCalendars) === 0) { |
|
| 1419 | - return []; |
|
| 1420 | - } |
|
| 1421 | - |
|
| 1422 | - $query = $this->db->getQueryBuilder(); |
|
| 1423 | - // Calendar id expressions |
|
| 1424 | - $calendarExpressions = []; |
|
| 1425 | - foreach($ownCalendars as $id) { |
|
| 1426 | - $calendarExpressions[] = $query->expr() |
|
| 1427 | - ->eq('c.calendarid', $query->createNamedParameter($id)); |
|
| 1428 | - } |
|
| 1429 | - foreach($sharedCalendars as $id) { |
|
| 1430 | - $calendarExpressions[] = $query->expr()->andX( |
|
| 1431 | - $query->expr()->eq('c.calendarid', |
|
| 1432 | - $query->createNamedParameter($id)), |
|
| 1433 | - $query->expr()->eq('c.classification', |
|
| 1434 | - $query->createNamedParameter(self::CLASSIFICATION_PUBLIC)) |
|
| 1435 | - ); |
|
| 1436 | - } |
|
| 1437 | - |
|
| 1438 | - if (count($calendarExpressions) === 1) { |
|
| 1439 | - $calExpr = $calendarExpressions[0]; |
|
| 1440 | - } else { |
|
| 1441 | - $calExpr = call_user_func_array([$query->expr(), 'orX'], $calendarExpressions); |
|
| 1442 | - } |
|
| 1443 | - |
|
| 1444 | - // Component expressions |
|
| 1445 | - $compExpressions = []; |
|
| 1446 | - foreach($filters['comps'] as $comp) { |
|
| 1447 | - $compExpressions[] = $query->expr() |
|
| 1448 | - ->eq('c.componenttype', $query->createNamedParameter($comp)); |
|
| 1449 | - } |
|
| 1450 | - |
|
| 1451 | - if (count($compExpressions) === 1) { |
|
| 1452 | - $compExpr = $compExpressions[0]; |
|
| 1453 | - } else { |
|
| 1454 | - $compExpr = call_user_func_array([$query->expr(), 'orX'], $compExpressions); |
|
| 1455 | - } |
|
| 1456 | - |
|
| 1457 | - if (!isset($filters['props'])) { |
|
| 1458 | - $filters['props'] = []; |
|
| 1459 | - } |
|
| 1460 | - if (!isset($filters['params'])) { |
|
| 1461 | - $filters['params'] = []; |
|
| 1462 | - } |
|
| 1463 | - |
|
| 1464 | - $propParamExpressions = []; |
|
| 1465 | - foreach($filters['props'] as $prop) { |
|
| 1466 | - $propParamExpressions[] = $query->expr()->andX( |
|
| 1467 | - $query->expr()->eq('i.name', $query->createNamedParameter($prop)), |
|
| 1468 | - $query->expr()->isNull('i.parameter') |
|
| 1469 | - ); |
|
| 1470 | - } |
|
| 1471 | - foreach($filters['params'] as $param) { |
|
| 1472 | - $propParamExpressions[] = $query->expr()->andX( |
|
| 1473 | - $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), |
|
| 1474 | - $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) |
|
| 1475 | - ); |
|
| 1476 | - } |
|
| 1477 | - |
|
| 1478 | - if (count($propParamExpressions) === 1) { |
|
| 1479 | - $propParamExpr = $propParamExpressions[0]; |
|
| 1480 | - } else { |
|
| 1481 | - $propParamExpr = call_user_func_array([$query->expr(), 'orX'], $propParamExpressions); |
|
| 1482 | - } |
|
| 1483 | - |
|
| 1484 | - $query->select(['c.calendarid', 'c.uri']) |
|
| 1485 | - ->from($this->dbObjectPropertiesTable, 'i') |
|
| 1486 | - ->join('i', 'calendarobjects', 'c', $query->expr()->eq('i.objectid', 'c.id')) |
|
| 1487 | - ->where($calExpr) |
|
| 1488 | - ->andWhere($compExpr) |
|
| 1489 | - ->andWhere($propParamExpr) |
|
| 1490 | - ->andWhere($query->expr()->iLike('i.value', |
|
| 1491 | - $query->createNamedParameter('%'.$this->db->escapeLikeParameter($filters['search-term']).'%'))); |
|
| 1492 | - |
|
| 1493 | - if ($offset) { |
|
| 1494 | - $query->setFirstResult($offset); |
|
| 1495 | - } |
|
| 1496 | - if ($limit) { |
|
| 1497 | - $query->setMaxResults($limit); |
|
| 1498 | - } |
|
| 1499 | - |
|
| 1500 | - $stmt = $query->execute(); |
|
| 1501 | - |
|
| 1502 | - $result = []; |
|
| 1503 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1504 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
| 1505 | - if (!in_array($path, $result)) { |
|
| 1506 | - $result[] = $path; |
|
| 1507 | - } |
|
| 1508 | - } |
|
| 1509 | - |
|
| 1510 | - return $result; |
|
| 1511 | - } |
|
| 1512 | - |
|
| 1513 | - /** |
|
| 1514 | - * used for Nextcloud's calendar API |
|
| 1515 | - * |
|
| 1516 | - * @param array $calendarInfo |
|
| 1517 | - * @param string $pattern |
|
| 1518 | - * @param array $searchProperties |
|
| 1519 | - * @param array $options |
|
| 1520 | - * @param integer|null $limit |
|
| 1521 | - * @param integer|null $offset |
|
| 1522 | - * |
|
| 1523 | - * @return array |
|
| 1524 | - */ |
|
| 1525 | - public function search(array $calendarInfo, $pattern, array $searchProperties, |
|
| 1526 | - array $options, $limit, $offset) { |
|
| 1527 | - $outerQuery = $this->db->getQueryBuilder(); |
|
| 1528 | - $innerQuery = $this->db->getQueryBuilder(); |
|
| 1529 | - |
|
| 1530 | - $innerQuery->selectDistinct('op.objectid') |
|
| 1531 | - ->from($this->dbObjectPropertiesTable, 'op') |
|
| 1532 | - ->andWhere($innerQuery->expr()->eq('op.calendarid', |
|
| 1533 | - $outerQuery->createNamedParameter($calendarInfo['id']))); |
|
| 1534 | - |
|
| 1535 | - // only return public items for shared calendars for now |
|
| 1536 | - if ($calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) { |
|
| 1537 | - $innerQuery->andWhere($innerQuery->expr()->eq('c.classification', |
|
| 1538 | - $outerQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC))); |
|
| 1539 | - } |
|
| 1540 | - |
|
| 1541 | - $or = $innerQuery->expr()->orX(); |
|
| 1542 | - foreach($searchProperties as $searchProperty) { |
|
| 1543 | - $or->add($innerQuery->expr()->eq('op.name', |
|
| 1544 | - $outerQuery->createNamedParameter($searchProperty))); |
|
| 1545 | - } |
|
| 1546 | - $innerQuery->andWhere($or); |
|
| 1547 | - |
|
| 1548 | - if ($pattern !== '') { |
|
| 1549 | - $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
|
| 1550 | - $outerQuery->createNamedParameter('%' . |
|
| 1551 | - $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1552 | - } |
|
| 1553 | - |
|
| 1554 | - $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri') |
|
| 1555 | - ->from('calendarobjects', 'c'); |
|
| 1556 | - |
|
| 1557 | - if (isset($options['timerange'])) { |
|
| 1558 | - if (isset($options['timerange']['start'])) { |
|
| 1559 | - $outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence', |
|
| 1560 | - $outerQuery->createNamedParameter($options['timerange']['start']->getTimeStamp))); |
|
| 1561 | - |
|
| 1562 | - } |
|
| 1563 | - if (isset($options['timerange']['end'])) { |
|
| 1564 | - $outerQuery->andWhere($outerQuery->expr()->lt('firstoccurence', |
|
| 1565 | - $outerQuery->createNamedParameter($options['timerange']['end']->getTimeStamp))); |
|
| 1566 | - } |
|
| 1567 | - } |
|
| 1568 | - |
|
| 1569 | - if (isset($options['types'])) { |
|
| 1570 | - $or = $outerQuery->expr()->orX(); |
|
| 1571 | - foreach($options['types'] as $type) { |
|
| 1572 | - $or->add($outerQuery->expr()->eq('componenttype', |
|
| 1573 | - $outerQuery->createNamedParameter($type))); |
|
| 1574 | - } |
|
| 1575 | - $outerQuery->andWhere($or); |
|
| 1576 | - } |
|
| 1577 | - |
|
| 1578 | - $outerQuery->andWhere($outerQuery->expr()->in('c.id', |
|
| 1579 | - $outerQuery->createFunction($innerQuery->getSQL()))); |
|
| 1580 | - |
|
| 1581 | - if ($offset) { |
|
| 1582 | - $outerQuery->setFirstResult($offset); |
|
| 1583 | - } |
|
| 1584 | - if ($limit) { |
|
| 1585 | - $outerQuery->setMaxResults($limit); |
|
| 1586 | - } |
|
| 1587 | - |
|
| 1588 | - $result = $outerQuery->execute(); |
|
| 1589 | - $calendarObjects = $result->fetchAll(); |
|
| 1590 | - |
|
| 1591 | - return array_map(function($o) { |
|
| 1592 | - $calendarData = Reader::read($o['calendardata']); |
|
| 1593 | - $comps = $calendarData->getComponents(); |
|
| 1594 | - $objects = []; |
|
| 1595 | - $timezones = []; |
|
| 1596 | - foreach($comps as $comp) { |
|
| 1597 | - if ($comp instanceof VTimeZone) { |
|
| 1598 | - $timezones[] = $comp; |
|
| 1599 | - } else { |
|
| 1600 | - $objects[] = $comp; |
|
| 1601 | - } |
|
| 1602 | - } |
|
| 1603 | - |
|
| 1604 | - return [ |
|
| 1605 | - 'id' => $o['id'], |
|
| 1606 | - 'type' => $o['componenttype'], |
|
| 1607 | - 'uid' => $o['uid'], |
|
| 1608 | - 'uri' => $o['uri'], |
|
| 1609 | - 'objects' => array_map(function($c) { |
|
| 1610 | - return $this->transformSearchData($c); |
|
| 1611 | - }, $objects), |
|
| 1612 | - 'timezones' => array_map(function($c) { |
|
| 1613 | - return $this->transformSearchData($c); |
|
| 1614 | - }, $timezones), |
|
| 1615 | - ]; |
|
| 1616 | - }, $calendarObjects); |
|
| 1617 | - } |
|
| 1618 | - |
|
| 1619 | - /** |
|
| 1620 | - * @param Component $comp |
|
| 1621 | - * @return array |
|
| 1622 | - */ |
|
| 1623 | - private function transformSearchData(Component $comp) { |
|
| 1624 | - $data = []; |
|
| 1625 | - /** @var Component[] $subComponents */ |
|
| 1626 | - $subComponents = $comp->getComponents(); |
|
| 1627 | - /** @var Property[] $properties */ |
|
| 1628 | - $properties = array_filter($comp->children(), function($c) { |
|
| 1629 | - return $c instanceof Property; |
|
| 1630 | - }); |
|
| 1631 | - $validationRules = $comp->getValidationRules(); |
|
| 1632 | - |
|
| 1633 | - foreach($subComponents as $subComponent) { |
|
| 1634 | - $name = $subComponent->name; |
|
| 1635 | - if (!isset($data[$name])) { |
|
| 1636 | - $data[$name] = []; |
|
| 1637 | - } |
|
| 1638 | - $data[$name][] = $this->transformSearchData($subComponent); |
|
| 1639 | - } |
|
| 1640 | - |
|
| 1641 | - foreach($properties as $property) { |
|
| 1642 | - $name = $property->name; |
|
| 1643 | - if (!isset($validationRules[$name])) { |
|
| 1644 | - $validationRules[$name] = '*'; |
|
| 1645 | - } |
|
| 1646 | - |
|
| 1647 | - $rule = $validationRules[$property->name]; |
|
| 1648 | - if ($rule === '+' || $rule === '*') { // multiple |
|
| 1649 | - if (!isset($data[$name])) { |
|
| 1650 | - $data[$name] = []; |
|
| 1651 | - } |
|
| 1652 | - |
|
| 1653 | - $data[$name][] = $this->transformSearchProperty($property); |
|
| 1654 | - } else { // once |
|
| 1655 | - $data[$name] = $this->transformSearchProperty($property); |
|
| 1656 | - } |
|
| 1657 | - } |
|
| 1658 | - |
|
| 1659 | - return $data; |
|
| 1660 | - } |
|
| 1661 | - |
|
| 1662 | - /** |
|
| 1663 | - * @param Property $prop |
|
| 1664 | - * @return array |
|
| 1665 | - */ |
|
| 1666 | - private function transformSearchProperty(Property $prop) { |
|
| 1667 | - // No need to check Date, as it extends DateTime |
|
| 1668 | - if ($prop instanceof Property\ICalendar\DateTime) { |
|
| 1669 | - $value = $prop->getDateTime(); |
|
| 1670 | - } else { |
|
| 1671 | - $value = $prop->getValue(); |
|
| 1672 | - } |
|
| 1673 | - |
|
| 1674 | - return [ |
|
| 1675 | - $value, |
|
| 1676 | - $prop->parameters() |
|
| 1677 | - ]; |
|
| 1678 | - } |
|
| 1679 | - |
|
| 1680 | - /** |
|
| 1681 | - * Searches through all of a users calendars and calendar objects to find |
|
| 1682 | - * an object with a specific UID. |
|
| 1683 | - * |
|
| 1684 | - * This method should return the path to this object, relative to the |
|
| 1685 | - * calendar home, so this path usually only contains two parts: |
|
| 1686 | - * |
|
| 1687 | - * calendarpath/objectpath.ics |
|
| 1688 | - * |
|
| 1689 | - * If the uid is not found, return null. |
|
| 1690 | - * |
|
| 1691 | - * This method should only consider * objects that the principal owns, so |
|
| 1692 | - * any calendars owned by other principals that also appear in this |
|
| 1693 | - * collection should be ignored. |
|
| 1694 | - * |
|
| 1695 | - * @param string $principalUri |
|
| 1696 | - * @param string $uid |
|
| 1697 | - * @return string|null |
|
| 1698 | - */ |
|
| 1699 | - function getCalendarObjectByUID($principalUri, $uid) { |
|
| 1700 | - |
|
| 1701 | - $query = $this->db->getQueryBuilder(); |
|
| 1702 | - $query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi') |
|
| 1703 | - ->from('calendarobjects', 'co') |
|
| 1704 | - ->leftJoin('co', 'calendars', 'c', $query->expr()->eq('co.calendarid', 'c.id')) |
|
| 1705 | - ->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri))) |
|
| 1706 | - ->andWhere($query->expr()->eq('co.uid', $query->createNamedParameter($uid))); |
|
| 1707 | - |
|
| 1708 | - $stmt = $query->execute(); |
|
| 1709 | - |
|
| 1710 | - if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1711 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
| 1712 | - } |
|
| 1713 | - |
|
| 1714 | - return null; |
|
| 1715 | - } |
|
| 1716 | - |
|
| 1717 | - /** |
|
| 1718 | - * The getChanges method returns all the changes that have happened, since |
|
| 1719 | - * the specified syncToken in the specified calendar. |
|
| 1720 | - * |
|
| 1721 | - * This function should return an array, such as the following: |
|
| 1722 | - * |
|
| 1723 | - * [ |
|
| 1724 | - * 'syncToken' => 'The current synctoken', |
|
| 1725 | - * 'added' => [ |
|
| 1726 | - * 'new.txt', |
|
| 1727 | - * ], |
|
| 1728 | - * 'modified' => [ |
|
| 1729 | - * 'modified.txt', |
|
| 1730 | - * ], |
|
| 1731 | - * 'deleted' => [ |
|
| 1732 | - * 'foo.php.bak', |
|
| 1733 | - * 'old.txt' |
|
| 1734 | - * ] |
|
| 1735 | - * ); |
|
| 1736 | - * |
|
| 1737 | - * The returned syncToken property should reflect the *current* syncToken |
|
| 1738 | - * of the calendar, as reported in the {http://sabredav.org/ns}sync-token |
|
| 1739 | - * property This is * needed here too, to ensure the operation is atomic. |
|
| 1740 | - * |
|
| 1741 | - * If the $syncToken argument is specified as null, this is an initial |
|
| 1742 | - * sync, and all members should be reported. |
|
| 1743 | - * |
|
| 1744 | - * The modified property is an array of nodenames that have changed since |
|
| 1745 | - * the last token. |
|
| 1746 | - * |
|
| 1747 | - * The deleted property is an array with nodenames, that have been deleted |
|
| 1748 | - * from collection. |
|
| 1749 | - * |
|
| 1750 | - * The $syncLevel argument is basically the 'depth' of the report. If it's |
|
| 1751 | - * 1, you only have to report changes that happened only directly in |
|
| 1752 | - * immediate descendants. If it's 2, it should also include changes from |
|
| 1753 | - * the nodes below the child collections. (grandchildren) |
|
| 1754 | - * |
|
| 1755 | - * The $limit argument allows a client to specify how many results should |
|
| 1756 | - * be returned at most. If the limit is not specified, it should be treated |
|
| 1757 | - * as infinite. |
|
| 1758 | - * |
|
| 1759 | - * If the limit (infinite or not) is higher than you're willing to return, |
|
| 1760 | - * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. |
|
| 1761 | - * |
|
| 1762 | - * If the syncToken is expired (due to data cleanup) or unknown, you must |
|
| 1763 | - * return null. |
|
| 1764 | - * |
|
| 1765 | - * The limit is 'suggestive'. You are free to ignore it. |
|
| 1766 | - * |
|
| 1767 | - * @param string $calendarId |
|
| 1768 | - * @param string $syncToken |
|
| 1769 | - * @param int $syncLevel |
|
| 1770 | - * @param int $limit |
|
| 1771 | - * @return array |
|
| 1772 | - */ |
|
| 1773 | - function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) { |
|
| 1774 | - // Current synctoken |
|
| 1775 | - $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); |
|
| 1776 | - $stmt->execute([ $calendarId ]); |
|
| 1777 | - $currentToken = $stmt->fetchColumn(0); |
|
| 1778 | - |
|
| 1779 | - if (is_null($currentToken)) { |
|
| 1780 | - return null; |
|
| 1781 | - } |
|
| 1782 | - |
|
| 1783 | - $result = [ |
|
| 1784 | - 'syncToken' => $currentToken, |
|
| 1785 | - 'added' => [], |
|
| 1786 | - 'modified' => [], |
|
| 1787 | - 'deleted' => [], |
|
| 1788 | - ]; |
|
| 1789 | - |
|
| 1790 | - if ($syncToken) { |
|
| 1791 | - |
|
| 1792 | - $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`"; |
|
| 1793 | - if ($limit>0) { |
|
| 1794 | - $query.= " LIMIT " . (int)$limit; |
|
| 1795 | - } |
|
| 1796 | - |
|
| 1797 | - // Fetching all changes |
|
| 1798 | - $stmt = $this->db->prepare($query); |
|
| 1799 | - $stmt->execute([$syncToken, $currentToken, $calendarId]); |
|
| 1800 | - |
|
| 1801 | - $changes = []; |
|
| 1802 | - |
|
| 1803 | - // This loop ensures that any duplicates are overwritten, only the |
|
| 1804 | - // last change on a node is relevant. |
|
| 1805 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1806 | - |
|
| 1807 | - $changes[$row['uri']] = $row['operation']; |
|
| 1808 | - |
|
| 1809 | - } |
|
| 1810 | - |
|
| 1811 | - foreach($changes as $uri => $operation) { |
|
| 1812 | - |
|
| 1813 | - switch($operation) { |
|
| 1814 | - case 1 : |
|
| 1815 | - $result['added'][] = $uri; |
|
| 1816 | - break; |
|
| 1817 | - case 2 : |
|
| 1818 | - $result['modified'][] = $uri; |
|
| 1819 | - break; |
|
| 1820 | - case 3 : |
|
| 1821 | - $result['deleted'][] = $uri; |
|
| 1822 | - break; |
|
| 1823 | - } |
|
| 1824 | - |
|
| 1825 | - } |
|
| 1826 | - } else { |
|
| 1827 | - // No synctoken supplied, this is the initial sync. |
|
| 1828 | - $query = "SELECT `uri` FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ?"; |
|
| 1829 | - $stmt = $this->db->prepare($query); |
|
| 1830 | - $stmt->execute([$calendarId]); |
|
| 1831 | - |
|
| 1832 | - $result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN); |
|
| 1833 | - } |
|
| 1834 | - return $result; |
|
| 1835 | - |
|
| 1836 | - } |
|
| 1837 | - |
|
| 1838 | - /** |
|
| 1839 | - * Returns a list of subscriptions for a principal. |
|
| 1840 | - * |
|
| 1841 | - * Every subscription is an array with the following keys: |
|
| 1842 | - * * id, a unique id that will be used by other functions to modify the |
|
| 1843 | - * subscription. This can be the same as the uri or a database key. |
|
| 1844 | - * * uri. This is just the 'base uri' or 'filename' of the subscription. |
|
| 1845 | - * * principaluri. The owner of the subscription. Almost always the same as |
|
| 1846 | - * principalUri passed to this method. |
|
| 1847 | - * |
|
| 1848 | - * Furthermore, all the subscription info must be returned too: |
|
| 1849 | - * |
|
| 1850 | - * 1. {DAV:}displayname |
|
| 1851 | - * 2. {http://apple.com/ns/ical/}refreshrate |
|
| 1852 | - * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos |
|
| 1853 | - * should not be stripped). |
|
| 1854 | - * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms |
|
| 1855 | - * should not be stripped). |
|
| 1856 | - * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if |
|
| 1857 | - * attachments should not be stripped). |
|
| 1858 | - * 6. {http://calendarserver.org/ns/}source (Must be a |
|
| 1859 | - * Sabre\DAV\Property\Href). |
|
| 1860 | - * 7. {http://apple.com/ns/ical/}calendar-color |
|
| 1861 | - * 8. {http://apple.com/ns/ical/}calendar-order |
|
| 1862 | - * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set |
|
| 1863 | - * (should just be an instance of |
|
| 1864 | - * Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of |
|
| 1865 | - * default components). |
|
| 1866 | - * |
|
| 1867 | - * @param string $principalUri |
|
| 1868 | - * @return array |
|
| 1869 | - */ |
|
| 1870 | - function getSubscriptionsForUser($principalUri) { |
|
| 1871 | - $fields = array_values($this->subscriptionPropertyMap); |
|
| 1872 | - $fields[] = 'id'; |
|
| 1873 | - $fields[] = 'uri'; |
|
| 1874 | - $fields[] = 'source'; |
|
| 1875 | - $fields[] = 'principaluri'; |
|
| 1876 | - $fields[] = 'lastmodified'; |
|
| 1877 | - |
|
| 1878 | - $query = $this->db->getQueryBuilder(); |
|
| 1879 | - $query->select($fields) |
|
| 1880 | - ->from('calendarsubscriptions') |
|
| 1881 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 1882 | - ->orderBy('calendarorder', 'asc'); |
|
| 1883 | - $stmt =$query->execute(); |
|
| 1884 | - |
|
| 1885 | - $subscriptions = []; |
|
| 1886 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1887 | - |
|
| 1888 | - $subscription = [ |
|
| 1889 | - 'id' => $row['id'], |
|
| 1890 | - 'uri' => $row['uri'], |
|
| 1891 | - 'principaluri' => $row['principaluri'], |
|
| 1892 | - 'source' => $row['source'], |
|
| 1893 | - 'lastmodified' => $row['lastmodified'], |
|
| 1894 | - |
|
| 1895 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 1896 | - ]; |
|
| 1897 | - |
|
| 1898 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1899 | - if (!is_null($row[$dbName])) { |
|
| 1900 | - $subscription[$xmlName] = $row[$dbName]; |
|
| 1901 | - } |
|
| 1902 | - } |
|
| 1903 | - |
|
| 1904 | - $subscriptions[] = $subscription; |
|
| 1905 | - |
|
| 1906 | - } |
|
| 1907 | - |
|
| 1908 | - return $subscriptions; |
|
| 1909 | - } |
|
| 1910 | - |
|
| 1911 | - /** |
|
| 1912 | - * Creates a new subscription for a principal. |
|
| 1913 | - * |
|
| 1914 | - * If the creation was a success, an id must be returned that can be used to reference |
|
| 1915 | - * this subscription in other methods, such as updateSubscription. |
|
| 1916 | - * |
|
| 1917 | - * @param string $principalUri |
|
| 1918 | - * @param string $uri |
|
| 1919 | - * @param array $properties |
|
| 1920 | - * @return mixed |
|
| 1921 | - */ |
|
| 1922 | - function createSubscription($principalUri, $uri, array $properties) { |
|
| 1923 | - |
|
| 1924 | - if (!isset($properties['{http://calendarserver.org/ns/}source'])) { |
|
| 1925 | - throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions'); |
|
| 1926 | - } |
|
| 1927 | - |
|
| 1928 | - $values = [ |
|
| 1929 | - 'principaluri' => $principalUri, |
|
| 1930 | - 'uri' => $uri, |
|
| 1931 | - 'source' => $properties['{http://calendarserver.org/ns/}source']->getHref(), |
|
| 1932 | - 'lastmodified' => time(), |
|
| 1933 | - ]; |
|
| 1934 | - |
|
| 1935 | - $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; |
|
| 1936 | - |
|
| 1937 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1938 | - if (array_key_exists($xmlName, $properties)) { |
|
| 1939 | - $values[$dbName] = $properties[$xmlName]; |
|
| 1940 | - if (in_array($dbName, $propertiesBoolean)) { |
|
| 1941 | - $values[$dbName] = true; |
|
| 1942 | - } |
|
| 1943 | - } |
|
| 1944 | - } |
|
| 1945 | - |
|
| 1946 | - $valuesToInsert = array(); |
|
| 1947 | - |
|
| 1948 | - $query = $this->db->getQueryBuilder(); |
|
| 1949 | - |
|
| 1950 | - foreach (array_keys($values) as $name) { |
|
| 1951 | - $valuesToInsert[$name] = $query->createNamedParameter($values[$name]); |
|
| 1952 | - } |
|
| 1953 | - |
|
| 1954 | - $query->insert('calendarsubscriptions') |
|
| 1955 | - ->values($valuesToInsert) |
|
| 1956 | - ->execute(); |
|
| 1957 | - |
|
| 1958 | - $subscriptionId = $this->db->lastInsertId('*PREFIX*calendarsubscriptions'); |
|
| 1959 | - |
|
| 1960 | - $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', new GenericEvent( |
|
| 1961 | - '\OCA\DAV\CalDAV\CalDavBackend::createSubscription', |
|
| 1962 | - [ |
|
| 1963 | - 'subscriptionId' => $subscriptionId, |
|
| 1964 | - 'subscriptionData' => $this->getSubscriptionById($subscriptionId), |
|
| 1965 | - ])); |
|
| 1966 | - |
|
| 1967 | - return $subscriptionId; |
|
| 1968 | - } |
|
| 1969 | - |
|
| 1970 | - /** |
|
| 1971 | - * Updates a subscription |
|
| 1972 | - * |
|
| 1973 | - * The list of mutations is stored in a Sabre\DAV\PropPatch object. |
|
| 1974 | - * To do the actual updates, you must tell this object which properties |
|
| 1975 | - * you're going to process with the handle() method. |
|
| 1976 | - * |
|
| 1977 | - * Calling the handle method is like telling the PropPatch object "I |
|
| 1978 | - * promise I can handle updating this property". |
|
| 1979 | - * |
|
| 1980 | - * Read the PropPatch documentation for more info and examples. |
|
| 1981 | - * |
|
| 1982 | - * @param mixed $subscriptionId |
|
| 1983 | - * @param PropPatch $propPatch |
|
| 1984 | - * @return void |
|
| 1985 | - */ |
|
| 1986 | - function updateSubscription($subscriptionId, PropPatch $propPatch) { |
|
| 1987 | - $supportedProperties = array_keys($this->subscriptionPropertyMap); |
|
| 1988 | - $supportedProperties[] = '{http://calendarserver.org/ns/}source'; |
|
| 1989 | - |
|
| 1990 | - /** |
|
| 1991 | - * @suppress SqlInjectionChecker |
|
| 1992 | - */ |
|
| 1993 | - $propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) { |
|
| 1994 | - |
|
| 1995 | - $newValues = []; |
|
| 1996 | - |
|
| 1997 | - foreach($mutations as $propertyName=>$propertyValue) { |
|
| 1998 | - if ($propertyName === '{http://calendarserver.org/ns/}source') { |
|
| 1999 | - $newValues['source'] = $propertyValue->getHref(); |
|
| 2000 | - } else { |
|
| 2001 | - $fieldName = $this->subscriptionPropertyMap[$propertyName]; |
|
| 2002 | - $newValues[$fieldName] = $propertyValue; |
|
| 2003 | - } |
|
| 2004 | - } |
|
| 2005 | - |
|
| 2006 | - $query = $this->db->getQueryBuilder(); |
|
| 2007 | - $query->update('calendarsubscriptions') |
|
| 2008 | - ->set('lastmodified', $query->createNamedParameter(time())); |
|
| 2009 | - foreach($newValues as $fieldName=>$value) { |
|
| 2010 | - $query->set($fieldName, $query->createNamedParameter($value)); |
|
| 2011 | - } |
|
| 2012 | - $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
|
| 2013 | - ->execute(); |
|
| 2014 | - |
|
| 2015 | - $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent( |
|
| 2016 | - '\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', |
|
| 2017 | - [ |
|
| 2018 | - 'subscriptionId' => $subscriptionId, |
|
| 2019 | - 'subscriptionData' => $this->getSubscriptionById($subscriptionId), |
|
| 2020 | - 'propertyMutations' => $mutations, |
|
| 2021 | - ])); |
|
| 2022 | - |
|
| 2023 | - return true; |
|
| 2024 | - |
|
| 2025 | - }); |
|
| 2026 | - } |
|
| 2027 | - |
|
| 2028 | - /** |
|
| 2029 | - * Deletes a subscription. |
|
| 2030 | - * |
|
| 2031 | - * @param mixed $subscriptionId |
|
| 2032 | - * @return void |
|
| 2033 | - */ |
|
| 2034 | - function deleteSubscription($subscriptionId) { |
|
| 2035 | - $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', new GenericEvent( |
|
| 2036 | - '\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', |
|
| 2037 | - [ |
|
| 2038 | - 'subscriptionId' => $subscriptionId, |
|
| 2039 | - 'subscriptionData' => $this->getSubscriptionById($subscriptionId), |
|
| 2040 | - ])); |
|
| 2041 | - |
|
| 2042 | - $query = $this->db->getQueryBuilder(); |
|
| 2043 | - $query->delete('calendarsubscriptions') |
|
| 2044 | - ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
|
| 2045 | - ->execute(); |
|
| 2046 | - } |
|
| 2047 | - |
|
| 2048 | - /** |
|
| 2049 | - * Returns a single scheduling object for the inbox collection. |
|
| 2050 | - * |
|
| 2051 | - * The returned array should contain the following elements: |
|
| 2052 | - * * uri - A unique basename for the object. This will be used to |
|
| 2053 | - * construct a full uri. |
|
| 2054 | - * * calendardata - The iCalendar object |
|
| 2055 | - * * lastmodified - The last modification date. Can be an int for a unix |
|
| 2056 | - * timestamp, or a PHP DateTime object. |
|
| 2057 | - * * etag - A unique token that must change if the object changed. |
|
| 2058 | - * * size - The size of the object, in bytes. |
|
| 2059 | - * |
|
| 2060 | - * @param string $principalUri |
|
| 2061 | - * @param string $objectUri |
|
| 2062 | - * @return array |
|
| 2063 | - */ |
|
| 2064 | - function getSchedulingObject($principalUri, $objectUri) { |
|
| 2065 | - $query = $this->db->getQueryBuilder(); |
|
| 2066 | - $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) |
|
| 2067 | - ->from('schedulingobjects') |
|
| 2068 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2069 | - ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 2070 | - ->execute(); |
|
| 2071 | - |
|
| 2072 | - $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
|
| 2073 | - |
|
| 2074 | - if(!$row) { |
|
| 2075 | - return null; |
|
| 2076 | - } |
|
| 2077 | - |
|
| 2078 | - return [ |
|
| 2079 | - 'uri' => $row['uri'], |
|
| 2080 | - 'calendardata' => $row['calendardata'], |
|
| 2081 | - 'lastmodified' => $row['lastmodified'], |
|
| 2082 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2083 | - 'size' => (int)$row['size'], |
|
| 2084 | - ]; |
|
| 2085 | - } |
|
| 2086 | - |
|
| 2087 | - /** |
|
| 2088 | - * Returns all scheduling objects for the inbox collection. |
|
| 2089 | - * |
|
| 2090 | - * These objects should be returned as an array. Every item in the array |
|
| 2091 | - * should follow the same structure as returned from getSchedulingObject. |
|
| 2092 | - * |
|
| 2093 | - * The main difference is that 'calendardata' is optional. |
|
| 2094 | - * |
|
| 2095 | - * @param string $principalUri |
|
| 2096 | - * @return array |
|
| 2097 | - */ |
|
| 2098 | - function getSchedulingObjects($principalUri) { |
|
| 2099 | - $query = $this->db->getQueryBuilder(); |
|
| 2100 | - $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) |
|
| 2101 | - ->from('schedulingobjects') |
|
| 2102 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2103 | - ->execute(); |
|
| 2104 | - |
|
| 2105 | - $result = []; |
|
| 2106 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 2107 | - $result[] = [ |
|
| 2108 | - 'calendardata' => $row['calendardata'], |
|
| 2109 | - 'uri' => $row['uri'], |
|
| 2110 | - 'lastmodified' => $row['lastmodified'], |
|
| 2111 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2112 | - 'size' => (int)$row['size'], |
|
| 2113 | - ]; |
|
| 2114 | - } |
|
| 2115 | - |
|
| 2116 | - return $result; |
|
| 2117 | - } |
|
| 2118 | - |
|
| 2119 | - /** |
|
| 2120 | - * Deletes a scheduling object from the inbox collection. |
|
| 2121 | - * |
|
| 2122 | - * @param string $principalUri |
|
| 2123 | - * @param string $objectUri |
|
| 2124 | - * @return void |
|
| 2125 | - */ |
|
| 2126 | - function deleteSchedulingObject($principalUri, $objectUri) { |
|
| 2127 | - $query = $this->db->getQueryBuilder(); |
|
| 2128 | - $query->delete('schedulingobjects') |
|
| 2129 | - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2130 | - ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 2131 | - ->execute(); |
|
| 2132 | - } |
|
| 2133 | - |
|
| 2134 | - /** |
|
| 2135 | - * Creates a new scheduling object. This should land in a users' inbox. |
|
| 2136 | - * |
|
| 2137 | - * @param string $principalUri |
|
| 2138 | - * @param string $objectUri |
|
| 2139 | - * @param string $objectData |
|
| 2140 | - * @return void |
|
| 2141 | - */ |
|
| 2142 | - function createSchedulingObject($principalUri, $objectUri, $objectData) { |
|
| 2143 | - $query = $this->db->getQueryBuilder(); |
|
| 2144 | - $query->insert('schedulingobjects') |
|
| 2145 | - ->values([ |
|
| 2146 | - 'principaluri' => $query->createNamedParameter($principalUri), |
|
| 2147 | - 'calendardata' => $query->createNamedParameter($objectData), |
|
| 2148 | - 'uri' => $query->createNamedParameter($objectUri), |
|
| 2149 | - 'lastmodified' => $query->createNamedParameter(time()), |
|
| 2150 | - 'etag' => $query->createNamedParameter(md5($objectData)), |
|
| 2151 | - 'size' => $query->createNamedParameter(strlen($objectData)) |
|
| 2152 | - ]) |
|
| 2153 | - ->execute(); |
|
| 2154 | - } |
|
| 2155 | - |
|
| 2156 | - /** |
|
| 2157 | - * Adds a change record to the calendarchanges table. |
|
| 2158 | - * |
|
| 2159 | - * @param mixed $calendarId |
|
| 2160 | - * @param string $objectUri |
|
| 2161 | - * @param int $operation 1 = add, 2 = modify, 3 = delete. |
|
| 2162 | - * @return void |
|
| 2163 | - */ |
|
| 2164 | - protected function addChange($calendarId, $objectUri, $operation) { |
|
| 2165 | - |
|
| 2166 | - $stmt = $this->db->prepare('INSERT INTO `*PREFIX*calendarchanges` (`uri`, `synctoken`, `calendarid`, `operation`) SELECT ?, `synctoken`, ?, ? FROM `*PREFIX*calendars` WHERE `id` = ?'); |
|
| 2167 | - $stmt->execute([ |
|
| 2168 | - $objectUri, |
|
| 2169 | - $calendarId, |
|
| 2170 | - $operation, |
|
| 2171 | - $calendarId |
|
| 2172 | - ]); |
|
| 2173 | - $stmt = $this->db->prepare('UPDATE `*PREFIX*calendars` SET `synctoken` = `synctoken` + 1 WHERE `id` = ?'); |
|
| 2174 | - $stmt->execute([ |
|
| 2175 | - $calendarId |
|
| 2176 | - ]); |
|
| 2177 | - |
|
| 2178 | - } |
|
| 2179 | - |
|
| 2180 | - /** |
|
| 2181 | - * Parses some information from calendar objects, used for optimized |
|
| 2182 | - * calendar-queries. |
|
| 2183 | - * |
|
| 2184 | - * Returns an array with the following keys: |
|
| 2185 | - * * etag - An md5 checksum of the object without the quotes. |
|
| 2186 | - * * size - Size of the object in bytes |
|
| 2187 | - * * componentType - VEVENT, VTODO or VJOURNAL |
|
| 2188 | - * * firstOccurence |
|
| 2189 | - * * lastOccurence |
|
| 2190 | - * * uid - value of the UID property |
|
| 2191 | - * |
|
| 2192 | - * @param string $calendarData |
|
| 2193 | - * @return array |
|
| 2194 | - */ |
|
| 2195 | - public function getDenormalizedData($calendarData) { |
|
| 2196 | - |
|
| 2197 | - $vObject = Reader::read($calendarData); |
|
| 2198 | - $componentType = null; |
|
| 2199 | - $component = null; |
|
| 2200 | - $firstOccurrence = null; |
|
| 2201 | - $lastOccurrence = null; |
|
| 2202 | - $uid = null; |
|
| 2203 | - $classification = self::CLASSIFICATION_PUBLIC; |
|
| 2204 | - foreach($vObject->getComponents() as $component) { |
|
| 2205 | - if ($component->name!=='VTIMEZONE') { |
|
| 2206 | - $componentType = $component->name; |
|
| 2207 | - $uid = (string)$component->UID; |
|
| 2208 | - break; |
|
| 2209 | - } |
|
| 2210 | - } |
|
| 2211 | - if (!$componentType) { |
|
| 2212 | - throw new \Sabre\DAV\Exception\BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component'); |
|
| 2213 | - } |
|
| 2214 | - if ($componentType === 'VEVENT' && $component->DTSTART) { |
|
| 2215 | - $firstOccurrence = $component->DTSTART->getDateTime()->getTimeStamp(); |
|
| 2216 | - // Finding the last occurrence is a bit harder |
|
| 2217 | - if (!isset($component->RRULE)) { |
|
| 2218 | - if (isset($component->DTEND)) { |
|
| 2219 | - $lastOccurrence = $component->DTEND->getDateTime()->getTimeStamp(); |
|
| 2220 | - } elseif (isset($component->DURATION)) { |
|
| 2221 | - $endDate = clone $component->DTSTART->getDateTime(); |
|
| 2222 | - $endDate->add(DateTimeParser::parse($component->DURATION->getValue())); |
|
| 2223 | - $lastOccurrence = $endDate->getTimeStamp(); |
|
| 2224 | - } elseif (!$component->DTSTART->hasTime()) { |
|
| 2225 | - $endDate = clone $component->DTSTART->getDateTime(); |
|
| 2226 | - $endDate->modify('+1 day'); |
|
| 2227 | - $lastOccurrence = $endDate->getTimeStamp(); |
|
| 2228 | - } else { |
|
| 2229 | - $lastOccurrence = $firstOccurrence; |
|
| 2230 | - } |
|
| 2231 | - } else { |
|
| 2232 | - $it = new EventIterator($vObject, (string)$component->UID); |
|
| 2233 | - $maxDate = new \DateTime(self::MAX_DATE); |
|
| 2234 | - if ($it->isInfinite()) { |
|
| 2235 | - $lastOccurrence = $maxDate->getTimestamp(); |
|
| 2236 | - } else { |
|
| 2237 | - $end = $it->getDtEnd(); |
|
| 2238 | - while($it->valid() && $end < $maxDate) { |
|
| 2239 | - $end = $it->getDtEnd(); |
|
| 2240 | - $it->next(); |
|
| 2241 | - |
|
| 2242 | - } |
|
| 2243 | - $lastOccurrence = $end->getTimestamp(); |
|
| 2244 | - } |
|
| 2245 | - |
|
| 2246 | - } |
|
| 2247 | - } |
|
| 2248 | - |
|
| 2249 | - if ($component->CLASS) { |
|
| 2250 | - $classification = CalDavBackend::CLASSIFICATION_PRIVATE; |
|
| 2251 | - switch ($component->CLASS->getValue()) { |
|
| 2252 | - case 'PUBLIC': |
|
| 2253 | - $classification = CalDavBackend::CLASSIFICATION_PUBLIC; |
|
| 2254 | - break; |
|
| 2255 | - case 'CONFIDENTIAL': |
|
| 2256 | - $classification = CalDavBackend::CLASSIFICATION_CONFIDENTIAL; |
|
| 2257 | - break; |
|
| 2258 | - } |
|
| 2259 | - } |
|
| 2260 | - return [ |
|
| 2261 | - 'etag' => md5($calendarData), |
|
| 2262 | - 'size' => strlen($calendarData), |
|
| 2263 | - 'componentType' => $componentType, |
|
| 2264 | - 'firstOccurence' => is_null($firstOccurrence) ? null : max(0, $firstOccurrence), |
|
| 2265 | - 'lastOccurence' => $lastOccurrence, |
|
| 2266 | - 'uid' => $uid, |
|
| 2267 | - 'classification' => $classification |
|
| 2268 | - ]; |
|
| 2269 | - |
|
| 2270 | - } |
|
| 2271 | - |
|
| 2272 | - /** |
|
| 2273 | - * @param $cardData |
|
| 2274 | - * @return bool|string |
|
| 2275 | - */ |
|
| 2276 | - private function readBlob($cardData) { |
|
| 2277 | - if (is_resource($cardData)) { |
|
| 2278 | - return stream_get_contents($cardData); |
|
| 2279 | - } |
|
| 2280 | - |
|
| 2281 | - return $cardData; |
|
| 2282 | - } |
|
| 2283 | - |
|
| 2284 | - /** |
|
| 2285 | - * @param IShareable $shareable |
|
| 2286 | - * @param array $add |
|
| 2287 | - * @param array $remove |
|
| 2288 | - */ |
|
| 2289 | - public function updateShares($shareable, $add, $remove) { |
|
| 2290 | - $calendarId = $shareable->getResourceId(); |
|
| 2291 | - $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateShares', new GenericEvent( |
|
| 2292 | - '\OCA\DAV\CalDAV\CalDavBackend::updateShares', |
|
| 2293 | - [ |
|
| 2294 | - 'calendarId' => $calendarId, |
|
| 2295 | - 'calendarData' => $this->getCalendarById($calendarId), |
|
| 2296 | - 'shares' => $this->getShares($calendarId), |
|
| 2297 | - 'add' => $add, |
|
| 2298 | - 'remove' => $remove, |
|
| 2299 | - ])); |
|
| 2300 | - $this->sharingBackend->updateShares($shareable, $add, $remove); |
|
| 2301 | - } |
|
| 2302 | - |
|
| 2303 | - /** |
|
| 2304 | - * @param int $resourceId |
|
| 2305 | - * @return array |
|
| 2306 | - */ |
|
| 2307 | - public function getShares($resourceId) { |
|
| 2308 | - return $this->sharingBackend->getShares($resourceId); |
|
| 2309 | - } |
|
| 2310 | - |
|
| 2311 | - /** |
|
| 2312 | - * @param boolean $value |
|
| 2313 | - * @param \OCA\DAV\CalDAV\Calendar $calendar |
|
| 2314 | - * @return string|null |
|
| 2315 | - */ |
|
| 2316 | - public function setPublishStatus($value, $calendar) { |
|
| 2317 | - |
|
| 2318 | - $calendarId = $calendar->getResourceId(); |
|
| 2319 | - $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', new GenericEvent( |
|
| 2320 | - '\OCA\DAV\CalDAV\CalDavBackend::updateShares', |
|
| 2321 | - [ |
|
| 2322 | - 'calendarId' => $calendarId, |
|
| 2323 | - 'calendarData' => $this->getCalendarById($calendarId), |
|
| 2324 | - 'public' => $value, |
|
| 2325 | - ])); |
|
| 2326 | - |
|
| 2327 | - $query = $this->db->getQueryBuilder(); |
|
| 2328 | - if ($value) { |
|
| 2329 | - $publicUri = $this->random->generate(16, ISecureRandom::CHAR_HUMAN_READABLE); |
|
| 2330 | - $query->insert('dav_shares') |
|
| 2331 | - ->values([ |
|
| 2332 | - 'principaluri' => $query->createNamedParameter($calendar->getPrincipalURI()), |
|
| 2333 | - 'type' => $query->createNamedParameter('calendar'), |
|
| 2334 | - 'access' => $query->createNamedParameter(self::ACCESS_PUBLIC), |
|
| 2335 | - 'resourceid' => $query->createNamedParameter($calendar->getResourceId()), |
|
| 2336 | - 'publicuri' => $query->createNamedParameter($publicUri) |
|
| 2337 | - ]); |
|
| 2338 | - $query->execute(); |
|
| 2339 | - return $publicUri; |
|
| 2340 | - } |
|
| 2341 | - $query->delete('dav_shares') |
|
| 2342 | - ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) |
|
| 2343 | - ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))); |
|
| 2344 | - $query->execute(); |
|
| 2345 | - return null; |
|
| 2346 | - } |
|
| 2347 | - |
|
| 2348 | - /** |
|
| 2349 | - * @param \OCA\DAV\CalDAV\Calendar $calendar |
|
| 2350 | - * @return mixed |
|
| 2351 | - */ |
|
| 2352 | - public function getPublishStatus($calendar) { |
|
| 2353 | - $query = $this->db->getQueryBuilder(); |
|
| 2354 | - $result = $query->select('publicuri') |
|
| 2355 | - ->from('dav_shares') |
|
| 2356 | - ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) |
|
| 2357 | - ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))) |
|
| 2358 | - ->execute(); |
|
| 2359 | - |
|
| 2360 | - $row = $result->fetch(); |
|
| 2361 | - $result->closeCursor(); |
|
| 2362 | - return $row ? reset($row) : false; |
|
| 2363 | - } |
|
| 2364 | - |
|
| 2365 | - /** |
|
| 2366 | - * @param int $resourceId |
|
| 2367 | - * @param array $acl |
|
| 2368 | - * @return array |
|
| 2369 | - */ |
|
| 2370 | - public function applyShareAcl($resourceId, $acl) { |
|
| 2371 | - return $this->sharingBackend->applyShareAcl($resourceId, $acl); |
|
| 2372 | - } |
|
| 2373 | - |
|
| 2374 | - |
|
| 2375 | - |
|
| 2376 | - /** |
|
| 2377 | - * update properties table |
|
| 2378 | - * |
|
| 2379 | - * @param int $calendarId |
|
| 2380 | - * @param string $objectUri |
|
| 2381 | - * @param string $calendarData |
|
| 2382 | - */ |
|
| 2383 | - public function updateProperties($calendarId, $objectUri, $calendarData) { |
|
| 2384 | - $objectId = $this->getCalendarObjectId($calendarId, $objectUri); |
|
| 2385 | - |
|
| 2386 | - try { |
|
| 2387 | - $vCalendar = $this->readCalendarData($calendarData); |
|
| 2388 | - } catch (\Exception $ex) { |
|
| 2389 | - return; |
|
| 2390 | - } |
|
| 2391 | - |
|
| 2392 | - $this->purgeProperties($calendarId, $objectId); |
|
| 2393 | - |
|
| 2394 | - $query = $this->db->getQueryBuilder(); |
|
| 2395 | - $query->insert($this->dbObjectPropertiesTable) |
|
| 2396 | - ->values( |
|
| 2397 | - [ |
|
| 2398 | - 'calendarid' => $query->createNamedParameter($calendarId), |
|
| 2399 | - 'objectid' => $query->createNamedParameter($objectId), |
|
| 2400 | - 'name' => $query->createParameter('name'), |
|
| 2401 | - 'parameter' => $query->createParameter('parameter'), |
|
| 2402 | - 'value' => $query->createParameter('value'), |
|
| 2403 | - ] |
|
| 2404 | - ); |
|
| 2405 | - |
|
| 2406 | - $indexComponents = ['VEVENT', 'VJOURNAL', 'VTODO']; |
|
| 2407 | - foreach ($vCalendar->getComponents() as $component) { |
|
| 2408 | - if (!in_array($component->name, $indexComponents)) { |
|
| 2409 | - continue; |
|
| 2410 | - } |
|
| 2411 | - |
|
| 2412 | - foreach ($component->children() as $property) { |
|
| 2413 | - if (in_array($property->name, self::$indexProperties)) { |
|
| 2414 | - $value = $property->getValue(); |
|
| 2415 | - // is this a shitty db? |
|
| 2416 | - if (!$this->db->supports4ByteText()) { |
|
| 2417 | - $value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value); |
|
| 2418 | - } |
|
| 2419 | - $value = mb_substr($value, 0, 254); |
|
| 2420 | - |
|
| 2421 | - $query->setParameter('name', $property->name); |
|
| 2422 | - $query->setParameter('parameter', null); |
|
| 2423 | - $query->setParameter('value', $value); |
|
| 2424 | - $query->execute(); |
|
| 2425 | - } |
|
| 2426 | - |
|
| 2427 | - if (array_key_exists($property->name, self::$indexParameters)) { |
|
| 2428 | - $parameters = $property->parameters(); |
|
| 2429 | - $indexedParametersForProperty = self::$indexParameters[$property->name]; |
|
| 2430 | - |
|
| 2431 | - foreach ($parameters as $key => $value) { |
|
| 2432 | - if (in_array($key, $indexedParametersForProperty)) { |
|
| 2433 | - // is this a shitty db? |
|
| 2434 | - if ($this->db->supports4ByteText()) { |
|
| 2435 | - $value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value); |
|
| 2436 | - } |
|
| 2437 | - $value = mb_substr($value, 0, 254); |
|
| 2438 | - |
|
| 2439 | - $query->setParameter('name', $property->name); |
|
| 2440 | - $query->setParameter('parameter', substr($key, 0, 254)); |
|
| 2441 | - $query->setParameter('value', substr($value, 0, 254)); |
|
| 2442 | - $query->execute(); |
|
| 2443 | - } |
|
| 2444 | - } |
|
| 2445 | - } |
|
| 2446 | - } |
|
| 2447 | - } |
|
| 2448 | - } |
|
| 2449 | - |
|
| 2450 | - /** |
|
| 2451 | - * deletes all birthday calendars |
|
| 2452 | - */ |
|
| 2453 | - public function deleteAllBirthdayCalendars() { |
|
| 2454 | - $query = $this->db->getQueryBuilder(); |
|
| 2455 | - $result = $query->select(['id'])->from('calendars') |
|
| 2456 | - ->where($query->expr()->eq('uri', |
|
| 2457 | - $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) |
|
| 2458 | - ->execute(); |
|
| 2459 | - |
|
| 2460 | - $ids = $result->fetchAll(); |
|
| 2461 | - foreach($ids as $id) { |
|
| 2462 | - $this->deleteCalendar($id['id']); |
|
| 2463 | - } |
|
| 2464 | - } |
|
| 2465 | - |
|
| 2466 | - /** |
|
| 2467 | - * @param $subscriptionId |
|
| 2468 | - */ |
|
| 2469 | - public function purgeAllCachedEventsForSubscription($subscriptionId) { |
|
| 2470 | - $query = $this->db->getQueryBuilder(); |
|
| 2471 | - $query->delete('calendarsubscrobjects') |
|
| 2472 | - ->where($query->expr()->eq('subscriptionid', $query->createNamedParameter($subscriptionId))); |
|
| 2473 | - $query->execute(); |
|
| 2474 | - } |
|
| 2475 | - |
|
| 2476 | - /** |
|
| 2477 | - * @param $subscriptionId |
|
| 2478 | - * @param $objectUri |
|
| 2479 | - * @param $calendarData |
|
| 2480 | - * @return string |
|
| 2481 | - * @throws DAV\Exception\BadRequest |
|
| 2482 | - */ |
|
| 2483 | - public function addCachedEvent($subscriptionId, $objectUri, $calendarData) { |
|
| 2484 | - $extraData = $this->getDenormalizedData($calendarData); |
|
| 2485 | - |
|
| 2486 | - $query = $this->db->getQueryBuilder(); |
|
| 2487 | - $query->insert('calendarsubscrobjects') |
|
| 2488 | - ->values([ |
|
| 2489 | - 'subscriptionid' => $query->createNamedParameter($subscriptionId), |
|
| 2490 | - 'uri' => $query->createNamedParameter($objectUri), |
|
| 2491 | - 'calendardata' => $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB), |
|
| 2492 | - 'lastmodified' => $query->createNamedParameter(time()), |
|
| 2493 | - 'etag' => $query->createNamedParameter($extraData['etag']), |
|
| 2494 | - 'size' => $query->createNamedParameter($extraData['size']), |
|
| 2495 | - 'componenttype' => $query->createNamedParameter($extraData['componentType']), |
|
| 2496 | - 'firstoccurence' => $query->createNamedParameter($extraData['firstOccurence']), |
|
| 2497 | - 'lastoccurence' => $query->createNamedParameter($extraData['lastOccurence']), |
|
| 2498 | - 'classification' => $query->createNamedParameter($extraData['classification']), |
|
| 2499 | - 'uid' => $query->createNamedParameter($extraData['uid']), |
|
| 2500 | - ]) |
|
| 2501 | - ->execute(); |
|
| 2502 | - } |
|
| 2503 | - |
|
| 2504 | - /** |
|
| 2505 | - * read VCalendar data into a VCalendar object |
|
| 2506 | - * |
|
| 2507 | - * @param string $objectData |
|
| 2508 | - * @return VCalendar |
|
| 2509 | - */ |
|
| 2510 | - protected function readCalendarData($objectData) { |
|
| 2511 | - return Reader::read($objectData); |
|
| 2512 | - } |
|
| 2513 | - |
|
| 2514 | - /** |
|
| 2515 | - * delete all properties from a given calendar object |
|
| 2516 | - * |
|
| 2517 | - * @param int $calendarId |
|
| 2518 | - * @param int $objectId |
|
| 2519 | - */ |
|
| 2520 | - protected function purgeProperties($calendarId, $objectId) { |
|
| 2521 | - $query = $this->db->getQueryBuilder(); |
|
| 2522 | - $query->delete($this->dbObjectPropertiesTable) |
|
| 2523 | - ->where($query->expr()->eq('objectid', $query->createNamedParameter($objectId))) |
|
| 2524 | - ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))); |
|
| 2525 | - $query->execute(); |
|
| 2526 | - } |
|
| 2527 | - |
|
| 2528 | - /** |
|
| 2529 | - * get ID from a given calendar object |
|
| 2530 | - * |
|
| 2531 | - * @param int $calendarId |
|
| 2532 | - * @param string $uri |
|
| 2533 | - * @return int |
|
| 2534 | - */ |
|
| 2535 | - protected function getCalendarObjectId($calendarId, $uri) { |
|
| 2536 | - $query = $this->db->getQueryBuilder(); |
|
| 2537 | - $query->select('id')->from('calendarobjects') |
|
| 2538 | - ->where($query->expr()->eq('uri', $query->createNamedParameter($uri))) |
|
| 2539 | - ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))); |
|
| 2540 | - |
|
| 2541 | - $result = $query->execute(); |
|
| 2542 | - $objectIds = $result->fetch(); |
|
| 2543 | - $result->closeCursor(); |
|
| 2544 | - |
|
| 2545 | - if (!isset($objectIds['id'])) { |
|
| 2546 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
| 2547 | - } |
|
| 2548 | - |
|
| 2549 | - return (int)$objectIds['id']; |
|
| 2550 | - } |
|
| 2551 | - |
|
| 2552 | - /** |
|
| 2553 | - * return legacy endpoint principal name to new principal name |
|
| 2554 | - * |
|
| 2555 | - * @param $principalUri |
|
| 2556 | - * @param $toV2 |
|
| 2557 | - * @return string |
|
| 2558 | - */ |
|
| 2559 | - private function convertPrincipal($principalUri, $toV2) { |
|
| 2560 | - if ($this->principalBackend->getPrincipalPrefix() === 'principals') { |
|
| 2561 | - list(, $name) = Uri\split($principalUri); |
|
| 2562 | - if ($toV2 === true) { |
|
| 2563 | - return "principals/users/$name"; |
|
| 2564 | - } |
|
| 2565 | - return "principals/$name"; |
|
| 2566 | - } |
|
| 2567 | - return $principalUri; |
|
| 2568 | - } |
|
| 2569 | - |
|
| 2570 | - /** |
|
| 2571 | - * adds information about an owner to the calendar data |
|
| 2572 | - * |
|
| 2573 | - * @param $calendarInfo |
|
| 2574 | - */ |
|
| 2575 | - private function addOwnerPrincipal(&$calendarInfo) { |
|
| 2576 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 2577 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 2578 | - if (isset($calendarInfo[$ownerPrincipalKey])) { |
|
| 2579 | - $uri = $calendarInfo[$ownerPrincipalKey]; |
|
| 2580 | - } else { |
|
| 2581 | - $uri = $calendarInfo['principaluri']; |
|
| 2582 | - } |
|
| 2583 | - |
|
| 2584 | - $principalInformation = $this->principalBackend->getPrincipalByPath($uri); |
|
| 2585 | - if (isset($principalInformation['{DAV:}displayname'])) { |
|
| 2586 | - $calendarInfo[$displaynameKey] = $principalInformation['{DAV:}displayname']; |
|
| 2587 | - } |
|
| 2588 | - } |
|
| 442 | + /** |
|
| 443 | + * @return array |
|
| 444 | + */ |
|
| 445 | + public function getPublicCalendars() { |
|
| 446 | + $fields = array_values($this->propertyMap); |
|
| 447 | + $fields[] = 'a.id'; |
|
| 448 | + $fields[] = 'a.uri'; |
|
| 449 | + $fields[] = 'a.synctoken'; |
|
| 450 | + $fields[] = 'a.components'; |
|
| 451 | + $fields[] = 'a.principaluri'; |
|
| 452 | + $fields[] = 'a.transparent'; |
|
| 453 | + $fields[] = 's.access'; |
|
| 454 | + $fields[] = 's.publicuri'; |
|
| 455 | + $calendars = []; |
|
| 456 | + $query = $this->db->getQueryBuilder(); |
|
| 457 | + $result = $query->select($fields) |
|
| 458 | + ->from('dav_shares', 's') |
|
| 459 | + ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) |
|
| 460 | + ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC))) |
|
| 461 | + ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
|
| 462 | + ->execute(); |
|
| 463 | + |
|
| 464 | + while($row = $result->fetch()) { |
|
| 465 | + list(, $name) = Uri\split($row['principaluri']); |
|
| 466 | + $row['displayname'] = $row['displayname'] . "($name)"; |
|
| 467 | + $components = []; |
|
| 468 | + if ($row['components']) { |
|
| 469 | + $components = explode(',',$row['components']); |
|
| 470 | + } |
|
| 471 | + $calendar = [ |
|
| 472 | + 'id' => $row['id'], |
|
| 473 | + 'uri' => $row['publicuri'], |
|
| 474 | + 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 475 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 476 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 477 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 478 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 479 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 480 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 481 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 482 | + ]; |
|
| 483 | + |
|
| 484 | + foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 485 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 486 | + } |
|
| 487 | + |
|
| 488 | + $this->addOwnerPrincipal($calendar); |
|
| 489 | + |
|
| 490 | + if (!isset($calendars[$calendar['id']])) { |
|
| 491 | + $calendars[$calendar['id']] = $calendar; |
|
| 492 | + } |
|
| 493 | + } |
|
| 494 | + $result->closeCursor(); |
|
| 495 | + |
|
| 496 | + return array_values($calendars); |
|
| 497 | + } |
|
| 498 | + |
|
| 499 | + /** |
|
| 500 | + * @param string $uri |
|
| 501 | + * @return array |
|
| 502 | + * @throws NotFound |
|
| 503 | + */ |
|
| 504 | + public function getPublicCalendar($uri) { |
|
| 505 | + $fields = array_values($this->propertyMap); |
|
| 506 | + $fields[] = 'a.id'; |
|
| 507 | + $fields[] = 'a.uri'; |
|
| 508 | + $fields[] = 'a.synctoken'; |
|
| 509 | + $fields[] = 'a.components'; |
|
| 510 | + $fields[] = 'a.principaluri'; |
|
| 511 | + $fields[] = 'a.transparent'; |
|
| 512 | + $fields[] = 's.access'; |
|
| 513 | + $fields[] = 's.publicuri'; |
|
| 514 | + $query = $this->db->getQueryBuilder(); |
|
| 515 | + $result = $query->select($fields) |
|
| 516 | + ->from('dav_shares', 's') |
|
| 517 | + ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) |
|
| 518 | + ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC))) |
|
| 519 | + ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
|
| 520 | + ->andWhere($query->expr()->eq('s.publicuri', $query->createNamedParameter($uri))) |
|
| 521 | + ->execute(); |
|
| 522 | + |
|
| 523 | + $row = $result->fetch(\PDO::FETCH_ASSOC); |
|
| 524 | + |
|
| 525 | + $result->closeCursor(); |
|
| 526 | + |
|
| 527 | + if ($row === false) { |
|
| 528 | + throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
| 529 | + } |
|
| 530 | + |
|
| 531 | + list(, $name) = Uri\split($row['principaluri']); |
|
| 532 | + $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
| 533 | + $components = []; |
|
| 534 | + if ($row['components']) { |
|
| 535 | + $components = explode(',',$row['components']); |
|
| 536 | + } |
|
| 537 | + $calendar = [ |
|
| 538 | + 'id' => $row['id'], |
|
| 539 | + 'uri' => $row['publicuri'], |
|
| 540 | + 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 541 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 542 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 543 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 544 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 545 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 546 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 547 | + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 548 | + ]; |
|
| 549 | + |
|
| 550 | + foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 551 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 552 | + } |
|
| 553 | + |
|
| 554 | + $this->addOwnerPrincipal($calendar); |
|
| 555 | + |
|
| 556 | + return $calendar; |
|
| 557 | + |
|
| 558 | + } |
|
| 559 | + |
|
| 560 | + /** |
|
| 561 | + * @param string $principal |
|
| 562 | + * @param string $uri |
|
| 563 | + * @return array|null |
|
| 564 | + */ |
|
| 565 | + public function getCalendarByUri($principal, $uri) { |
|
| 566 | + $fields = array_values($this->propertyMap); |
|
| 567 | + $fields[] = 'id'; |
|
| 568 | + $fields[] = 'uri'; |
|
| 569 | + $fields[] = 'synctoken'; |
|
| 570 | + $fields[] = 'components'; |
|
| 571 | + $fields[] = 'principaluri'; |
|
| 572 | + $fields[] = 'transparent'; |
|
| 573 | + |
|
| 574 | + // Making fields a comma-delimited list |
|
| 575 | + $query = $this->db->getQueryBuilder(); |
|
| 576 | + $query->select($fields)->from('calendars') |
|
| 577 | + ->where($query->expr()->eq('uri', $query->createNamedParameter($uri))) |
|
| 578 | + ->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($principal))) |
|
| 579 | + ->setMaxResults(1); |
|
| 580 | + $stmt = $query->execute(); |
|
| 581 | + |
|
| 582 | + $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
|
| 583 | + $stmt->closeCursor(); |
|
| 584 | + if ($row === false) { |
|
| 585 | + return null; |
|
| 586 | + } |
|
| 587 | + |
|
| 588 | + $components = []; |
|
| 589 | + if ($row['components']) { |
|
| 590 | + $components = explode(',',$row['components']); |
|
| 591 | + } |
|
| 592 | + |
|
| 593 | + $calendar = [ |
|
| 594 | + 'id' => $row['id'], |
|
| 595 | + 'uri' => $row['uri'], |
|
| 596 | + 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 597 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 598 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 599 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 600 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 601 | + ]; |
|
| 602 | + |
|
| 603 | + foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 604 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 605 | + } |
|
| 606 | + |
|
| 607 | + $this->addOwnerPrincipal($calendar); |
|
| 608 | + |
|
| 609 | + return $calendar; |
|
| 610 | + } |
|
| 611 | + |
|
| 612 | + /** |
|
| 613 | + * @param $calendarId |
|
| 614 | + * @return array|null |
|
| 615 | + */ |
|
| 616 | + public function getCalendarById($calendarId) { |
|
| 617 | + $fields = array_values($this->propertyMap); |
|
| 618 | + $fields[] = 'id'; |
|
| 619 | + $fields[] = 'uri'; |
|
| 620 | + $fields[] = 'synctoken'; |
|
| 621 | + $fields[] = 'components'; |
|
| 622 | + $fields[] = 'principaluri'; |
|
| 623 | + $fields[] = 'transparent'; |
|
| 624 | + |
|
| 625 | + // Making fields a comma-delimited list |
|
| 626 | + $query = $this->db->getQueryBuilder(); |
|
| 627 | + $query->select($fields)->from('calendars') |
|
| 628 | + ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))) |
|
| 629 | + ->setMaxResults(1); |
|
| 630 | + $stmt = $query->execute(); |
|
| 631 | + |
|
| 632 | + $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
|
| 633 | + $stmt->closeCursor(); |
|
| 634 | + if ($row === false) { |
|
| 635 | + return null; |
|
| 636 | + } |
|
| 637 | + |
|
| 638 | + $components = []; |
|
| 639 | + if ($row['components']) { |
|
| 640 | + $components = explode(',',$row['components']); |
|
| 641 | + } |
|
| 642 | + |
|
| 643 | + $calendar = [ |
|
| 644 | + 'id' => $row['id'], |
|
| 645 | + 'uri' => $row['uri'], |
|
| 646 | + 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 647 | + '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 648 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 649 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 650 | + '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 651 | + ]; |
|
| 652 | + |
|
| 653 | + foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 654 | + $calendar[$xmlName] = $row[$dbName]; |
|
| 655 | + } |
|
| 656 | + |
|
| 657 | + $this->addOwnerPrincipal($calendar); |
|
| 658 | + |
|
| 659 | + return $calendar; |
|
| 660 | + } |
|
| 661 | + |
|
| 662 | + /** |
|
| 663 | + * @param $subscriptionId |
|
| 664 | + */ |
|
| 665 | + public function getSubscriptionById($subscriptionId) { |
|
| 666 | + $fields = array_values($this->subscriptionPropertyMap); |
|
| 667 | + $fields[] = 'id'; |
|
| 668 | + $fields[] = 'uri'; |
|
| 669 | + $fields[] = 'source'; |
|
| 670 | + $fields[] = 'principaluri'; |
|
| 671 | + $fields[] = 'lastmodified'; |
|
| 672 | + |
|
| 673 | + $query = $this->db->getQueryBuilder(); |
|
| 674 | + $query->select($fields) |
|
| 675 | + ->from('calendarsubscriptions') |
|
| 676 | + ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
|
| 677 | + ->orderBy('calendarorder', 'asc'); |
|
| 678 | + $stmt =$query->execute(); |
|
| 679 | + |
|
| 680 | + $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
|
| 681 | + $stmt->closeCursor(); |
|
| 682 | + if ($row === false) { |
|
| 683 | + return null; |
|
| 684 | + } |
|
| 685 | + |
|
| 686 | + $subscription = [ |
|
| 687 | + 'id' => $row['id'], |
|
| 688 | + 'uri' => $row['uri'], |
|
| 689 | + 'principaluri' => $row['principaluri'], |
|
| 690 | + 'source' => $row['source'], |
|
| 691 | + 'lastmodified' => $row['lastmodified'], |
|
| 692 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 693 | + ]; |
|
| 694 | + |
|
| 695 | + foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 696 | + if (!is_null($row[$dbName])) { |
|
| 697 | + $subscription[$xmlName] = $row[$dbName]; |
|
| 698 | + } |
|
| 699 | + } |
|
| 700 | + |
|
| 701 | + return $subscription; |
|
| 702 | + } |
|
| 703 | + |
|
| 704 | + /** |
|
| 705 | + * Creates a new calendar for a principal. |
|
| 706 | + * |
|
| 707 | + * If the creation was a success, an id must be returned that can be used to reference |
|
| 708 | + * this calendar in other methods, such as updateCalendar. |
|
| 709 | + * |
|
| 710 | + * @param string $principalUri |
|
| 711 | + * @param string $calendarUri |
|
| 712 | + * @param array $properties |
|
| 713 | + * @return int |
|
| 714 | + * @suppress SqlInjectionChecker |
|
| 715 | + */ |
|
| 716 | + function createCalendar($principalUri, $calendarUri, array $properties) { |
|
| 717 | + $values = [ |
|
| 718 | + 'principaluri' => $this->convertPrincipal($principalUri, true), |
|
| 719 | + 'uri' => $calendarUri, |
|
| 720 | + 'synctoken' => 1, |
|
| 721 | + 'transparent' => 0, |
|
| 722 | + 'components' => 'VEVENT,VTODO', |
|
| 723 | + 'displayname' => $calendarUri |
|
| 724 | + ]; |
|
| 725 | + |
|
| 726 | + // Default value |
|
| 727 | + $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
|
| 728 | + if (isset($properties[$sccs])) { |
|
| 729 | + if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
|
| 730 | + throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 731 | + } |
|
| 732 | + $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
| 733 | + } |
|
| 734 | + $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 735 | + if (isset($properties[$transp])) { |
|
| 736 | + $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
|
| 737 | + } |
|
| 738 | + |
|
| 739 | + foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 740 | + if (isset($properties[$xmlName])) { |
|
| 741 | + $values[$dbName] = $properties[$xmlName]; |
|
| 742 | + } |
|
| 743 | + } |
|
| 744 | + |
|
| 745 | + $query = $this->db->getQueryBuilder(); |
|
| 746 | + $query->insert('calendars'); |
|
| 747 | + foreach($values as $column => $value) { |
|
| 748 | + $query->setValue($column, $query->createNamedParameter($value)); |
|
| 749 | + } |
|
| 750 | + $query->execute(); |
|
| 751 | + $calendarId = $query->getLastInsertId(); |
|
| 752 | + |
|
| 753 | + $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent( |
|
| 754 | + '\OCA\DAV\CalDAV\CalDavBackend::createCalendar', |
|
| 755 | + [ |
|
| 756 | + 'calendarId' => $calendarId, |
|
| 757 | + 'calendarData' => $this->getCalendarById($calendarId), |
|
| 758 | + ])); |
|
| 759 | + |
|
| 760 | + return $calendarId; |
|
| 761 | + } |
|
| 762 | + |
|
| 763 | + /** |
|
| 764 | + * Updates properties for a calendar. |
|
| 765 | + * |
|
| 766 | + * The list of mutations is stored in a Sabre\DAV\PropPatch object. |
|
| 767 | + * To do the actual updates, you must tell this object which properties |
|
| 768 | + * you're going to process with the handle() method. |
|
| 769 | + * |
|
| 770 | + * Calling the handle method is like telling the PropPatch object "I |
|
| 771 | + * promise I can handle updating this property". |
|
| 772 | + * |
|
| 773 | + * Read the PropPatch documentation for more info and examples. |
|
| 774 | + * |
|
| 775 | + * @param mixed $calendarId |
|
| 776 | + * @param PropPatch $propPatch |
|
| 777 | + * @return void |
|
| 778 | + */ |
|
| 779 | + function updateCalendar($calendarId, PropPatch $propPatch) { |
|
| 780 | + $supportedProperties = array_keys($this->propertyMap); |
|
| 781 | + $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 782 | + |
|
| 783 | + /** |
|
| 784 | + * @suppress SqlInjectionChecker |
|
| 785 | + */ |
|
| 786 | + $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { |
|
| 787 | + $newValues = []; |
|
| 788 | + foreach ($mutations as $propertyName => $propertyValue) { |
|
| 789 | + |
|
| 790 | + switch ($propertyName) { |
|
| 791 | + case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' : |
|
| 792 | + $fieldName = 'transparent'; |
|
| 793 | + $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
|
| 794 | + break; |
|
| 795 | + default : |
|
| 796 | + $fieldName = $this->propertyMap[$propertyName]; |
|
| 797 | + $newValues[$fieldName] = $propertyValue; |
|
| 798 | + break; |
|
| 799 | + } |
|
| 800 | + |
|
| 801 | + } |
|
| 802 | + $query = $this->db->getQueryBuilder(); |
|
| 803 | + $query->update('calendars'); |
|
| 804 | + foreach ($newValues as $fieldName => $value) { |
|
| 805 | + $query->set($fieldName, $query->createNamedParameter($value)); |
|
| 806 | + } |
|
| 807 | + $query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
|
| 808 | + $query->execute(); |
|
| 809 | + |
|
| 810 | + $this->addChange($calendarId, "", 2); |
|
| 811 | + |
|
| 812 | + $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent( |
|
| 813 | + '\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', |
|
| 814 | + [ |
|
| 815 | + 'calendarId' => $calendarId, |
|
| 816 | + 'calendarData' => $this->getCalendarById($calendarId), |
|
| 817 | + 'shares' => $this->getShares($calendarId), |
|
| 818 | + 'propertyMutations' => $mutations, |
|
| 819 | + ])); |
|
| 820 | + |
|
| 821 | + return true; |
|
| 822 | + }); |
|
| 823 | + } |
|
| 824 | + |
|
| 825 | + /** |
|
| 826 | + * Delete a calendar and all it's objects |
|
| 827 | + * |
|
| 828 | + * @param mixed $calendarId |
|
| 829 | + * @return void |
|
| 830 | + */ |
|
| 831 | + function deleteCalendar($calendarId) { |
|
| 832 | + $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', new GenericEvent( |
|
| 833 | + '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', |
|
| 834 | + [ |
|
| 835 | + 'calendarId' => $calendarId, |
|
| 836 | + 'calendarData' => $this->getCalendarById($calendarId), |
|
| 837 | + 'shares' => $this->getShares($calendarId), |
|
| 838 | + ])); |
|
| 839 | + |
|
| 840 | + $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ?'); |
|
| 841 | + $stmt->execute([$calendarId]); |
|
| 842 | + |
|
| 843 | + $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendars` WHERE `id` = ?'); |
|
| 844 | + $stmt->execute([$calendarId]); |
|
| 845 | + |
|
| 846 | + $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarchanges` WHERE `calendarid` = ?'); |
|
| 847 | + $stmt->execute([$calendarId]); |
|
| 848 | + |
|
| 849 | + $this->sharingBackend->deleteAllShares($calendarId); |
|
| 850 | + |
|
| 851 | + $query = $this->db->getQueryBuilder(); |
|
| 852 | + $query->delete($this->dbObjectPropertiesTable) |
|
| 853 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 854 | + ->execute(); |
|
| 855 | + } |
|
| 856 | + |
|
| 857 | + /** |
|
| 858 | + * Delete all of an user's shares |
|
| 859 | + * |
|
| 860 | + * @param string $principaluri |
|
| 861 | + * @return void |
|
| 862 | + */ |
|
| 863 | + function deleteAllSharesByUser($principaluri) { |
|
| 864 | + $this->sharingBackend->deleteAllSharesByUser($principaluri); |
|
| 865 | + } |
|
| 866 | + |
|
| 867 | + /** |
|
| 868 | + * Returns all calendar objects within a calendar. |
|
| 869 | + * |
|
| 870 | + * Every item contains an array with the following keys: |
|
| 871 | + * * calendardata - The iCalendar-compatible calendar data |
|
| 872 | + * * uri - a unique key which will be used to construct the uri. This can |
|
| 873 | + * be any arbitrary string, but making sure it ends with '.ics' is a |
|
| 874 | + * good idea. This is only the basename, or filename, not the full |
|
| 875 | + * path. |
|
| 876 | + * * lastmodified - a timestamp of the last modification time |
|
| 877 | + * * etag - An arbitrary string, surrounded by double-quotes. (e.g.: |
|
| 878 | + * '"abcdef"') |
|
| 879 | + * * size - The size of the calendar objects, in bytes. |
|
| 880 | + * * component - optional, a string containing the type of object, such |
|
| 881 | + * as 'vevent' or 'vtodo'. If specified, this will be used to populate |
|
| 882 | + * the Content-Type header. |
|
| 883 | + * |
|
| 884 | + * Note that the etag is optional, but it's highly encouraged to return for |
|
| 885 | + * speed reasons. |
|
| 886 | + * |
|
| 887 | + * The calendardata is also optional. If it's not returned |
|
| 888 | + * 'getCalendarObject' will be called later, which *is* expected to return |
|
| 889 | + * calendardata. |
|
| 890 | + * |
|
| 891 | + * If neither etag or size are specified, the calendardata will be |
|
| 892 | + * used/fetched to determine these numbers. If both are specified the |
|
| 893 | + * amount of times this is needed is reduced by a great degree. |
|
| 894 | + * |
|
| 895 | + * @param mixed $calendarId |
|
| 896 | + * @return array |
|
| 897 | + */ |
|
| 898 | + function getCalendarObjects($calendarId):array { |
|
| 899 | + return $this->commonGetCalendarObjects('calendarobjects', 'calendarid', $calendarId); |
|
| 900 | + } |
|
| 901 | + |
|
| 902 | + /** |
|
| 903 | + * @param mixed $subscriptionId |
|
| 904 | + * @return array |
|
| 905 | + */ |
|
| 906 | + public function getCachedCalendarObjects($subscriptionId):array { |
|
| 907 | + return $this->commonGetCalendarObjects('calendarsubscrobjects', 'subscriptionid', $subscriptionId); |
|
| 908 | + } |
|
| 909 | + |
|
| 910 | + /** |
|
| 911 | + * @param string $tablename |
|
| 912 | + * @param string $selector |
|
| 913 | + * @param mixed $id |
|
| 914 | + * @return array |
|
| 915 | + */ |
|
| 916 | + private function commonGetCalendarObjects(string $tablename, string $selector, $id):array { |
|
| 917 | + $query = $this->db->getQueryBuilder(); |
|
| 918 | + $query->select(['id', 'uri', 'lastmodified', 'etag', $selector, 'size', 'componenttype', 'classification']) |
|
| 919 | + ->from($tablename) |
|
| 920 | + ->where($query->expr()->eq($selector, $query->createNamedParameter($id))); |
|
| 921 | + $stmt = $query->execute(); |
|
| 922 | + |
|
| 923 | + $result = []; |
|
| 924 | + foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 925 | + $result[] = [ |
|
| 926 | + 'id' => $row['id'], |
|
| 927 | + 'uri' => $row['uri'], |
|
| 928 | + 'lastmodified' => $row['lastmodified'], |
|
| 929 | + 'etag' => '"' . $row['etag'] . '"', |
|
| 930 | + 'calendarid' => $row[$selector], |
|
| 931 | + 'size' => (int)$row['size'], |
|
| 932 | + 'component' => strtolower($row['componenttype']), |
|
| 933 | + 'classification'=> (int)$row['classification'] |
|
| 934 | + ]; |
|
| 935 | + } |
|
| 936 | + |
|
| 937 | + return $result; |
|
| 938 | + } |
|
| 939 | + |
|
| 940 | + /** |
|
| 941 | + * Returns information from a single calendar object, based on it's object |
|
| 942 | + * uri. |
|
| 943 | + * |
|
| 944 | + * The object uri is only the basename, or filename and not a full path. |
|
| 945 | + * |
|
| 946 | + * The returned array must have the same keys as getCalendarObjects. The |
|
| 947 | + * 'calendardata' object is required here though, while it's not required |
|
| 948 | + * for getCalendarObjects. |
|
| 949 | + * |
|
| 950 | + * This method must return null if the object did not exist. |
|
| 951 | + * |
|
| 952 | + * @param mixed $calendarId |
|
| 953 | + * @param string $objectUri |
|
| 954 | + * @return array|null |
|
| 955 | + */ |
|
| 956 | + function getCalendarObject($calendarId, $objectUri) { |
|
| 957 | + return $this->commonGetCalendarObject('calendarobjects', 'calendarid', $calendarId, $objectUri); |
|
| 958 | + } |
|
| 959 | + |
|
| 960 | + /** |
|
| 961 | + * @param $subscriptionId |
|
| 962 | + * @param $objectUri |
|
| 963 | + * @return array |
|
| 964 | + */ |
|
| 965 | + public function getCachedCalendarObject($subscriptionId, $objectUri) { |
|
| 966 | + return $this->commonGetCalendarObject('calendarsubscrobjects', 'subscriptionid', $subscriptionId, $objectUri); |
|
| 967 | + } |
|
| 968 | + |
|
| 969 | + /** |
|
| 970 | + * @param string $tablename |
|
| 971 | + * @param string $selector |
|
| 972 | + * @param $id |
|
| 973 | + * @param $objectUri |
|
| 974 | + * @return array |
|
| 975 | + */ |
|
| 976 | + private function commonGetCalendarObject(string $tablename, string $selector, $id, $objectUri):array { |
|
| 977 | + $query = $this->db->getQueryBuilder(); |
|
| 978 | + $query->select(['id', 'uri', 'lastmodified', 'etag', $selector, 'size', 'calendardata', 'componenttype', 'classification']) |
|
| 979 | + ->from($tablename) |
|
| 980 | + ->where($query->expr()->eq($selector, $query->createNamedParameter($id))) |
|
| 981 | + ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))); |
|
| 982 | + $stmt = $query->execute(); |
|
| 983 | + $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
|
| 984 | + |
|
| 985 | + if(!$row) { |
|
| 986 | + return null; |
|
| 987 | + } |
|
| 988 | + |
|
| 989 | + return [ |
|
| 990 | + 'id' => $row['id'], |
|
| 991 | + 'uri' => $row['uri'], |
|
| 992 | + 'lastmodified' => $row['lastmodified'], |
|
| 993 | + 'etag' => '"' . $row['etag'] . '"', |
|
| 994 | + 'calendarid' => $row[$selector], |
|
| 995 | + 'size' => (int)$row['size'], |
|
| 996 | + 'calendardata' => $this->readBlob($row['calendardata']), |
|
| 997 | + 'component' => strtolower($row['componenttype']), |
|
| 998 | + 'classification'=> (int)$row['classification'] |
|
| 999 | + ]; |
|
| 1000 | + } |
|
| 1001 | + |
|
| 1002 | + /** |
|
| 1003 | + * Returns a list of calendar objects. |
|
| 1004 | + * |
|
| 1005 | + * This method should work identical to getCalendarObject, but instead |
|
| 1006 | + * return all the calendar objects in the list as an array. |
|
| 1007 | + * |
|
| 1008 | + * If the backend supports this, it may allow for some speed-ups. |
|
| 1009 | + * |
|
| 1010 | + * @param mixed $calendarId |
|
| 1011 | + * @param string[] $uris |
|
| 1012 | + * @return array |
|
| 1013 | + */ |
|
| 1014 | + function getMultipleCalendarObjects($calendarId, array $uris) { |
|
| 1015 | + return $this->commonGetMultipleCachedCalendarObjects('calendarobjects', 'calendarid', $calendarId, $uris); |
|
| 1016 | + } |
|
| 1017 | + |
|
| 1018 | + /** |
|
| 1019 | + * @param $subscripionId |
|
| 1020 | + * @param array $uris |
|
| 1021 | + * @return array |
|
| 1022 | + */ |
|
| 1023 | + function getMultipleCachedCalendarObjects($subscripionId, array $uris) { |
|
| 1024 | + return $this->commonGetMultipleCachedCalendarObjects('calendarsubscrobjects', 'subscriptionid', $subscripionId, $uris); |
|
| 1025 | + } |
|
| 1026 | + |
|
| 1027 | + /** |
|
| 1028 | + * @param string $tablename |
|
| 1029 | + * @param string $selector |
|
| 1030 | + * @param $id |
|
| 1031 | + * @param array $uris |
|
| 1032 | + * @return array |
|
| 1033 | + */ |
|
| 1034 | + private function commonGetMultipleCachedCalendarObjects(string $tablename, string $selector, $id, array $uris) { |
|
| 1035 | + if (empty($uris)) { |
|
| 1036 | + return []; |
|
| 1037 | + } |
|
| 1038 | + |
|
| 1039 | + $chunks = array_chunk($uris, 100); |
|
| 1040 | + $objects = []; |
|
| 1041 | + |
|
| 1042 | + $query = $this->db->getQueryBuilder(); |
|
| 1043 | + $query->select(['id', 'uri', 'lastmodified', 'etag', $selector, 'size', 'calendardata', 'componenttype', 'classification']) |
|
| 1044 | + ->from($tablename) |
|
| 1045 | + ->where($query->expr()->eq($selector, $query->createNamedParameter($id))) |
|
| 1046 | + ->andWhere($query->expr()->in('uri', $query->createParameter('uri'))); |
|
| 1047 | + |
|
| 1048 | + foreach ($chunks as $uris) { |
|
| 1049 | + $query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY); |
|
| 1050 | + $result = $query->execute(); |
|
| 1051 | + |
|
| 1052 | + while ($row = $result->fetch()) { |
|
| 1053 | + $objects[] = [ |
|
| 1054 | + 'id' => $row['id'], |
|
| 1055 | + 'uri' => $row['uri'], |
|
| 1056 | + 'lastmodified' => $row['lastmodified'], |
|
| 1057 | + 'etag' => '"' . $row['etag'] . '"', |
|
| 1058 | + 'calendarid' => $row[$selector], |
|
| 1059 | + 'size' => (int)$row['size'], |
|
| 1060 | + 'calendardata' => $this->readBlob($row['calendardata']), |
|
| 1061 | + 'component' => strtolower($row['componenttype']), |
|
| 1062 | + 'classification' => (int)$row['classification'] |
|
| 1063 | + ]; |
|
| 1064 | + } |
|
| 1065 | + $result->closeCursor(); |
|
| 1066 | + } |
|
| 1067 | + |
|
| 1068 | + return $objects; |
|
| 1069 | + } |
|
| 1070 | + |
|
| 1071 | + /** |
|
| 1072 | + * Creates a new calendar object. |
|
| 1073 | + * |
|
| 1074 | + * The object uri is only the basename, or filename and not a full path. |
|
| 1075 | + * |
|
| 1076 | + * It is possible return an etag from this function, which will be used in |
|
| 1077 | + * the response to this PUT request. Note that the ETag must be surrounded |
|
| 1078 | + * by double-quotes. |
|
| 1079 | + * |
|
| 1080 | + * However, you should only really return this ETag if you don't mangle the |
|
| 1081 | + * calendar-data. If the result of a subsequent GET to this object is not |
|
| 1082 | + * the exact same as this request body, you should omit the ETag. |
|
| 1083 | + * |
|
| 1084 | + * @param mixed $calendarId |
|
| 1085 | + * @param string $objectUri |
|
| 1086 | + * @param string $calendarData |
|
| 1087 | + * @return string |
|
| 1088 | + */ |
|
| 1089 | + function createCalendarObject($calendarId, $objectUri, $calendarData) { |
|
| 1090 | + $extraData = $this->getDenormalizedData($calendarData); |
|
| 1091 | + |
|
| 1092 | + $q = $this->db->getQueryBuilder(); |
|
| 1093 | + $q->select($q->createFunction('COUNT(*)')) |
|
| 1094 | + ->from('calendarobjects') |
|
| 1095 | + ->where($q->expr()->eq('calendarid', $q->createNamedParameter($calendarId))) |
|
| 1096 | + ->andWhere($q->expr()->eq('uid', $q->createNamedParameter($extraData['uid']))); |
|
| 1097 | + |
|
| 1098 | + $result = $q->execute(); |
|
| 1099 | + $count = (int) $result->fetchColumn(); |
|
| 1100 | + $result->closeCursor(); |
|
| 1101 | + |
|
| 1102 | + if ($count !== 0) { |
|
| 1103 | + throw new \Sabre\DAV\Exception\BadRequest('Calendar object with uid already exists in this calendar collection.'); |
|
| 1104 | + } |
|
| 1105 | + |
|
| 1106 | + $query = $this->db->getQueryBuilder(); |
|
| 1107 | + $query->insert('calendarobjects') |
|
| 1108 | + ->values([ |
|
| 1109 | + 'calendarid' => $query->createNamedParameter($calendarId), |
|
| 1110 | + 'uri' => $query->createNamedParameter($objectUri), |
|
| 1111 | + 'calendardata' => $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB), |
|
| 1112 | + 'lastmodified' => $query->createNamedParameter(time()), |
|
| 1113 | + 'etag' => $query->createNamedParameter($extraData['etag']), |
|
| 1114 | + 'size' => $query->createNamedParameter($extraData['size']), |
|
| 1115 | + 'componenttype' => $query->createNamedParameter($extraData['componentType']), |
|
| 1116 | + 'firstoccurence' => $query->createNamedParameter($extraData['firstOccurence']), |
|
| 1117 | + 'lastoccurence' => $query->createNamedParameter($extraData['lastOccurence']), |
|
| 1118 | + 'classification' => $query->createNamedParameter($extraData['classification']), |
|
| 1119 | + 'uid' => $query->createNamedParameter($extraData['uid']), |
|
| 1120 | + ]) |
|
| 1121 | + ->execute(); |
|
| 1122 | + |
|
| 1123 | + $this->updateProperties($calendarId, $objectUri, $calendarData); |
|
| 1124 | + |
|
| 1125 | + $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent( |
|
| 1126 | + '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', |
|
| 1127 | + [ |
|
| 1128 | + 'calendarId' => $calendarId, |
|
| 1129 | + 'calendarData' => $this->getCalendarById($calendarId), |
|
| 1130 | + 'shares' => $this->getShares($calendarId), |
|
| 1131 | + 'objectData' => $this->getCalendarObject($calendarId, $objectUri), |
|
| 1132 | + ] |
|
| 1133 | + )); |
|
| 1134 | + $this->addChange($calendarId, $objectUri, 1); |
|
| 1135 | + |
|
| 1136 | + return '"' . $extraData['etag'] . '"'; |
|
| 1137 | + } |
|
| 1138 | + |
|
| 1139 | + /** |
|
| 1140 | + * Updates an existing calendarobject, based on it's uri. |
|
| 1141 | + * |
|
| 1142 | + * The object uri is only the basename, or filename and not a full path. |
|
| 1143 | + * |
|
| 1144 | + * It is possible return an etag from this function, which will be used in |
|
| 1145 | + * the response to this PUT request. Note that the ETag must be surrounded |
|
| 1146 | + * by double-quotes. |
|
| 1147 | + * |
|
| 1148 | + * However, you should only really return this ETag if you don't mangle the |
|
| 1149 | + * calendar-data. If the result of a subsequent GET to this object is not |
|
| 1150 | + * the exact same as this request body, you should omit the ETag. |
|
| 1151 | + * |
|
| 1152 | + * @param mixed $calendarId |
|
| 1153 | + * @param string $objectUri |
|
| 1154 | + * @param string $calendarData |
|
| 1155 | + * @return string |
|
| 1156 | + */ |
|
| 1157 | + function updateCalendarObject($calendarId, $objectUri, $calendarData) { |
|
| 1158 | + $extraData = $this->getDenormalizedData($calendarData); |
|
| 1159 | + |
|
| 1160 | + $query = $this->db->getQueryBuilder(); |
|
| 1161 | + $query->update('calendarobjects') |
|
| 1162 | + ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) |
|
| 1163 | + ->set('lastmodified', $query->createNamedParameter(time())) |
|
| 1164 | + ->set('etag', $query->createNamedParameter($extraData['etag'])) |
|
| 1165 | + ->set('size', $query->createNamedParameter($extraData['size'])) |
|
| 1166 | + ->set('componenttype', $query->createNamedParameter($extraData['componentType'])) |
|
| 1167 | + ->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence'])) |
|
| 1168 | + ->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence'])) |
|
| 1169 | + ->set('classification', $query->createNamedParameter($extraData['classification'])) |
|
| 1170 | + ->set('uid', $query->createNamedParameter($extraData['uid'])) |
|
| 1171 | + ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
|
| 1172 | + ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 1173 | + ->execute(); |
|
| 1174 | + |
|
| 1175 | + $this->updateProperties($calendarId, $objectUri, $calendarData); |
|
| 1176 | + |
|
| 1177 | + $data = $this->getCalendarObject($calendarId, $objectUri); |
|
| 1178 | + if (is_array($data)) { |
|
| 1179 | + $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent( |
|
| 1180 | + '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', |
|
| 1181 | + [ |
|
| 1182 | + 'calendarId' => $calendarId, |
|
| 1183 | + 'calendarData' => $this->getCalendarById($calendarId), |
|
| 1184 | + 'shares' => $this->getShares($calendarId), |
|
| 1185 | + 'objectData' => $data, |
|
| 1186 | + ] |
|
| 1187 | + )); |
|
| 1188 | + } |
|
| 1189 | + $this->addChange($calendarId, $objectUri, 2); |
|
| 1190 | + |
|
| 1191 | + return '"' . $extraData['etag'] . '"'; |
|
| 1192 | + } |
|
| 1193 | + |
|
| 1194 | + /** |
|
| 1195 | + * @param int $calendarObjectId |
|
| 1196 | + * @param int $classification |
|
| 1197 | + */ |
|
| 1198 | + public function setClassification($calendarObjectId, $classification) { |
|
| 1199 | + if (!in_array($classification, [ |
|
| 1200 | + self::CLASSIFICATION_PUBLIC, self::CLASSIFICATION_PRIVATE, self::CLASSIFICATION_CONFIDENTIAL |
|
| 1201 | + ])) { |
|
| 1202 | + throw new \InvalidArgumentException(); |
|
| 1203 | + } |
|
| 1204 | + $query = $this->db->getQueryBuilder(); |
|
| 1205 | + $query->update('calendarobjects') |
|
| 1206 | + ->set('classification', $query->createNamedParameter($classification)) |
|
| 1207 | + ->where($query->expr()->eq('id', $query->createNamedParameter($calendarObjectId))) |
|
| 1208 | + ->execute(); |
|
| 1209 | + } |
|
| 1210 | + |
|
| 1211 | + /** |
|
| 1212 | + * Deletes an existing calendar object. |
|
| 1213 | + * |
|
| 1214 | + * The object uri is only the basename, or filename and not a full path. |
|
| 1215 | + * |
|
| 1216 | + * @param mixed $calendarId |
|
| 1217 | + * @param string $objectUri |
|
| 1218 | + * @return void |
|
| 1219 | + */ |
|
| 1220 | + function deleteCalendarObject($calendarId, $objectUri) { |
|
| 1221 | + $data = $this->getCalendarObject($calendarId, $objectUri); |
|
| 1222 | + if (is_array($data)) { |
|
| 1223 | + $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent( |
|
| 1224 | + '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', |
|
| 1225 | + [ |
|
| 1226 | + 'calendarId' => $calendarId, |
|
| 1227 | + 'calendarData' => $this->getCalendarById($calendarId), |
|
| 1228 | + 'shares' => $this->getShares($calendarId), |
|
| 1229 | + 'objectData' => $data, |
|
| 1230 | + ] |
|
| 1231 | + )); |
|
| 1232 | + } |
|
| 1233 | + |
|
| 1234 | + $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `uri` = ?'); |
|
| 1235 | + $stmt->execute([$calendarId, $objectUri]); |
|
| 1236 | + |
|
| 1237 | + $this->purgeProperties($calendarId, $data['id']); |
|
| 1238 | + |
|
| 1239 | + $this->addChange($calendarId, $objectUri, 3); |
|
| 1240 | + } |
|
| 1241 | + |
|
| 1242 | + /** |
|
| 1243 | + * Performs a calendar-query on the contents of this calendar. |
|
| 1244 | + * |
|
| 1245 | + * The calendar-query is defined in RFC4791 : CalDAV. Using the |
|
| 1246 | + * calendar-query it is possible for a client to request a specific set of |
|
| 1247 | + * object, based on contents of iCalendar properties, date-ranges and |
|
| 1248 | + * iCalendar component types (VTODO, VEVENT). |
|
| 1249 | + * |
|
| 1250 | + * This method should just return a list of (relative) urls that match this |
|
| 1251 | + * query. |
|
| 1252 | + * |
|
| 1253 | + * The list of filters are specified as an array. The exact array is |
|
| 1254 | + * documented by Sabre\CalDAV\CalendarQueryParser. |
|
| 1255 | + * |
|
| 1256 | + * Note that it is extremely likely that getCalendarObject for every path |
|
| 1257 | + * returned from this method will be called almost immediately after. You |
|
| 1258 | + * may want to anticipate this to speed up these requests. |
|
| 1259 | + * |
|
| 1260 | + * This method provides a default implementation, which parses *all* the |
|
| 1261 | + * iCalendar objects in the specified calendar. |
|
| 1262 | + * |
|
| 1263 | + * This default may well be good enough for personal use, and calendars |
|
| 1264 | + * that aren't very large. But if you anticipate high usage, big calendars |
|
| 1265 | + * or high loads, you are strongly advised to optimize certain paths. |
|
| 1266 | + * |
|
| 1267 | + * The best way to do so is override this method and to optimize |
|
| 1268 | + * specifically for 'common filters'. |
|
| 1269 | + * |
|
| 1270 | + * Requests that are extremely common are: |
|
| 1271 | + * * requests for just VEVENTS |
|
| 1272 | + * * requests for just VTODO |
|
| 1273 | + * * requests with a time-range-filter on either VEVENT or VTODO. |
|
| 1274 | + * |
|
| 1275 | + * ..and combinations of these requests. It may not be worth it to try to |
|
| 1276 | + * handle every possible situation and just rely on the (relatively |
|
| 1277 | + * easy to use) CalendarQueryValidator to handle the rest. |
|
| 1278 | + * |
|
| 1279 | + * Note that especially time-range-filters may be difficult to parse. A |
|
| 1280 | + * time-range filter specified on a VEVENT must for instance also handle |
|
| 1281 | + * recurrence rules correctly. |
|
| 1282 | + * A good example of how to interprete all these filters can also simply |
|
| 1283 | + * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct |
|
| 1284 | + * as possible, so it gives you a good idea on what type of stuff you need |
|
| 1285 | + * to think of. |
|
| 1286 | + * |
|
| 1287 | + * @param mixed $calendarId |
|
| 1288 | + * @param array $filters |
|
| 1289 | + * @return array |
|
| 1290 | + */ |
|
| 1291 | + function calendarQuery($calendarId, array $filters):array { |
|
| 1292 | + return $this->commonCalendarQuery('calendarobjects', 'calendarid', $calendarId, $filters); |
|
| 1293 | + } |
|
| 1294 | + |
|
| 1295 | + /** |
|
| 1296 | + * @param $subscriptionId |
|
| 1297 | + * @param array $filters |
|
| 1298 | + * @return array |
|
| 1299 | + */ |
|
| 1300 | + public function cachedCalendarQuery($subscriptionId, array $filters):array { |
|
| 1301 | + return $this->commonCalendarQuery('calendarsubscrobjects', 'subscriptionid', $subscriptionId, $filters); |
|
| 1302 | + } |
|
| 1303 | + |
|
| 1304 | + /** |
|
| 1305 | + * @param string $tablename |
|
| 1306 | + * @param string $selector |
|
| 1307 | + * @param $id |
|
| 1308 | + * @param array $filters |
|
| 1309 | + * @return array |
|
| 1310 | + */ |
|
| 1311 | + private function commonCalendarQuery(string $tablename, string $selector, $id, array $filters) { |
|
| 1312 | + $componentType = null; |
|
| 1313 | + $requirePostFilter = true; |
|
| 1314 | + $timeRange = null; |
|
| 1315 | + |
|
| 1316 | + // if no filters were specified, we don't need to filter after a query |
|
| 1317 | + if (!$filters['prop-filters'] && !$filters['comp-filters']) { |
|
| 1318 | + $requirePostFilter = false; |
|
| 1319 | + } |
|
| 1320 | + |
|
| 1321 | + // Figuring out if there's a component filter |
|
| 1322 | + if (count($filters['comp-filters']) > 0 && !$filters['comp-filters'][0]['is-not-defined']) { |
|
| 1323 | + $componentType = $filters['comp-filters'][0]['name']; |
|
| 1324 | + |
|
| 1325 | + // Checking if we need post-filters |
|
| 1326 | + if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['time-range'] && !$filters['comp-filters'][0]['prop-filters']) { |
|
| 1327 | + $requirePostFilter = false; |
|
| 1328 | + } |
|
| 1329 | + // There was a time-range filter |
|
| 1330 | + if ($componentType === 'VEVENT' && isset($filters['comp-filters'][0]['time-range'])) { |
|
| 1331 | + $timeRange = $filters['comp-filters'][0]['time-range']; |
|
| 1332 | + |
|
| 1333 | + // If start time OR the end time is not specified, we can do a |
|
| 1334 | + // 100% accurate mysql query. |
|
| 1335 | + if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['prop-filters'] && (!$timeRange['start'] || !$timeRange['end'])) { |
|
| 1336 | + $requirePostFilter = false; |
|
| 1337 | + } |
|
| 1338 | + } |
|
| 1339 | + |
|
| 1340 | + } |
|
| 1341 | + $columns = ['uri']; |
|
| 1342 | + if ($requirePostFilter) { |
|
| 1343 | + $columns = ['uri', 'calendardata']; |
|
| 1344 | + } |
|
| 1345 | + $query = $this->db->getQueryBuilder(); |
|
| 1346 | + $query->select($columns) |
|
| 1347 | + ->from($tablename) |
|
| 1348 | + ->where($query->expr()->eq($selector, $query->createNamedParameter($id))); |
|
| 1349 | + |
|
| 1350 | + if ($componentType) { |
|
| 1351 | + $query->andWhere($query->expr()->eq('componenttype', $query->createNamedParameter($componentType))); |
|
| 1352 | + } |
|
| 1353 | + |
|
| 1354 | + if ($timeRange && $timeRange['start']) { |
|
| 1355 | + $query->andWhere($query->expr()->gt('lastoccurence', $query->createNamedParameter($timeRange['start']->getTimeStamp()))); |
|
| 1356 | + } |
|
| 1357 | + if ($timeRange && $timeRange['end']) { |
|
| 1358 | + $query->andWhere($query->expr()->lt('firstoccurence', $query->createNamedParameter($timeRange['end']->getTimeStamp()))); |
|
| 1359 | + } |
|
| 1360 | + |
|
| 1361 | + $stmt = $query->execute(); |
|
| 1362 | + |
|
| 1363 | + $result = []; |
|
| 1364 | + while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1365 | + if ($requirePostFilter) { |
|
| 1366 | + // validateFilterForObject will parse the calendar data |
|
| 1367 | + // catch parsing errors |
|
| 1368 | + try { |
|
| 1369 | + $matches = $this->validateFilterForObject($row, $filters); |
|
| 1370 | + } catch(ParseException $ex) { |
|
| 1371 | + $this->logger->logException($ex, [ |
|
| 1372 | + 'app' => 'dav', |
|
| 1373 | + 'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri'] |
|
| 1374 | + ]); |
|
| 1375 | + continue; |
|
| 1376 | + } catch (InvalidDataException $ex) { |
|
| 1377 | + $this->logger->logException($ex, [ |
|
| 1378 | + 'app' => 'dav', |
|
| 1379 | + 'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri'] |
|
| 1380 | + ]); |
|
| 1381 | + continue; |
|
| 1382 | + } |
|
| 1383 | + |
|
| 1384 | + if (!$matches) { |
|
| 1385 | + continue; |
|
| 1386 | + } |
|
| 1387 | + } |
|
| 1388 | + $result[] = $row['uri']; |
|
| 1389 | + } |
|
| 1390 | + |
|
| 1391 | + return $result; |
|
| 1392 | + } |
|
| 1393 | + |
|
| 1394 | + /** |
|
| 1395 | + * custom Nextcloud search extension for CalDAV |
|
| 1396 | + * |
|
| 1397 | + * @param string $principalUri |
|
| 1398 | + * @param array $filters |
|
| 1399 | + * @param integer|null $limit |
|
| 1400 | + * @param integer|null $offset |
|
| 1401 | + * @return array |
|
| 1402 | + */ |
|
| 1403 | + public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) { |
|
| 1404 | + $calendars = $this->getCalendarsForUser($principalUri); |
|
| 1405 | + $ownCalendars = []; |
|
| 1406 | + $sharedCalendars = []; |
|
| 1407 | + |
|
| 1408 | + $uriMapper = []; |
|
| 1409 | + |
|
| 1410 | + foreach($calendars as $calendar) { |
|
| 1411 | + if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { |
|
| 1412 | + $ownCalendars[] = $calendar['id']; |
|
| 1413 | + } else { |
|
| 1414 | + $sharedCalendars[] = $calendar['id']; |
|
| 1415 | + } |
|
| 1416 | + $uriMapper[$calendar['id']] = $calendar['uri']; |
|
| 1417 | + } |
|
| 1418 | + if (count($ownCalendars) === 0 && count($sharedCalendars) === 0) { |
|
| 1419 | + return []; |
|
| 1420 | + } |
|
| 1421 | + |
|
| 1422 | + $query = $this->db->getQueryBuilder(); |
|
| 1423 | + // Calendar id expressions |
|
| 1424 | + $calendarExpressions = []; |
|
| 1425 | + foreach($ownCalendars as $id) { |
|
| 1426 | + $calendarExpressions[] = $query->expr() |
|
| 1427 | + ->eq('c.calendarid', $query->createNamedParameter($id)); |
|
| 1428 | + } |
|
| 1429 | + foreach($sharedCalendars as $id) { |
|
| 1430 | + $calendarExpressions[] = $query->expr()->andX( |
|
| 1431 | + $query->expr()->eq('c.calendarid', |
|
| 1432 | + $query->createNamedParameter($id)), |
|
| 1433 | + $query->expr()->eq('c.classification', |
|
| 1434 | + $query->createNamedParameter(self::CLASSIFICATION_PUBLIC)) |
|
| 1435 | + ); |
|
| 1436 | + } |
|
| 1437 | + |
|
| 1438 | + if (count($calendarExpressions) === 1) { |
|
| 1439 | + $calExpr = $calendarExpressions[0]; |
|
| 1440 | + } else { |
|
| 1441 | + $calExpr = call_user_func_array([$query->expr(), 'orX'], $calendarExpressions); |
|
| 1442 | + } |
|
| 1443 | + |
|
| 1444 | + // Component expressions |
|
| 1445 | + $compExpressions = []; |
|
| 1446 | + foreach($filters['comps'] as $comp) { |
|
| 1447 | + $compExpressions[] = $query->expr() |
|
| 1448 | + ->eq('c.componenttype', $query->createNamedParameter($comp)); |
|
| 1449 | + } |
|
| 1450 | + |
|
| 1451 | + if (count($compExpressions) === 1) { |
|
| 1452 | + $compExpr = $compExpressions[0]; |
|
| 1453 | + } else { |
|
| 1454 | + $compExpr = call_user_func_array([$query->expr(), 'orX'], $compExpressions); |
|
| 1455 | + } |
|
| 1456 | + |
|
| 1457 | + if (!isset($filters['props'])) { |
|
| 1458 | + $filters['props'] = []; |
|
| 1459 | + } |
|
| 1460 | + if (!isset($filters['params'])) { |
|
| 1461 | + $filters['params'] = []; |
|
| 1462 | + } |
|
| 1463 | + |
|
| 1464 | + $propParamExpressions = []; |
|
| 1465 | + foreach($filters['props'] as $prop) { |
|
| 1466 | + $propParamExpressions[] = $query->expr()->andX( |
|
| 1467 | + $query->expr()->eq('i.name', $query->createNamedParameter($prop)), |
|
| 1468 | + $query->expr()->isNull('i.parameter') |
|
| 1469 | + ); |
|
| 1470 | + } |
|
| 1471 | + foreach($filters['params'] as $param) { |
|
| 1472 | + $propParamExpressions[] = $query->expr()->andX( |
|
| 1473 | + $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), |
|
| 1474 | + $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) |
|
| 1475 | + ); |
|
| 1476 | + } |
|
| 1477 | + |
|
| 1478 | + if (count($propParamExpressions) === 1) { |
|
| 1479 | + $propParamExpr = $propParamExpressions[0]; |
|
| 1480 | + } else { |
|
| 1481 | + $propParamExpr = call_user_func_array([$query->expr(), 'orX'], $propParamExpressions); |
|
| 1482 | + } |
|
| 1483 | + |
|
| 1484 | + $query->select(['c.calendarid', 'c.uri']) |
|
| 1485 | + ->from($this->dbObjectPropertiesTable, 'i') |
|
| 1486 | + ->join('i', 'calendarobjects', 'c', $query->expr()->eq('i.objectid', 'c.id')) |
|
| 1487 | + ->where($calExpr) |
|
| 1488 | + ->andWhere($compExpr) |
|
| 1489 | + ->andWhere($propParamExpr) |
|
| 1490 | + ->andWhere($query->expr()->iLike('i.value', |
|
| 1491 | + $query->createNamedParameter('%'.$this->db->escapeLikeParameter($filters['search-term']).'%'))); |
|
| 1492 | + |
|
| 1493 | + if ($offset) { |
|
| 1494 | + $query->setFirstResult($offset); |
|
| 1495 | + } |
|
| 1496 | + if ($limit) { |
|
| 1497 | + $query->setMaxResults($limit); |
|
| 1498 | + } |
|
| 1499 | + |
|
| 1500 | + $stmt = $query->execute(); |
|
| 1501 | + |
|
| 1502 | + $result = []; |
|
| 1503 | + while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1504 | + $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
| 1505 | + if (!in_array($path, $result)) { |
|
| 1506 | + $result[] = $path; |
|
| 1507 | + } |
|
| 1508 | + } |
|
| 1509 | + |
|
| 1510 | + return $result; |
|
| 1511 | + } |
|
| 1512 | + |
|
| 1513 | + /** |
|
| 1514 | + * used for Nextcloud's calendar API |
|
| 1515 | + * |
|
| 1516 | + * @param array $calendarInfo |
|
| 1517 | + * @param string $pattern |
|
| 1518 | + * @param array $searchProperties |
|
| 1519 | + * @param array $options |
|
| 1520 | + * @param integer|null $limit |
|
| 1521 | + * @param integer|null $offset |
|
| 1522 | + * |
|
| 1523 | + * @return array |
|
| 1524 | + */ |
|
| 1525 | + public function search(array $calendarInfo, $pattern, array $searchProperties, |
|
| 1526 | + array $options, $limit, $offset) { |
|
| 1527 | + $outerQuery = $this->db->getQueryBuilder(); |
|
| 1528 | + $innerQuery = $this->db->getQueryBuilder(); |
|
| 1529 | + |
|
| 1530 | + $innerQuery->selectDistinct('op.objectid') |
|
| 1531 | + ->from($this->dbObjectPropertiesTable, 'op') |
|
| 1532 | + ->andWhere($innerQuery->expr()->eq('op.calendarid', |
|
| 1533 | + $outerQuery->createNamedParameter($calendarInfo['id']))); |
|
| 1534 | + |
|
| 1535 | + // only return public items for shared calendars for now |
|
| 1536 | + if ($calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) { |
|
| 1537 | + $innerQuery->andWhere($innerQuery->expr()->eq('c.classification', |
|
| 1538 | + $outerQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC))); |
|
| 1539 | + } |
|
| 1540 | + |
|
| 1541 | + $or = $innerQuery->expr()->orX(); |
|
| 1542 | + foreach($searchProperties as $searchProperty) { |
|
| 1543 | + $or->add($innerQuery->expr()->eq('op.name', |
|
| 1544 | + $outerQuery->createNamedParameter($searchProperty))); |
|
| 1545 | + } |
|
| 1546 | + $innerQuery->andWhere($or); |
|
| 1547 | + |
|
| 1548 | + if ($pattern !== '') { |
|
| 1549 | + $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
|
| 1550 | + $outerQuery->createNamedParameter('%' . |
|
| 1551 | + $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1552 | + } |
|
| 1553 | + |
|
| 1554 | + $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri') |
|
| 1555 | + ->from('calendarobjects', 'c'); |
|
| 1556 | + |
|
| 1557 | + if (isset($options['timerange'])) { |
|
| 1558 | + if (isset($options['timerange']['start'])) { |
|
| 1559 | + $outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence', |
|
| 1560 | + $outerQuery->createNamedParameter($options['timerange']['start']->getTimeStamp))); |
|
| 1561 | + |
|
| 1562 | + } |
|
| 1563 | + if (isset($options['timerange']['end'])) { |
|
| 1564 | + $outerQuery->andWhere($outerQuery->expr()->lt('firstoccurence', |
|
| 1565 | + $outerQuery->createNamedParameter($options['timerange']['end']->getTimeStamp))); |
|
| 1566 | + } |
|
| 1567 | + } |
|
| 1568 | + |
|
| 1569 | + if (isset($options['types'])) { |
|
| 1570 | + $or = $outerQuery->expr()->orX(); |
|
| 1571 | + foreach($options['types'] as $type) { |
|
| 1572 | + $or->add($outerQuery->expr()->eq('componenttype', |
|
| 1573 | + $outerQuery->createNamedParameter($type))); |
|
| 1574 | + } |
|
| 1575 | + $outerQuery->andWhere($or); |
|
| 1576 | + } |
|
| 1577 | + |
|
| 1578 | + $outerQuery->andWhere($outerQuery->expr()->in('c.id', |
|
| 1579 | + $outerQuery->createFunction($innerQuery->getSQL()))); |
|
| 1580 | + |
|
| 1581 | + if ($offset) { |
|
| 1582 | + $outerQuery->setFirstResult($offset); |
|
| 1583 | + } |
|
| 1584 | + if ($limit) { |
|
| 1585 | + $outerQuery->setMaxResults($limit); |
|
| 1586 | + } |
|
| 1587 | + |
|
| 1588 | + $result = $outerQuery->execute(); |
|
| 1589 | + $calendarObjects = $result->fetchAll(); |
|
| 1590 | + |
|
| 1591 | + return array_map(function($o) { |
|
| 1592 | + $calendarData = Reader::read($o['calendardata']); |
|
| 1593 | + $comps = $calendarData->getComponents(); |
|
| 1594 | + $objects = []; |
|
| 1595 | + $timezones = []; |
|
| 1596 | + foreach($comps as $comp) { |
|
| 1597 | + if ($comp instanceof VTimeZone) { |
|
| 1598 | + $timezones[] = $comp; |
|
| 1599 | + } else { |
|
| 1600 | + $objects[] = $comp; |
|
| 1601 | + } |
|
| 1602 | + } |
|
| 1603 | + |
|
| 1604 | + return [ |
|
| 1605 | + 'id' => $o['id'], |
|
| 1606 | + 'type' => $o['componenttype'], |
|
| 1607 | + 'uid' => $o['uid'], |
|
| 1608 | + 'uri' => $o['uri'], |
|
| 1609 | + 'objects' => array_map(function($c) { |
|
| 1610 | + return $this->transformSearchData($c); |
|
| 1611 | + }, $objects), |
|
| 1612 | + 'timezones' => array_map(function($c) { |
|
| 1613 | + return $this->transformSearchData($c); |
|
| 1614 | + }, $timezones), |
|
| 1615 | + ]; |
|
| 1616 | + }, $calendarObjects); |
|
| 1617 | + } |
|
| 1618 | + |
|
| 1619 | + /** |
|
| 1620 | + * @param Component $comp |
|
| 1621 | + * @return array |
|
| 1622 | + */ |
|
| 1623 | + private function transformSearchData(Component $comp) { |
|
| 1624 | + $data = []; |
|
| 1625 | + /** @var Component[] $subComponents */ |
|
| 1626 | + $subComponents = $comp->getComponents(); |
|
| 1627 | + /** @var Property[] $properties */ |
|
| 1628 | + $properties = array_filter($comp->children(), function($c) { |
|
| 1629 | + return $c instanceof Property; |
|
| 1630 | + }); |
|
| 1631 | + $validationRules = $comp->getValidationRules(); |
|
| 1632 | + |
|
| 1633 | + foreach($subComponents as $subComponent) { |
|
| 1634 | + $name = $subComponent->name; |
|
| 1635 | + if (!isset($data[$name])) { |
|
| 1636 | + $data[$name] = []; |
|
| 1637 | + } |
|
| 1638 | + $data[$name][] = $this->transformSearchData($subComponent); |
|
| 1639 | + } |
|
| 1640 | + |
|
| 1641 | + foreach($properties as $property) { |
|
| 1642 | + $name = $property->name; |
|
| 1643 | + if (!isset($validationRules[$name])) { |
|
| 1644 | + $validationRules[$name] = '*'; |
|
| 1645 | + } |
|
| 1646 | + |
|
| 1647 | + $rule = $validationRules[$property->name]; |
|
| 1648 | + if ($rule === '+' || $rule === '*') { // multiple |
|
| 1649 | + if (!isset($data[$name])) { |
|
| 1650 | + $data[$name] = []; |
|
| 1651 | + } |
|
| 1652 | + |
|
| 1653 | + $data[$name][] = $this->transformSearchProperty($property); |
|
| 1654 | + } else { // once |
|
| 1655 | + $data[$name] = $this->transformSearchProperty($property); |
|
| 1656 | + } |
|
| 1657 | + } |
|
| 1658 | + |
|
| 1659 | + return $data; |
|
| 1660 | + } |
|
| 1661 | + |
|
| 1662 | + /** |
|
| 1663 | + * @param Property $prop |
|
| 1664 | + * @return array |
|
| 1665 | + */ |
|
| 1666 | + private function transformSearchProperty(Property $prop) { |
|
| 1667 | + // No need to check Date, as it extends DateTime |
|
| 1668 | + if ($prop instanceof Property\ICalendar\DateTime) { |
|
| 1669 | + $value = $prop->getDateTime(); |
|
| 1670 | + } else { |
|
| 1671 | + $value = $prop->getValue(); |
|
| 1672 | + } |
|
| 1673 | + |
|
| 1674 | + return [ |
|
| 1675 | + $value, |
|
| 1676 | + $prop->parameters() |
|
| 1677 | + ]; |
|
| 1678 | + } |
|
| 1679 | + |
|
| 1680 | + /** |
|
| 1681 | + * Searches through all of a users calendars and calendar objects to find |
|
| 1682 | + * an object with a specific UID. |
|
| 1683 | + * |
|
| 1684 | + * This method should return the path to this object, relative to the |
|
| 1685 | + * calendar home, so this path usually only contains two parts: |
|
| 1686 | + * |
|
| 1687 | + * calendarpath/objectpath.ics |
|
| 1688 | + * |
|
| 1689 | + * If the uid is not found, return null. |
|
| 1690 | + * |
|
| 1691 | + * This method should only consider * objects that the principal owns, so |
|
| 1692 | + * any calendars owned by other principals that also appear in this |
|
| 1693 | + * collection should be ignored. |
|
| 1694 | + * |
|
| 1695 | + * @param string $principalUri |
|
| 1696 | + * @param string $uid |
|
| 1697 | + * @return string|null |
|
| 1698 | + */ |
|
| 1699 | + function getCalendarObjectByUID($principalUri, $uid) { |
|
| 1700 | + |
|
| 1701 | + $query = $this->db->getQueryBuilder(); |
|
| 1702 | + $query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi') |
|
| 1703 | + ->from('calendarobjects', 'co') |
|
| 1704 | + ->leftJoin('co', 'calendars', 'c', $query->expr()->eq('co.calendarid', 'c.id')) |
|
| 1705 | + ->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri))) |
|
| 1706 | + ->andWhere($query->expr()->eq('co.uid', $query->createNamedParameter($uid))); |
|
| 1707 | + |
|
| 1708 | + $stmt = $query->execute(); |
|
| 1709 | + |
|
| 1710 | + if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1711 | + return $row['calendaruri'] . '/' . $row['objecturi']; |
|
| 1712 | + } |
|
| 1713 | + |
|
| 1714 | + return null; |
|
| 1715 | + } |
|
| 1716 | + |
|
| 1717 | + /** |
|
| 1718 | + * The getChanges method returns all the changes that have happened, since |
|
| 1719 | + * the specified syncToken in the specified calendar. |
|
| 1720 | + * |
|
| 1721 | + * This function should return an array, such as the following: |
|
| 1722 | + * |
|
| 1723 | + * [ |
|
| 1724 | + * 'syncToken' => 'The current synctoken', |
|
| 1725 | + * 'added' => [ |
|
| 1726 | + * 'new.txt', |
|
| 1727 | + * ], |
|
| 1728 | + * 'modified' => [ |
|
| 1729 | + * 'modified.txt', |
|
| 1730 | + * ], |
|
| 1731 | + * 'deleted' => [ |
|
| 1732 | + * 'foo.php.bak', |
|
| 1733 | + * 'old.txt' |
|
| 1734 | + * ] |
|
| 1735 | + * ); |
|
| 1736 | + * |
|
| 1737 | + * The returned syncToken property should reflect the *current* syncToken |
|
| 1738 | + * of the calendar, as reported in the {http://sabredav.org/ns}sync-token |
|
| 1739 | + * property This is * needed here too, to ensure the operation is atomic. |
|
| 1740 | + * |
|
| 1741 | + * If the $syncToken argument is specified as null, this is an initial |
|
| 1742 | + * sync, and all members should be reported. |
|
| 1743 | + * |
|
| 1744 | + * The modified property is an array of nodenames that have changed since |
|
| 1745 | + * the last token. |
|
| 1746 | + * |
|
| 1747 | + * The deleted property is an array with nodenames, that have been deleted |
|
| 1748 | + * from collection. |
|
| 1749 | + * |
|
| 1750 | + * The $syncLevel argument is basically the 'depth' of the report. If it's |
|
| 1751 | + * 1, you only have to report changes that happened only directly in |
|
| 1752 | + * immediate descendants. If it's 2, it should also include changes from |
|
| 1753 | + * the nodes below the child collections. (grandchildren) |
|
| 1754 | + * |
|
| 1755 | + * The $limit argument allows a client to specify how many results should |
|
| 1756 | + * be returned at most. If the limit is not specified, it should be treated |
|
| 1757 | + * as infinite. |
|
| 1758 | + * |
|
| 1759 | + * If the limit (infinite or not) is higher than you're willing to return, |
|
| 1760 | + * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. |
|
| 1761 | + * |
|
| 1762 | + * If the syncToken is expired (due to data cleanup) or unknown, you must |
|
| 1763 | + * return null. |
|
| 1764 | + * |
|
| 1765 | + * The limit is 'suggestive'. You are free to ignore it. |
|
| 1766 | + * |
|
| 1767 | + * @param string $calendarId |
|
| 1768 | + * @param string $syncToken |
|
| 1769 | + * @param int $syncLevel |
|
| 1770 | + * @param int $limit |
|
| 1771 | + * @return array |
|
| 1772 | + */ |
|
| 1773 | + function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) { |
|
| 1774 | + // Current synctoken |
|
| 1775 | + $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); |
|
| 1776 | + $stmt->execute([ $calendarId ]); |
|
| 1777 | + $currentToken = $stmt->fetchColumn(0); |
|
| 1778 | + |
|
| 1779 | + if (is_null($currentToken)) { |
|
| 1780 | + return null; |
|
| 1781 | + } |
|
| 1782 | + |
|
| 1783 | + $result = [ |
|
| 1784 | + 'syncToken' => $currentToken, |
|
| 1785 | + 'added' => [], |
|
| 1786 | + 'modified' => [], |
|
| 1787 | + 'deleted' => [], |
|
| 1788 | + ]; |
|
| 1789 | + |
|
| 1790 | + if ($syncToken) { |
|
| 1791 | + |
|
| 1792 | + $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`"; |
|
| 1793 | + if ($limit>0) { |
|
| 1794 | + $query.= " LIMIT " . (int)$limit; |
|
| 1795 | + } |
|
| 1796 | + |
|
| 1797 | + // Fetching all changes |
|
| 1798 | + $stmt = $this->db->prepare($query); |
|
| 1799 | + $stmt->execute([$syncToken, $currentToken, $calendarId]); |
|
| 1800 | + |
|
| 1801 | + $changes = []; |
|
| 1802 | + |
|
| 1803 | + // This loop ensures that any duplicates are overwritten, only the |
|
| 1804 | + // last change on a node is relevant. |
|
| 1805 | + while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1806 | + |
|
| 1807 | + $changes[$row['uri']] = $row['operation']; |
|
| 1808 | + |
|
| 1809 | + } |
|
| 1810 | + |
|
| 1811 | + foreach($changes as $uri => $operation) { |
|
| 1812 | + |
|
| 1813 | + switch($operation) { |
|
| 1814 | + case 1 : |
|
| 1815 | + $result['added'][] = $uri; |
|
| 1816 | + break; |
|
| 1817 | + case 2 : |
|
| 1818 | + $result['modified'][] = $uri; |
|
| 1819 | + break; |
|
| 1820 | + case 3 : |
|
| 1821 | + $result['deleted'][] = $uri; |
|
| 1822 | + break; |
|
| 1823 | + } |
|
| 1824 | + |
|
| 1825 | + } |
|
| 1826 | + } else { |
|
| 1827 | + // No synctoken supplied, this is the initial sync. |
|
| 1828 | + $query = "SELECT `uri` FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ?"; |
|
| 1829 | + $stmt = $this->db->prepare($query); |
|
| 1830 | + $stmt->execute([$calendarId]); |
|
| 1831 | + |
|
| 1832 | + $result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN); |
|
| 1833 | + } |
|
| 1834 | + return $result; |
|
| 1835 | + |
|
| 1836 | + } |
|
| 1837 | + |
|
| 1838 | + /** |
|
| 1839 | + * Returns a list of subscriptions for a principal. |
|
| 1840 | + * |
|
| 1841 | + * Every subscription is an array with the following keys: |
|
| 1842 | + * * id, a unique id that will be used by other functions to modify the |
|
| 1843 | + * subscription. This can be the same as the uri or a database key. |
|
| 1844 | + * * uri. This is just the 'base uri' or 'filename' of the subscription. |
|
| 1845 | + * * principaluri. The owner of the subscription. Almost always the same as |
|
| 1846 | + * principalUri passed to this method. |
|
| 1847 | + * |
|
| 1848 | + * Furthermore, all the subscription info must be returned too: |
|
| 1849 | + * |
|
| 1850 | + * 1. {DAV:}displayname |
|
| 1851 | + * 2. {http://apple.com/ns/ical/}refreshrate |
|
| 1852 | + * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos |
|
| 1853 | + * should not be stripped). |
|
| 1854 | + * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms |
|
| 1855 | + * should not be stripped). |
|
| 1856 | + * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if |
|
| 1857 | + * attachments should not be stripped). |
|
| 1858 | + * 6. {http://calendarserver.org/ns/}source (Must be a |
|
| 1859 | + * Sabre\DAV\Property\Href). |
|
| 1860 | + * 7. {http://apple.com/ns/ical/}calendar-color |
|
| 1861 | + * 8. {http://apple.com/ns/ical/}calendar-order |
|
| 1862 | + * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set |
|
| 1863 | + * (should just be an instance of |
|
| 1864 | + * Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of |
|
| 1865 | + * default components). |
|
| 1866 | + * |
|
| 1867 | + * @param string $principalUri |
|
| 1868 | + * @return array |
|
| 1869 | + */ |
|
| 1870 | + function getSubscriptionsForUser($principalUri) { |
|
| 1871 | + $fields = array_values($this->subscriptionPropertyMap); |
|
| 1872 | + $fields[] = 'id'; |
|
| 1873 | + $fields[] = 'uri'; |
|
| 1874 | + $fields[] = 'source'; |
|
| 1875 | + $fields[] = 'principaluri'; |
|
| 1876 | + $fields[] = 'lastmodified'; |
|
| 1877 | + |
|
| 1878 | + $query = $this->db->getQueryBuilder(); |
|
| 1879 | + $query->select($fields) |
|
| 1880 | + ->from('calendarsubscriptions') |
|
| 1881 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 1882 | + ->orderBy('calendarorder', 'asc'); |
|
| 1883 | + $stmt =$query->execute(); |
|
| 1884 | + |
|
| 1885 | + $subscriptions = []; |
|
| 1886 | + while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1887 | + |
|
| 1888 | + $subscription = [ |
|
| 1889 | + 'id' => $row['id'], |
|
| 1890 | + 'uri' => $row['uri'], |
|
| 1891 | + 'principaluri' => $row['principaluri'], |
|
| 1892 | + 'source' => $row['source'], |
|
| 1893 | + 'lastmodified' => $row['lastmodified'], |
|
| 1894 | + |
|
| 1895 | + '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 1896 | + ]; |
|
| 1897 | + |
|
| 1898 | + foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1899 | + if (!is_null($row[$dbName])) { |
|
| 1900 | + $subscription[$xmlName] = $row[$dbName]; |
|
| 1901 | + } |
|
| 1902 | + } |
|
| 1903 | + |
|
| 1904 | + $subscriptions[] = $subscription; |
|
| 1905 | + |
|
| 1906 | + } |
|
| 1907 | + |
|
| 1908 | + return $subscriptions; |
|
| 1909 | + } |
|
| 1910 | + |
|
| 1911 | + /** |
|
| 1912 | + * Creates a new subscription for a principal. |
|
| 1913 | + * |
|
| 1914 | + * If the creation was a success, an id must be returned that can be used to reference |
|
| 1915 | + * this subscription in other methods, such as updateSubscription. |
|
| 1916 | + * |
|
| 1917 | + * @param string $principalUri |
|
| 1918 | + * @param string $uri |
|
| 1919 | + * @param array $properties |
|
| 1920 | + * @return mixed |
|
| 1921 | + */ |
|
| 1922 | + function createSubscription($principalUri, $uri, array $properties) { |
|
| 1923 | + |
|
| 1924 | + if (!isset($properties['{http://calendarserver.org/ns/}source'])) { |
|
| 1925 | + throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions'); |
|
| 1926 | + } |
|
| 1927 | + |
|
| 1928 | + $values = [ |
|
| 1929 | + 'principaluri' => $principalUri, |
|
| 1930 | + 'uri' => $uri, |
|
| 1931 | + 'source' => $properties['{http://calendarserver.org/ns/}source']->getHref(), |
|
| 1932 | + 'lastmodified' => time(), |
|
| 1933 | + ]; |
|
| 1934 | + |
|
| 1935 | + $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; |
|
| 1936 | + |
|
| 1937 | + foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1938 | + if (array_key_exists($xmlName, $properties)) { |
|
| 1939 | + $values[$dbName] = $properties[$xmlName]; |
|
| 1940 | + if (in_array($dbName, $propertiesBoolean)) { |
|
| 1941 | + $values[$dbName] = true; |
|
| 1942 | + } |
|
| 1943 | + } |
|
| 1944 | + } |
|
| 1945 | + |
|
| 1946 | + $valuesToInsert = array(); |
|
| 1947 | + |
|
| 1948 | + $query = $this->db->getQueryBuilder(); |
|
| 1949 | + |
|
| 1950 | + foreach (array_keys($values) as $name) { |
|
| 1951 | + $valuesToInsert[$name] = $query->createNamedParameter($values[$name]); |
|
| 1952 | + } |
|
| 1953 | + |
|
| 1954 | + $query->insert('calendarsubscriptions') |
|
| 1955 | + ->values($valuesToInsert) |
|
| 1956 | + ->execute(); |
|
| 1957 | + |
|
| 1958 | + $subscriptionId = $this->db->lastInsertId('*PREFIX*calendarsubscriptions'); |
|
| 1959 | + |
|
| 1960 | + $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', new GenericEvent( |
|
| 1961 | + '\OCA\DAV\CalDAV\CalDavBackend::createSubscription', |
|
| 1962 | + [ |
|
| 1963 | + 'subscriptionId' => $subscriptionId, |
|
| 1964 | + 'subscriptionData' => $this->getSubscriptionById($subscriptionId), |
|
| 1965 | + ])); |
|
| 1966 | + |
|
| 1967 | + return $subscriptionId; |
|
| 1968 | + } |
|
| 1969 | + |
|
| 1970 | + /** |
|
| 1971 | + * Updates a subscription |
|
| 1972 | + * |
|
| 1973 | + * The list of mutations is stored in a Sabre\DAV\PropPatch object. |
|
| 1974 | + * To do the actual updates, you must tell this object which properties |
|
| 1975 | + * you're going to process with the handle() method. |
|
| 1976 | + * |
|
| 1977 | + * Calling the handle method is like telling the PropPatch object "I |
|
| 1978 | + * promise I can handle updating this property". |
|
| 1979 | + * |
|
| 1980 | + * Read the PropPatch documentation for more info and examples. |
|
| 1981 | + * |
|
| 1982 | + * @param mixed $subscriptionId |
|
| 1983 | + * @param PropPatch $propPatch |
|
| 1984 | + * @return void |
|
| 1985 | + */ |
|
| 1986 | + function updateSubscription($subscriptionId, PropPatch $propPatch) { |
|
| 1987 | + $supportedProperties = array_keys($this->subscriptionPropertyMap); |
|
| 1988 | + $supportedProperties[] = '{http://calendarserver.org/ns/}source'; |
|
| 1989 | + |
|
| 1990 | + /** |
|
| 1991 | + * @suppress SqlInjectionChecker |
|
| 1992 | + */ |
|
| 1993 | + $propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) { |
|
| 1994 | + |
|
| 1995 | + $newValues = []; |
|
| 1996 | + |
|
| 1997 | + foreach($mutations as $propertyName=>$propertyValue) { |
|
| 1998 | + if ($propertyName === '{http://calendarserver.org/ns/}source') { |
|
| 1999 | + $newValues['source'] = $propertyValue->getHref(); |
|
| 2000 | + } else { |
|
| 2001 | + $fieldName = $this->subscriptionPropertyMap[$propertyName]; |
|
| 2002 | + $newValues[$fieldName] = $propertyValue; |
|
| 2003 | + } |
|
| 2004 | + } |
|
| 2005 | + |
|
| 2006 | + $query = $this->db->getQueryBuilder(); |
|
| 2007 | + $query->update('calendarsubscriptions') |
|
| 2008 | + ->set('lastmodified', $query->createNamedParameter(time())); |
|
| 2009 | + foreach($newValues as $fieldName=>$value) { |
|
| 2010 | + $query->set($fieldName, $query->createNamedParameter($value)); |
|
| 2011 | + } |
|
| 2012 | + $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
|
| 2013 | + ->execute(); |
|
| 2014 | + |
|
| 2015 | + $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent( |
|
| 2016 | + '\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', |
|
| 2017 | + [ |
|
| 2018 | + 'subscriptionId' => $subscriptionId, |
|
| 2019 | + 'subscriptionData' => $this->getSubscriptionById($subscriptionId), |
|
| 2020 | + 'propertyMutations' => $mutations, |
|
| 2021 | + ])); |
|
| 2022 | + |
|
| 2023 | + return true; |
|
| 2024 | + |
|
| 2025 | + }); |
|
| 2026 | + } |
|
| 2027 | + |
|
| 2028 | + /** |
|
| 2029 | + * Deletes a subscription. |
|
| 2030 | + * |
|
| 2031 | + * @param mixed $subscriptionId |
|
| 2032 | + * @return void |
|
| 2033 | + */ |
|
| 2034 | + function deleteSubscription($subscriptionId) { |
|
| 2035 | + $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', new GenericEvent( |
|
| 2036 | + '\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', |
|
| 2037 | + [ |
|
| 2038 | + 'subscriptionId' => $subscriptionId, |
|
| 2039 | + 'subscriptionData' => $this->getSubscriptionById($subscriptionId), |
|
| 2040 | + ])); |
|
| 2041 | + |
|
| 2042 | + $query = $this->db->getQueryBuilder(); |
|
| 2043 | + $query->delete('calendarsubscriptions') |
|
| 2044 | + ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
|
| 2045 | + ->execute(); |
|
| 2046 | + } |
|
| 2047 | + |
|
| 2048 | + /** |
|
| 2049 | + * Returns a single scheduling object for the inbox collection. |
|
| 2050 | + * |
|
| 2051 | + * The returned array should contain the following elements: |
|
| 2052 | + * * uri - A unique basename for the object. This will be used to |
|
| 2053 | + * construct a full uri. |
|
| 2054 | + * * calendardata - The iCalendar object |
|
| 2055 | + * * lastmodified - The last modification date. Can be an int for a unix |
|
| 2056 | + * timestamp, or a PHP DateTime object. |
|
| 2057 | + * * etag - A unique token that must change if the object changed. |
|
| 2058 | + * * size - The size of the object, in bytes. |
|
| 2059 | + * |
|
| 2060 | + * @param string $principalUri |
|
| 2061 | + * @param string $objectUri |
|
| 2062 | + * @return array |
|
| 2063 | + */ |
|
| 2064 | + function getSchedulingObject($principalUri, $objectUri) { |
|
| 2065 | + $query = $this->db->getQueryBuilder(); |
|
| 2066 | + $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) |
|
| 2067 | + ->from('schedulingobjects') |
|
| 2068 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2069 | + ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 2070 | + ->execute(); |
|
| 2071 | + |
|
| 2072 | + $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
|
| 2073 | + |
|
| 2074 | + if(!$row) { |
|
| 2075 | + return null; |
|
| 2076 | + } |
|
| 2077 | + |
|
| 2078 | + return [ |
|
| 2079 | + 'uri' => $row['uri'], |
|
| 2080 | + 'calendardata' => $row['calendardata'], |
|
| 2081 | + 'lastmodified' => $row['lastmodified'], |
|
| 2082 | + 'etag' => '"' . $row['etag'] . '"', |
|
| 2083 | + 'size' => (int)$row['size'], |
|
| 2084 | + ]; |
|
| 2085 | + } |
|
| 2086 | + |
|
| 2087 | + /** |
|
| 2088 | + * Returns all scheduling objects for the inbox collection. |
|
| 2089 | + * |
|
| 2090 | + * These objects should be returned as an array. Every item in the array |
|
| 2091 | + * should follow the same structure as returned from getSchedulingObject. |
|
| 2092 | + * |
|
| 2093 | + * The main difference is that 'calendardata' is optional. |
|
| 2094 | + * |
|
| 2095 | + * @param string $principalUri |
|
| 2096 | + * @return array |
|
| 2097 | + */ |
|
| 2098 | + function getSchedulingObjects($principalUri) { |
|
| 2099 | + $query = $this->db->getQueryBuilder(); |
|
| 2100 | + $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) |
|
| 2101 | + ->from('schedulingobjects') |
|
| 2102 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2103 | + ->execute(); |
|
| 2104 | + |
|
| 2105 | + $result = []; |
|
| 2106 | + foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 2107 | + $result[] = [ |
|
| 2108 | + 'calendardata' => $row['calendardata'], |
|
| 2109 | + 'uri' => $row['uri'], |
|
| 2110 | + 'lastmodified' => $row['lastmodified'], |
|
| 2111 | + 'etag' => '"' . $row['etag'] . '"', |
|
| 2112 | + 'size' => (int)$row['size'], |
|
| 2113 | + ]; |
|
| 2114 | + } |
|
| 2115 | + |
|
| 2116 | + return $result; |
|
| 2117 | + } |
|
| 2118 | + |
|
| 2119 | + /** |
|
| 2120 | + * Deletes a scheduling object from the inbox collection. |
|
| 2121 | + * |
|
| 2122 | + * @param string $principalUri |
|
| 2123 | + * @param string $objectUri |
|
| 2124 | + * @return void |
|
| 2125 | + */ |
|
| 2126 | + function deleteSchedulingObject($principalUri, $objectUri) { |
|
| 2127 | + $query = $this->db->getQueryBuilder(); |
|
| 2128 | + $query->delete('schedulingobjects') |
|
| 2129 | + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
|
| 2130 | + ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) |
|
| 2131 | + ->execute(); |
|
| 2132 | + } |
|
| 2133 | + |
|
| 2134 | + /** |
|
| 2135 | + * Creates a new scheduling object. This should land in a users' inbox. |
|
| 2136 | + * |
|
| 2137 | + * @param string $principalUri |
|
| 2138 | + * @param string $objectUri |
|
| 2139 | + * @param string $objectData |
|
| 2140 | + * @return void |
|
| 2141 | + */ |
|
| 2142 | + function createSchedulingObject($principalUri, $objectUri, $objectData) { |
|
| 2143 | + $query = $this->db->getQueryBuilder(); |
|
| 2144 | + $query->insert('schedulingobjects') |
|
| 2145 | + ->values([ |
|
| 2146 | + 'principaluri' => $query->createNamedParameter($principalUri), |
|
| 2147 | + 'calendardata' => $query->createNamedParameter($objectData), |
|
| 2148 | + 'uri' => $query->createNamedParameter($objectUri), |
|
| 2149 | + 'lastmodified' => $query->createNamedParameter(time()), |
|
| 2150 | + 'etag' => $query->createNamedParameter(md5($objectData)), |
|
| 2151 | + 'size' => $query->createNamedParameter(strlen($objectData)) |
|
| 2152 | + ]) |
|
| 2153 | + ->execute(); |
|
| 2154 | + } |
|
| 2155 | + |
|
| 2156 | + /** |
|
| 2157 | + * Adds a change record to the calendarchanges table. |
|
| 2158 | + * |
|
| 2159 | + * @param mixed $calendarId |
|
| 2160 | + * @param string $objectUri |
|
| 2161 | + * @param int $operation 1 = add, 2 = modify, 3 = delete. |
|
| 2162 | + * @return void |
|
| 2163 | + */ |
|
| 2164 | + protected function addChange($calendarId, $objectUri, $operation) { |
|
| 2165 | + |
|
| 2166 | + $stmt = $this->db->prepare('INSERT INTO `*PREFIX*calendarchanges` (`uri`, `synctoken`, `calendarid`, `operation`) SELECT ?, `synctoken`, ?, ? FROM `*PREFIX*calendars` WHERE `id` = ?'); |
|
| 2167 | + $stmt->execute([ |
|
| 2168 | + $objectUri, |
|
| 2169 | + $calendarId, |
|
| 2170 | + $operation, |
|
| 2171 | + $calendarId |
|
| 2172 | + ]); |
|
| 2173 | + $stmt = $this->db->prepare('UPDATE `*PREFIX*calendars` SET `synctoken` = `synctoken` + 1 WHERE `id` = ?'); |
|
| 2174 | + $stmt->execute([ |
|
| 2175 | + $calendarId |
|
| 2176 | + ]); |
|
| 2177 | + |
|
| 2178 | + } |
|
| 2179 | + |
|
| 2180 | + /** |
|
| 2181 | + * Parses some information from calendar objects, used for optimized |
|
| 2182 | + * calendar-queries. |
|
| 2183 | + * |
|
| 2184 | + * Returns an array with the following keys: |
|
| 2185 | + * * etag - An md5 checksum of the object without the quotes. |
|
| 2186 | + * * size - Size of the object in bytes |
|
| 2187 | + * * componentType - VEVENT, VTODO or VJOURNAL |
|
| 2188 | + * * firstOccurence |
|
| 2189 | + * * lastOccurence |
|
| 2190 | + * * uid - value of the UID property |
|
| 2191 | + * |
|
| 2192 | + * @param string $calendarData |
|
| 2193 | + * @return array |
|
| 2194 | + */ |
|
| 2195 | + public function getDenormalizedData($calendarData) { |
|
| 2196 | + |
|
| 2197 | + $vObject = Reader::read($calendarData); |
|
| 2198 | + $componentType = null; |
|
| 2199 | + $component = null; |
|
| 2200 | + $firstOccurrence = null; |
|
| 2201 | + $lastOccurrence = null; |
|
| 2202 | + $uid = null; |
|
| 2203 | + $classification = self::CLASSIFICATION_PUBLIC; |
|
| 2204 | + foreach($vObject->getComponents() as $component) { |
|
| 2205 | + if ($component->name!=='VTIMEZONE') { |
|
| 2206 | + $componentType = $component->name; |
|
| 2207 | + $uid = (string)$component->UID; |
|
| 2208 | + break; |
|
| 2209 | + } |
|
| 2210 | + } |
|
| 2211 | + if (!$componentType) { |
|
| 2212 | + throw new \Sabre\DAV\Exception\BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component'); |
|
| 2213 | + } |
|
| 2214 | + if ($componentType === 'VEVENT' && $component->DTSTART) { |
|
| 2215 | + $firstOccurrence = $component->DTSTART->getDateTime()->getTimeStamp(); |
|
| 2216 | + // Finding the last occurrence is a bit harder |
|
| 2217 | + if (!isset($component->RRULE)) { |
|
| 2218 | + if (isset($component->DTEND)) { |
|
| 2219 | + $lastOccurrence = $component->DTEND->getDateTime()->getTimeStamp(); |
|
| 2220 | + } elseif (isset($component->DURATION)) { |
|
| 2221 | + $endDate = clone $component->DTSTART->getDateTime(); |
|
| 2222 | + $endDate->add(DateTimeParser::parse($component->DURATION->getValue())); |
|
| 2223 | + $lastOccurrence = $endDate->getTimeStamp(); |
|
| 2224 | + } elseif (!$component->DTSTART->hasTime()) { |
|
| 2225 | + $endDate = clone $component->DTSTART->getDateTime(); |
|
| 2226 | + $endDate->modify('+1 day'); |
|
| 2227 | + $lastOccurrence = $endDate->getTimeStamp(); |
|
| 2228 | + } else { |
|
| 2229 | + $lastOccurrence = $firstOccurrence; |
|
| 2230 | + } |
|
| 2231 | + } else { |
|
| 2232 | + $it = new EventIterator($vObject, (string)$component->UID); |
|
| 2233 | + $maxDate = new \DateTime(self::MAX_DATE); |
|
| 2234 | + if ($it->isInfinite()) { |
|
| 2235 | + $lastOccurrence = $maxDate->getTimestamp(); |
|
| 2236 | + } else { |
|
| 2237 | + $end = $it->getDtEnd(); |
|
| 2238 | + while($it->valid() && $end < $maxDate) { |
|
| 2239 | + $end = $it->getDtEnd(); |
|
| 2240 | + $it->next(); |
|
| 2241 | + |
|
| 2242 | + } |
|
| 2243 | + $lastOccurrence = $end->getTimestamp(); |
|
| 2244 | + } |
|
| 2245 | + |
|
| 2246 | + } |
|
| 2247 | + } |
|
| 2248 | + |
|
| 2249 | + if ($component->CLASS) { |
|
| 2250 | + $classification = CalDavBackend::CLASSIFICATION_PRIVATE; |
|
| 2251 | + switch ($component->CLASS->getValue()) { |
|
| 2252 | + case 'PUBLIC': |
|
| 2253 | + $classification = CalDavBackend::CLASSIFICATION_PUBLIC; |
|
| 2254 | + break; |
|
| 2255 | + case 'CONFIDENTIAL': |
|
| 2256 | + $classification = CalDavBackend::CLASSIFICATION_CONFIDENTIAL; |
|
| 2257 | + break; |
|
| 2258 | + } |
|
| 2259 | + } |
|
| 2260 | + return [ |
|
| 2261 | + 'etag' => md5($calendarData), |
|
| 2262 | + 'size' => strlen($calendarData), |
|
| 2263 | + 'componentType' => $componentType, |
|
| 2264 | + 'firstOccurence' => is_null($firstOccurrence) ? null : max(0, $firstOccurrence), |
|
| 2265 | + 'lastOccurence' => $lastOccurrence, |
|
| 2266 | + 'uid' => $uid, |
|
| 2267 | + 'classification' => $classification |
|
| 2268 | + ]; |
|
| 2269 | + |
|
| 2270 | + } |
|
| 2271 | + |
|
| 2272 | + /** |
|
| 2273 | + * @param $cardData |
|
| 2274 | + * @return bool|string |
|
| 2275 | + */ |
|
| 2276 | + private function readBlob($cardData) { |
|
| 2277 | + if (is_resource($cardData)) { |
|
| 2278 | + return stream_get_contents($cardData); |
|
| 2279 | + } |
|
| 2280 | + |
|
| 2281 | + return $cardData; |
|
| 2282 | + } |
|
| 2283 | + |
|
| 2284 | + /** |
|
| 2285 | + * @param IShareable $shareable |
|
| 2286 | + * @param array $add |
|
| 2287 | + * @param array $remove |
|
| 2288 | + */ |
|
| 2289 | + public function updateShares($shareable, $add, $remove) { |
|
| 2290 | + $calendarId = $shareable->getResourceId(); |
|
| 2291 | + $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateShares', new GenericEvent( |
|
| 2292 | + '\OCA\DAV\CalDAV\CalDavBackend::updateShares', |
|
| 2293 | + [ |
|
| 2294 | + 'calendarId' => $calendarId, |
|
| 2295 | + 'calendarData' => $this->getCalendarById($calendarId), |
|
| 2296 | + 'shares' => $this->getShares($calendarId), |
|
| 2297 | + 'add' => $add, |
|
| 2298 | + 'remove' => $remove, |
|
| 2299 | + ])); |
|
| 2300 | + $this->sharingBackend->updateShares($shareable, $add, $remove); |
|
| 2301 | + } |
|
| 2302 | + |
|
| 2303 | + /** |
|
| 2304 | + * @param int $resourceId |
|
| 2305 | + * @return array |
|
| 2306 | + */ |
|
| 2307 | + public function getShares($resourceId) { |
|
| 2308 | + return $this->sharingBackend->getShares($resourceId); |
|
| 2309 | + } |
|
| 2310 | + |
|
| 2311 | + /** |
|
| 2312 | + * @param boolean $value |
|
| 2313 | + * @param \OCA\DAV\CalDAV\Calendar $calendar |
|
| 2314 | + * @return string|null |
|
| 2315 | + */ |
|
| 2316 | + public function setPublishStatus($value, $calendar) { |
|
| 2317 | + |
|
| 2318 | + $calendarId = $calendar->getResourceId(); |
|
| 2319 | + $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', new GenericEvent( |
|
| 2320 | + '\OCA\DAV\CalDAV\CalDavBackend::updateShares', |
|
| 2321 | + [ |
|
| 2322 | + 'calendarId' => $calendarId, |
|
| 2323 | + 'calendarData' => $this->getCalendarById($calendarId), |
|
| 2324 | + 'public' => $value, |
|
| 2325 | + ])); |
|
| 2326 | + |
|
| 2327 | + $query = $this->db->getQueryBuilder(); |
|
| 2328 | + if ($value) { |
|
| 2329 | + $publicUri = $this->random->generate(16, ISecureRandom::CHAR_HUMAN_READABLE); |
|
| 2330 | + $query->insert('dav_shares') |
|
| 2331 | + ->values([ |
|
| 2332 | + 'principaluri' => $query->createNamedParameter($calendar->getPrincipalURI()), |
|
| 2333 | + 'type' => $query->createNamedParameter('calendar'), |
|
| 2334 | + 'access' => $query->createNamedParameter(self::ACCESS_PUBLIC), |
|
| 2335 | + 'resourceid' => $query->createNamedParameter($calendar->getResourceId()), |
|
| 2336 | + 'publicuri' => $query->createNamedParameter($publicUri) |
|
| 2337 | + ]); |
|
| 2338 | + $query->execute(); |
|
| 2339 | + return $publicUri; |
|
| 2340 | + } |
|
| 2341 | + $query->delete('dav_shares') |
|
| 2342 | + ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) |
|
| 2343 | + ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))); |
|
| 2344 | + $query->execute(); |
|
| 2345 | + return null; |
|
| 2346 | + } |
|
| 2347 | + |
|
| 2348 | + /** |
|
| 2349 | + * @param \OCA\DAV\CalDAV\Calendar $calendar |
|
| 2350 | + * @return mixed |
|
| 2351 | + */ |
|
| 2352 | + public function getPublishStatus($calendar) { |
|
| 2353 | + $query = $this->db->getQueryBuilder(); |
|
| 2354 | + $result = $query->select('publicuri') |
|
| 2355 | + ->from('dav_shares') |
|
| 2356 | + ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) |
|
| 2357 | + ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))) |
|
| 2358 | + ->execute(); |
|
| 2359 | + |
|
| 2360 | + $row = $result->fetch(); |
|
| 2361 | + $result->closeCursor(); |
|
| 2362 | + return $row ? reset($row) : false; |
|
| 2363 | + } |
|
| 2364 | + |
|
| 2365 | + /** |
|
| 2366 | + * @param int $resourceId |
|
| 2367 | + * @param array $acl |
|
| 2368 | + * @return array |
|
| 2369 | + */ |
|
| 2370 | + public function applyShareAcl($resourceId, $acl) { |
|
| 2371 | + return $this->sharingBackend->applyShareAcl($resourceId, $acl); |
|
| 2372 | + } |
|
| 2373 | + |
|
| 2374 | + |
|
| 2375 | + |
|
| 2376 | + /** |
|
| 2377 | + * update properties table |
|
| 2378 | + * |
|
| 2379 | + * @param int $calendarId |
|
| 2380 | + * @param string $objectUri |
|
| 2381 | + * @param string $calendarData |
|
| 2382 | + */ |
|
| 2383 | + public function updateProperties($calendarId, $objectUri, $calendarData) { |
|
| 2384 | + $objectId = $this->getCalendarObjectId($calendarId, $objectUri); |
|
| 2385 | + |
|
| 2386 | + try { |
|
| 2387 | + $vCalendar = $this->readCalendarData($calendarData); |
|
| 2388 | + } catch (\Exception $ex) { |
|
| 2389 | + return; |
|
| 2390 | + } |
|
| 2391 | + |
|
| 2392 | + $this->purgeProperties($calendarId, $objectId); |
|
| 2393 | + |
|
| 2394 | + $query = $this->db->getQueryBuilder(); |
|
| 2395 | + $query->insert($this->dbObjectPropertiesTable) |
|
| 2396 | + ->values( |
|
| 2397 | + [ |
|
| 2398 | + 'calendarid' => $query->createNamedParameter($calendarId), |
|
| 2399 | + 'objectid' => $query->createNamedParameter($objectId), |
|
| 2400 | + 'name' => $query->createParameter('name'), |
|
| 2401 | + 'parameter' => $query->createParameter('parameter'), |
|
| 2402 | + 'value' => $query->createParameter('value'), |
|
| 2403 | + ] |
|
| 2404 | + ); |
|
| 2405 | + |
|
| 2406 | + $indexComponents = ['VEVENT', 'VJOURNAL', 'VTODO']; |
|
| 2407 | + foreach ($vCalendar->getComponents() as $component) { |
|
| 2408 | + if (!in_array($component->name, $indexComponents)) { |
|
| 2409 | + continue; |
|
| 2410 | + } |
|
| 2411 | + |
|
| 2412 | + foreach ($component->children() as $property) { |
|
| 2413 | + if (in_array($property->name, self::$indexProperties)) { |
|
| 2414 | + $value = $property->getValue(); |
|
| 2415 | + // is this a shitty db? |
|
| 2416 | + if (!$this->db->supports4ByteText()) { |
|
| 2417 | + $value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value); |
|
| 2418 | + } |
|
| 2419 | + $value = mb_substr($value, 0, 254); |
|
| 2420 | + |
|
| 2421 | + $query->setParameter('name', $property->name); |
|
| 2422 | + $query->setParameter('parameter', null); |
|
| 2423 | + $query->setParameter('value', $value); |
|
| 2424 | + $query->execute(); |
|
| 2425 | + } |
|
| 2426 | + |
|
| 2427 | + if (array_key_exists($property->name, self::$indexParameters)) { |
|
| 2428 | + $parameters = $property->parameters(); |
|
| 2429 | + $indexedParametersForProperty = self::$indexParameters[$property->name]; |
|
| 2430 | + |
|
| 2431 | + foreach ($parameters as $key => $value) { |
|
| 2432 | + if (in_array($key, $indexedParametersForProperty)) { |
|
| 2433 | + // is this a shitty db? |
|
| 2434 | + if ($this->db->supports4ByteText()) { |
|
| 2435 | + $value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value); |
|
| 2436 | + } |
|
| 2437 | + $value = mb_substr($value, 0, 254); |
|
| 2438 | + |
|
| 2439 | + $query->setParameter('name', $property->name); |
|
| 2440 | + $query->setParameter('parameter', substr($key, 0, 254)); |
|
| 2441 | + $query->setParameter('value', substr($value, 0, 254)); |
|
| 2442 | + $query->execute(); |
|
| 2443 | + } |
|
| 2444 | + } |
|
| 2445 | + } |
|
| 2446 | + } |
|
| 2447 | + } |
|
| 2448 | + } |
|
| 2449 | + |
|
| 2450 | + /** |
|
| 2451 | + * deletes all birthday calendars |
|
| 2452 | + */ |
|
| 2453 | + public function deleteAllBirthdayCalendars() { |
|
| 2454 | + $query = $this->db->getQueryBuilder(); |
|
| 2455 | + $result = $query->select(['id'])->from('calendars') |
|
| 2456 | + ->where($query->expr()->eq('uri', |
|
| 2457 | + $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) |
|
| 2458 | + ->execute(); |
|
| 2459 | + |
|
| 2460 | + $ids = $result->fetchAll(); |
|
| 2461 | + foreach($ids as $id) { |
|
| 2462 | + $this->deleteCalendar($id['id']); |
|
| 2463 | + } |
|
| 2464 | + } |
|
| 2465 | + |
|
| 2466 | + /** |
|
| 2467 | + * @param $subscriptionId |
|
| 2468 | + */ |
|
| 2469 | + public function purgeAllCachedEventsForSubscription($subscriptionId) { |
|
| 2470 | + $query = $this->db->getQueryBuilder(); |
|
| 2471 | + $query->delete('calendarsubscrobjects') |
|
| 2472 | + ->where($query->expr()->eq('subscriptionid', $query->createNamedParameter($subscriptionId))); |
|
| 2473 | + $query->execute(); |
|
| 2474 | + } |
|
| 2475 | + |
|
| 2476 | + /** |
|
| 2477 | + * @param $subscriptionId |
|
| 2478 | + * @param $objectUri |
|
| 2479 | + * @param $calendarData |
|
| 2480 | + * @return string |
|
| 2481 | + * @throws DAV\Exception\BadRequest |
|
| 2482 | + */ |
|
| 2483 | + public function addCachedEvent($subscriptionId, $objectUri, $calendarData) { |
|
| 2484 | + $extraData = $this->getDenormalizedData($calendarData); |
|
| 2485 | + |
|
| 2486 | + $query = $this->db->getQueryBuilder(); |
|
| 2487 | + $query->insert('calendarsubscrobjects') |
|
| 2488 | + ->values([ |
|
| 2489 | + 'subscriptionid' => $query->createNamedParameter($subscriptionId), |
|
| 2490 | + 'uri' => $query->createNamedParameter($objectUri), |
|
| 2491 | + 'calendardata' => $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB), |
|
| 2492 | + 'lastmodified' => $query->createNamedParameter(time()), |
|
| 2493 | + 'etag' => $query->createNamedParameter($extraData['etag']), |
|
| 2494 | + 'size' => $query->createNamedParameter($extraData['size']), |
|
| 2495 | + 'componenttype' => $query->createNamedParameter($extraData['componentType']), |
|
| 2496 | + 'firstoccurence' => $query->createNamedParameter($extraData['firstOccurence']), |
|
| 2497 | + 'lastoccurence' => $query->createNamedParameter($extraData['lastOccurence']), |
|
| 2498 | + 'classification' => $query->createNamedParameter($extraData['classification']), |
|
| 2499 | + 'uid' => $query->createNamedParameter($extraData['uid']), |
|
| 2500 | + ]) |
|
| 2501 | + ->execute(); |
|
| 2502 | + } |
|
| 2503 | + |
|
| 2504 | + /** |
|
| 2505 | + * read VCalendar data into a VCalendar object |
|
| 2506 | + * |
|
| 2507 | + * @param string $objectData |
|
| 2508 | + * @return VCalendar |
|
| 2509 | + */ |
|
| 2510 | + protected function readCalendarData($objectData) { |
|
| 2511 | + return Reader::read($objectData); |
|
| 2512 | + } |
|
| 2513 | + |
|
| 2514 | + /** |
|
| 2515 | + * delete all properties from a given calendar object |
|
| 2516 | + * |
|
| 2517 | + * @param int $calendarId |
|
| 2518 | + * @param int $objectId |
|
| 2519 | + */ |
|
| 2520 | + protected function purgeProperties($calendarId, $objectId) { |
|
| 2521 | + $query = $this->db->getQueryBuilder(); |
|
| 2522 | + $query->delete($this->dbObjectPropertiesTable) |
|
| 2523 | + ->where($query->expr()->eq('objectid', $query->createNamedParameter($objectId))) |
|
| 2524 | + ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))); |
|
| 2525 | + $query->execute(); |
|
| 2526 | + } |
|
| 2527 | + |
|
| 2528 | + /** |
|
| 2529 | + * get ID from a given calendar object |
|
| 2530 | + * |
|
| 2531 | + * @param int $calendarId |
|
| 2532 | + * @param string $uri |
|
| 2533 | + * @return int |
|
| 2534 | + */ |
|
| 2535 | + protected function getCalendarObjectId($calendarId, $uri) { |
|
| 2536 | + $query = $this->db->getQueryBuilder(); |
|
| 2537 | + $query->select('id')->from('calendarobjects') |
|
| 2538 | + ->where($query->expr()->eq('uri', $query->createNamedParameter($uri))) |
|
| 2539 | + ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))); |
|
| 2540 | + |
|
| 2541 | + $result = $query->execute(); |
|
| 2542 | + $objectIds = $result->fetch(); |
|
| 2543 | + $result->closeCursor(); |
|
| 2544 | + |
|
| 2545 | + if (!isset($objectIds['id'])) { |
|
| 2546 | + throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
| 2547 | + } |
|
| 2548 | + |
|
| 2549 | + return (int)$objectIds['id']; |
|
| 2550 | + } |
|
| 2551 | + |
|
| 2552 | + /** |
|
| 2553 | + * return legacy endpoint principal name to new principal name |
|
| 2554 | + * |
|
| 2555 | + * @param $principalUri |
|
| 2556 | + * @param $toV2 |
|
| 2557 | + * @return string |
|
| 2558 | + */ |
|
| 2559 | + private function convertPrincipal($principalUri, $toV2) { |
|
| 2560 | + if ($this->principalBackend->getPrincipalPrefix() === 'principals') { |
|
| 2561 | + list(, $name) = Uri\split($principalUri); |
|
| 2562 | + if ($toV2 === true) { |
|
| 2563 | + return "principals/users/$name"; |
|
| 2564 | + } |
|
| 2565 | + return "principals/$name"; |
|
| 2566 | + } |
|
| 2567 | + return $principalUri; |
|
| 2568 | + } |
|
| 2569 | + |
|
| 2570 | + /** |
|
| 2571 | + * adds information about an owner to the calendar data |
|
| 2572 | + * |
|
| 2573 | + * @param $calendarInfo |
|
| 2574 | + */ |
|
| 2575 | + private function addOwnerPrincipal(&$calendarInfo) { |
|
| 2576 | + $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 2577 | + $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 2578 | + if (isset($calendarInfo[$ownerPrincipalKey])) { |
|
| 2579 | + $uri = $calendarInfo[$ownerPrincipalKey]; |
|
| 2580 | + } else { |
|
| 2581 | + $uri = $calendarInfo['principaluri']; |
|
| 2582 | + } |
|
| 2583 | + |
|
| 2584 | + $principalInformation = $this->principalBackend->getPrincipalByPath($uri); |
|
| 2585 | + if (isset($principalInformation['{DAV:}displayname'])) { |
|
| 2586 | + $calendarInfo[$displaynameKey] = $principalInformation['{DAV:}displayname']; |
|
| 2587 | + } |
|
| 2588 | + } |
|
| 2589 | 2589 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - return (int)$query->execute()->fetchColumn(); |
|
| 221 | + return (int) $query->execute()->fetchColumn(); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |
@@ -265,25 +265,25 @@ discard block |
||
| 265 | 265 | $stmt = $query->execute(); |
| 266 | 266 | |
| 267 | 267 | $calendars = []; |
| 268 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 268 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 269 | 269 | |
| 270 | 270 | $components = []; |
| 271 | 271 | if ($row['components']) { |
| 272 | - $components = explode(',',$row['components']); |
|
| 272 | + $components = explode(',', $row['components']); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | $calendar = [ |
| 276 | 276 | 'id' => $row['id'], |
| 277 | 277 | 'uri' => $row['uri'], |
| 278 | 278 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 279 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 280 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 281 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 282 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 283 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 279 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 280 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 281 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 282 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 283 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 284 | 284 | ]; |
| 285 | 285 | |
| 286 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 286 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 287 | 287 | $calendar[$xmlName] = $row[$dbName]; |
| 288 | 288 | } |
| 289 | 289 | |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | $principals = array_map(function($principal) { |
| 302 | 302 | return urldecode($principal); |
| 303 | 303 | }, $principals); |
| 304 | - $principals[]= $principalUri; |
|
| 304 | + $principals[] = $principalUri; |
|
| 305 | 305 | |
| 306 | 306 | $fields = array_values($this->propertyMap); |
| 307 | 307 | $fields[] = 'a.id'; |
@@ -321,8 +321,8 @@ discard block |
||
| 321 | 321 | ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) |
| 322 | 322 | ->execute(); |
| 323 | 323 | |
| 324 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 325 | - while($row = $result->fetch()) { |
|
| 324 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
| 325 | + while ($row = $result->fetch()) { |
|
| 326 | 326 | if ($row['principaluri'] === $principalUri) { |
| 327 | 327 | continue; |
| 328 | 328 | } |
@@ -341,25 +341,25 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | list(, $name) = Uri\split($row['principaluri']); |
| 344 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 345 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
| 344 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
| 345 | + $row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
| 346 | 346 | $components = []; |
| 347 | 347 | if ($row['components']) { |
| 348 | - $components = explode(',',$row['components']); |
|
| 348 | + $components = explode(',', $row['components']); |
|
| 349 | 349 | } |
| 350 | 350 | $calendar = [ |
| 351 | 351 | 'id' => $row['id'], |
| 352 | 352 | 'uri' => $uri, |
| 353 | 353 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
| 354 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 355 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 356 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 357 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 358 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 354 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 355 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 356 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 357 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 358 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 359 | 359 | $readOnlyPropertyName => $readOnly, |
| 360 | 360 | ]; |
| 361 | 361 | |
| 362 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 362 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 363 | 363 | $calendar[$xmlName] = $row[$dbName]; |
| 364 | 364 | } |
| 365 | 365 | |
@@ -392,21 +392,21 @@ discard block |
||
| 392 | 392 | ->orderBy('calendarorder', 'ASC'); |
| 393 | 393 | $stmt = $query->execute(); |
| 394 | 394 | $calendars = []; |
| 395 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 395 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 396 | 396 | $components = []; |
| 397 | 397 | if ($row['components']) { |
| 398 | - $components = explode(',',$row['components']); |
|
| 398 | + $components = explode(',', $row['components']); |
|
| 399 | 399 | } |
| 400 | 400 | $calendar = [ |
| 401 | 401 | 'id' => $row['id'], |
| 402 | 402 | 'uri' => $row['uri'], |
| 403 | 403 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 404 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 405 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 406 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 407 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 404 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 405 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 406 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 407 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 408 | 408 | ]; |
| 409 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 409 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 410 | 410 | $calendar[$xmlName] = $row[$dbName]; |
| 411 | 411 | } |
| 412 | 412 | |
@@ -461,27 +461,27 @@ discard block |
||
| 461 | 461 | ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
| 462 | 462 | ->execute(); |
| 463 | 463 | |
| 464 | - while($row = $result->fetch()) { |
|
| 464 | + while ($row = $result->fetch()) { |
|
| 465 | 465 | list(, $name) = Uri\split($row['principaluri']); |
| 466 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
| 466 | + $row['displayname'] = $row['displayname']."($name)"; |
|
| 467 | 467 | $components = []; |
| 468 | 468 | if ($row['components']) { |
| 469 | - $components = explode(',',$row['components']); |
|
| 469 | + $components = explode(',', $row['components']); |
|
| 470 | 470 | } |
| 471 | 471 | $calendar = [ |
| 472 | 472 | 'id' => $row['id'], |
| 473 | 473 | 'uri' => $row['publicuri'], |
| 474 | 474 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 475 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 476 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 477 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 478 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 479 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 480 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 481 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 475 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 476 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 477 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 478 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 479 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 480 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
| 481 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 482 | 482 | ]; |
| 483 | 483 | |
| 484 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 484 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 485 | 485 | $calendar[$xmlName] = $row[$dbName]; |
| 486 | 486 | } |
| 487 | 487 | |
@@ -525,29 +525,29 @@ discard block |
||
| 525 | 525 | $result->closeCursor(); |
| 526 | 526 | |
| 527 | 527 | if ($row === false) { |
| 528 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
| 528 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | list(, $name) = Uri\split($row['principaluri']); |
| 532 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
| 532 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
| 533 | 533 | $components = []; |
| 534 | 534 | if ($row['components']) { |
| 535 | - $components = explode(',',$row['components']); |
|
| 535 | + $components = explode(',', $row['components']); |
|
| 536 | 536 | } |
| 537 | 537 | $calendar = [ |
| 538 | 538 | 'id' => $row['id'], |
| 539 | 539 | 'uri' => $row['publicuri'], |
| 540 | 540 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 541 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 542 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 543 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 544 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 545 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 546 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 547 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 541 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 542 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 543 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 544 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 545 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 546 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
| 547 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 548 | 548 | ]; |
| 549 | 549 | |
| 550 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 550 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 551 | 551 | $calendar[$xmlName] = $row[$dbName]; |
| 552 | 552 | } |
| 553 | 553 | |
@@ -587,20 +587,20 @@ discard block |
||
| 587 | 587 | |
| 588 | 588 | $components = []; |
| 589 | 589 | if ($row['components']) { |
| 590 | - $components = explode(',',$row['components']); |
|
| 590 | + $components = explode(',', $row['components']); |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | $calendar = [ |
| 594 | 594 | 'id' => $row['id'], |
| 595 | 595 | 'uri' => $row['uri'], |
| 596 | 596 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 597 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 598 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 599 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 600 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 597 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 598 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 599 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 600 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 601 | 601 | ]; |
| 602 | 602 | |
| 603 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 603 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 604 | 604 | $calendar[$xmlName] = $row[$dbName]; |
| 605 | 605 | } |
| 606 | 606 | |
@@ -637,20 +637,20 @@ discard block |
||
| 637 | 637 | |
| 638 | 638 | $components = []; |
| 639 | 639 | if ($row['components']) { |
| 640 | - $components = explode(',',$row['components']); |
|
| 640 | + $components = explode(',', $row['components']); |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | $calendar = [ |
| 644 | 644 | 'id' => $row['id'], |
| 645 | 645 | 'uri' => $row['uri'], |
| 646 | 646 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 647 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 648 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 649 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 650 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 647 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 648 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 649 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 650 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 651 | 651 | ]; |
| 652 | 652 | |
| 653 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 653 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 654 | 654 | $calendar[$xmlName] = $row[$dbName]; |
| 655 | 655 | } |
| 656 | 656 | |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | ->from('calendarsubscriptions') |
| 676 | 676 | ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
| 677 | 677 | ->orderBy('calendarorder', 'asc'); |
| 678 | - $stmt =$query->execute(); |
|
| 678 | + $stmt = $query->execute(); |
|
| 679 | 679 | |
| 680 | 680 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
| 681 | 681 | $stmt->closeCursor(); |
@@ -689,10 +689,10 @@ discard block |
||
| 689 | 689 | 'principaluri' => $row['principaluri'], |
| 690 | 690 | 'source' => $row['source'], |
| 691 | 691 | 'lastmodified' => $row['lastmodified'], |
| 692 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 692 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 693 | 693 | ]; |
| 694 | 694 | |
| 695 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 695 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 696 | 696 | if (!is_null($row[$dbName])) { |
| 697 | 697 | $subscription[$xmlName] = $row[$dbName]; |
| 698 | 698 | } |
@@ -727,16 +727,16 @@ discard block |
||
| 727 | 727 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
| 728 | 728 | if (isset($properties[$sccs])) { |
| 729 | 729 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
| 730 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 730 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 731 | 731 | } |
| 732 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
| 732 | + $values['components'] = implode(',', $properties[$sccs]->getValue()); |
|
| 733 | 733 | } |
| 734 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 734 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 735 | 735 | if (isset($properties[$transp])) { |
| 736 | 736 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
| 737 | 737 | } |
| 738 | 738 | |
| 739 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 739 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 740 | 740 | if (isset($properties[$xmlName])) { |
| 741 | 741 | $values[$dbName] = $properties[$xmlName]; |
| 742 | 742 | } |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | |
| 745 | 745 | $query = $this->db->getQueryBuilder(); |
| 746 | 746 | $query->insert('calendars'); |
| 747 | - foreach($values as $column => $value) { |
|
| 747 | + foreach ($values as $column => $value) { |
|
| 748 | 748 | $query->setValue($column, $query->createNamedParameter($value)); |
| 749 | 749 | } |
| 750 | 750 | $query->execute(); |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | */ |
| 779 | 779 | function updateCalendar($calendarId, PropPatch $propPatch) { |
| 780 | 780 | $supportedProperties = array_keys($this->propertyMap); |
| 781 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 781 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 782 | 782 | |
| 783 | 783 | /** |
| 784 | 784 | * @suppress SqlInjectionChecker |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | foreach ($mutations as $propertyName => $propertyValue) { |
| 789 | 789 | |
| 790 | 790 | switch ($propertyName) { |
| 791 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' : |
|
| 791 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' : |
|
| 792 | 792 | $fieldName = 'transparent'; |
| 793 | 793 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
| 794 | 794 | break; |
@@ -921,16 +921,16 @@ discard block |
||
| 921 | 921 | $stmt = $query->execute(); |
| 922 | 922 | |
| 923 | 923 | $result = []; |
| 924 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 924 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 925 | 925 | $result[] = [ |
| 926 | 926 | 'id' => $row['id'], |
| 927 | 927 | 'uri' => $row['uri'], |
| 928 | 928 | 'lastmodified' => $row['lastmodified'], |
| 929 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 929 | + 'etag' => '"'.$row['etag'].'"', |
|
| 930 | 930 | 'calendarid' => $row[$selector], |
| 931 | - 'size' => (int)$row['size'], |
|
| 931 | + 'size' => (int) $row['size'], |
|
| 932 | 932 | 'component' => strtolower($row['componenttype']), |
| 933 | - 'classification'=> (int)$row['classification'] |
|
| 933 | + 'classification'=> (int) $row['classification'] |
|
| 934 | 934 | ]; |
| 935 | 935 | } |
| 936 | 936 | |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | $stmt = $query->execute(); |
| 983 | 983 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
| 984 | 984 | |
| 985 | - if(!$row) { |
|
| 985 | + if (!$row) { |
|
| 986 | 986 | return null; |
| 987 | 987 | } |
| 988 | 988 | |
@@ -990,12 +990,12 @@ discard block |
||
| 990 | 990 | 'id' => $row['id'], |
| 991 | 991 | 'uri' => $row['uri'], |
| 992 | 992 | 'lastmodified' => $row['lastmodified'], |
| 993 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 993 | + 'etag' => '"'.$row['etag'].'"', |
|
| 994 | 994 | 'calendarid' => $row[$selector], |
| 995 | - 'size' => (int)$row['size'], |
|
| 995 | + 'size' => (int) $row['size'], |
|
| 996 | 996 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 997 | 997 | 'component' => strtolower($row['componenttype']), |
| 998 | - 'classification'=> (int)$row['classification'] |
|
| 998 | + 'classification'=> (int) $row['classification'] |
|
| 999 | 999 | ]; |
| 1000 | 1000 | } |
| 1001 | 1001 | |
@@ -1054,12 +1054,12 @@ discard block |
||
| 1054 | 1054 | 'id' => $row['id'], |
| 1055 | 1055 | 'uri' => $row['uri'], |
| 1056 | 1056 | 'lastmodified' => $row['lastmodified'], |
| 1057 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1057 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1058 | 1058 | 'calendarid' => $row[$selector], |
| 1059 | - 'size' => (int)$row['size'], |
|
| 1059 | + 'size' => (int) $row['size'], |
|
| 1060 | 1060 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 1061 | 1061 | 'component' => strtolower($row['componenttype']), |
| 1062 | - 'classification' => (int)$row['classification'] |
|
| 1062 | + 'classification' => (int) $row['classification'] |
|
| 1063 | 1063 | ]; |
| 1064 | 1064 | } |
| 1065 | 1065 | $result->closeCursor(); |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | )); |
| 1134 | 1134 | $this->addChange($calendarId, $objectUri, 1); |
| 1135 | 1135 | |
| 1136 | - return '"' . $extraData['etag'] . '"'; |
|
| 1136 | + return '"'.$extraData['etag'].'"'; |
|
| 1137 | 1137 | } |
| 1138 | 1138 | |
| 1139 | 1139 | /** |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | } |
| 1189 | 1189 | $this->addChange($calendarId, $objectUri, 2); |
| 1190 | 1190 | |
| 1191 | - return '"' . $extraData['etag'] . '"'; |
|
| 1191 | + return '"'.$extraData['etag'].'"'; |
|
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | 1194 | /** |
@@ -1361,13 +1361,13 @@ discard block |
||
| 1361 | 1361 | $stmt = $query->execute(); |
| 1362 | 1362 | |
| 1363 | 1363 | $result = []; |
| 1364 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1364 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1365 | 1365 | if ($requirePostFilter) { |
| 1366 | 1366 | // validateFilterForObject will parse the calendar data |
| 1367 | 1367 | // catch parsing errors |
| 1368 | 1368 | try { |
| 1369 | 1369 | $matches = $this->validateFilterForObject($row, $filters); |
| 1370 | - } catch(ParseException $ex) { |
|
| 1370 | + } catch (ParseException $ex) { |
|
| 1371 | 1371 | $this->logger->logException($ex, [ |
| 1372 | 1372 | 'app' => 'dav', |
| 1373 | 1373 | 'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri'] |
@@ -1400,14 +1400,14 @@ discard block |
||
| 1400 | 1400 | * @param integer|null $offset |
| 1401 | 1401 | * @return array |
| 1402 | 1402 | */ |
| 1403 | - public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) { |
|
| 1403 | + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
|
| 1404 | 1404 | $calendars = $this->getCalendarsForUser($principalUri); |
| 1405 | 1405 | $ownCalendars = []; |
| 1406 | 1406 | $sharedCalendars = []; |
| 1407 | 1407 | |
| 1408 | 1408 | $uriMapper = []; |
| 1409 | 1409 | |
| 1410 | - foreach($calendars as $calendar) { |
|
| 1410 | + foreach ($calendars as $calendar) { |
|
| 1411 | 1411 | if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { |
| 1412 | 1412 | $ownCalendars[] = $calendar['id']; |
| 1413 | 1413 | } else { |
@@ -1422,11 +1422,11 @@ discard block |
||
| 1422 | 1422 | $query = $this->db->getQueryBuilder(); |
| 1423 | 1423 | // Calendar id expressions |
| 1424 | 1424 | $calendarExpressions = []; |
| 1425 | - foreach($ownCalendars as $id) { |
|
| 1425 | + foreach ($ownCalendars as $id) { |
|
| 1426 | 1426 | $calendarExpressions[] = $query->expr() |
| 1427 | 1427 | ->eq('c.calendarid', $query->createNamedParameter($id)); |
| 1428 | 1428 | } |
| 1429 | - foreach($sharedCalendars as $id) { |
|
| 1429 | + foreach ($sharedCalendars as $id) { |
|
| 1430 | 1430 | $calendarExpressions[] = $query->expr()->andX( |
| 1431 | 1431 | $query->expr()->eq('c.calendarid', |
| 1432 | 1432 | $query->createNamedParameter($id)), |
@@ -1443,7 +1443,7 @@ discard block |
||
| 1443 | 1443 | |
| 1444 | 1444 | // Component expressions |
| 1445 | 1445 | $compExpressions = []; |
| 1446 | - foreach($filters['comps'] as $comp) { |
|
| 1446 | + foreach ($filters['comps'] as $comp) { |
|
| 1447 | 1447 | $compExpressions[] = $query->expr() |
| 1448 | 1448 | ->eq('c.componenttype', $query->createNamedParameter($comp)); |
| 1449 | 1449 | } |
@@ -1462,13 +1462,13 @@ discard block |
||
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | 1464 | $propParamExpressions = []; |
| 1465 | - foreach($filters['props'] as $prop) { |
|
| 1465 | + foreach ($filters['props'] as $prop) { |
|
| 1466 | 1466 | $propParamExpressions[] = $query->expr()->andX( |
| 1467 | 1467 | $query->expr()->eq('i.name', $query->createNamedParameter($prop)), |
| 1468 | 1468 | $query->expr()->isNull('i.parameter') |
| 1469 | 1469 | ); |
| 1470 | 1470 | } |
| 1471 | - foreach($filters['params'] as $param) { |
|
| 1471 | + foreach ($filters['params'] as $param) { |
|
| 1472 | 1472 | $propParamExpressions[] = $query->expr()->andX( |
| 1473 | 1473 | $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), |
| 1474 | 1474 | $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) |
@@ -1500,8 +1500,8 @@ discard block |
||
| 1500 | 1500 | $stmt = $query->execute(); |
| 1501 | 1501 | |
| 1502 | 1502 | $result = []; |
| 1503 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1504 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
| 1503 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1504 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
| 1505 | 1505 | if (!in_array($path, $result)) { |
| 1506 | 1506 | $result[] = $path; |
| 1507 | 1507 | } |
@@ -1539,7 +1539,7 @@ discard block |
||
| 1539 | 1539 | } |
| 1540 | 1540 | |
| 1541 | 1541 | $or = $innerQuery->expr()->orX(); |
| 1542 | - foreach($searchProperties as $searchProperty) { |
|
| 1542 | + foreach ($searchProperties as $searchProperty) { |
|
| 1543 | 1543 | $or->add($innerQuery->expr()->eq('op.name', |
| 1544 | 1544 | $outerQuery->createNamedParameter($searchProperty))); |
| 1545 | 1545 | } |
@@ -1547,8 +1547,8 @@ discard block |
||
| 1547 | 1547 | |
| 1548 | 1548 | if ($pattern !== '') { |
| 1549 | 1549 | $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
| 1550 | - $outerQuery->createNamedParameter('%' . |
|
| 1551 | - $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1550 | + $outerQuery->createNamedParameter('%'. |
|
| 1551 | + $this->db->escapeLikeParameter($pattern).'%'))); |
|
| 1552 | 1552 | } |
| 1553 | 1553 | |
| 1554 | 1554 | $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri') |
@@ -1568,7 +1568,7 @@ discard block |
||
| 1568 | 1568 | |
| 1569 | 1569 | if (isset($options['types'])) { |
| 1570 | 1570 | $or = $outerQuery->expr()->orX(); |
| 1571 | - foreach($options['types'] as $type) { |
|
| 1571 | + foreach ($options['types'] as $type) { |
|
| 1572 | 1572 | $or->add($outerQuery->expr()->eq('componenttype', |
| 1573 | 1573 | $outerQuery->createNamedParameter($type))); |
| 1574 | 1574 | } |
@@ -1593,7 +1593,7 @@ discard block |
||
| 1593 | 1593 | $comps = $calendarData->getComponents(); |
| 1594 | 1594 | $objects = []; |
| 1595 | 1595 | $timezones = []; |
| 1596 | - foreach($comps as $comp) { |
|
| 1596 | + foreach ($comps as $comp) { |
|
| 1597 | 1597 | if ($comp instanceof VTimeZone) { |
| 1598 | 1598 | $timezones[] = $comp; |
| 1599 | 1599 | } else { |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | }); |
| 1631 | 1631 | $validationRules = $comp->getValidationRules(); |
| 1632 | 1632 | |
| 1633 | - foreach($subComponents as $subComponent) { |
|
| 1633 | + foreach ($subComponents as $subComponent) { |
|
| 1634 | 1634 | $name = $subComponent->name; |
| 1635 | 1635 | if (!isset($data[$name])) { |
| 1636 | 1636 | $data[$name] = []; |
@@ -1638,7 +1638,7 @@ discard block |
||
| 1638 | 1638 | $data[$name][] = $this->transformSearchData($subComponent); |
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | - foreach($properties as $property) { |
|
| 1641 | + foreach ($properties as $property) { |
|
| 1642 | 1642 | $name = $property->name; |
| 1643 | 1643 | if (!isset($validationRules[$name])) { |
| 1644 | 1644 | $validationRules[$name] = '*'; |
@@ -1708,7 +1708,7 @@ discard block |
||
| 1708 | 1708 | $stmt = $query->execute(); |
| 1709 | 1709 | |
| 1710 | 1710 | if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
| 1711 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
| 1711 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
| 1712 | 1712 | } |
| 1713 | 1713 | |
| 1714 | 1714 | return null; |
@@ -1773,7 +1773,7 @@ discard block |
||
| 1773 | 1773 | function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) { |
| 1774 | 1774 | // Current synctoken |
| 1775 | 1775 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); |
| 1776 | - $stmt->execute([ $calendarId ]); |
|
| 1776 | + $stmt->execute([$calendarId]); |
|
| 1777 | 1777 | $currentToken = $stmt->fetchColumn(0); |
| 1778 | 1778 | |
| 1779 | 1779 | if (is_null($currentToken)) { |
@@ -1790,8 +1790,8 @@ discard block |
||
| 1790 | 1790 | if ($syncToken) { |
| 1791 | 1791 | |
| 1792 | 1792 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`"; |
| 1793 | - if ($limit>0) { |
|
| 1794 | - $query.= " LIMIT " . (int)$limit; |
|
| 1793 | + if ($limit > 0) { |
|
| 1794 | + $query .= " LIMIT ".(int) $limit; |
|
| 1795 | 1795 | } |
| 1796 | 1796 | |
| 1797 | 1797 | // Fetching all changes |
@@ -1802,15 +1802,15 @@ discard block |
||
| 1802 | 1802 | |
| 1803 | 1803 | // This loop ensures that any duplicates are overwritten, only the |
| 1804 | 1804 | // last change on a node is relevant. |
| 1805 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1805 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1806 | 1806 | |
| 1807 | 1807 | $changes[$row['uri']] = $row['operation']; |
| 1808 | 1808 | |
| 1809 | 1809 | } |
| 1810 | 1810 | |
| 1811 | - foreach($changes as $uri => $operation) { |
|
| 1811 | + foreach ($changes as $uri => $operation) { |
|
| 1812 | 1812 | |
| 1813 | - switch($operation) { |
|
| 1813 | + switch ($operation) { |
|
| 1814 | 1814 | case 1 : |
| 1815 | 1815 | $result['added'][] = $uri; |
| 1816 | 1816 | break; |
@@ -1880,10 +1880,10 @@ discard block |
||
| 1880 | 1880 | ->from('calendarsubscriptions') |
| 1881 | 1881 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
| 1882 | 1882 | ->orderBy('calendarorder', 'asc'); |
| 1883 | - $stmt =$query->execute(); |
|
| 1883 | + $stmt = $query->execute(); |
|
| 1884 | 1884 | |
| 1885 | 1885 | $subscriptions = []; |
| 1886 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1886 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1887 | 1887 | |
| 1888 | 1888 | $subscription = [ |
| 1889 | 1889 | 'id' => $row['id'], |
@@ -1892,10 +1892,10 @@ discard block |
||
| 1892 | 1892 | 'source' => $row['source'], |
| 1893 | 1893 | 'lastmodified' => $row['lastmodified'], |
| 1894 | 1894 | |
| 1895 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 1895 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 1896 | 1896 | ]; |
| 1897 | 1897 | |
| 1898 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1898 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1899 | 1899 | if (!is_null($row[$dbName])) { |
| 1900 | 1900 | $subscription[$xmlName] = $row[$dbName]; |
| 1901 | 1901 | } |
@@ -1934,7 +1934,7 @@ discard block |
||
| 1934 | 1934 | |
| 1935 | 1935 | $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; |
| 1936 | 1936 | |
| 1937 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1937 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1938 | 1938 | if (array_key_exists($xmlName, $properties)) { |
| 1939 | 1939 | $values[$dbName] = $properties[$xmlName]; |
| 1940 | 1940 | if (in_array($dbName, $propertiesBoolean)) { |
@@ -1994,7 +1994,7 @@ discard block |
||
| 1994 | 1994 | |
| 1995 | 1995 | $newValues = []; |
| 1996 | 1996 | |
| 1997 | - foreach($mutations as $propertyName=>$propertyValue) { |
|
| 1997 | + foreach ($mutations as $propertyName=>$propertyValue) { |
|
| 1998 | 1998 | if ($propertyName === '{http://calendarserver.org/ns/}source') { |
| 1999 | 1999 | $newValues['source'] = $propertyValue->getHref(); |
| 2000 | 2000 | } else { |
@@ -2006,7 +2006,7 @@ discard block |
||
| 2006 | 2006 | $query = $this->db->getQueryBuilder(); |
| 2007 | 2007 | $query->update('calendarsubscriptions') |
| 2008 | 2008 | ->set('lastmodified', $query->createNamedParameter(time())); |
| 2009 | - foreach($newValues as $fieldName=>$value) { |
|
| 2009 | + foreach ($newValues as $fieldName=>$value) { |
|
| 2010 | 2010 | $query->set($fieldName, $query->createNamedParameter($value)); |
| 2011 | 2011 | } |
| 2012 | 2012 | $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
@@ -2071,7 +2071,7 @@ discard block |
||
| 2071 | 2071 | |
| 2072 | 2072 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
| 2073 | 2073 | |
| 2074 | - if(!$row) { |
|
| 2074 | + if (!$row) { |
|
| 2075 | 2075 | return null; |
| 2076 | 2076 | } |
| 2077 | 2077 | |
@@ -2079,8 +2079,8 @@ discard block |
||
| 2079 | 2079 | 'uri' => $row['uri'], |
| 2080 | 2080 | 'calendardata' => $row['calendardata'], |
| 2081 | 2081 | 'lastmodified' => $row['lastmodified'], |
| 2082 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2083 | - 'size' => (int)$row['size'], |
|
| 2082 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2083 | + 'size' => (int) $row['size'], |
|
| 2084 | 2084 | ]; |
| 2085 | 2085 | } |
| 2086 | 2086 | |
@@ -2103,13 +2103,13 @@ discard block |
||
| 2103 | 2103 | ->execute(); |
| 2104 | 2104 | |
| 2105 | 2105 | $result = []; |
| 2106 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 2106 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 2107 | 2107 | $result[] = [ |
| 2108 | 2108 | 'calendardata' => $row['calendardata'], |
| 2109 | 2109 | 'uri' => $row['uri'], |
| 2110 | 2110 | 'lastmodified' => $row['lastmodified'], |
| 2111 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2112 | - 'size' => (int)$row['size'], |
|
| 2111 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2112 | + 'size' => (int) $row['size'], |
|
| 2113 | 2113 | ]; |
| 2114 | 2114 | } |
| 2115 | 2115 | |
@@ -2201,10 +2201,10 @@ discard block |
||
| 2201 | 2201 | $lastOccurrence = null; |
| 2202 | 2202 | $uid = null; |
| 2203 | 2203 | $classification = self::CLASSIFICATION_PUBLIC; |
| 2204 | - foreach($vObject->getComponents() as $component) { |
|
| 2205 | - if ($component->name!=='VTIMEZONE') { |
|
| 2204 | + foreach ($vObject->getComponents() as $component) { |
|
| 2205 | + if ($component->name !== 'VTIMEZONE') { |
|
| 2206 | 2206 | $componentType = $component->name; |
| 2207 | - $uid = (string)$component->UID; |
|
| 2207 | + $uid = (string) $component->UID; |
|
| 2208 | 2208 | break; |
| 2209 | 2209 | } |
| 2210 | 2210 | } |
@@ -2229,13 +2229,13 @@ discard block |
||
| 2229 | 2229 | $lastOccurrence = $firstOccurrence; |
| 2230 | 2230 | } |
| 2231 | 2231 | } else { |
| 2232 | - $it = new EventIterator($vObject, (string)$component->UID); |
|
| 2232 | + $it = new EventIterator($vObject, (string) $component->UID); |
|
| 2233 | 2233 | $maxDate = new \DateTime(self::MAX_DATE); |
| 2234 | 2234 | if ($it->isInfinite()) { |
| 2235 | 2235 | $lastOccurrence = $maxDate->getTimestamp(); |
| 2236 | 2236 | } else { |
| 2237 | 2237 | $end = $it->getDtEnd(); |
| 2238 | - while($it->valid() && $end < $maxDate) { |
|
| 2238 | + while ($it->valid() && $end < $maxDate) { |
|
| 2239 | 2239 | $end = $it->getDtEnd(); |
| 2240 | 2240 | $it->next(); |
| 2241 | 2241 | |
@@ -2458,7 +2458,7 @@ discard block |
||
| 2458 | 2458 | ->execute(); |
| 2459 | 2459 | |
| 2460 | 2460 | $ids = $result->fetchAll(); |
| 2461 | - foreach($ids as $id) { |
|
| 2461 | + foreach ($ids as $id) { |
|
| 2462 | 2462 | $this->deleteCalendar($id['id']); |
| 2463 | 2463 | } |
| 2464 | 2464 | } |
@@ -2543,10 +2543,10 @@ discard block |
||
| 2543 | 2543 | $result->closeCursor(); |
| 2544 | 2544 | |
| 2545 | 2545 | if (!isset($objectIds['id'])) { |
| 2546 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
| 2546 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
| 2547 | 2547 | } |
| 2548 | 2548 | |
| 2549 | - return (int)$objectIds['id']; |
|
| 2549 | + return (int) $objectIds['id']; |
|
| 2550 | 2550 | } |
| 2551 | 2551 | |
| 2552 | 2552 | /** |
@@ -2573,8 +2573,8 @@ discard block |
||
| 2573 | 2573 | * @param $calendarInfo |
| 2574 | 2574 | */ |
| 2575 | 2575 | private function addOwnerPrincipal(&$calendarInfo) { |
| 2576 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 2577 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 2576 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
| 2577 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
| 2578 | 2578 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
| 2579 | 2579 | $uri = $calendarInfo[$ownerPrincipalKey]; |
| 2580 | 2580 | } else { |
@@ -24,15 +24,12 @@ |
||
| 24 | 24 | namespace OCA\DAV\CalDAV\WebcalCaching; |
| 25 | 25 | |
| 26 | 26 | use OCA\DAV\CalDAV\CalendarHome; |
| 27 | -use OCP\BackgroundJob\IJobList; |
|
| 28 | 27 | use OCP\IRequest; |
| 29 | 28 | use Sabre\DAV\Exception\NotFound; |
| 30 | 29 | use Sabre\DAV\Server; |
| 31 | 30 | use Sabre\DAV\ServerPlugin; |
| 32 | 31 | use Sabre\HTTP\RequestInterface; |
| 33 | 32 | use Sabre\HTTP\ResponseInterface; |
| 34 | -use Symfony\Component\EventDispatcher\EventDispatcher; |
|
| 35 | -use Symfony\Component\EventDispatcher\GenericEvent; |
|
| 36 | 33 | |
| 37 | 34 | class Plugin extends ServerPlugin { |
| 38 | 35 | |
@@ -36,115 +36,115 @@ |
||
| 36 | 36 | |
| 37 | 37 | class Plugin extends ServerPlugin { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * list of regular expressions for calendar user agents, |
|
| 41 | - * that do not support subscriptions on their own |
|
| 42 | - * |
|
| 43 | - * @var string[] |
|
| 44 | - */ |
|
| 45 | - const ENABLE_FOR_CLIENTS = [ |
|
| 46 | - // TODO - fill me |
|
| 47 | - ]; |
|
| 39 | + /** |
|
| 40 | + * list of regular expressions for calendar user agents, |
|
| 41 | + * that do not support subscriptions on their own |
|
| 42 | + * |
|
| 43 | + * @var string[] |
|
| 44 | + */ |
|
| 45 | + const ENABLE_FOR_CLIENTS = [ |
|
| 46 | + // TODO - fill me |
|
| 47 | + ]; |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @var bool |
|
| 51 | - */ |
|
| 52 | - private $enabled=false; |
|
| 49 | + /** |
|
| 50 | + * @var bool |
|
| 51 | + */ |
|
| 52 | + private $enabled=false; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @var Server |
|
| 56 | - */ |
|
| 57 | - private $server; |
|
| 54 | + /** |
|
| 55 | + * @var Server |
|
| 56 | + */ |
|
| 57 | + private $server; |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Plugin constructor. |
|
| 61 | - * |
|
| 62 | - * @param IRequest $request |
|
| 63 | - */ |
|
| 64 | - public function __construct(IRequest $request) { |
|
| 65 | - if ($request->isUserAgent(self::ENABLE_FOR_CLIENTS)) { |
|
| 66 | - $this->enabled = true; |
|
| 67 | - } |
|
| 59 | + /** |
|
| 60 | + * Plugin constructor. |
|
| 61 | + * |
|
| 62 | + * @param IRequest $request |
|
| 63 | + */ |
|
| 64 | + public function __construct(IRequest $request) { |
|
| 65 | + if ($request->isUserAgent(self::ENABLE_FOR_CLIENTS)) { |
|
| 66 | + $this->enabled = true; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - $magicHeader = $request->getHeader('X-NC-CALDAV-WEBCAL-CACHING'); |
|
| 70 | - if ($magicHeader === 'ON') { |
|
| 71 | - $this->enabled = true; |
|
| 72 | - } |
|
| 73 | - } |
|
| 69 | + $magicHeader = $request->getHeader('X-NC-CALDAV-WEBCAL-CACHING'); |
|
| 70 | + if ($magicHeader === 'ON') { |
|
| 71 | + $this->enabled = true; |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * This initializes the plugin. |
|
| 77 | - * |
|
| 78 | - * This function is called by Sabre\DAV\Server, after |
|
| 79 | - * addPlugin is called. |
|
| 80 | - * |
|
| 81 | - * This method should set up the required event subscriptions. |
|
| 82 | - * |
|
| 83 | - * @param Server $server |
|
| 84 | - */ |
|
| 85 | - public function initialize(Server $server) { |
|
| 86 | - $this->server = $server; |
|
| 87 | - $server->on('beforeMethod', [$this, 'beforeMethod']); |
|
| 88 | - } |
|
| 75 | + /** |
|
| 76 | + * This initializes the plugin. |
|
| 77 | + * |
|
| 78 | + * This function is called by Sabre\DAV\Server, after |
|
| 79 | + * addPlugin is called. |
|
| 80 | + * |
|
| 81 | + * This method should set up the required event subscriptions. |
|
| 82 | + * |
|
| 83 | + * @param Server $server |
|
| 84 | + */ |
|
| 85 | + public function initialize(Server $server) { |
|
| 86 | + $this->server = $server; |
|
| 87 | + $server->on('beforeMethod', [$this, 'beforeMethod']); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * @param RequestInterface $request |
|
| 92 | - * @param ResponseInterface $response |
|
| 93 | - */ |
|
| 94 | - public function beforeMethod(RequestInterface $request, ResponseInterface $response) { |
|
| 95 | - if (!$this->enabled) { |
|
| 96 | - return; |
|
| 97 | - } |
|
| 90 | + /** |
|
| 91 | + * @param RequestInterface $request |
|
| 92 | + * @param ResponseInterface $response |
|
| 93 | + */ |
|
| 94 | + public function beforeMethod(RequestInterface $request, ResponseInterface $response) { |
|
| 95 | + if (!$this->enabled) { |
|
| 96 | + return; |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - $path = $request->getPath(); |
|
| 100 | - $pathParts = explode('/', ltrim($path, '/')); |
|
| 101 | - if (\count($pathParts) < 2) { |
|
| 102 | - return; |
|
| 103 | - } |
|
| 99 | + $path = $request->getPath(); |
|
| 100 | + $pathParts = explode('/', ltrim($path, '/')); |
|
| 101 | + if (\count($pathParts) < 2) { |
|
| 102 | + return; |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - // $calendarHomePath will look like: calendars/username |
|
| 106 | - $calendarHomePath = $pathParts[0] . '/' . $pathParts[1]; |
|
| 107 | - try { |
|
| 108 | - $calendarHome = $this->server->tree->getNodeForPath($calendarHomePath); |
|
| 109 | - if (!($calendarHome instanceof CalendarHome)) { |
|
| 110 | - //how did we end up here? |
|
| 111 | - return; |
|
| 112 | - } |
|
| 105 | + // $calendarHomePath will look like: calendars/username |
|
| 106 | + $calendarHomePath = $pathParts[0] . '/' . $pathParts[1]; |
|
| 107 | + try { |
|
| 108 | + $calendarHome = $this->server->tree->getNodeForPath($calendarHomePath); |
|
| 109 | + if (!($calendarHome instanceof CalendarHome)) { |
|
| 110 | + //how did we end up here? |
|
| 111 | + return; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - $calendarHome->enableCachedSubscriptionsForThisRequest(); |
|
| 115 | - } catch(NotFound $ex) { |
|
| 116 | - return; |
|
| 117 | - } |
|
| 118 | - } |
|
| 114 | + $calendarHome->enableCachedSubscriptionsForThisRequest(); |
|
| 115 | + } catch(NotFound $ex) { |
|
| 116 | + return; |
|
| 117 | + } |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - /** |
|
| 121 | - * @return bool |
|
| 122 | - */ |
|
| 123 | - public function isCachingEnabledForThisRequest():bool { |
|
| 124 | - return $this->enabled; |
|
| 125 | - } |
|
| 120 | + /** |
|
| 121 | + * @return bool |
|
| 122 | + */ |
|
| 123 | + public function isCachingEnabledForThisRequest():bool { |
|
| 124 | + return $this->enabled; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * This method should return a list of server-features. |
|
| 129 | - * |
|
| 130 | - * This is for example 'versioning' and is added to the DAV: header |
|
| 131 | - * in an OPTIONS response. |
|
| 132 | - * |
|
| 133 | - * @return string[] |
|
| 134 | - */ |
|
| 135 | - public function getFeatures():array { |
|
| 136 | - return ['nc-calendar-webcal-cache']; |
|
| 137 | - } |
|
| 127 | + /** |
|
| 128 | + * This method should return a list of server-features. |
|
| 129 | + * |
|
| 130 | + * This is for example 'versioning' and is added to the DAV: header |
|
| 131 | + * in an OPTIONS response. |
|
| 132 | + * |
|
| 133 | + * @return string[] |
|
| 134 | + */ |
|
| 135 | + public function getFeatures():array { |
|
| 136 | + return ['nc-calendar-webcal-cache']; |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - /** |
|
| 140 | - * Returns a plugin name. |
|
| 141 | - * |
|
| 142 | - * Using this name other plugins will be able to access other plugins |
|
| 143 | - * using Sabre\DAV\Server::getPlugin |
|
| 144 | - * |
|
| 145 | - * @return string |
|
| 146 | - */ |
|
| 147 | - public function getPluginName():string { |
|
| 148 | - return 'nc-calendar-webcal-cache'; |
|
| 149 | - } |
|
| 139 | + /** |
|
| 140 | + * Returns a plugin name. |
|
| 141 | + * |
|
| 142 | + * Using this name other plugins will be able to access other plugins |
|
| 143 | + * using Sabre\DAV\Server::getPlugin |
|
| 144 | + * |
|
| 145 | + * @return string |
|
| 146 | + */ |
|
| 147 | + public function getPluginName():string { |
|
| 148 | + return 'nc-calendar-webcal-cache'; |
|
| 149 | + } |
|
| 150 | 150 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * @var bool |
| 51 | 51 | */ |
| 52 | - private $enabled=false; |
|
| 52 | + private $enabled = false; |
|
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * @var Server |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // $calendarHomePath will look like: calendars/username |
| 106 | - $calendarHomePath = $pathParts[0] . '/' . $pathParts[1]; |
|
| 106 | + $calendarHomePath = $pathParts[0].'/'.$pathParts[1]; |
|
| 107 | 107 | try { |
| 108 | 108 | $calendarHome = $this->server->tree->getNodeForPath($calendarHomePath); |
| 109 | 109 | if (!($calendarHome instanceof CalendarHome)) { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $calendarHome->enableCachedSubscriptionsForThisRequest(); |
| 115 | - } catch(NotFound $ex) { |
|
| 115 | + } catch (NotFound $ex) { |
|
| 116 | 116 | return; |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -6,192 +6,192 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ComposerStaticInitDAV |
| 8 | 8 | { |
| 9 | - public static $prefixLengthsPsr4 = array ( |
|
| 9 | + public static $prefixLengthsPsr4 = array( |
|
| 10 | 10 | 'O' => |
| 11 | - array ( |
|
| 11 | + array( |
|
| 12 | 12 | 'OCA\\DAV\\' => 8, |
| 13 | 13 | ), |
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | - public static $prefixDirsPsr4 = array ( |
|
| 16 | + public static $prefixDirsPsr4 = array( |
|
| 17 | 17 | 'OCA\\DAV\\' => |
| 18 | - array ( |
|
| 19 | - 0 => __DIR__ . '/..' . '/../lib', |
|
| 18 | + array( |
|
| 19 | + 0 => __DIR__.'/..'.'/../lib', |
|
| 20 | 20 | ), |
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | - public static $classMap = array ( |
|
| 24 | - 'OCA\\DAV\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', |
|
| 25 | - 'OCA\\DAV\\AppInfo\\PluginManager' => __DIR__ . '/..' . '/../lib/AppInfo/PluginManager.php', |
|
| 26 | - 'OCA\\DAV\\Avatars\\AvatarHome' => __DIR__ . '/..' . '/../lib/Avatars/AvatarHome.php', |
|
| 27 | - 'OCA\\DAV\\Avatars\\AvatarNode' => __DIR__ . '/..' . '/../lib/Avatars/AvatarNode.php', |
|
| 28 | - 'OCA\\DAV\\Avatars\\RootCollection' => __DIR__ . '/..' . '/../lib/Avatars/RootCollection.php', |
|
| 29 | - 'OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupDirectLinksJob.php', |
|
| 30 | - 'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php', |
|
| 31 | - 'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/RefreshWebcalJob.php', |
|
| 32 | - 'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php', |
|
| 33 | - 'OCA\\DAV\\CalDAV\\Activity\\Backend' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Backend.php', |
|
| 34 | - 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Filter/Calendar.php', |
|
| 35 | - 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Filter/Todo.php', |
|
| 36 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Base.php', |
|
| 37 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Calendar.php', |
|
| 38 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Event.php', |
|
| 39 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Todo.php', |
|
| 40 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Calendar.php', |
|
| 41 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Event.php', |
|
| 42 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Todo.php', |
|
| 43 | - 'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => __DIR__ . '/..' . '/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php', |
|
| 44 | - 'OCA\\DAV\\CalDAV\\BirthdayService' => __DIR__ . '/..' . '/../lib/CalDAV/BirthdayService.php', |
|
| 45 | - 'OCA\\DAV\\CalDAV\\CachedSubscription' => __DIR__ . '/..' . '/../lib/CalDAV/CachedSubscription.php', |
|
| 46 | - 'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => __DIR__ . '/..' . '/../lib/CalDAV/CachedSubscriptionObject.php', |
|
| 47 | - 'OCA\\DAV\\CalDAV\\CalDavBackend' => __DIR__ . '/..' . '/../lib/CalDAV/CalDavBackend.php', |
|
| 48 | - 'OCA\\DAV\\CalDAV\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Calendar.php', |
|
| 49 | - 'OCA\\DAV\\CalDAV\\CalendarHome' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarHome.php', |
|
| 50 | - 'OCA\\DAV\\CalDAV\\CalendarImpl' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarImpl.php', |
|
| 51 | - 'OCA\\DAV\\CalDAV\\CalendarManager' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarManager.php', |
|
| 52 | - 'OCA\\DAV\\CalDAV\\CalendarObject' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarObject.php', |
|
| 53 | - 'OCA\\DAV\\CalDAV\\CalendarRoot' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarRoot.php', |
|
| 54 | - 'OCA\\DAV\\CalDAV\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/Plugin.php', |
|
| 55 | - 'OCA\\DAV\\CalDAV\\Principal\\Collection' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/Collection.php', |
|
| 56 | - 'OCA\\DAV\\CalDAV\\Principal\\User' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/User.php', |
|
| 57 | - 'OCA\\DAV\\CalDAV\\PublicCalendar' => __DIR__ . '/..' . '/../lib/CalDAV/PublicCalendar.php', |
|
| 58 | - 'OCA\\DAV\\CalDAV\\PublicCalendarObject' => __DIR__ . '/..' . '/../lib/CalDAV/PublicCalendarObject.php', |
|
| 59 | - 'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => __DIR__ . '/..' . '/../lib/CalDAV/PublicCalendarRoot.php', |
|
| 60 | - 'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Publishing/PublishPlugin.php', |
|
| 61 | - 'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => __DIR__ . '/..' . '/../lib/CalDAV/Publishing/Xml/Publisher.php', |
|
| 62 | - 'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => __DIR__ . '/..' . '/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php', |
|
| 63 | - 'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => __DIR__ . '/..' . '/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php', |
|
| 64 | - 'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => __DIR__ . '/..' . '/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php', |
|
| 65 | - 'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Schedule/IMipPlugin.php', |
|
| 66 | - 'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/Schedule/Plugin.php', |
|
| 67 | - 'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Search/SearchPlugin.php', |
|
| 68 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/CompFilter.php', |
|
| 69 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php', |
|
| 70 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php', |
|
| 71 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php', |
|
| 72 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/PropFilter.php', |
|
| 73 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php', |
|
| 74 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php', |
|
| 75 | - 'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/WebcalCaching/Plugin.php', |
|
| 76 | - 'OCA\\DAV\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php', |
|
| 77 | - 'OCA\\DAV\\CardDAV\\AddressBook' => __DIR__ . '/..' . '/../lib/CardDAV/AddressBook.php', |
|
| 78 | - 'OCA\\DAV\\CardDAV\\AddressBookImpl' => __DIR__ . '/..' . '/../lib/CardDAV/AddressBookImpl.php', |
|
| 79 | - 'OCA\\DAV\\CardDAV\\AddressBookRoot' => __DIR__ . '/..' . '/../lib/CardDAV/AddressBookRoot.php', |
|
| 80 | - 'OCA\\DAV\\CardDAV\\CardDavBackend' => __DIR__ . '/..' . '/../lib/CardDAV/CardDavBackend.php', |
|
| 81 | - 'OCA\\DAV\\CardDAV\\ContactsManager' => __DIR__ . '/..' . '/../lib/CardDAV/ContactsManager.php', |
|
| 82 | - 'OCA\\DAV\\CardDAV\\Converter' => __DIR__ . '/..' . '/../lib/CardDAV/Converter.php', |
|
| 83 | - 'OCA\\DAV\\CardDAV\\ImageExportPlugin' => __DIR__ . '/..' . '/../lib/CardDAV/ImageExportPlugin.php', |
|
| 84 | - 'OCA\\DAV\\CardDAV\\PhotoCache' => __DIR__ . '/..' . '/../lib/CardDAV/PhotoCache.php', |
|
| 85 | - 'OCA\\DAV\\CardDAV\\Plugin' => __DIR__ . '/..' . '/../lib/CardDAV/Plugin.php', |
|
| 86 | - 'OCA\\DAV\\CardDAV\\SyncService' => __DIR__ . '/..' . '/../lib/CardDAV/SyncService.php', |
|
| 87 | - 'OCA\\DAV\\CardDAV\\UserAddressBooks' => __DIR__ . '/..' . '/../lib/CardDAV/UserAddressBooks.php', |
|
| 88 | - 'OCA\\DAV\\CardDAV\\Xml\\Groups' => __DIR__ . '/..' . '/../lib/CardDAV/Xml/Groups.php', |
|
| 89 | - 'OCA\\DAV\\Command\\CreateAddressBook' => __DIR__ . '/..' . '/../lib/Command/CreateAddressBook.php', |
|
| 90 | - 'OCA\\DAV\\Command\\CreateCalendar' => __DIR__ . '/..' . '/../lib/Command/CreateCalendar.php', |
|
| 91 | - 'OCA\\DAV\\Command\\RemoveInvalidShares' => __DIR__ . '/..' . '/../lib/Command/RemoveInvalidShares.php', |
|
| 92 | - 'OCA\\DAV\\Command\\SyncBirthdayCalendar' => __DIR__ . '/..' . '/../lib/Command/SyncBirthdayCalendar.php', |
|
| 93 | - 'OCA\\DAV\\Command\\SyncSystemAddressBook' => __DIR__ . '/..' . '/../lib/Command/SyncSystemAddressBook.php', |
|
| 94 | - 'OCA\\DAV\\Comments\\CommentNode' => __DIR__ . '/..' . '/../lib/Comments/CommentNode.php', |
|
| 95 | - 'OCA\\DAV\\Comments\\CommentsPlugin' => __DIR__ . '/..' . '/../lib/Comments/CommentsPlugin.php', |
|
| 96 | - 'OCA\\DAV\\Comments\\EntityCollection' => __DIR__ . '/..' . '/../lib/Comments/EntityCollection.php', |
|
| 97 | - 'OCA\\DAV\\Comments\\EntityTypeCollection' => __DIR__ . '/..' . '/../lib/Comments/EntityTypeCollection.php', |
|
| 98 | - 'OCA\\DAV\\Comments\\RootCollection' => __DIR__ . '/..' . '/../lib/Comments/RootCollection.php', |
|
| 99 | - 'OCA\\DAV\\Connector\\LegacyDAVACL' => __DIR__ . '/..' . '/../lib/Connector/LegacyDAVACL.php', |
|
| 100 | - 'OCA\\DAV\\Connector\\PublicAuth' => __DIR__ . '/..' . '/../lib/Connector/PublicAuth.php', |
|
| 101 | - 'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/AnonymousOptionsPlugin.php', |
|
| 102 | - 'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/AppEnabledPlugin.php', |
|
| 103 | - 'OCA\\DAV\\Connector\\Sabre\\Auth' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Auth.php', |
|
| 104 | - 'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => __DIR__ . '/..' . '/../lib/Connector/Sabre/BearerAuth.php', |
|
| 105 | - 'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/BlockLegacyClientPlugin.php', |
|
| 106 | - 'OCA\\DAV\\Connector\\Sabre\\CachingTree' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CachingTree.php', |
|
| 107 | - 'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ChecksumList.php', |
|
| 108 | - 'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CommentPropertiesPlugin.php', |
|
| 109 | - 'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php', |
|
| 110 | - 'OCA\\DAV\\Connector\\Sabre\\CustomPropertiesBackend' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CustomPropertiesBackend.php', |
|
| 111 | - 'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/DavAclPlugin.php', |
|
| 112 | - 'OCA\\DAV\\Connector\\Sabre\\Directory' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Directory.php', |
|
| 113 | - 'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/DummyGetResponsePlugin.php', |
|
| 114 | - 'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ExceptionLoggerPlugin.php', |
|
| 115 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/EntityTooLarge.php', |
|
| 116 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/FileLocked.php', |
|
| 117 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/Forbidden.php', |
|
| 118 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/InvalidPath.php', |
|
| 119 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php', |
|
| 120 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php', |
|
| 121 | - 'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FakeLockerPlugin.php', |
|
| 122 | - 'OCA\\DAV\\Connector\\Sabre\\File' => __DIR__ . '/..' . '/../lib/Connector/Sabre/File.php', |
|
| 123 | - 'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FilesPlugin.php', |
|
| 124 | - 'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FilesReportPlugin.php', |
|
| 125 | - 'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/LockPlugin.php', |
|
| 126 | - 'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/MaintenancePlugin.php', |
|
| 127 | - 'OCA\\DAV\\Connector\\Sabre\\Node' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Node.php', |
|
| 128 | - 'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ObjectTree.php', |
|
| 129 | - 'OCA\\DAV\\Connector\\Sabre\\Principal' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Principal.php', |
|
| 130 | - 'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/QuotaPlugin.php', |
|
| 131 | - 'OCA\\DAV\\Connector\\Sabre\\Server' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Server.php', |
|
| 132 | - 'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ServerFactory.php', |
|
| 133 | - 'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ShareTypeList.php', |
|
| 134 | - 'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/SharesPlugin.php', |
|
| 135 | - 'OCA\\DAV\\Connector\\Sabre\\TagList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/TagList.php', |
|
| 136 | - 'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/TagsPlugin.php', |
|
| 137 | - 'OCA\\DAV\\Controller\\BirthdayCalendarController' => __DIR__ . '/..' . '/../lib/Controller/BirthdayCalendarController.php', |
|
| 138 | - 'OCA\\DAV\\Controller\\DirectController' => __DIR__ . '/..' . '/../lib/Controller/DirectController.php', |
|
| 139 | - 'OCA\\DAV\\DAV\\CustomPropertiesBackend' => __DIR__ . '/..' . '/../lib/DAV/CustomPropertiesBackend.php', |
|
| 140 | - 'OCA\\DAV\\DAV\\GroupPrincipalBackend' => __DIR__ . '/..' . '/../lib/DAV/GroupPrincipalBackend.php', |
|
| 141 | - 'OCA\\DAV\\DAV\\PublicAuth' => __DIR__ . '/..' . '/../lib/DAV/PublicAuth.php', |
|
| 142 | - 'OCA\\DAV\\DAV\\Sharing\\Backend' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Backend.php', |
|
| 143 | - 'OCA\\DAV\\DAV\\Sharing\\IShareable' => __DIR__ . '/..' . '/../lib/DAV/Sharing/IShareable.php', |
|
| 144 | - 'OCA\\DAV\\DAV\\Sharing\\Plugin' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Plugin.php', |
|
| 145 | - 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Xml/Invite.php', |
|
| 146 | - 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Xml/ShareRequest.php', |
|
| 147 | - 'OCA\\DAV\\DAV\\SystemPrincipalBackend' => __DIR__ . '/..' . '/../lib/DAV/SystemPrincipalBackend.php', |
|
| 148 | - 'OCA\\DAV\\Db\\Direct' => __DIR__ . '/..' . '/../lib/Db/Direct.php', |
|
| 149 | - 'OCA\\DAV\\Db\\DirectMapper' => __DIR__ . '/..' . '/../lib/Db/DirectMapper.php', |
|
| 150 | - 'OCA\\DAV\\Direct\\DirectFile' => __DIR__ . '/..' . '/../lib/Direct/DirectFile.php', |
|
| 151 | - 'OCA\\DAV\\Direct\\DirectHome' => __DIR__ . '/..' . '/../lib/Direct/DirectHome.php', |
|
| 152 | - 'OCA\\DAV\\Direct\\Server' => __DIR__ . '/..' . '/../lib/Direct/Server.php', |
|
| 153 | - 'OCA\\DAV\\Direct\\ServerFactory' => __DIR__ . '/..' . '/../lib/Direct/ServerFactory.php', |
|
| 154 | - 'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => __DIR__ . '/..' . '/../lib/Files/BrowserErrorPagePlugin.php', |
|
| 155 | - 'OCA\\DAV\\Files\\FileSearchBackend' => __DIR__ . '/..' . '/../lib/Files/FileSearchBackend.php', |
|
| 156 | - 'OCA\\DAV\\Files\\FilesHome' => __DIR__ . '/..' . '/../lib/Files/FilesHome.php', |
|
| 157 | - 'OCA\\DAV\\Files\\LazySearchBackend' => __DIR__ . '/..' . '/../lib/Files/LazySearchBackend.php', |
|
| 158 | - 'OCA\\DAV\\Files\\RootCollection' => __DIR__ . '/..' . '/../lib/Files/RootCollection.php', |
|
| 159 | - 'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => __DIR__ . '/..' . '/../lib/Files/Sharing/FilesDropPlugin.php', |
|
| 160 | - 'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => __DIR__ . '/..' . '/../lib/Files/Sharing/PublicLinkCheckPlugin.php', |
|
| 161 | - 'OCA\\DAV\\HookManager' => __DIR__ . '/..' . '/../lib/HookManager.php', |
|
| 162 | - 'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => __DIR__ . '/..' . '/../lib/Migration/BuildCalendarSearchIndex.php', |
|
| 163 | - 'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php', |
|
| 164 | - 'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => __DIR__ . '/..' . '/../lib/Migration/CalDAVRemoveEmptyValue.php', |
|
| 165 | - 'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => __DIR__ . '/..' . '/../lib/Migration/FixBirthdayCalendarComponent.php', |
|
| 166 | - 'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => __DIR__ . '/..' . '/../lib/Migration/RefreshWebcalJobRegistrar.php', |
|
| 167 | - 'OCA\\DAV\\Migration\\Version1004Date20170825134824' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170825134824.php', |
|
| 168 | - 'OCA\\DAV\\Migration\\Version1004Date20170919104507' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170919104507.php', |
|
| 169 | - 'OCA\\DAV\\Migration\\Version1004Date20170924124212' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170924124212.php', |
|
| 170 | - 'OCA\\DAV\\Migration\\Version1004Date20170926103422' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170926103422.php', |
|
| 171 | - 'OCA\\DAV\\Migration\\Version1005Date20180413093149' => __DIR__ . '/..' . '/../lib/Migration/Version1005Date20180413093149.php', |
|
| 172 | - 'OCA\\DAV\\Migration\\Version1005Date20180530124431' => __DIR__ . '/..' . '/../lib/Migration/Version1005Date20180530124431.php', |
|
| 173 | - 'OCA\\DAV\\Migration\\Version1006Date20180628111625' => __DIR__ . '/..' . '/../lib/Migration/Version1006Date20180628111625.php', |
|
| 174 | - 'OCA\\DAV\\RootCollection' => __DIR__ . '/..' . '/../lib/RootCollection.php', |
|
| 175 | - 'OCA\\DAV\\Server' => __DIR__ . '/..' . '/../lib/Server.php', |
|
| 176 | - 'OCA\\DAV\\Settings\\CalDAVSettings' => __DIR__ . '/..' . '/../lib/Settings/CalDAVSettings.php', |
|
| 177 | - 'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagMappingNode.php', |
|
| 178 | - 'OCA\\DAV\\SystemTag\\SystemTagNode' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagNode.php', |
|
| 179 | - 'OCA\\DAV\\SystemTag\\SystemTagPlugin' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagPlugin.php', |
|
| 180 | - 'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsByIdCollection.php', |
|
| 181 | - 'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsObjectMappingCollection.php', |
|
| 182 | - 'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsObjectTypeCollection.php', |
|
| 183 | - 'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsRelationsCollection.php', |
|
| 184 | - 'OCA\\DAV\\Upload\\AssemblyStream' => __DIR__ . '/..' . '/../lib/Upload/AssemblyStream.php', |
|
| 185 | - 'OCA\\DAV\\Upload\\ChunkingPlugin' => __DIR__ . '/..' . '/../lib/Upload/ChunkingPlugin.php', |
|
| 186 | - 'OCA\\DAV\\Upload\\FutureFile' => __DIR__ . '/..' . '/../lib/Upload/FutureFile.php', |
|
| 187 | - 'OCA\\DAV\\Upload\\RootCollection' => __DIR__ . '/..' . '/../lib/Upload/RootCollection.php', |
|
| 188 | - 'OCA\\DAV\\Upload\\UploadFolder' => __DIR__ . '/..' . '/../lib/Upload/UploadFolder.php', |
|
| 189 | - 'OCA\\DAV\\Upload\\UploadHome' => __DIR__ . '/..' . '/../lib/Upload/UploadHome.php', |
|
| 23 | + public static $classMap = array( |
|
| 24 | + 'OCA\\DAV\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php', |
|
| 25 | + 'OCA\\DAV\\AppInfo\\PluginManager' => __DIR__.'/..'.'/../lib/AppInfo/PluginManager.php', |
|
| 26 | + 'OCA\\DAV\\Avatars\\AvatarHome' => __DIR__.'/..'.'/../lib/Avatars/AvatarHome.php', |
|
| 27 | + 'OCA\\DAV\\Avatars\\AvatarNode' => __DIR__.'/..'.'/../lib/Avatars/AvatarNode.php', |
|
| 28 | + 'OCA\\DAV\\Avatars\\RootCollection' => __DIR__.'/..'.'/../lib/Avatars/RootCollection.php', |
|
| 29 | + 'OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupDirectLinksJob.php', |
|
| 30 | + 'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => __DIR__.'/..'.'/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php', |
|
| 31 | + 'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => __DIR__.'/..'.'/../lib/BackgroundJob/RefreshWebcalJob.php', |
|
| 32 | + 'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => __DIR__.'/..'.'/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php', |
|
| 33 | + 'OCA\\DAV\\CalDAV\\Activity\\Backend' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Backend.php', |
|
| 34 | + 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Filter/Calendar.php', |
|
| 35 | + 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Filter/Todo.php', |
|
| 36 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Base.php', |
|
| 37 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Calendar.php', |
|
| 38 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Event.php', |
|
| 39 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Todo.php', |
|
| 40 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/Calendar.php', |
|
| 41 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/Event.php', |
|
| 42 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/Todo.php', |
|
| 43 | + 'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => __DIR__.'/..'.'/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php', |
|
| 44 | + 'OCA\\DAV\\CalDAV\\BirthdayService' => __DIR__.'/..'.'/../lib/CalDAV/BirthdayService.php', |
|
| 45 | + 'OCA\\DAV\\CalDAV\\CachedSubscription' => __DIR__.'/..'.'/../lib/CalDAV/CachedSubscription.php', |
|
| 46 | + 'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => __DIR__.'/..'.'/../lib/CalDAV/CachedSubscriptionObject.php', |
|
| 47 | + 'OCA\\DAV\\CalDAV\\CalDavBackend' => __DIR__.'/..'.'/../lib/CalDAV/CalDavBackend.php', |
|
| 48 | + 'OCA\\DAV\\CalDAV\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Calendar.php', |
|
| 49 | + 'OCA\\DAV\\CalDAV\\CalendarHome' => __DIR__.'/..'.'/../lib/CalDAV/CalendarHome.php', |
|
| 50 | + 'OCA\\DAV\\CalDAV\\CalendarImpl' => __DIR__.'/..'.'/../lib/CalDAV/CalendarImpl.php', |
|
| 51 | + 'OCA\\DAV\\CalDAV\\CalendarManager' => __DIR__.'/..'.'/../lib/CalDAV/CalendarManager.php', |
|
| 52 | + 'OCA\\DAV\\CalDAV\\CalendarObject' => __DIR__.'/..'.'/../lib/CalDAV/CalendarObject.php', |
|
| 53 | + 'OCA\\DAV\\CalDAV\\CalendarRoot' => __DIR__.'/..'.'/../lib/CalDAV/CalendarRoot.php', |
|
| 54 | + 'OCA\\DAV\\CalDAV\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/Plugin.php', |
|
| 55 | + 'OCA\\DAV\\CalDAV\\Principal\\Collection' => __DIR__.'/..'.'/../lib/CalDAV/Principal/Collection.php', |
|
| 56 | + 'OCA\\DAV\\CalDAV\\Principal\\User' => __DIR__.'/..'.'/../lib/CalDAV/Principal/User.php', |
|
| 57 | + 'OCA\\DAV\\CalDAV\\PublicCalendar' => __DIR__.'/..'.'/../lib/CalDAV/PublicCalendar.php', |
|
| 58 | + 'OCA\\DAV\\CalDAV\\PublicCalendarObject' => __DIR__.'/..'.'/../lib/CalDAV/PublicCalendarObject.php', |
|
| 59 | + 'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => __DIR__.'/..'.'/../lib/CalDAV/PublicCalendarRoot.php', |
|
| 60 | + 'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Publishing/PublishPlugin.php', |
|
| 61 | + 'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => __DIR__.'/..'.'/../lib/CalDAV/Publishing/Xml/Publisher.php', |
|
| 62 | + 'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => __DIR__.'/..'.'/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php', |
|
| 63 | + 'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => __DIR__.'/..'.'/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php', |
|
| 64 | + 'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => __DIR__.'/..'.'/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php', |
|
| 65 | + 'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Schedule/IMipPlugin.php', |
|
| 66 | + 'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/Schedule/Plugin.php', |
|
| 67 | + 'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Search/SearchPlugin.php', |
|
| 68 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/CompFilter.php', |
|
| 69 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php', |
|
| 70 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php', |
|
| 71 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php', |
|
| 72 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/PropFilter.php', |
|
| 73 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php', |
|
| 74 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php', |
|
| 75 | + 'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/WebcalCaching/Plugin.php', |
|
| 76 | + 'OCA\\DAV\\Capabilities' => __DIR__.'/..'.'/../lib/Capabilities.php', |
|
| 77 | + 'OCA\\DAV\\CardDAV\\AddressBook' => __DIR__.'/..'.'/../lib/CardDAV/AddressBook.php', |
|
| 78 | + 'OCA\\DAV\\CardDAV\\AddressBookImpl' => __DIR__.'/..'.'/../lib/CardDAV/AddressBookImpl.php', |
|
| 79 | + 'OCA\\DAV\\CardDAV\\AddressBookRoot' => __DIR__.'/..'.'/../lib/CardDAV/AddressBookRoot.php', |
|
| 80 | + 'OCA\\DAV\\CardDAV\\CardDavBackend' => __DIR__.'/..'.'/../lib/CardDAV/CardDavBackend.php', |
|
| 81 | + 'OCA\\DAV\\CardDAV\\ContactsManager' => __DIR__.'/..'.'/../lib/CardDAV/ContactsManager.php', |
|
| 82 | + 'OCA\\DAV\\CardDAV\\Converter' => __DIR__.'/..'.'/../lib/CardDAV/Converter.php', |
|
| 83 | + 'OCA\\DAV\\CardDAV\\ImageExportPlugin' => __DIR__.'/..'.'/../lib/CardDAV/ImageExportPlugin.php', |
|
| 84 | + 'OCA\\DAV\\CardDAV\\PhotoCache' => __DIR__.'/..'.'/../lib/CardDAV/PhotoCache.php', |
|
| 85 | + 'OCA\\DAV\\CardDAV\\Plugin' => __DIR__.'/..'.'/../lib/CardDAV/Plugin.php', |
|
| 86 | + 'OCA\\DAV\\CardDAV\\SyncService' => __DIR__.'/..'.'/../lib/CardDAV/SyncService.php', |
|
| 87 | + 'OCA\\DAV\\CardDAV\\UserAddressBooks' => __DIR__.'/..'.'/../lib/CardDAV/UserAddressBooks.php', |
|
| 88 | + 'OCA\\DAV\\CardDAV\\Xml\\Groups' => __DIR__.'/..'.'/../lib/CardDAV/Xml/Groups.php', |
|
| 89 | + 'OCA\\DAV\\Command\\CreateAddressBook' => __DIR__.'/..'.'/../lib/Command/CreateAddressBook.php', |
|
| 90 | + 'OCA\\DAV\\Command\\CreateCalendar' => __DIR__.'/..'.'/../lib/Command/CreateCalendar.php', |
|
| 91 | + 'OCA\\DAV\\Command\\RemoveInvalidShares' => __DIR__.'/..'.'/../lib/Command/RemoveInvalidShares.php', |
|
| 92 | + 'OCA\\DAV\\Command\\SyncBirthdayCalendar' => __DIR__.'/..'.'/../lib/Command/SyncBirthdayCalendar.php', |
|
| 93 | + 'OCA\\DAV\\Command\\SyncSystemAddressBook' => __DIR__.'/..'.'/../lib/Command/SyncSystemAddressBook.php', |
|
| 94 | + 'OCA\\DAV\\Comments\\CommentNode' => __DIR__.'/..'.'/../lib/Comments/CommentNode.php', |
|
| 95 | + 'OCA\\DAV\\Comments\\CommentsPlugin' => __DIR__.'/..'.'/../lib/Comments/CommentsPlugin.php', |
|
| 96 | + 'OCA\\DAV\\Comments\\EntityCollection' => __DIR__.'/..'.'/../lib/Comments/EntityCollection.php', |
|
| 97 | + 'OCA\\DAV\\Comments\\EntityTypeCollection' => __DIR__.'/..'.'/../lib/Comments/EntityTypeCollection.php', |
|
| 98 | + 'OCA\\DAV\\Comments\\RootCollection' => __DIR__.'/..'.'/../lib/Comments/RootCollection.php', |
|
| 99 | + 'OCA\\DAV\\Connector\\LegacyDAVACL' => __DIR__.'/..'.'/../lib/Connector/LegacyDAVACL.php', |
|
| 100 | + 'OCA\\DAV\\Connector\\PublicAuth' => __DIR__.'/..'.'/../lib/Connector/PublicAuth.php', |
|
| 101 | + 'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/AnonymousOptionsPlugin.php', |
|
| 102 | + 'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/AppEnabledPlugin.php', |
|
| 103 | + 'OCA\\DAV\\Connector\\Sabre\\Auth' => __DIR__.'/..'.'/../lib/Connector/Sabre/Auth.php', |
|
| 104 | + 'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => __DIR__.'/..'.'/../lib/Connector/Sabre/BearerAuth.php', |
|
| 105 | + 'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/BlockLegacyClientPlugin.php', |
|
| 106 | + 'OCA\\DAV\\Connector\\Sabre\\CachingTree' => __DIR__.'/..'.'/../lib/Connector/Sabre/CachingTree.php', |
|
| 107 | + 'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => __DIR__.'/..'.'/../lib/Connector/Sabre/ChecksumList.php', |
|
| 108 | + 'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/CommentPropertiesPlugin.php', |
|
| 109 | + 'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php', |
|
| 110 | + 'OCA\\DAV\\Connector\\Sabre\\CustomPropertiesBackend' => __DIR__.'/..'.'/../lib/Connector/Sabre/CustomPropertiesBackend.php', |
|
| 111 | + 'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/DavAclPlugin.php', |
|
| 112 | + 'OCA\\DAV\\Connector\\Sabre\\Directory' => __DIR__.'/..'.'/../lib/Connector/Sabre/Directory.php', |
|
| 113 | + 'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/DummyGetResponsePlugin.php', |
|
| 114 | + 'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/ExceptionLoggerPlugin.php', |
|
| 115 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/EntityTooLarge.php', |
|
| 116 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/FileLocked.php', |
|
| 117 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/Forbidden.php', |
|
| 118 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/InvalidPath.php', |
|
| 119 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php', |
|
| 120 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php', |
|
| 121 | + 'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/FakeLockerPlugin.php', |
|
| 122 | + 'OCA\\DAV\\Connector\\Sabre\\File' => __DIR__.'/..'.'/../lib/Connector/Sabre/File.php', |
|
| 123 | + 'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/FilesPlugin.php', |
|
| 124 | + 'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/FilesReportPlugin.php', |
|
| 125 | + 'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/LockPlugin.php', |
|
| 126 | + 'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/MaintenancePlugin.php', |
|
| 127 | + 'OCA\\DAV\\Connector\\Sabre\\Node' => __DIR__.'/..'.'/../lib/Connector/Sabre/Node.php', |
|
| 128 | + 'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => __DIR__.'/..'.'/../lib/Connector/Sabre/ObjectTree.php', |
|
| 129 | + 'OCA\\DAV\\Connector\\Sabre\\Principal' => __DIR__.'/..'.'/../lib/Connector/Sabre/Principal.php', |
|
| 130 | + 'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/QuotaPlugin.php', |
|
| 131 | + 'OCA\\DAV\\Connector\\Sabre\\Server' => __DIR__.'/..'.'/../lib/Connector/Sabre/Server.php', |
|
| 132 | + 'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => __DIR__.'/..'.'/../lib/Connector/Sabre/ServerFactory.php', |
|
| 133 | + 'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => __DIR__.'/..'.'/../lib/Connector/Sabre/ShareTypeList.php', |
|
| 134 | + 'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/SharesPlugin.php', |
|
| 135 | + 'OCA\\DAV\\Connector\\Sabre\\TagList' => __DIR__.'/..'.'/../lib/Connector/Sabre/TagList.php', |
|
| 136 | + 'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/TagsPlugin.php', |
|
| 137 | + 'OCA\\DAV\\Controller\\BirthdayCalendarController' => __DIR__.'/..'.'/../lib/Controller/BirthdayCalendarController.php', |
|
| 138 | + 'OCA\\DAV\\Controller\\DirectController' => __DIR__.'/..'.'/../lib/Controller/DirectController.php', |
|
| 139 | + 'OCA\\DAV\\DAV\\CustomPropertiesBackend' => __DIR__.'/..'.'/../lib/DAV/CustomPropertiesBackend.php', |
|
| 140 | + 'OCA\\DAV\\DAV\\GroupPrincipalBackend' => __DIR__.'/..'.'/../lib/DAV/GroupPrincipalBackend.php', |
|
| 141 | + 'OCA\\DAV\\DAV\\PublicAuth' => __DIR__.'/..'.'/../lib/DAV/PublicAuth.php', |
|
| 142 | + 'OCA\\DAV\\DAV\\Sharing\\Backend' => __DIR__.'/..'.'/../lib/DAV/Sharing/Backend.php', |
|
| 143 | + 'OCA\\DAV\\DAV\\Sharing\\IShareable' => __DIR__.'/..'.'/../lib/DAV/Sharing/IShareable.php', |
|
| 144 | + 'OCA\\DAV\\DAV\\Sharing\\Plugin' => __DIR__.'/..'.'/../lib/DAV/Sharing/Plugin.php', |
|
| 145 | + 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => __DIR__.'/..'.'/../lib/DAV/Sharing/Xml/Invite.php', |
|
| 146 | + 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => __DIR__.'/..'.'/../lib/DAV/Sharing/Xml/ShareRequest.php', |
|
| 147 | + 'OCA\\DAV\\DAV\\SystemPrincipalBackend' => __DIR__.'/..'.'/../lib/DAV/SystemPrincipalBackend.php', |
|
| 148 | + 'OCA\\DAV\\Db\\Direct' => __DIR__.'/..'.'/../lib/Db/Direct.php', |
|
| 149 | + 'OCA\\DAV\\Db\\DirectMapper' => __DIR__.'/..'.'/../lib/Db/DirectMapper.php', |
|
| 150 | + 'OCA\\DAV\\Direct\\DirectFile' => __DIR__.'/..'.'/../lib/Direct/DirectFile.php', |
|
| 151 | + 'OCA\\DAV\\Direct\\DirectHome' => __DIR__.'/..'.'/../lib/Direct/DirectHome.php', |
|
| 152 | + 'OCA\\DAV\\Direct\\Server' => __DIR__.'/..'.'/../lib/Direct/Server.php', |
|
| 153 | + 'OCA\\DAV\\Direct\\ServerFactory' => __DIR__.'/..'.'/../lib/Direct/ServerFactory.php', |
|
| 154 | + 'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => __DIR__.'/..'.'/../lib/Files/BrowserErrorPagePlugin.php', |
|
| 155 | + 'OCA\\DAV\\Files\\FileSearchBackend' => __DIR__.'/..'.'/../lib/Files/FileSearchBackend.php', |
|
| 156 | + 'OCA\\DAV\\Files\\FilesHome' => __DIR__.'/..'.'/../lib/Files/FilesHome.php', |
|
| 157 | + 'OCA\\DAV\\Files\\LazySearchBackend' => __DIR__.'/..'.'/../lib/Files/LazySearchBackend.php', |
|
| 158 | + 'OCA\\DAV\\Files\\RootCollection' => __DIR__.'/..'.'/../lib/Files/RootCollection.php', |
|
| 159 | + 'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => __DIR__.'/..'.'/../lib/Files/Sharing/FilesDropPlugin.php', |
|
| 160 | + 'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => __DIR__.'/..'.'/../lib/Files/Sharing/PublicLinkCheckPlugin.php', |
|
| 161 | + 'OCA\\DAV\\HookManager' => __DIR__.'/..'.'/../lib/HookManager.php', |
|
| 162 | + 'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => __DIR__.'/..'.'/../lib/Migration/BuildCalendarSearchIndex.php', |
|
| 163 | + 'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => __DIR__.'/..'.'/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php', |
|
| 164 | + 'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => __DIR__.'/..'.'/../lib/Migration/CalDAVRemoveEmptyValue.php', |
|
| 165 | + 'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => __DIR__.'/..'.'/../lib/Migration/FixBirthdayCalendarComponent.php', |
|
| 166 | + 'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => __DIR__.'/..'.'/../lib/Migration/RefreshWebcalJobRegistrar.php', |
|
| 167 | + 'OCA\\DAV\\Migration\\Version1004Date20170825134824' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170825134824.php', |
|
| 168 | + 'OCA\\DAV\\Migration\\Version1004Date20170919104507' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170919104507.php', |
|
| 169 | + 'OCA\\DAV\\Migration\\Version1004Date20170924124212' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170924124212.php', |
|
| 170 | + 'OCA\\DAV\\Migration\\Version1004Date20170926103422' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170926103422.php', |
|
| 171 | + 'OCA\\DAV\\Migration\\Version1005Date20180413093149' => __DIR__.'/..'.'/../lib/Migration/Version1005Date20180413093149.php', |
|
| 172 | + 'OCA\\DAV\\Migration\\Version1005Date20180530124431' => __DIR__.'/..'.'/../lib/Migration/Version1005Date20180530124431.php', |
|
| 173 | + 'OCA\\DAV\\Migration\\Version1006Date20180628111625' => __DIR__.'/..'.'/../lib/Migration/Version1006Date20180628111625.php', |
|
| 174 | + 'OCA\\DAV\\RootCollection' => __DIR__.'/..'.'/../lib/RootCollection.php', |
|
| 175 | + 'OCA\\DAV\\Server' => __DIR__.'/..'.'/../lib/Server.php', |
|
| 176 | + 'OCA\\DAV\\Settings\\CalDAVSettings' => __DIR__.'/..'.'/../lib/Settings/CalDAVSettings.php', |
|
| 177 | + 'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagMappingNode.php', |
|
| 178 | + 'OCA\\DAV\\SystemTag\\SystemTagNode' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagNode.php', |
|
| 179 | + 'OCA\\DAV\\SystemTag\\SystemTagPlugin' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagPlugin.php', |
|
| 180 | + 'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsByIdCollection.php', |
|
| 181 | + 'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsObjectMappingCollection.php', |
|
| 182 | + 'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsObjectTypeCollection.php', |
|
| 183 | + 'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsRelationsCollection.php', |
|
| 184 | + 'OCA\\DAV\\Upload\\AssemblyStream' => __DIR__.'/..'.'/../lib/Upload/AssemblyStream.php', |
|
| 185 | + 'OCA\\DAV\\Upload\\ChunkingPlugin' => __DIR__.'/..'.'/../lib/Upload/ChunkingPlugin.php', |
|
| 186 | + 'OCA\\DAV\\Upload\\FutureFile' => __DIR__.'/..'.'/../lib/Upload/FutureFile.php', |
|
| 187 | + 'OCA\\DAV\\Upload\\RootCollection' => __DIR__.'/..'.'/../lib/Upload/RootCollection.php', |
|
| 188 | + 'OCA\\DAV\\Upload\\UploadFolder' => __DIR__.'/..'.'/../lib/Upload/UploadFolder.php', |
|
| 189 | + 'OCA\\DAV\\Upload\\UploadHome' => __DIR__.'/..'.'/../lib/Upload/UploadHome.php', |
|
| 190 | 190 | ); |
| 191 | 191 | |
| 192 | 192 | public static function getInitializer(ClassLoader $loader) |
| 193 | 193 | { |
| 194 | - return \Closure::bind(function () use ($loader) { |
|
| 194 | + return \Closure::bind(function() use ($loader) { |
|
| 195 | 195 | $loader->prefixLengthsPsr4 = ComposerStaticInitDAV::$prefixLengthsPsr4; |
| 196 | 196 | $loader->prefixDirsPsr4 = ComposerStaticInitDAV::$prefixDirsPsr4; |
| 197 | 197 | $loader->classMap = ComposerStaticInitDAV::$classMap; |
@@ -6,170 +6,170 @@ |
||
| 6 | 6 | $baseDir = $vendorDir; |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'OCA\\DAV\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', |
|
| 10 | - 'OCA\\DAV\\AppInfo\\PluginManager' => $baseDir . '/../lib/AppInfo/PluginManager.php', |
|
| 11 | - 'OCA\\DAV\\Avatars\\AvatarHome' => $baseDir . '/../lib/Avatars/AvatarHome.php', |
|
| 12 | - 'OCA\\DAV\\Avatars\\AvatarNode' => $baseDir . '/../lib/Avatars/AvatarNode.php', |
|
| 13 | - 'OCA\\DAV\\Avatars\\RootCollection' => $baseDir . '/../lib/Avatars/RootCollection.php', |
|
| 14 | - 'OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob' => $baseDir . '/../lib/BackgroundJob/CleanupDirectLinksJob.php', |
|
| 15 | - 'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => $baseDir . '/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php', |
|
| 16 | - 'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => $baseDir . '/../lib/BackgroundJob/RefreshWebcalJob.php', |
|
| 17 | - 'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => $baseDir . '/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php', |
|
| 18 | - 'OCA\\DAV\\CalDAV\\Activity\\Backend' => $baseDir . '/../lib/CalDAV/Activity/Backend.php', |
|
| 19 | - 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Filter/Calendar.php', |
|
| 20 | - 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Filter/Todo.php', |
|
| 21 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => $baseDir . '/../lib/CalDAV/Activity/Provider/Base.php', |
|
| 22 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Provider/Calendar.php', |
|
| 23 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => $baseDir . '/../lib/CalDAV/Activity/Provider/Event.php', |
|
| 24 | - 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Provider/Todo.php', |
|
| 25 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Setting/Calendar.php', |
|
| 26 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => $baseDir . '/../lib/CalDAV/Activity/Setting/Event.php', |
|
| 27 | - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Setting/Todo.php', |
|
| 28 | - 'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => $baseDir . '/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php', |
|
| 29 | - 'OCA\\DAV\\CalDAV\\BirthdayService' => $baseDir . '/../lib/CalDAV/BirthdayService.php', |
|
| 30 | - 'OCA\\DAV\\CalDAV\\CachedSubscription' => $baseDir . '/../lib/CalDAV/CachedSubscription.php', |
|
| 31 | - 'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => $baseDir . '/../lib/CalDAV/CachedSubscriptionObject.php', |
|
| 32 | - 'OCA\\DAV\\CalDAV\\CalDavBackend' => $baseDir . '/../lib/CalDAV/CalDavBackend.php', |
|
| 33 | - 'OCA\\DAV\\CalDAV\\Calendar' => $baseDir . '/../lib/CalDAV/Calendar.php', |
|
| 34 | - 'OCA\\DAV\\CalDAV\\CalendarHome' => $baseDir . '/../lib/CalDAV/CalendarHome.php', |
|
| 35 | - 'OCA\\DAV\\CalDAV\\CalendarImpl' => $baseDir . '/../lib/CalDAV/CalendarImpl.php', |
|
| 36 | - 'OCA\\DAV\\CalDAV\\CalendarManager' => $baseDir . '/../lib/CalDAV/CalendarManager.php', |
|
| 37 | - 'OCA\\DAV\\CalDAV\\CalendarObject' => $baseDir . '/../lib/CalDAV/CalendarObject.php', |
|
| 38 | - 'OCA\\DAV\\CalDAV\\CalendarRoot' => $baseDir . '/../lib/CalDAV/CalendarRoot.php', |
|
| 39 | - 'OCA\\DAV\\CalDAV\\Plugin' => $baseDir . '/../lib/CalDAV/Plugin.php', |
|
| 40 | - 'OCA\\DAV\\CalDAV\\Principal\\Collection' => $baseDir . '/../lib/CalDAV/Principal/Collection.php', |
|
| 41 | - 'OCA\\DAV\\CalDAV\\Principal\\User' => $baseDir . '/../lib/CalDAV/Principal/User.php', |
|
| 42 | - 'OCA\\DAV\\CalDAV\\PublicCalendar' => $baseDir . '/../lib/CalDAV/PublicCalendar.php', |
|
| 43 | - 'OCA\\DAV\\CalDAV\\PublicCalendarObject' => $baseDir . '/../lib/CalDAV/PublicCalendarObject.php', |
|
| 44 | - 'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => $baseDir . '/../lib/CalDAV/PublicCalendarRoot.php', |
|
| 45 | - 'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => $baseDir . '/../lib/CalDAV/Publishing/PublishPlugin.php', |
|
| 46 | - 'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => $baseDir . '/../lib/CalDAV/Publishing/Xml/Publisher.php', |
|
| 47 | - 'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => $baseDir . '/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php', |
|
| 48 | - 'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => $baseDir . '/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php', |
|
| 49 | - 'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => $baseDir . '/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php', |
|
| 50 | - 'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => $baseDir . '/../lib/CalDAV/Schedule/IMipPlugin.php', |
|
| 51 | - 'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => $baseDir . '/../lib/CalDAV/Schedule/Plugin.php', |
|
| 52 | - 'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => $baseDir . '/../lib/CalDAV/Search/SearchPlugin.php', |
|
| 53 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/CompFilter.php', |
|
| 54 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php', |
|
| 55 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php', |
|
| 56 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php', |
|
| 57 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/PropFilter.php', |
|
| 58 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php', |
|
| 59 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => $baseDir . '/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php', |
|
| 60 | - 'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => $baseDir . '/../lib/CalDAV/WebcalCaching/Plugin.php', |
|
| 61 | - 'OCA\\DAV\\Capabilities' => $baseDir . '/../lib/Capabilities.php', |
|
| 62 | - 'OCA\\DAV\\CardDAV\\AddressBook' => $baseDir . '/../lib/CardDAV/AddressBook.php', |
|
| 63 | - 'OCA\\DAV\\CardDAV\\AddressBookImpl' => $baseDir . '/../lib/CardDAV/AddressBookImpl.php', |
|
| 64 | - 'OCA\\DAV\\CardDAV\\AddressBookRoot' => $baseDir . '/../lib/CardDAV/AddressBookRoot.php', |
|
| 65 | - 'OCA\\DAV\\CardDAV\\CardDavBackend' => $baseDir . '/../lib/CardDAV/CardDavBackend.php', |
|
| 66 | - 'OCA\\DAV\\CardDAV\\ContactsManager' => $baseDir . '/../lib/CardDAV/ContactsManager.php', |
|
| 67 | - 'OCA\\DAV\\CardDAV\\Converter' => $baseDir . '/../lib/CardDAV/Converter.php', |
|
| 68 | - 'OCA\\DAV\\CardDAV\\ImageExportPlugin' => $baseDir . '/../lib/CardDAV/ImageExportPlugin.php', |
|
| 69 | - 'OCA\\DAV\\CardDAV\\PhotoCache' => $baseDir . '/../lib/CardDAV/PhotoCache.php', |
|
| 70 | - 'OCA\\DAV\\CardDAV\\Plugin' => $baseDir . '/../lib/CardDAV/Plugin.php', |
|
| 71 | - 'OCA\\DAV\\CardDAV\\SyncService' => $baseDir . '/../lib/CardDAV/SyncService.php', |
|
| 72 | - 'OCA\\DAV\\CardDAV\\UserAddressBooks' => $baseDir . '/../lib/CardDAV/UserAddressBooks.php', |
|
| 73 | - 'OCA\\DAV\\CardDAV\\Xml\\Groups' => $baseDir . '/../lib/CardDAV/Xml/Groups.php', |
|
| 74 | - 'OCA\\DAV\\Command\\CreateAddressBook' => $baseDir . '/../lib/Command/CreateAddressBook.php', |
|
| 75 | - 'OCA\\DAV\\Command\\CreateCalendar' => $baseDir . '/../lib/Command/CreateCalendar.php', |
|
| 76 | - 'OCA\\DAV\\Command\\RemoveInvalidShares' => $baseDir . '/../lib/Command/RemoveInvalidShares.php', |
|
| 77 | - 'OCA\\DAV\\Command\\SyncBirthdayCalendar' => $baseDir . '/../lib/Command/SyncBirthdayCalendar.php', |
|
| 78 | - 'OCA\\DAV\\Command\\SyncSystemAddressBook' => $baseDir . '/../lib/Command/SyncSystemAddressBook.php', |
|
| 79 | - 'OCA\\DAV\\Comments\\CommentNode' => $baseDir . '/../lib/Comments/CommentNode.php', |
|
| 80 | - 'OCA\\DAV\\Comments\\CommentsPlugin' => $baseDir . '/../lib/Comments/CommentsPlugin.php', |
|
| 81 | - 'OCA\\DAV\\Comments\\EntityCollection' => $baseDir . '/../lib/Comments/EntityCollection.php', |
|
| 82 | - 'OCA\\DAV\\Comments\\EntityTypeCollection' => $baseDir . '/../lib/Comments/EntityTypeCollection.php', |
|
| 83 | - 'OCA\\DAV\\Comments\\RootCollection' => $baseDir . '/../lib/Comments/RootCollection.php', |
|
| 84 | - 'OCA\\DAV\\Connector\\LegacyDAVACL' => $baseDir . '/../lib/Connector/LegacyDAVACL.php', |
|
| 85 | - 'OCA\\DAV\\Connector\\PublicAuth' => $baseDir . '/../lib/Connector/PublicAuth.php', |
|
| 86 | - 'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => $baseDir . '/../lib/Connector/Sabre/AnonymousOptionsPlugin.php', |
|
| 87 | - 'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => $baseDir . '/../lib/Connector/Sabre/AppEnabledPlugin.php', |
|
| 88 | - 'OCA\\DAV\\Connector\\Sabre\\Auth' => $baseDir . '/../lib/Connector/Sabre/Auth.php', |
|
| 89 | - 'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => $baseDir . '/../lib/Connector/Sabre/BearerAuth.php', |
|
| 90 | - 'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => $baseDir . '/../lib/Connector/Sabre/BlockLegacyClientPlugin.php', |
|
| 91 | - 'OCA\\DAV\\Connector\\Sabre\\CachingTree' => $baseDir . '/../lib/Connector/Sabre/CachingTree.php', |
|
| 92 | - 'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => $baseDir . '/../lib/Connector/Sabre/ChecksumList.php', |
|
| 93 | - 'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => $baseDir . '/../lib/Connector/Sabre/CommentPropertiesPlugin.php', |
|
| 94 | - 'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => $baseDir . '/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php', |
|
| 95 | - 'OCA\\DAV\\Connector\\Sabre\\CustomPropertiesBackend' => $baseDir . '/../lib/Connector/Sabre/CustomPropertiesBackend.php', |
|
| 96 | - 'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => $baseDir . '/../lib/Connector/Sabre/DavAclPlugin.php', |
|
| 97 | - 'OCA\\DAV\\Connector\\Sabre\\Directory' => $baseDir . '/../lib/Connector/Sabre/Directory.php', |
|
| 98 | - 'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => $baseDir . '/../lib/Connector/Sabre/DummyGetResponsePlugin.php', |
|
| 99 | - 'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => $baseDir . '/../lib/Connector/Sabre/ExceptionLoggerPlugin.php', |
|
| 100 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => $baseDir . '/../lib/Connector/Sabre/Exception/EntityTooLarge.php', |
|
| 101 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => $baseDir . '/../lib/Connector/Sabre/Exception/FileLocked.php', |
|
| 102 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => $baseDir . '/../lib/Connector/Sabre/Exception/Forbidden.php', |
|
| 103 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => $baseDir . '/../lib/Connector/Sabre/Exception/InvalidPath.php', |
|
| 104 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => $baseDir . '/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php', |
|
| 105 | - 'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => $baseDir . '/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php', |
|
| 106 | - 'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => $baseDir . '/../lib/Connector/Sabre/FakeLockerPlugin.php', |
|
| 107 | - 'OCA\\DAV\\Connector\\Sabre\\File' => $baseDir . '/../lib/Connector/Sabre/File.php', |
|
| 108 | - 'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => $baseDir . '/../lib/Connector/Sabre/FilesPlugin.php', |
|
| 109 | - 'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => $baseDir . '/../lib/Connector/Sabre/FilesReportPlugin.php', |
|
| 110 | - 'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => $baseDir . '/../lib/Connector/Sabre/LockPlugin.php', |
|
| 111 | - 'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => $baseDir . '/../lib/Connector/Sabre/MaintenancePlugin.php', |
|
| 112 | - 'OCA\\DAV\\Connector\\Sabre\\Node' => $baseDir . '/../lib/Connector/Sabre/Node.php', |
|
| 113 | - 'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => $baseDir . '/../lib/Connector/Sabre/ObjectTree.php', |
|
| 114 | - 'OCA\\DAV\\Connector\\Sabre\\Principal' => $baseDir . '/../lib/Connector/Sabre/Principal.php', |
|
| 115 | - 'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => $baseDir . '/../lib/Connector/Sabre/QuotaPlugin.php', |
|
| 116 | - 'OCA\\DAV\\Connector\\Sabre\\Server' => $baseDir . '/../lib/Connector/Sabre/Server.php', |
|
| 117 | - 'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => $baseDir . '/../lib/Connector/Sabre/ServerFactory.php', |
|
| 118 | - 'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => $baseDir . '/../lib/Connector/Sabre/ShareTypeList.php', |
|
| 119 | - 'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => $baseDir . '/../lib/Connector/Sabre/SharesPlugin.php', |
|
| 120 | - 'OCA\\DAV\\Connector\\Sabre\\TagList' => $baseDir . '/../lib/Connector/Sabre/TagList.php', |
|
| 121 | - 'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => $baseDir . '/../lib/Connector/Sabre/TagsPlugin.php', |
|
| 122 | - 'OCA\\DAV\\Controller\\BirthdayCalendarController' => $baseDir . '/../lib/Controller/BirthdayCalendarController.php', |
|
| 123 | - 'OCA\\DAV\\Controller\\DirectController' => $baseDir . '/../lib/Controller/DirectController.php', |
|
| 124 | - 'OCA\\DAV\\DAV\\CustomPropertiesBackend' => $baseDir . '/../lib/DAV/CustomPropertiesBackend.php', |
|
| 125 | - 'OCA\\DAV\\DAV\\GroupPrincipalBackend' => $baseDir . '/../lib/DAV/GroupPrincipalBackend.php', |
|
| 126 | - 'OCA\\DAV\\DAV\\PublicAuth' => $baseDir . '/../lib/DAV/PublicAuth.php', |
|
| 127 | - 'OCA\\DAV\\DAV\\Sharing\\Backend' => $baseDir . '/../lib/DAV/Sharing/Backend.php', |
|
| 128 | - 'OCA\\DAV\\DAV\\Sharing\\IShareable' => $baseDir . '/../lib/DAV/Sharing/IShareable.php', |
|
| 129 | - 'OCA\\DAV\\DAV\\Sharing\\Plugin' => $baseDir . '/../lib/DAV/Sharing/Plugin.php', |
|
| 130 | - 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => $baseDir . '/../lib/DAV/Sharing/Xml/Invite.php', |
|
| 131 | - 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => $baseDir . '/../lib/DAV/Sharing/Xml/ShareRequest.php', |
|
| 132 | - 'OCA\\DAV\\DAV\\SystemPrincipalBackend' => $baseDir . '/../lib/DAV/SystemPrincipalBackend.php', |
|
| 133 | - 'OCA\\DAV\\Db\\Direct' => $baseDir . '/../lib/Db/Direct.php', |
|
| 134 | - 'OCA\\DAV\\Db\\DirectMapper' => $baseDir . '/../lib/Db/DirectMapper.php', |
|
| 135 | - 'OCA\\DAV\\Direct\\DirectFile' => $baseDir . '/../lib/Direct/DirectFile.php', |
|
| 136 | - 'OCA\\DAV\\Direct\\DirectHome' => $baseDir . '/../lib/Direct/DirectHome.php', |
|
| 137 | - 'OCA\\DAV\\Direct\\Server' => $baseDir . '/../lib/Direct/Server.php', |
|
| 138 | - 'OCA\\DAV\\Direct\\ServerFactory' => $baseDir . '/../lib/Direct/ServerFactory.php', |
|
| 139 | - 'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => $baseDir . '/../lib/Files/BrowserErrorPagePlugin.php', |
|
| 140 | - 'OCA\\DAV\\Files\\FileSearchBackend' => $baseDir . '/../lib/Files/FileSearchBackend.php', |
|
| 141 | - 'OCA\\DAV\\Files\\FilesHome' => $baseDir . '/../lib/Files/FilesHome.php', |
|
| 142 | - 'OCA\\DAV\\Files\\LazySearchBackend' => $baseDir . '/../lib/Files/LazySearchBackend.php', |
|
| 143 | - 'OCA\\DAV\\Files\\RootCollection' => $baseDir . '/../lib/Files/RootCollection.php', |
|
| 144 | - 'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => $baseDir . '/../lib/Files/Sharing/FilesDropPlugin.php', |
|
| 145 | - 'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => $baseDir . '/../lib/Files/Sharing/PublicLinkCheckPlugin.php', |
|
| 146 | - 'OCA\\DAV\\HookManager' => $baseDir . '/../lib/HookManager.php', |
|
| 147 | - 'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => $baseDir . '/../lib/Migration/BuildCalendarSearchIndex.php', |
|
| 148 | - 'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => $baseDir . '/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php', |
|
| 149 | - 'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => $baseDir . '/../lib/Migration/CalDAVRemoveEmptyValue.php', |
|
| 150 | - 'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => $baseDir . '/../lib/Migration/FixBirthdayCalendarComponent.php', |
|
| 151 | - 'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => $baseDir . '/../lib/Migration/RefreshWebcalJobRegistrar.php', |
|
| 152 | - 'OCA\\DAV\\Migration\\Version1004Date20170825134824' => $baseDir . '/../lib/Migration/Version1004Date20170825134824.php', |
|
| 153 | - 'OCA\\DAV\\Migration\\Version1004Date20170919104507' => $baseDir . '/../lib/Migration/Version1004Date20170919104507.php', |
|
| 154 | - 'OCA\\DAV\\Migration\\Version1004Date20170924124212' => $baseDir . '/../lib/Migration/Version1004Date20170924124212.php', |
|
| 155 | - 'OCA\\DAV\\Migration\\Version1004Date20170926103422' => $baseDir . '/../lib/Migration/Version1004Date20170926103422.php', |
|
| 156 | - 'OCA\\DAV\\Migration\\Version1005Date20180413093149' => $baseDir . '/../lib/Migration/Version1005Date20180413093149.php', |
|
| 157 | - 'OCA\\DAV\\Migration\\Version1005Date20180530124431' => $baseDir . '/../lib/Migration/Version1005Date20180530124431.php', |
|
| 158 | - 'OCA\\DAV\\Migration\\Version1006Date20180628111625' => $baseDir . '/../lib/Migration/Version1006Date20180628111625.php', |
|
| 159 | - 'OCA\\DAV\\RootCollection' => $baseDir . '/../lib/RootCollection.php', |
|
| 160 | - 'OCA\\DAV\\Server' => $baseDir . '/../lib/Server.php', |
|
| 161 | - 'OCA\\DAV\\Settings\\CalDAVSettings' => $baseDir . '/../lib/Settings/CalDAVSettings.php', |
|
| 162 | - 'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => $baseDir . '/../lib/SystemTag/SystemTagMappingNode.php', |
|
| 163 | - 'OCA\\DAV\\SystemTag\\SystemTagNode' => $baseDir . '/../lib/SystemTag/SystemTagNode.php', |
|
| 164 | - 'OCA\\DAV\\SystemTag\\SystemTagPlugin' => $baseDir . '/../lib/SystemTag/SystemTagPlugin.php', |
|
| 165 | - 'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => $baseDir . '/../lib/SystemTag/SystemTagsByIdCollection.php', |
|
| 166 | - 'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => $baseDir . '/../lib/SystemTag/SystemTagsObjectMappingCollection.php', |
|
| 167 | - 'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => $baseDir . '/../lib/SystemTag/SystemTagsObjectTypeCollection.php', |
|
| 168 | - 'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => $baseDir . '/../lib/SystemTag/SystemTagsRelationsCollection.php', |
|
| 169 | - 'OCA\\DAV\\Upload\\AssemblyStream' => $baseDir . '/../lib/Upload/AssemblyStream.php', |
|
| 170 | - 'OCA\\DAV\\Upload\\ChunkingPlugin' => $baseDir . '/../lib/Upload/ChunkingPlugin.php', |
|
| 171 | - 'OCA\\DAV\\Upload\\FutureFile' => $baseDir . '/../lib/Upload/FutureFile.php', |
|
| 172 | - 'OCA\\DAV\\Upload\\RootCollection' => $baseDir . '/../lib/Upload/RootCollection.php', |
|
| 173 | - 'OCA\\DAV\\Upload\\UploadFolder' => $baseDir . '/../lib/Upload/UploadFolder.php', |
|
| 174 | - 'OCA\\DAV\\Upload\\UploadHome' => $baseDir . '/../lib/Upload/UploadHome.php', |
|
| 9 | + 'OCA\\DAV\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php', |
|
| 10 | + 'OCA\\DAV\\AppInfo\\PluginManager' => $baseDir.'/../lib/AppInfo/PluginManager.php', |
|
| 11 | + 'OCA\\DAV\\Avatars\\AvatarHome' => $baseDir.'/../lib/Avatars/AvatarHome.php', |
|
| 12 | + 'OCA\\DAV\\Avatars\\AvatarNode' => $baseDir.'/../lib/Avatars/AvatarNode.php', |
|
| 13 | + 'OCA\\DAV\\Avatars\\RootCollection' => $baseDir.'/../lib/Avatars/RootCollection.php', |
|
| 14 | + 'OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob' => $baseDir.'/../lib/BackgroundJob/CleanupDirectLinksJob.php', |
|
| 15 | + 'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => $baseDir.'/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php', |
|
| 16 | + 'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => $baseDir.'/../lib/BackgroundJob/RefreshWebcalJob.php', |
|
| 17 | + 'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => $baseDir.'/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php', |
|
| 18 | + 'OCA\\DAV\\CalDAV\\Activity\\Backend' => $baseDir.'/../lib/CalDAV/Activity/Backend.php', |
|
| 19 | + 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => $baseDir.'/../lib/CalDAV/Activity/Filter/Calendar.php', |
|
| 20 | + 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => $baseDir.'/../lib/CalDAV/Activity/Filter/Todo.php', |
|
| 21 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => $baseDir.'/../lib/CalDAV/Activity/Provider/Base.php', |
|
| 22 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => $baseDir.'/../lib/CalDAV/Activity/Provider/Calendar.php', |
|
| 23 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => $baseDir.'/../lib/CalDAV/Activity/Provider/Event.php', |
|
| 24 | + 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => $baseDir.'/../lib/CalDAV/Activity/Provider/Todo.php', |
|
| 25 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => $baseDir.'/../lib/CalDAV/Activity/Setting/Calendar.php', |
|
| 26 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => $baseDir.'/../lib/CalDAV/Activity/Setting/Event.php', |
|
| 27 | + 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => $baseDir.'/../lib/CalDAV/Activity/Setting/Todo.php', |
|
| 28 | + 'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => $baseDir.'/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php', |
|
| 29 | + 'OCA\\DAV\\CalDAV\\BirthdayService' => $baseDir.'/../lib/CalDAV/BirthdayService.php', |
|
| 30 | + 'OCA\\DAV\\CalDAV\\CachedSubscription' => $baseDir.'/../lib/CalDAV/CachedSubscription.php', |
|
| 31 | + 'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => $baseDir.'/../lib/CalDAV/CachedSubscriptionObject.php', |
|
| 32 | + 'OCA\\DAV\\CalDAV\\CalDavBackend' => $baseDir.'/../lib/CalDAV/CalDavBackend.php', |
|
| 33 | + 'OCA\\DAV\\CalDAV\\Calendar' => $baseDir.'/../lib/CalDAV/Calendar.php', |
|
| 34 | + 'OCA\\DAV\\CalDAV\\CalendarHome' => $baseDir.'/../lib/CalDAV/CalendarHome.php', |
|
| 35 | + 'OCA\\DAV\\CalDAV\\CalendarImpl' => $baseDir.'/../lib/CalDAV/CalendarImpl.php', |
|
| 36 | + 'OCA\\DAV\\CalDAV\\CalendarManager' => $baseDir.'/../lib/CalDAV/CalendarManager.php', |
|
| 37 | + 'OCA\\DAV\\CalDAV\\CalendarObject' => $baseDir.'/../lib/CalDAV/CalendarObject.php', |
|
| 38 | + 'OCA\\DAV\\CalDAV\\CalendarRoot' => $baseDir.'/../lib/CalDAV/CalendarRoot.php', |
|
| 39 | + 'OCA\\DAV\\CalDAV\\Plugin' => $baseDir.'/../lib/CalDAV/Plugin.php', |
|
| 40 | + 'OCA\\DAV\\CalDAV\\Principal\\Collection' => $baseDir.'/../lib/CalDAV/Principal/Collection.php', |
|
| 41 | + 'OCA\\DAV\\CalDAV\\Principal\\User' => $baseDir.'/../lib/CalDAV/Principal/User.php', |
|
| 42 | + 'OCA\\DAV\\CalDAV\\PublicCalendar' => $baseDir.'/../lib/CalDAV/PublicCalendar.php', |
|
| 43 | + 'OCA\\DAV\\CalDAV\\PublicCalendarObject' => $baseDir.'/../lib/CalDAV/PublicCalendarObject.php', |
|
| 44 | + 'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => $baseDir.'/../lib/CalDAV/PublicCalendarRoot.php', |
|
| 45 | + 'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => $baseDir.'/../lib/CalDAV/Publishing/PublishPlugin.php', |
|
| 46 | + 'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => $baseDir.'/../lib/CalDAV/Publishing/Xml/Publisher.php', |
|
| 47 | + 'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => $baseDir.'/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php', |
|
| 48 | + 'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => $baseDir.'/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php', |
|
| 49 | + 'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => $baseDir.'/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php', |
|
| 50 | + 'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => $baseDir.'/../lib/CalDAV/Schedule/IMipPlugin.php', |
|
| 51 | + 'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => $baseDir.'/../lib/CalDAV/Schedule/Plugin.php', |
|
| 52 | + 'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => $baseDir.'/../lib/CalDAV/Search/SearchPlugin.php', |
|
| 53 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/CompFilter.php', |
|
| 54 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php', |
|
| 55 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php', |
|
| 56 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php', |
|
| 57 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/PropFilter.php', |
|
| 58 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php', |
|
| 59 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => $baseDir.'/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php', |
|
| 60 | + 'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => $baseDir.'/../lib/CalDAV/WebcalCaching/Plugin.php', |
|
| 61 | + 'OCA\\DAV\\Capabilities' => $baseDir.'/../lib/Capabilities.php', |
|
| 62 | + 'OCA\\DAV\\CardDAV\\AddressBook' => $baseDir.'/../lib/CardDAV/AddressBook.php', |
|
| 63 | + 'OCA\\DAV\\CardDAV\\AddressBookImpl' => $baseDir.'/../lib/CardDAV/AddressBookImpl.php', |
|
| 64 | + 'OCA\\DAV\\CardDAV\\AddressBookRoot' => $baseDir.'/../lib/CardDAV/AddressBookRoot.php', |
|
| 65 | + 'OCA\\DAV\\CardDAV\\CardDavBackend' => $baseDir.'/../lib/CardDAV/CardDavBackend.php', |
|
| 66 | + 'OCA\\DAV\\CardDAV\\ContactsManager' => $baseDir.'/../lib/CardDAV/ContactsManager.php', |
|
| 67 | + 'OCA\\DAV\\CardDAV\\Converter' => $baseDir.'/../lib/CardDAV/Converter.php', |
|
| 68 | + 'OCA\\DAV\\CardDAV\\ImageExportPlugin' => $baseDir.'/../lib/CardDAV/ImageExportPlugin.php', |
|
| 69 | + 'OCA\\DAV\\CardDAV\\PhotoCache' => $baseDir.'/../lib/CardDAV/PhotoCache.php', |
|
| 70 | + 'OCA\\DAV\\CardDAV\\Plugin' => $baseDir.'/../lib/CardDAV/Plugin.php', |
|
| 71 | + 'OCA\\DAV\\CardDAV\\SyncService' => $baseDir.'/../lib/CardDAV/SyncService.php', |
|
| 72 | + 'OCA\\DAV\\CardDAV\\UserAddressBooks' => $baseDir.'/../lib/CardDAV/UserAddressBooks.php', |
|
| 73 | + 'OCA\\DAV\\CardDAV\\Xml\\Groups' => $baseDir.'/../lib/CardDAV/Xml/Groups.php', |
|
| 74 | + 'OCA\\DAV\\Command\\CreateAddressBook' => $baseDir.'/../lib/Command/CreateAddressBook.php', |
|
| 75 | + 'OCA\\DAV\\Command\\CreateCalendar' => $baseDir.'/../lib/Command/CreateCalendar.php', |
|
| 76 | + 'OCA\\DAV\\Command\\RemoveInvalidShares' => $baseDir.'/../lib/Command/RemoveInvalidShares.php', |
|
| 77 | + 'OCA\\DAV\\Command\\SyncBirthdayCalendar' => $baseDir.'/../lib/Command/SyncBirthdayCalendar.php', |
|
| 78 | + 'OCA\\DAV\\Command\\SyncSystemAddressBook' => $baseDir.'/../lib/Command/SyncSystemAddressBook.php', |
|
| 79 | + 'OCA\\DAV\\Comments\\CommentNode' => $baseDir.'/../lib/Comments/CommentNode.php', |
|
| 80 | + 'OCA\\DAV\\Comments\\CommentsPlugin' => $baseDir.'/../lib/Comments/CommentsPlugin.php', |
|
| 81 | + 'OCA\\DAV\\Comments\\EntityCollection' => $baseDir.'/../lib/Comments/EntityCollection.php', |
|
| 82 | + 'OCA\\DAV\\Comments\\EntityTypeCollection' => $baseDir.'/../lib/Comments/EntityTypeCollection.php', |
|
| 83 | + 'OCA\\DAV\\Comments\\RootCollection' => $baseDir.'/../lib/Comments/RootCollection.php', |
|
| 84 | + 'OCA\\DAV\\Connector\\LegacyDAVACL' => $baseDir.'/../lib/Connector/LegacyDAVACL.php', |
|
| 85 | + 'OCA\\DAV\\Connector\\PublicAuth' => $baseDir.'/../lib/Connector/PublicAuth.php', |
|
| 86 | + 'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => $baseDir.'/../lib/Connector/Sabre/AnonymousOptionsPlugin.php', |
|
| 87 | + 'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => $baseDir.'/../lib/Connector/Sabre/AppEnabledPlugin.php', |
|
| 88 | + 'OCA\\DAV\\Connector\\Sabre\\Auth' => $baseDir.'/../lib/Connector/Sabre/Auth.php', |
|
| 89 | + 'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => $baseDir.'/../lib/Connector/Sabre/BearerAuth.php', |
|
| 90 | + 'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => $baseDir.'/../lib/Connector/Sabre/BlockLegacyClientPlugin.php', |
|
| 91 | + 'OCA\\DAV\\Connector\\Sabre\\CachingTree' => $baseDir.'/../lib/Connector/Sabre/CachingTree.php', |
|
| 92 | + 'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => $baseDir.'/../lib/Connector/Sabre/ChecksumList.php', |
|
| 93 | + 'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => $baseDir.'/../lib/Connector/Sabre/CommentPropertiesPlugin.php', |
|
| 94 | + 'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => $baseDir.'/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php', |
|
| 95 | + 'OCA\\DAV\\Connector\\Sabre\\CustomPropertiesBackend' => $baseDir.'/../lib/Connector/Sabre/CustomPropertiesBackend.php', |
|
| 96 | + 'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => $baseDir.'/../lib/Connector/Sabre/DavAclPlugin.php', |
|
| 97 | + 'OCA\\DAV\\Connector\\Sabre\\Directory' => $baseDir.'/../lib/Connector/Sabre/Directory.php', |
|
| 98 | + 'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => $baseDir.'/../lib/Connector/Sabre/DummyGetResponsePlugin.php', |
|
| 99 | + 'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => $baseDir.'/../lib/Connector/Sabre/ExceptionLoggerPlugin.php', |
|
| 100 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => $baseDir.'/../lib/Connector/Sabre/Exception/EntityTooLarge.php', |
|
| 101 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => $baseDir.'/../lib/Connector/Sabre/Exception/FileLocked.php', |
|
| 102 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => $baseDir.'/../lib/Connector/Sabre/Exception/Forbidden.php', |
|
| 103 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => $baseDir.'/../lib/Connector/Sabre/Exception/InvalidPath.php', |
|
| 104 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => $baseDir.'/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php', |
|
| 105 | + 'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => $baseDir.'/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php', |
|
| 106 | + 'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => $baseDir.'/../lib/Connector/Sabre/FakeLockerPlugin.php', |
|
| 107 | + 'OCA\\DAV\\Connector\\Sabre\\File' => $baseDir.'/../lib/Connector/Sabre/File.php', |
|
| 108 | + 'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => $baseDir.'/../lib/Connector/Sabre/FilesPlugin.php', |
|
| 109 | + 'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => $baseDir.'/../lib/Connector/Sabre/FilesReportPlugin.php', |
|
| 110 | + 'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => $baseDir.'/../lib/Connector/Sabre/LockPlugin.php', |
|
| 111 | + 'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => $baseDir.'/../lib/Connector/Sabre/MaintenancePlugin.php', |
|
| 112 | + 'OCA\\DAV\\Connector\\Sabre\\Node' => $baseDir.'/../lib/Connector/Sabre/Node.php', |
|
| 113 | + 'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => $baseDir.'/../lib/Connector/Sabre/ObjectTree.php', |
|
| 114 | + 'OCA\\DAV\\Connector\\Sabre\\Principal' => $baseDir.'/../lib/Connector/Sabre/Principal.php', |
|
| 115 | + 'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => $baseDir.'/../lib/Connector/Sabre/QuotaPlugin.php', |
|
| 116 | + 'OCA\\DAV\\Connector\\Sabre\\Server' => $baseDir.'/../lib/Connector/Sabre/Server.php', |
|
| 117 | + 'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => $baseDir.'/../lib/Connector/Sabre/ServerFactory.php', |
|
| 118 | + 'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => $baseDir.'/../lib/Connector/Sabre/ShareTypeList.php', |
|
| 119 | + 'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => $baseDir.'/../lib/Connector/Sabre/SharesPlugin.php', |
|
| 120 | + 'OCA\\DAV\\Connector\\Sabre\\TagList' => $baseDir.'/../lib/Connector/Sabre/TagList.php', |
|
| 121 | + 'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => $baseDir.'/../lib/Connector/Sabre/TagsPlugin.php', |
|
| 122 | + 'OCA\\DAV\\Controller\\BirthdayCalendarController' => $baseDir.'/../lib/Controller/BirthdayCalendarController.php', |
|
| 123 | + 'OCA\\DAV\\Controller\\DirectController' => $baseDir.'/../lib/Controller/DirectController.php', |
|
| 124 | + 'OCA\\DAV\\DAV\\CustomPropertiesBackend' => $baseDir.'/../lib/DAV/CustomPropertiesBackend.php', |
|
| 125 | + 'OCA\\DAV\\DAV\\GroupPrincipalBackend' => $baseDir.'/../lib/DAV/GroupPrincipalBackend.php', |
|
| 126 | + 'OCA\\DAV\\DAV\\PublicAuth' => $baseDir.'/../lib/DAV/PublicAuth.php', |
|
| 127 | + 'OCA\\DAV\\DAV\\Sharing\\Backend' => $baseDir.'/../lib/DAV/Sharing/Backend.php', |
|
| 128 | + 'OCA\\DAV\\DAV\\Sharing\\IShareable' => $baseDir.'/../lib/DAV/Sharing/IShareable.php', |
|
| 129 | + 'OCA\\DAV\\DAV\\Sharing\\Plugin' => $baseDir.'/../lib/DAV/Sharing/Plugin.php', |
|
| 130 | + 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => $baseDir.'/../lib/DAV/Sharing/Xml/Invite.php', |
|
| 131 | + 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => $baseDir.'/../lib/DAV/Sharing/Xml/ShareRequest.php', |
|
| 132 | + 'OCA\\DAV\\DAV\\SystemPrincipalBackend' => $baseDir.'/../lib/DAV/SystemPrincipalBackend.php', |
|
| 133 | + 'OCA\\DAV\\Db\\Direct' => $baseDir.'/../lib/Db/Direct.php', |
|
| 134 | + 'OCA\\DAV\\Db\\DirectMapper' => $baseDir.'/../lib/Db/DirectMapper.php', |
|
| 135 | + 'OCA\\DAV\\Direct\\DirectFile' => $baseDir.'/../lib/Direct/DirectFile.php', |
|
| 136 | + 'OCA\\DAV\\Direct\\DirectHome' => $baseDir.'/../lib/Direct/DirectHome.php', |
|
| 137 | + 'OCA\\DAV\\Direct\\Server' => $baseDir.'/../lib/Direct/Server.php', |
|
| 138 | + 'OCA\\DAV\\Direct\\ServerFactory' => $baseDir.'/../lib/Direct/ServerFactory.php', |
|
| 139 | + 'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => $baseDir.'/../lib/Files/BrowserErrorPagePlugin.php', |
|
| 140 | + 'OCA\\DAV\\Files\\FileSearchBackend' => $baseDir.'/../lib/Files/FileSearchBackend.php', |
|
| 141 | + 'OCA\\DAV\\Files\\FilesHome' => $baseDir.'/../lib/Files/FilesHome.php', |
|
| 142 | + 'OCA\\DAV\\Files\\LazySearchBackend' => $baseDir.'/../lib/Files/LazySearchBackend.php', |
|
| 143 | + 'OCA\\DAV\\Files\\RootCollection' => $baseDir.'/../lib/Files/RootCollection.php', |
|
| 144 | + 'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => $baseDir.'/../lib/Files/Sharing/FilesDropPlugin.php', |
|
| 145 | + 'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => $baseDir.'/../lib/Files/Sharing/PublicLinkCheckPlugin.php', |
|
| 146 | + 'OCA\\DAV\\HookManager' => $baseDir.'/../lib/HookManager.php', |
|
| 147 | + 'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => $baseDir.'/../lib/Migration/BuildCalendarSearchIndex.php', |
|
| 148 | + 'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => $baseDir.'/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php', |
|
| 149 | + 'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => $baseDir.'/../lib/Migration/CalDAVRemoveEmptyValue.php', |
|
| 150 | + 'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => $baseDir.'/../lib/Migration/FixBirthdayCalendarComponent.php', |
|
| 151 | + 'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => $baseDir.'/../lib/Migration/RefreshWebcalJobRegistrar.php', |
|
| 152 | + 'OCA\\DAV\\Migration\\Version1004Date20170825134824' => $baseDir.'/../lib/Migration/Version1004Date20170825134824.php', |
|
| 153 | + 'OCA\\DAV\\Migration\\Version1004Date20170919104507' => $baseDir.'/../lib/Migration/Version1004Date20170919104507.php', |
|
| 154 | + 'OCA\\DAV\\Migration\\Version1004Date20170924124212' => $baseDir.'/../lib/Migration/Version1004Date20170924124212.php', |
|
| 155 | + 'OCA\\DAV\\Migration\\Version1004Date20170926103422' => $baseDir.'/../lib/Migration/Version1004Date20170926103422.php', |
|
| 156 | + 'OCA\\DAV\\Migration\\Version1005Date20180413093149' => $baseDir.'/../lib/Migration/Version1005Date20180413093149.php', |
|
| 157 | + 'OCA\\DAV\\Migration\\Version1005Date20180530124431' => $baseDir.'/../lib/Migration/Version1005Date20180530124431.php', |
|
| 158 | + 'OCA\\DAV\\Migration\\Version1006Date20180628111625' => $baseDir.'/../lib/Migration/Version1006Date20180628111625.php', |
|
| 159 | + 'OCA\\DAV\\RootCollection' => $baseDir.'/../lib/RootCollection.php', |
|
| 160 | + 'OCA\\DAV\\Server' => $baseDir.'/../lib/Server.php', |
|
| 161 | + 'OCA\\DAV\\Settings\\CalDAVSettings' => $baseDir.'/../lib/Settings/CalDAVSettings.php', |
|
| 162 | + 'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => $baseDir.'/../lib/SystemTag/SystemTagMappingNode.php', |
|
| 163 | + 'OCA\\DAV\\SystemTag\\SystemTagNode' => $baseDir.'/../lib/SystemTag/SystemTagNode.php', |
|
| 164 | + 'OCA\\DAV\\SystemTag\\SystemTagPlugin' => $baseDir.'/../lib/SystemTag/SystemTagPlugin.php', |
|
| 165 | + 'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => $baseDir.'/../lib/SystemTag/SystemTagsByIdCollection.php', |
|
| 166 | + 'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => $baseDir.'/../lib/SystemTag/SystemTagsObjectMappingCollection.php', |
|
| 167 | + 'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => $baseDir.'/../lib/SystemTag/SystemTagsObjectTypeCollection.php', |
|
| 168 | + 'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => $baseDir.'/../lib/SystemTag/SystemTagsRelationsCollection.php', |
|
| 169 | + 'OCA\\DAV\\Upload\\AssemblyStream' => $baseDir.'/../lib/Upload/AssemblyStream.php', |
|
| 170 | + 'OCA\\DAV\\Upload\\ChunkingPlugin' => $baseDir.'/../lib/Upload/ChunkingPlugin.php', |
|
| 171 | + 'OCA\\DAV\\Upload\\FutureFile' => $baseDir.'/../lib/Upload/FutureFile.php', |
|
| 172 | + 'OCA\\DAV\\Upload\\RootCollection' => $baseDir.'/../lib/Upload/RootCollection.php', |
|
| 173 | + 'OCA\\DAV\\Upload\\UploadFolder' => $baseDir.'/../lib/Upload/UploadFolder.php', |
|
| 174 | + 'OCA\\DAV\\Upload\\UploadHome' => $baseDir.'/../lib/Upload/UploadHome.php', |
|
| 175 | 175 | ); |
@@ -31,59 +31,59 @@ discard block |
||
| 31 | 31 | $app->registerHooks(); |
| 32 | 32 | |
| 33 | 33 | \OC::$server->registerService('CardDAVSyncService', function() use ($app) { |
| 34 | - return $app->getSyncService(); |
|
| 34 | + return $app->getSyncService(); |
|
| 35 | 35 | }); |
| 36 | 36 | |
| 37 | 37 | $eventDispatcher = \OC::$server->getEventDispatcher(); |
| 38 | 38 | |
| 39 | 39 | $eventDispatcher->addListener('OCP\Federation\TrustedServerEvent::remove', |
| 40 | - function(GenericEvent $event) use ($app) { |
|
| 41 | - /** @var CardDavBackend $cardDavBackend */ |
|
| 42 | - $cardDavBackend = $app->getContainer()->query(CardDavBackend::class); |
|
| 43 | - $addressBookUri = $event->getSubject(); |
|
| 44 | - $addressBook = $cardDavBackend->getAddressBooksByUri('principals/system/system', $addressBookUri); |
|
| 45 | - if (!is_null($addressBook)) { |
|
| 46 | - $cardDavBackend->deleteAddressBook($addressBook['id']); |
|
| 47 | - } |
|
| 48 | - } |
|
| 40 | + function(GenericEvent $event) use ($app) { |
|
| 41 | + /** @var CardDavBackend $cardDavBackend */ |
|
| 42 | + $cardDavBackend = $app->getContainer()->query(CardDavBackend::class); |
|
| 43 | + $addressBookUri = $event->getSubject(); |
|
| 44 | + $addressBook = $cardDavBackend->getAddressBooksByUri('principals/system/system', $addressBookUri); |
|
| 45 | + if (!is_null($addressBook)) { |
|
| 46 | + $cardDavBackend->deleteAddressBook($addressBook['id']); |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | 51 | $eventDispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', |
| 52 | - function(GenericEvent $event) use ($app) { |
|
| 53 | - $jobList = $app->getContainer()->getServer()->getJobList(); |
|
| 54 | - $subscriptionData = $event->getArgument('subscriptionData'); |
|
| 52 | + function(GenericEvent $event) use ($app) { |
|
| 53 | + $jobList = $app->getContainer()->getServer()->getJobList(); |
|
| 54 | + $subscriptionData = $event->getArgument('subscriptionData'); |
|
| 55 | 55 | |
| 56 | - $jobList->add(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [ |
|
| 57 | - 'principaluri' => $subscriptionData['principaluri'], |
|
| 58 | - 'uri' => $subscriptionData['uri'] |
|
| 59 | - ]); |
|
| 60 | - } |
|
| 56 | + $jobList->add(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [ |
|
| 57 | + 'principaluri' => $subscriptionData['principaluri'], |
|
| 58 | + 'uri' => $subscriptionData['uri'] |
|
| 59 | + ]); |
|
| 60 | + } |
|
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | 63 | $eventDispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', |
| 64 | - function(GenericEvent $event) use ($app) { |
|
| 65 | - $jobList = $app->getContainer()->getServer()->getJobList(); |
|
| 66 | - $subscriptionData = $event->getArgument('subscriptionData'); |
|
| 64 | + function(GenericEvent $event) use ($app) { |
|
| 65 | + $jobList = $app->getContainer()->getServer()->getJobList(); |
|
| 66 | + $subscriptionData = $event->getArgument('subscriptionData'); |
|
| 67 | 67 | |
| 68 | - $jobList->remove(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [ |
|
| 69 | - 'principaluri' => $subscriptionData['principaluri'], |
|
| 70 | - 'uri' => $subscriptionData['uri'] |
|
| 71 | - ]); |
|
| 68 | + $jobList->remove(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [ |
|
| 69 | + 'principaluri' => $subscriptionData['principaluri'], |
|
| 70 | + 'uri' => $subscriptionData['uri'] |
|
| 71 | + ]); |
|
| 72 | 72 | |
| 73 | - /** @var \OCA\DAV\CalDAV\CalDavBackend $calDavBackend */ |
|
| 74 | - $calDavBackend = $app->getContainer()->query(\OCA\DAV\CalDAV\CalDavBackend::class); |
|
| 75 | - $calDavBackend->purgeAllCachedEventsForSubscription($subscriptionData['id']); |
|
| 76 | - } |
|
| 73 | + /** @var \OCA\DAV\CalDAV\CalDavBackend $calDavBackend */ |
|
| 74 | + $calDavBackend = $app->getContainer()->query(\OCA\DAV\CalDAV\CalDavBackend::class); |
|
| 75 | + $calDavBackend->purgeAllCachedEventsForSubscription($subscriptionData['id']); |
|
| 76 | + } |
|
| 77 | 77 | ); |
| 78 | 78 | |
| 79 | 79 | $eventHandler = function() use ($app) { |
| 80 | - try { |
|
| 81 | - $job = $app->getContainer()->query(\OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob::class); |
|
| 82 | - $job->run([]); |
|
| 83 | - $app->getContainer()->getServer()->getJobList()->setLastRun($job); |
|
| 84 | - } catch(\Exception $ex) { |
|
| 85 | - $app->getContainer()->getServer()->getLogger()->logException($ex); |
|
| 86 | - } |
|
| 80 | + try { |
|
| 81 | + $job = $app->getContainer()->query(\OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob::class); |
|
| 82 | + $job->run([]); |
|
| 83 | + $app->getContainer()->getServer()->getJobList()->setLastRun($job); |
|
| 84 | + } catch(\Exception $ex) { |
|
| 85 | + $app->getContainer()->getServer()->getLogger()->logException($ex); |
|
| 86 | + } |
|
| 87 | 87 | }; |
| 88 | 88 | |
| 89 | 89 | $eventDispatcher->addListener('\OCP\Calendar\Resource\ForceRefreshEvent', $eventHandler); |
@@ -91,18 +91,18 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $cm = \OC::$server->getContactsManager(); |
| 93 | 93 | $cm->register(function() use ($cm, $app) { |
| 94 | - $user = \OC::$server->getUserSession()->getUser(); |
|
| 95 | - if (!is_null($user)) { |
|
| 96 | - $app->setupContactsProvider($cm, $user->getUID()); |
|
| 97 | - } else { |
|
| 98 | - $app->setupSystemContactsProvider($cm); |
|
| 99 | - } |
|
| 94 | + $user = \OC::$server->getUserSession()->getUser(); |
|
| 95 | + if (!is_null($user)) { |
|
| 96 | + $app->setupContactsProvider($cm, $user->getUID()); |
|
| 97 | + } else { |
|
| 98 | + $app->setupSystemContactsProvider($cm); |
|
| 99 | + } |
|
| 100 | 100 | }); |
| 101 | 101 | |
| 102 | 102 | $calendarManager = \OC::$server->getCalendarManager(); |
| 103 | 103 | $calendarManager->register(function() use ($calendarManager, $app) { |
| 104 | - $user = \OC::$server->getUserSession()->getUser(); |
|
| 105 | - if ($user !== null) { |
|
| 106 | - $app->setupCalendarProvider($calendarManager, $user->getUID()); |
|
| 107 | - } |
|
| 104 | + $user = \OC::$server->getUserSession()->getUser(); |
|
| 105 | + if ($user !== null) { |
|
| 106 | + $app->setupCalendarProvider($calendarManager, $user->getUID()); |
|
| 107 | + } |
|
| 108 | 108 | }); |
@@ -36,140 +36,140 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | class CachedSubscription extends \Sabre\CalDAV\Calendar { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @return string |
|
| 41 | - */ |
|
| 42 | - public function getPrincipalURI():string { |
|
| 43 | - return $this->calendarInfo['principaluri']; |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * @return array |
|
| 48 | - */ |
|
| 49 | - public function getACL():array { |
|
| 50 | - return [ |
|
| 51 | - [ |
|
| 52 | - 'privilege' => '{DAV:}read', |
|
| 53 | - 'principal' => $this->getOwner(), |
|
| 54 | - 'protected' => true, |
|
| 55 | - ] |
|
| 56 | - ]; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @return array |
|
| 61 | - */ |
|
| 62 | - public function getChildACL():array { |
|
| 63 | - return $this->getACL(); |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * @return null|string |
|
| 68 | - */ |
|
| 69 | - public function getOwner() { |
|
| 70 | - if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) { |
|
| 71 | - return $this->calendarInfo['{http://owncloud.org/ns}owner-principal']; |
|
| 72 | - } |
|
| 73 | - return parent::getOwner(); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * |
|
| 78 | - */ |
|
| 79 | - public function delete() { |
|
| 80 | - $this->caldavBackend->deleteSubscription($this->calendarInfo['id']); |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * @param PropPatch $propPatch |
|
| 85 | - */ |
|
| 86 | - public function propPatch(PropPatch $propPatch) { |
|
| 87 | - $this->caldavBackend->updateSubscription($this->calendarInfo['id'], $propPatch); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * @param string $name |
|
| 92 | - * @return CalendarObject|\Sabre\CalDAV\ICalendarObject |
|
| 93 | - * @throws NotFound |
|
| 94 | - */ |
|
| 95 | - public function getChild($name) { |
|
| 96 | - $obj = $this->caldavBackend->getCachedCalendarObject($this->calendarInfo['id'], $name); |
|
| 97 | - if (!$obj) { |
|
| 98 | - throw new NotFound('Calendar object not found'); |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - $obj['acl'] = $this->getChildACL(); |
|
| 102 | - return new CalendarObject($this->caldavBackend, $this->calendarInfo, $obj); |
|
| 103 | - |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * @return array |
|
| 108 | - */ |
|
| 109 | - public function getChildren():array { |
|
| 110 | - $objs = $this->caldavBackend->getCachedCalendarObjects($this->calendarInfo['id']); |
|
| 111 | - |
|
| 112 | - $children = []; |
|
| 113 | - foreach($objs as $obj) { |
|
| 114 | - $children[] = new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - return $children; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * @param array $paths |
|
| 122 | - * @return array |
|
| 123 | - */ |
|
| 124 | - public function getMultipleChildren(array $paths):array { |
|
| 125 | - $objs = $this->caldavBackend->getMultipleCachedCalendarObjects($this->calendarInfo['id'], $paths); |
|
| 126 | - |
|
| 127 | - $children = []; |
|
| 128 | - foreach($objs as $obj) { |
|
| 129 | - $children[] = new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj); |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - return $children; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * @param string $name |
|
| 137 | - * @param null $calendarData |
|
| 138 | - * @return null|string|void |
|
| 139 | - * @throws MethodNotAllowed |
|
| 140 | - */ |
|
| 141 | - public function createFile($name, $calendarData = null) { |
|
| 142 | - throw new MethodNotAllowed('Creating objects in cached subscription is not allowed'); |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * @param string $name |
|
| 147 | - * @return bool |
|
| 148 | - */ |
|
| 149 | - public function childExists($name):bool { |
|
| 150 | - $obj = $this->caldavBackend->getCachedCalendarObject($this->calendarInfo['id'], $name); |
|
| 151 | - if (!$obj) { |
|
| 152 | - return false; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - return true; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - /** |
|
| 159 | - * @param array $filters |
|
| 160 | - * @return array |
|
| 161 | - */ |
|
| 162 | - public function calendarQuery(array $filters):array { |
|
| 163 | - return $this->caldavBackend->cachedCalendarQuery($this->calendarInfo['id'], $filters); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * CachedSubscriptions don't support sync-tokens for now |
|
| 168 | - * Clients will have to do a multi get etag for now |
|
| 169 | - * |
|
| 170 | - * @return null |
|
| 171 | - */ |
|
| 172 | - public function getSyncToken() { |
|
| 173 | - return null; |
|
| 174 | - } |
|
| 39 | + /** |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 42 | + public function getPrincipalURI():string { |
|
| 43 | + return $this->calendarInfo['principaluri']; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * @return array |
|
| 48 | + */ |
|
| 49 | + public function getACL():array { |
|
| 50 | + return [ |
|
| 51 | + [ |
|
| 52 | + 'privilege' => '{DAV:}read', |
|
| 53 | + 'principal' => $this->getOwner(), |
|
| 54 | + 'protected' => true, |
|
| 55 | + ] |
|
| 56 | + ]; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @return array |
|
| 61 | + */ |
|
| 62 | + public function getChildACL():array { |
|
| 63 | + return $this->getACL(); |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * @return null|string |
|
| 68 | + */ |
|
| 69 | + public function getOwner() { |
|
| 70 | + if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) { |
|
| 71 | + return $this->calendarInfo['{http://owncloud.org/ns}owner-principal']; |
|
| 72 | + } |
|
| 73 | + return parent::getOwner(); |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * |
|
| 78 | + */ |
|
| 79 | + public function delete() { |
|
| 80 | + $this->caldavBackend->deleteSubscription($this->calendarInfo['id']); |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * @param PropPatch $propPatch |
|
| 85 | + */ |
|
| 86 | + public function propPatch(PropPatch $propPatch) { |
|
| 87 | + $this->caldavBackend->updateSubscription($this->calendarInfo['id'], $propPatch); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * @param string $name |
|
| 92 | + * @return CalendarObject|\Sabre\CalDAV\ICalendarObject |
|
| 93 | + * @throws NotFound |
|
| 94 | + */ |
|
| 95 | + public function getChild($name) { |
|
| 96 | + $obj = $this->caldavBackend->getCachedCalendarObject($this->calendarInfo['id'], $name); |
|
| 97 | + if (!$obj) { |
|
| 98 | + throw new NotFound('Calendar object not found'); |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + $obj['acl'] = $this->getChildACL(); |
|
| 102 | + return new CalendarObject($this->caldavBackend, $this->calendarInfo, $obj); |
|
| 103 | + |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * @return array |
|
| 108 | + */ |
|
| 109 | + public function getChildren():array { |
|
| 110 | + $objs = $this->caldavBackend->getCachedCalendarObjects($this->calendarInfo['id']); |
|
| 111 | + |
|
| 112 | + $children = []; |
|
| 113 | + foreach($objs as $obj) { |
|
| 114 | + $children[] = new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + return $children; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * @param array $paths |
|
| 122 | + * @return array |
|
| 123 | + */ |
|
| 124 | + public function getMultipleChildren(array $paths):array { |
|
| 125 | + $objs = $this->caldavBackend->getMultipleCachedCalendarObjects($this->calendarInfo['id'], $paths); |
|
| 126 | + |
|
| 127 | + $children = []; |
|
| 128 | + foreach($objs as $obj) { |
|
| 129 | + $children[] = new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj); |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + return $children; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * @param string $name |
|
| 137 | + * @param null $calendarData |
|
| 138 | + * @return null|string|void |
|
| 139 | + * @throws MethodNotAllowed |
|
| 140 | + */ |
|
| 141 | + public function createFile($name, $calendarData = null) { |
|
| 142 | + throw new MethodNotAllowed('Creating objects in cached subscription is not allowed'); |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * @param string $name |
|
| 147 | + * @return bool |
|
| 148 | + */ |
|
| 149 | + public function childExists($name):bool { |
|
| 150 | + $obj = $this->caldavBackend->getCachedCalendarObject($this->calendarInfo['id'], $name); |
|
| 151 | + if (!$obj) { |
|
| 152 | + return false; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + return true; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + /** |
|
| 159 | + * @param array $filters |
|
| 160 | + * @return array |
|
| 161 | + */ |
|
| 162 | + public function calendarQuery(array $filters):array { |
|
| 163 | + return $this->caldavBackend->cachedCalendarQuery($this->calendarInfo['id'], $filters); |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * CachedSubscriptions don't support sync-tokens for now |
|
| 168 | + * Clients will have to do a multi get etag for now |
|
| 169 | + * |
|
| 170 | + * @return null |
|
| 171 | + */ |
|
| 172 | + public function getSyncToken() { |
|
| 173 | + return null; |
|
| 174 | + } |
|
| 175 | 175 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $objs = $this->caldavBackend->getCachedCalendarObjects($this->calendarInfo['id']); |
| 111 | 111 | |
| 112 | 112 | $children = []; |
| 113 | - foreach($objs as $obj) { |
|
| 113 | + foreach ($objs as $obj) { |
|
| 114 | 114 | $children[] = new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $objs = $this->caldavBackend->getMultipleCachedCalendarObjects($this->calendarInfo['id'], $paths); |
| 126 | 126 | |
| 127 | 127 | $children = []; |
| 128 | - foreach($objs as $obj) { |
|
| 128 | + foreach ($objs as $obj) { |
|
| 129 | 129 | $children[] = new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -37,127 +37,127 @@ |
||
| 37 | 37 | |
| 38 | 38 | class CalendarHome extends \Sabre\CalDAV\CalendarHome { |
| 39 | 39 | |
| 40 | - /** @var \OCP\IL10N */ |
|
| 41 | - private $l10n; |
|
| 42 | - |
|
| 43 | - /** @var \OCP\IConfig */ |
|
| 44 | - private $config; |
|
| 45 | - |
|
| 46 | - /** @var bool */ |
|
| 47 | - private $returnCachedSubscriptions=false; |
|
| 48 | - |
|
| 49 | - public function __construct(BackendInterface $caldavBackend, $principalInfo) { |
|
| 50 | - parent::__construct($caldavBackend, $principalInfo); |
|
| 51 | - $this->l10n = \OC::$server->getL10N('dav'); |
|
| 52 | - $this->config = \OC::$server->getConfig(); |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * @return BackendInterface |
|
| 57 | - */ |
|
| 58 | - public function getCalDAVBackend() { |
|
| 59 | - return $this->caldavBackend; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * @inheritdoc |
|
| 64 | - */ |
|
| 65 | - function createExtendedCollection($name, MkCol $mkCol) { |
|
| 66 | - $reservedNames = [BirthdayService::BIRTHDAY_CALENDAR_URI]; |
|
| 67 | - |
|
| 68 | - if (in_array($name, $reservedNames)) { |
|
| 69 | - throw new MethodNotAllowed('The resource you tried to create has a reserved name'); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - parent::createExtendedCollection($name, $mkCol); |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * @inheritdoc |
|
| 77 | - */ |
|
| 78 | - function getChildren() { |
|
| 79 | - $calendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']); |
|
| 80 | - $objects = []; |
|
| 81 | - foreach ($calendars as $calendar) { |
|
| 82 | - $objects[] = new Calendar($this->caldavBackend, $calendar, $this->l10n, $this->config); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - if ($this->caldavBackend instanceof SchedulingSupport) { |
|
| 86 | - $objects[] = new Inbox($this->caldavBackend, $this->principalInfo['uri']); |
|
| 87 | - $objects[] = new Outbox($this->principalInfo['uri']); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - // We're adding a notifications node, if it's supported by the backend. |
|
| 91 | - if ($this->caldavBackend instanceof NotificationSupport) { |
|
| 92 | - $objects[] = new \Sabre\CalDAV\Notifications\Collection($this->caldavBackend, $this->principalInfo['uri']); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - // If the backend supports subscriptions, we'll add those as well, |
|
| 96 | - if ($this->caldavBackend instanceof SubscriptionSupport) { |
|
| 97 | - foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) { |
|
| 98 | - if ($this->returnCachedSubscriptions) { |
|
| 99 | - $objects[] = new CachedSubscription($this->caldavBackend, $subscription); |
|
| 100 | - } else { |
|
| 101 | - $objects[] = new Subscription($this->caldavBackend, $subscription); |
|
| 102 | - } |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - return $objects; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * @inheritdoc |
|
| 111 | - */ |
|
| 112 | - function getChild($name) { |
|
| 113 | - // Special nodes |
|
| 114 | - if ($name === 'inbox' && $this->caldavBackend instanceof SchedulingSupport) { |
|
| 115 | - return new Inbox($this->caldavBackend, $this->principalInfo['uri']); |
|
| 116 | - } |
|
| 117 | - if ($name === 'outbox' && $this->caldavBackend instanceof SchedulingSupport) { |
|
| 118 | - return new Outbox($this->principalInfo['uri']); |
|
| 119 | - } |
|
| 120 | - if ($name === 'notifications' && $this->caldavBackend instanceof NotificationSupport) { |
|
| 121 | - return new \Sabre\CalDAv\Notifications\Collection($this->caldavBackend, $this->principalInfo['uri']); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - // Calendars |
|
| 125 | - foreach ($this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']) as $calendar) { |
|
| 126 | - if ($calendar['uri'] === $name) { |
|
| 127 | - return new Calendar($this->caldavBackend, $calendar, $this->l10n, $this->config); |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - if ($this->caldavBackend instanceof SubscriptionSupport) { |
|
| 132 | - foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) { |
|
| 133 | - if ($subscription['uri'] === $name) { |
|
| 134 | - if ($this->returnCachedSubscriptions) { |
|
| 135 | - return new CachedSubscription($this->caldavBackend, $subscription); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - return new Subscription($this->caldavBackend, $subscription); |
|
| 139 | - } |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - throw new NotFound('Node with name \'' . $name . '\' could not be found'); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - /** |
|
| 148 | - * @param array $filters |
|
| 149 | - * @param integer|null $limit |
|
| 150 | - * @param integer|null $offset |
|
| 151 | - */ |
|
| 152 | - function calendarSearch(array $filters, $limit=null, $offset=null) { |
|
| 153 | - $principalUri = $this->principalInfo['uri']; |
|
| 154 | - return $this->caldavBackend->calendarSearch($principalUri, $filters, $limit, $offset); |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * |
|
| 159 | - */ |
|
| 160 | - public function enableCachedSubscriptionsForThisRequest() { |
|
| 161 | - $this->returnCachedSubscriptions = true; |
|
| 162 | - } |
|
| 40 | + /** @var \OCP\IL10N */ |
|
| 41 | + private $l10n; |
|
| 42 | + |
|
| 43 | + /** @var \OCP\IConfig */ |
|
| 44 | + private $config; |
|
| 45 | + |
|
| 46 | + /** @var bool */ |
|
| 47 | + private $returnCachedSubscriptions=false; |
|
| 48 | + |
|
| 49 | + public function __construct(BackendInterface $caldavBackend, $principalInfo) { |
|
| 50 | + parent::__construct($caldavBackend, $principalInfo); |
|
| 51 | + $this->l10n = \OC::$server->getL10N('dav'); |
|
| 52 | + $this->config = \OC::$server->getConfig(); |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * @return BackendInterface |
|
| 57 | + */ |
|
| 58 | + public function getCalDAVBackend() { |
|
| 59 | + return $this->caldavBackend; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @inheritdoc |
|
| 64 | + */ |
|
| 65 | + function createExtendedCollection($name, MkCol $mkCol) { |
|
| 66 | + $reservedNames = [BirthdayService::BIRTHDAY_CALENDAR_URI]; |
|
| 67 | + |
|
| 68 | + if (in_array($name, $reservedNames)) { |
|
| 69 | + throw new MethodNotAllowed('The resource you tried to create has a reserved name'); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + parent::createExtendedCollection($name, $mkCol); |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * @inheritdoc |
|
| 77 | + */ |
|
| 78 | + function getChildren() { |
|
| 79 | + $calendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']); |
|
| 80 | + $objects = []; |
|
| 81 | + foreach ($calendars as $calendar) { |
|
| 82 | + $objects[] = new Calendar($this->caldavBackend, $calendar, $this->l10n, $this->config); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + if ($this->caldavBackend instanceof SchedulingSupport) { |
|
| 86 | + $objects[] = new Inbox($this->caldavBackend, $this->principalInfo['uri']); |
|
| 87 | + $objects[] = new Outbox($this->principalInfo['uri']); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + // We're adding a notifications node, if it's supported by the backend. |
|
| 91 | + if ($this->caldavBackend instanceof NotificationSupport) { |
|
| 92 | + $objects[] = new \Sabre\CalDAV\Notifications\Collection($this->caldavBackend, $this->principalInfo['uri']); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + // If the backend supports subscriptions, we'll add those as well, |
|
| 96 | + if ($this->caldavBackend instanceof SubscriptionSupport) { |
|
| 97 | + foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) { |
|
| 98 | + if ($this->returnCachedSubscriptions) { |
|
| 99 | + $objects[] = new CachedSubscription($this->caldavBackend, $subscription); |
|
| 100 | + } else { |
|
| 101 | + $objects[] = new Subscription($this->caldavBackend, $subscription); |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + return $objects; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * @inheritdoc |
|
| 111 | + */ |
|
| 112 | + function getChild($name) { |
|
| 113 | + // Special nodes |
|
| 114 | + if ($name === 'inbox' && $this->caldavBackend instanceof SchedulingSupport) { |
|
| 115 | + return new Inbox($this->caldavBackend, $this->principalInfo['uri']); |
|
| 116 | + } |
|
| 117 | + if ($name === 'outbox' && $this->caldavBackend instanceof SchedulingSupport) { |
|
| 118 | + return new Outbox($this->principalInfo['uri']); |
|
| 119 | + } |
|
| 120 | + if ($name === 'notifications' && $this->caldavBackend instanceof NotificationSupport) { |
|
| 121 | + return new \Sabre\CalDAv\Notifications\Collection($this->caldavBackend, $this->principalInfo['uri']); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + // Calendars |
|
| 125 | + foreach ($this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']) as $calendar) { |
|
| 126 | + if ($calendar['uri'] === $name) { |
|
| 127 | + return new Calendar($this->caldavBackend, $calendar, $this->l10n, $this->config); |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + if ($this->caldavBackend instanceof SubscriptionSupport) { |
|
| 132 | + foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) { |
|
| 133 | + if ($subscription['uri'] === $name) { |
|
| 134 | + if ($this->returnCachedSubscriptions) { |
|
| 135 | + return new CachedSubscription($this->caldavBackend, $subscription); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + return new Subscription($this->caldavBackend, $subscription); |
|
| 139 | + } |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + throw new NotFound('Node with name \'' . $name . '\' could not be found'); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + /** |
|
| 148 | + * @param array $filters |
|
| 149 | + * @param integer|null $limit |
|
| 150 | + * @param integer|null $offset |
|
| 151 | + */ |
|
| 152 | + function calendarSearch(array $filters, $limit=null, $offset=null) { |
|
| 153 | + $principalUri = $this->principalInfo['uri']; |
|
| 154 | + return $this->caldavBackend->calendarSearch($principalUri, $filters, $limit, $offset); |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * |
|
| 159 | + */ |
|
| 160 | + public function enableCachedSubscriptionsForThisRequest() { |
|
| 161 | + $this->returnCachedSubscriptions = true; |
|
| 162 | + } |
|
| 163 | 163 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | private $config; |
| 45 | 45 | |
| 46 | 46 | /** @var bool */ |
| 47 | - private $returnCachedSubscriptions=false; |
|
| 47 | + private $returnCachedSubscriptions = false; |
|
| 48 | 48 | |
| 49 | 49 | public function __construct(BackendInterface $caldavBackend, $principalInfo) { |
| 50 | 50 | parent::__construct($caldavBackend, $principalInfo); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - throw new NotFound('Node with name \'' . $name . '\' could not be found'); |
|
| 144 | + throw new NotFound('Node with name \''.$name.'\' could not be found'); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @param integer|null $limit |
| 150 | 150 | * @param integer|null $offset |
| 151 | 151 | */ |
| 152 | - function calendarSearch(array $filters, $limit=null, $offset=null) { |
|
| 152 | + function calendarSearch(array $filters, $limit = null, $offset = null) { |
|
| 153 | 153 | $principalUri = $this->principalInfo['uri']; |
| 154 | 154 | return $this->caldavBackend->calendarSearch($principalUri, $filters, $limit, $offset); |
| 155 | 155 | } |
@@ -33,32 +33,32 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | class CachedSubscriptionObject extends \Sabre\CalDAV\CalendarObject { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @inheritdoc |
|
| 38 | - */ |
|
| 39 | - public function get() { |
|
| 40 | - // Pre-populating the 'calendardata' is optional, if we don't have it |
|
| 41 | - // already we fetch it from the backend. |
|
| 42 | - if (!isset($this->objectData['calendardata'])) { |
|
| 43 | - $this->objectData = $this->caldavBackend->getCachedCalendarObject($this->calendarInfo['id'], $this->objectData['uri']); |
|
| 44 | - } |
|
| 36 | + /** |
|
| 37 | + * @inheritdoc |
|
| 38 | + */ |
|
| 39 | + public function get() { |
|
| 40 | + // Pre-populating the 'calendardata' is optional, if we don't have it |
|
| 41 | + // already we fetch it from the backend. |
|
| 42 | + if (!isset($this->objectData['calendardata'])) { |
|
| 43 | + $this->objectData = $this->caldavBackend->getCachedCalendarObject($this->calendarInfo['id'], $this->objectData['uri']); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - return $this->objectData['calendardata']; |
|
| 47 | - } |
|
| 46 | + return $this->objectData['calendardata']; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @param resource|string $calendarData |
|
| 51 | - * @return string|void |
|
| 52 | - * @throws MethodNotAllowed |
|
| 53 | - */ |
|
| 54 | - public function put($calendarData) { |
|
| 55 | - throw new MethodNotAllowed('Creating objects in cached subscription is not allowed'); |
|
| 56 | - } |
|
| 49 | + /** |
|
| 50 | + * @param resource|string $calendarData |
|
| 51 | + * @return string|void |
|
| 52 | + * @throws MethodNotAllowed |
|
| 53 | + */ |
|
| 54 | + public function put($calendarData) { |
|
| 55 | + throw new MethodNotAllowed('Creating objects in cached subscription is not allowed'); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @throws MethodNotAllowed |
|
| 60 | - */ |
|
| 61 | - public function delete() { |
|
| 62 | - throw new MethodNotAllowed('Deleting objects in cached subscription is not allowed'); |
|
| 63 | - } |
|
| 58 | + /** |
|
| 59 | + * @throws MethodNotAllowed |
|
| 60 | + */ |
|
| 61 | + public function delete() { |
|
| 62 | + throw new MethodNotAllowed('Deleting objects in cached subscription is not allowed'); |
|
| 63 | + } |
|
| 64 | 64 | } |
@@ -34,133 +34,133 @@ |
||
| 34 | 34 | |
| 35 | 35 | class RefreshWebcalJob extends TimedJob { |
| 36 | 36 | |
| 37 | - /** @var CalDavBackend */ |
|
| 38 | - private $calDavBackend; |
|
| 39 | - |
|
| 40 | - /** @var IClientService */ |
|
| 41 | - private $clientService; |
|
| 42 | - |
|
| 43 | - /** @var ILogger */ |
|
| 44 | - private $logger; |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * RefreshWebcalJob constructor. |
|
| 48 | - * |
|
| 49 | - * @param CalDavBackend $calDavBackend |
|
| 50 | - * @param IClientService $clientService |
|
| 51 | - * @param ILogger $logger |
|
| 52 | - */ |
|
| 53 | - public function __construct(CalDavBackend $calDavBackend, IClientService $clientService, ILogger $logger) { |
|
| 54 | - $this->calDavBackend = $calDavBackend; |
|
| 55 | - $this->clientService = $clientService; |
|
| 56 | - $this->logger = $logger; |
|
| 57 | - |
|
| 58 | - $this->setInterval(60*60*24); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * @param array $argument |
|
| 63 | - */ |
|
| 64 | - protected function run($argument) { |
|
| 65 | - $principalUri = $argument['principaluri']; |
|
| 66 | - $uri = $argument['uri']; |
|
| 67 | - |
|
| 68 | - $subscriptions = array_filter( |
|
| 69 | - $this->calDavBackend->getSubscriptionsForUser($principalUri), |
|
| 70 | - function($sub) use ($uri) { |
|
| 71 | - return $sub['uri'] === $uri; |
|
| 72 | - } |
|
| 73 | - ); |
|
| 74 | - |
|
| 75 | - if (\count($subscriptions) === 0) { |
|
| 76 | - return; |
|
| 77 | - } |
|
| 78 | - /** @var array $subscription */ |
|
| 79 | - $subscription = $subscriptions[0]; |
|
| 37 | + /** @var CalDavBackend */ |
|
| 38 | + private $calDavBackend; |
|
| 39 | + |
|
| 40 | + /** @var IClientService */ |
|
| 41 | + private $clientService; |
|
| 42 | + |
|
| 43 | + /** @var ILogger */ |
|
| 44 | + private $logger; |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * RefreshWebcalJob constructor. |
|
| 48 | + * |
|
| 49 | + * @param CalDavBackend $calDavBackend |
|
| 50 | + * @param IClientService $clientService |
|
| 51 | + * @param ILogger $logger |
|
| 52 | + */ |
|
| 53 | + public function __construct(CalDavBackend $calDavBackend, IClientService $clientService, ILogger $logger) { |
|
| 54 | + $this->calDavBackend = $calDavBackend; |
|
| 55 | + $this->clientService = $clientService; |
|
| 56 | + $this->logger = $logger; |
|
| 57 | + |
|
| 58 | + $this->setInterval(60*60*24); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * @param array $argument |
|
| 63 | + */ |
|
| 64 | + protected function run($argument) { |
|
| 65 | + $principalUri = $argument['principaluri']; |
|
| 66 | + $uri = $argument['uri']; |
|
| 67 | + |
|
| 68 | + $subscriptions = array_filter( |
|
| 69 | + $this->calDavBackend->getSubscriptionsForUser($principalUri), |
|
| 70 | + function($sub) use ($uri) { |
|
| 71 | + return $sub['uri'] === $uri; |
|
| 72 | + } |
|
| 73 | + ); |
|
| 74 | + |
|
| 75 | + if (\count($subscriptions) === 0) { |
|
| 76 | + return; |
|
| 77 | + } |
|
| 78 | + /** @var array $subscription */ |
|
| 79 | + $subscription = $subscriptions[0]; |
|
| 80 | 80 | |
| 81 | 81 | // if ($subscription['refreshrate']) |
| 82 | 82 | |
| 83 | - $webcalData = $this->queryWebcalFeed($subscription); |
|
| 84 | - if (!$webcalData) { |
|
| 85 | - return; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - $stripTodos = $subscription['striptodos']; |
|
| 89 | - $stripAlarms = $subscription['stripalarms']; |
|
| 90 | - $stripAttachments = $subscription['stripattachments']; |
|
| 91 | - |
|
| 92 | - try { |
|
| 93 | - $splitter = new ICalendar($webcalData); |
|
| 94 | - |
|
| 95 | - // we wait with deleting all purged events till we parsed the new ones |
|
| 96 | - // in case the new calendar is broken and new ICalendar throws a ParseException |
|
| 97 | - // the user will still see the old data |
|
| 98 | - $this->calDavBackend->purgeAllCachedEventsForSubscription($subscription['id']); |
|
| 99 | - |
|
| 100 | - while ($vObject = $splitter->getNext()) { |
|
| 101 | - /** @var Component $vObject */ |
|
| 102 | - $uid = null; |
|
| 103 | - $compName = null; |
|
| 104 | - |
|
| 105 | - foreach ($vObject->getComponents() as $component) { |
|
| 106 | - if ($component->name === 'VTIMEZONE') { |
|
| 107 | - continue; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - $uid = $component->{'UID'}->getValue(); |
|
| 111 | - $compName = $component->name; |
|
| 112 | - |
|
| 113 | - if ($stripAlarms) { |
|
| 114 | - unset($component->{'VALARM'}); |
|
| 115 | - } |
|
| 116 | - if ($stripAttachments) { |
|
| 117 | - unset($component->{'ATTACH'}); |
|
| 118 | - } |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - if ($stripTodos && $compName === 'VTODO') { |
|
| 122 | - continue; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - $uri = $uid . '.ics'; |
|
| 126 | - $calendarData = $vObject->serialize(); |
|
| 127 | - try { |
|
| 128 | - $this->calDavBackend->addCachedEvent($subscription['id'], $uri, $calendarData); |
|
| 129 | - } catch(BadRequest $ex) { |
|
| 130 | - $this->logger->logException($ex); |
|
| 131 | - } |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - } catch(ParseException $ex) { |
|
| 135 | - $subscriptionId = $subscription['id']; |
|
| 136 | - |
|
| 137 | - $this->logger->logException($ex); |
|
| 138 | - $this->logger->warning("Subscription $subscriptionId could not be refreshed due to a parsing error"); |
|
| 139 | - } |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * @param array $subscription |
|
| 144 | - * @return null|resource |
|
| 145 | - */ |
|
| 146 | - private function queryWebcalFeed(array $subscription) { |
|
| 147 | - $client = $this->clientService->newClient(); |
|
| 148 | - try { |
|
| 149 | - $response = $client->get($subscription['source'], [ |
|
| 150 | - 'stream' => true, |
|
| 151 | - 'allow_redirects' => [ |
|
| 152 | - 'redirects' => 10 |
|
| 153 | - ] |
|
| 154 | - ]); |
|
| 155 | - |
|
| 156 | - return $response->getBody(); |
|
| 157 | - } catch(\Exception $ex) { |
|
| 158 | - $subscriptionId = $subscription['id']; |
|
| 159 | - |
|
| 160 | - $this->logger->logException($ex); |
|
| 161 | - $this->logger->warning("Subscription $subscriptionId could not be refreshed due to a network error"); |
|
| 162 | - |
|
| 163 | - return null; |
|
| 164 | - } |
|
| 165 | - } |
|
| 83 | + $webcalData = $this->queryWebcalFeed($subscription); |
|
| 84 | + if (!$webcalData) { |
|
| 85 | + return; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + $stripTodos = $subscription['striptodos']; |
|
| 89 | + $stripAlarms = $subscription['stripalarms']; |
|
| 90 | + $stripAttachments = $subscription['stripattachments']; |
|
| 91 | + |
|
| 92 | + try { |
|
| 93 | + $splitter = new ICalendar($webcalData); |
|
| 94 | + |
|
| 95 | + // we wait with deleting all purged events till we parsed the new ones |
|
| 96 | + // in case the new calendar is broken and new ICalendar throws a ParseException |
|
| 97 | + // the user will still see the old data |
|
| 98 | + $this->calDavBackend->purgeAllCachedEventsForSubscription($subscription['id']); |
|
| 99 | + |
|
| 100 | + while ($vObject = $splitter->getNext()) { |
|
| 101 | + /** @var Component $vObject */ |
|
| 102 | + $uid = null; |
|
| 103 | + $compName = null; |
|
| 104 | + |
|
| 105 | + foreach ($vObject->getComponents() as $component) { |
|
| 106 | + if ($component->name === 'VTIMEZONE') { |
|
| 107 | + continue; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + $uid = $component->{'UID'}->getValue(); |
|
| 111 | + $compName = $component->name; |
|
| 112 | + |
|
| 113 | + if ($stripAlarms) { |
|
| 114 | + unset($component->{'VALARM'}); |
|
| 115 | + } |
|
| 116 | + if ($stripAttachments) { |
|
| 117 | + unset($component->{'ATTACH'}); |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + if ($stripTodos && $compName === 'VTODO') { |
|
| 122 | + continue; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + $uri = $uid . '.ics'; |
|
| 126 | + $calendarData = $vObject->serialize(); |
|
| 127 | + try { |
|
| 128 | + $this->calDavBackend->addCachedEvent($subscription['id'], $uri, $calendarData); |
|
| 129 | + } catch(BadRequest $ex) { |
|
| 130 | + $this->logger->logException($ex); |
|
| 131 | + } |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + } catch(ParseException $ex) { |
|
| 135 | + $subscriptionId = $subscription['id']; |
|
| 136 | + |
|
| 137 | + $this->logger->logException($ex); |
|
| 138 | + $this->logger->warning("Subscription $subscriptionId could not be refreshed due to a parsing error"); |
|
| 139 | + } |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * @param array $subscription |
|
| 144 | + * @return null|resource |
|
| 145 | + */ |
|
| 146 | + private function queryWebcalFeed(array $subscription) { |
|
| 147 | + $client = $this->clientService->newClient(); |
|
| 148 | + try { |
|
| 149 | + $response = $client->get($subscription['source'], [ |
|
| 150 | + 'stream' => true, |
|
| 151 | + 'allow_redirects' => [ |
|
| 152 | + 'redirects' => 10 |
|
| 153 | + ] |
|
| 154 | + ]); |
|
| 155 | + |
|
| 156 | + return $response->getBody(); |
|
| 157 | + } catch(\Exception $ex) { |
|
| 158 | + $subscriptionId = $subscription['id']; |
|
| 159 | + |
|
| 160 | + $this->logger->logException($ex); |
|
| 161 | + $this->logger->warning("Subscription $subscriptionId could not be refreshed due to a network error"); |
|
| 162 | + |
|
| 163 | + return null; |
|
| 164 | + } |
|
| 165 | + } |
|
| 166 | 166 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $this->clientService = $clientService; |
| 56 | 56 | $this->logger = $logger; |
| 57 | 57 | |
| 58 | - $this->setInterval(60*60*24); |
|
| 58 | + $this->setInterval(60 * 60 * 24); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -122,16 +122,16 @@ discard block |
||
| 122 | 122 | continue; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $uri = $uid . '.ics'; |
|
| 125 | + $uri = $uid.'.ics'; |
|
| 126 | 126 | $calendarData = $vObject->serialize(); |
| 127 | 127 | try { |
| 128 | 128 | $this->calDavBackend->addCachedEvent($subscription['id'], $uri, $calendarData); |
| 129 | - } catch(BadRequest $ex) { |
|
| 129 | + } catch (BadRequest $ex) { |
|
| 130 | 130 | $this->logger->logException($ex); |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - } catch(ParseException $ex) { |
|
| 134 | + } catch (ParseException $ex) { |
|
| 135 | 135 | $subscriptionId = $subscription['id']; |
| 136 | 136 | |
| 137 | 137 | $this->logger->logException($ex); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | ]); |
| 155 | 155 | |
| 156 | 156 | return $response->getBody(); |
| 157 | - } catch(\Exception $ex) { |
|
| 157 | + } catch (\Exception $ex) { |
|
| 158 | 158 | $subscriptionId = $subscription['id']; |
| 159 | 159 | |
| 160 | 160 | $this->logger->logException($ex); |