@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | $name = $input->getArgument('name'); |
115 | 115 | $this->caldav = new CalDavBackend($this->dbConnection, $principalBackend, $this->userManager, $random, $dispatcher); |
116 | 116 | |
117 | - $calendar = $this->caldav->getCalendarByUri(self::URI_USERS . $userOrigin, $name); |
|
117 | + $calendar = $this->caldav->getCalendarByUri(self::URI_USERS.$userOrigin, $name); |
|
118 | 118 | |
119 | 119 | if (null === $calendar) { |
120 | 120 | /** If we got no matching calendar with URI, let's try the display names */ |
121 | - $suggestedUris = $this->caldav->findCalendarsUrisByDisplayName($name, self::URI_USERS . $userOrigin); |
|
121 | + $suggestedUris = $this->caldav->findCalendarsUrisByDisplayName($name, self::URI_USERS.$userOrigin); |
|
122 | 122 | if (count($suggestedUris) > 0) { |
123 | 123 | $this->io->note('No calendar with this URI was found, but you may want to try with these?'); |
124 | 124 | $this->io->listing($suggestedUris); |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | throw new \InvalidArgumentException("User <$userOrigin> has no calendar named <$name>."); |
127 | 127 | } |
128 | 128 | |
129 | - if (null !== $this->caldav->getCalendarByUri(self::URI_USERS . $userDestination, $name)) { |
|
129 | + if (null !== $this->caldav->getCalendarByUri(self::URI_USERS.$userDestination, $name)) { |
|
130 | 130 | throw new \InvalidArgumentException("User <$userDestination> already has a calendar named <$name>."); |
131 | 131 | } |
132 | 132 | |
133 | 133 | $this->checkShares($calendar, $userDestination, $input->getOption('force')); |
134 | 134 | |
135 | - $this->caldav->moveCalendar($name, self::URI_USERS . $userOrigin, self::URI_USERS . $userDestination); |
|
135 | + $this->caldav->moveCalendar($name, self::URI_USERS.$userOrigin, self::URI_USERS.$userDestination); |
|
136 | 136 | |
137 | 137 | $this->io->success("Calendar <$name> was moved from user <$userOrigin> to <$userDestination>"); |
138 | 138 | } |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | list($prefix, $group) = str_split($share['href'], 28); |
153 | 153 | if ('principal:principals/groups/' === $prefix && !$this->groupManager->isInGroup($userDestination, $group)) { |
154 | 154 | if ($force) { |
155 | - $this->caldav->updateShares(new Calendar($this->caldav, $calendar, $this->l10n), [], ['href' => 'principal:principals/groups/' . $group]); |
|
155 | + $this->caldav->updateShares(new Calendar($this->caldav, $calendar, $this->l10n), [], ['href' => 'principal:principals/groups/'.$group]); |
|
156 | 156 | } else { |
157 | - throw new \InvalidArgumentException("User <$userDestination> is not part of the group <$group> with which the calendar <" . $calendar['uri'] . "> was shared. You may use -f to move the calendar while deleting this share."); |
|
157 | + throw new \InvalidArgumentException("User <$userDestination> is not part of the group <$group> with which the calendar <".$calendar['uri']."> was shared. You may use -f to move the calendar while deleting this share."); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); |
198 | 198 | } |
199 | 199 | |
200 | - return (int)$query->execute()->fetchColumn(); |
|
200 | + return (int) $query->execute()->fetchColumn(); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -244,25 +244,25 @@ discard block |
||
244 | 244 | $stmt = $query->execute(); |
245 | 245 | |
246 | 246 | $calendars = []; |
247 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
247 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
248 | 248 | |
249 | 249 | $components = []; |
250 | 250 | if ($row['components']) { |
251 | - $components = explode(',',$row['components']); |
|
251 | + $components = explode(',', $row['components']); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | $calendar = [ |
255 | 255 | 'id' => $row['id'], |
256 | 256 | 'uri' => $row['uri'], |
257 | 257 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
258 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
259 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
260 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
261 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
262 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
258 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
259 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
260 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
261 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
262 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
263 | 263 | ]; |
264 | 264 | |
265 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
265 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
266 | 266 | $calendar[$xmlName] = $row[$dbName]; |
267 | 267 | } |
268 | 268 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $principals = array_map(function($principal) { |
281 | 281 | return urldecode($principal); |
282 | 282 | }, $principals); |
283 | - $principals[]= $principalUri; |
|
283 | + $principals[] = $principalUri; |
|
284 | 284 | |
285 | 285 | $fields = array_values($this->propertyMap); |
286 | 286 | $fields[] = 'a.id'; |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) |
301 | 301 | ->execute(); |
302 | 302 | |
303 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
304 | - while($row = $result->fetch()) { |
|
303 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
304 | + while ($row = $result->fetch()) { |
|
305 | 305 | if ($row['principaluri'] === $principalUri) { |
306 | 306 | continue; |
307 | 307 | } |
@@ -320,25 +320,25 @@ discard block |
||
320 | 320 | } |
321 | 321 | |
322 | 322 | list(, $name) = Uri\split($row['principaluri']); |
323 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
324 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
323 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
324 | + $row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
325 | 325 | $components = []; |
326 | 326 | if ($row['components']) { |
327 | - $components = explode(',',$row['components']); |
|
327 | + $components = explode(',', $row['components']); |
|
328 | 328 | } |
329 | 329 | $calendar = [ |
330 | 330 | 'id' => $row['id'], |
331 | 331 | 'uri' => $uri, |
332 | 332 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
333 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
334 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
335 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
336 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
337 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
333 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
334 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
335 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
336 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
337 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
338 | 338 | $readOnlyPropertyName => $readOnly, |
339 | 339 | ]; |
340 | 340 | |
341 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
341 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
342 | 342 | $calendar[$xmlName] = $row[$dbName]; |
343 | 343 | } |
344 | 344 | |
@@ -367,21 +367,21 @@ discard block |
||
367 | 367 | ->orderBy('calendarorder', 'ASC'); |
368 | 368 | $stmt = $query->execute(); |
369 | 369 | $calendars = []; |
370 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
370 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
371 | 371 | $components = []; |
372 | 372 | if ($row['components']) { |
373 | - $components = explode(',',$row['components']); |
|
373 | + $components = explode(',', $row['components']); |
|
374 | 374 | } |
375 | 375 | $calendar = [ |
376 | 376 | 'id' => $row['id'], |
377 | 377 | 'uri' => $row['uri'], |
378 | 378 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
379 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
380 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
381 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
382 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
379 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
380 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
381 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
382 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
383 | 383 | ]; |
384 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
384 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
385 | 385 | $calendar[$xmlName] = $row[$dbName]; |
386 | 386 | } |
387 | 387 | |
@@ -432,27 +432,27 @@ discard block |
||
432 | 432 | ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
433 | 433 | ->execute(); |
434 | 434 | |
435 | - while($row = $result->fetch()) { |
|
435 | + while ($row = $result->fetch()) { |
|
436 | 436 | list(, $name) = Uri\split($row['principaluri']); |
437 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
437 | + $row['displayname'] = $row['displayname']."($name)"; |
|
438 | 438 | $components = []; |
439 | 439 | if ($row['components']) { |
440 | - $components = explode(',',$row['components']); |
|
440 | + $components = explode(',', $row['components']); |
|
441 | 441 | } |
442 | 442 | $calendar = [ |
443 | 443 | 'id' => $row['id'], |
444 | 444 | 'uri' => $row['publicuri'], |
445 | 445 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
446 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
447 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
448 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
449 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
450 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
451 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
452 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
446 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
447 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
448 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
449 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
450 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
451 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
452 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
453 | 453 | ]; |
454 | 454 | |
455 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
455 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
456 | 456 | $calendar[$xmlName] = $row[$dbName]; |
457 | 457 | } |
458 | 458 | |
@@ -496,29 +496,29 @@ discard block |
||
496 | 496 | $result->closeCursor(); |
497 | 497 | |
498 | 498 | if ($row === false) { |
499 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
499 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | list(, $name) = Uri\split($row['principaluri']); |
503 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
503 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
504 | 504 | $components = []; |
505 | 505 | if ($row['components']) { |
506 | - $components = explode(',',$row['components']); |
|
506 | + $components = explode(',', $row['components']); |
|
507 | 507 | } |
508 | 508 | $calendar = [ |
509 | 509 | 'id' => $row['id'], |
510 | 510 | 'uri' => $row['publicuri'], |
511 | 511 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
512 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
513 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
514 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
515 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
516 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
517 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
518 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
512 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
513 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
514 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
515 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
516 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
517 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
518 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
519 | 519 | ]; |
520 | 520 | |
521 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
521 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
522 | 522 | $calendar[$xmlName] = $row[$dbName]; |
523 | 523 | } |
524 | 524 | |
@@ -558,20 +558,20 @@ discard block |
||
558 | 558 | |
559 | 559 | $components = []; |
560 | 560 | if ($row['components']) { |
561 | - $components = explode(',',$row['components']); |
|
561 | + $components = explode(',', $row['components']); |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | $calendar = [ |
565 | 565 | 'id' => $row['id'], |
566 | 566 | 'uri' => $row['uri'], |
567 | 567 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
568 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
569 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
570 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
571 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
568 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
569 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
570 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
571 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
572 | 572 | ]; |
573 | 573 | |
574 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
574 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
575 | 575 | $calendar[$xmlName] = $row[$dbName]; |
576 | 576 | } |
577 | 577 | |
@@ -604,20 +604,20 @@ discard block |
||
604 | 604 | |
605 | 605 | $components = []; |
606 | 606 | if ($row['components']) { |
607 | - $components = explode(',',$row['components']); |
|
607 | + $components = explode(',', $row['components']); |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | $calendar = [ |
611 | 611 | 'id' => $row['id'], |
612 | 612 | 'uri' => $row['uri'], |
613 | 613 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
614 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
615 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
616 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
617 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
614 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
615 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
616 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
617 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
618 | 618 | ]; |
619 | 619 | |
620 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
620 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
621 | 621 | $calendar[$xmlName] = $row[$dbName]; |
622 | 622 | } |
623 | 623 | |
@@ -652,16 +652,16 @@ discard block |
||
652 | 652 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
653 | 653 | if (isset($properties[$sccs])) { |
654 | 654 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
655 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
655 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
656 | 656 | } |
657 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
657 | + $values['components'] = implode(',', $properties[$sccs]->getValue()); |
|
658 | 658 | } |
659 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
659 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
660 | 660 | if (isset($properties[$transp])) { |
661 | 661 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
662 | 662 | } |
663 | 663 | |
664 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
664 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
665 | 665 | if (isset($properties[$xmlName])) { |
666 | 666 | $values[$dbName] = $properties[$xmlName]; |
667 | 667 | } |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | |
670 | 670 | $query = $this->db->getQueryBuilder(); |
671 | 671 | $query->insert('calendars'); |
672 | - foreach($values as $column => $value) { |
|
672 | + foreach ($values as $column => $value) { |
|
673 | 673 | $query->setValue($column, $query->createNamedParameter($value)); |
674 | 674 | } |
675 | 675 | $query->execute(); |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | */ |
704 | 704 | function updateCalendar($calendarId, PropPatch $propPatch) { |
705 | 705 | $supportedProperties = array_keys($this->propertyMap); |
706 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
706 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
707 | 707 | |
708 | 708 | /** |
709 | 709 | * @suppress SqlInjectionChecker |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | foreach ($mutations as $propertyName => $propertyValue) { |
714 | 714 | |
715 | 715 | switch ($propertyName) { |
716 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' : |
|
716 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' : |
|
717 | 717 | $fieldName = 'transparent'; |
718 | 718 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
719 | 719 | break; |
@@ -828,16 +828,16 @@ discard block |
||
828 | 828 | $stmt = $query->execute(); |
829 | 829 | |
830 | 830 | $result = []; |
831 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
831 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
832 | 832 | $result[] = [ |
833 | 833 | 'id' => $row['id'], |
834 | 834 | 'uri' => $row['uri'], |
835 | 835 | 'lastmodified' => $row['lastmodified'], |
836 | - 'etag' => '"' . $row['etag'] . '"', |
|
836 | + 'etag' => '"'.$row['etag'].'"', |
|
837 | 837 | 'calendarid' => $row['calendarid'], |
838 | - 'size' => (int)$row['size'], |
|
838 | + 'size' => (int) $row['size'], |
|
839 | 839 | 'component' => strtolower($row['componenttype']), |
840 | - 'classification'=> (int)$row['classification'] |
|
840 | + 'classification'=> (int) $row['classification'] |
|
841 | 841 | ]; |
842 | 842 | } |
843 | 843 | |
@@ -870,18 +870,18 @@ discard block |
||
870 | 870 | $stmt = $query->execute(); |
871 | 871 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
872 | 872 | |
873 | - if(!$row) return null; |
|
873 | + if (!$row) return null; |
|
874 | 874 | |
875 | 875 | return [ |
876 | 876 | 'id' => $row['id'], |
877 | 877 | 'uri' => $row['uri'], |
878 | 878 | 'lastmodified' => $row['lastmodified'], |
879 | - 'etag' => '"' . $row['etag'] . '"', |
|
879 | + 'etag' => '"'.$row['etag'].'"', |
|
880 | 880 | 'calendarid' => $row['calendarid'], |
881 | - 'size' => (int)$row['size'], |
|
881 | + 'size' => (int) $row['size'], |
|
882 | 882 | 'calendardata' => $this->readBlob($row['calendardata']), |
883 | 883 | 'component' => strtolower($row['componenttype']), |
884 | - 'classification'=> (int)$row['classification'] |
|
884 | + 'classification'=> (int) $row['classification'] |
|
885 | 885 | ]; |
886 | 886 | } |
887 | 887 | |
@@ -920,12 +920,12 @@ discard block |
||
920 | 920 | 'id' => $row['id'], |
921 | 921 | 'uri' => $row['uri'], |
922 | 922 | 'lastmodified' => $row['lastmodified'], |
923 | - 'etag' => '"' . $row['etag'] . '"', |
|
923 | + 'etag' => '"'.$row['etag'].'"', |
|
924 | 924 | 'calendarid' => $row['calendarid'], |
925 | - 'size' => (int)$row['size'], |
|
925 | + 'size' => (int) $row['size'], |
|
926 | 926 | 'calendardata' => $this->readBlob($row['calendardata']), |
927 | 927 | 'component' => strtolower($row['componenttype']), |
928 | - 'classification' => (int)$row['classification'] |
|
928 | + 'classification' => (int) $row['classification'] |
|
929 | 929 | ]; |
930 | 930 | } |
931 | 931 | $result->closeCursor(); |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | )); |
985 | 985 | $this->addChange($calendarId, $objectUri, 1); |
986 | 986 | |
987 | - return '"' . $extraData['etag'] . '"'; |
|
987 | + return '"'.$extraData['etag'].'"'; |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | /** |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | } |
1040 | 1040 | $this->addChange($calendarId, $objectUri, 2); |
1041 | 1041 | |
1042 | - return '"' . $extraData['etag'] . '"'; |
|
1042 | + return '"'.$extraData['etag'].'"'; |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | /** |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | $stmt = $query->execute(); |
1193 | 1193 | |
1194 | 1194 | $result = []; |
1195 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1195 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1196 | 1196 | if ($requirePostFilter) { |
1197 | 1197 | if (!$this->validateFilterForObject($row, $filters)) { |
1198 | 1198 | continue; |
@@ -1213,14 +1213,14 @@ discard block |
||
1213 | 1213 | * @param integer|null $offset |
1214 | 1214 | * @return array |
1215 | 1215 | */ |
1216 | - public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) { |
|
1216 | + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
|
1217 | 1217 | $calendars = $this->getCalendarsForUser($principalUri); |
1218 | 1218 | $ownCalendars = []; |
1219 | 1219 | $sharedCalendars = []; |
1220 | 1220 | |
1221 | 1221 | $uriMapper = []; |
1222 | 1222 | |
1223 | - foreach($calendars as $calendar) { |
|
1223 | + foreach ($calendars as $calendar) { |
|
1224 | 1224 | if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { |
1225 | 1225 | $ownCalendars[] = $calendar['id']; |
1226 | 1226 | } else { |
@@ -1235,11 +1235,11 @@ discard block |
||
1235 | 1235 | $query = $this->db->getQueryBuilder(); |
1236 | 1236 | // Calendar id expressions |
1237 | 1237 | $calendarExpressions = []; |
1238 | - foreach($ownCalendars as $id) { |
|
1238 | + foreach ($ownCalendars as $id) { |
|
1239 | 1239 | $calendarExpressions[] = $query->expr() |
1240 | 1240 | ->eq('c.calendarid', $query->createNamedParameter($id)); |
1241 | 1241 | } |
1242 | - foreach($sharedCalendars as $id) { |
|
1242 | + foreach ($sharedCalendars as $id) { |
|
1243 | 1243 | $calendarExpressions[] = $query->expr()->andX( |
1244 | 1244 | $query->expr()->eq('c.calendarid', |
1245 | 1245 | $query->createNamedParameter($id)), |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | |
1257 | 1257 | // Component expressions |
1258 | 1258 | $compExpressions = []; |
1259 | - foreach($filters['comps'] as $comp) { |
|
1259 | + foreach ($filters['comps'] as $comp) { |
|
1260 | 1260 | $compExpressions[] = $query->expr() |
1261 | 1261 | ->eq('c.componenttype', $query->createNamedParameter($comp)); |
1262 | 1262 | } |
@@ -1275,13 +1275,13 @@ discard block |
||
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | $propParamExpressions = []; |
1278 | - foreach($filters['props'] as $prop) { |
|
1278 | + foreach ($filters['props'] as $prop) { |
|
1279 | 1279 | $propParamExpressions[] = $query->expr()->andX( |
1280 | 1280 | $query->expr()->eq('i.name', $query->createNamedParameter($prop)), |
1281 | 1281 | $query->expr()->isNull('i.parameter') |
1282 | 1282 | ); |
1283 | 1283 | } |
1284 | - foreach($filters['params'] as $param) { |
|
1284 | + foreach ($filters['params'] as $param) { |
|
1285 | 1285 | $propParamExpressions[] = $query->expr()->andX( |
1286 | 1286 | $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), |
1287 | 1287 | $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) |
@@ -1313,8 +1313,8 @@ discard block |
||
1313 | 1313 | $stmt = $query->execute(); |
1314 | 1314 | |
1315 | 1315 | $result = []; |
1316 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1317 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
1316 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1317 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
1318 | 1318 | if (!in_array($path, $result)) { |
1319 | 1319 | $result[] = $path; |
1320 | 1320 | } |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | $stmt = $query->execute(); |
1355 | 1355 | |
1356 | 1356 | if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
1357 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
1357 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
1358 | 1358 | } |
1359 | 1359 | |
1360 | 1360 | return null; |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) { |
1420 | 1420 | // Current synctoken |
1421 | 1421 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); |
1422 | - $stmt->execute([ $calendarId ]); |
|
1422 | + $stmt->execute([$calendarId]); |
|
1423 | 1423 | $currentToken = $stmt->fetchColumn(0); |
1424 | 1424 | |
1425 | 1425 | if (is_null($currentToken)) { |
@@ -1436,8 +1436,8 @@ discard block |
||
1436 | 1436 | if ($syncToken) { |
1437 | 1437 | |
1438 | 1438 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`"; |
1439 | - if ($limit>0) { |
|
1440 | - $query.= " LIMIT " . (int)$limit; |
|
1439 | + if ($limit > 0) { |
|
1440 | + $query .= " LIMIT ".(int) $limit; |
|
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | // Fetching all changes |
@@ -1448,15 +1448,15 @@ discard block |
||
1448 | 1448 | |
1449 | 1449 | // This loop ensures that any duplicates are overwritten, only the |
1450 | 1450 | // last change on a node is relevant. |
1451 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1451 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1452 | 1452 | |
1453 | 1453 | $changes[$row['uri']] = $row['operation']; |
1454 | 1454 | |
1455 | 1455 | } |
1456 | 1456 | |
1457 | - foreach($changes as $uri => $operation) { |
|
1457 | + foreach ($changes as $uri => $operation) { |
|
1458 | 1458 | |
1459 | - switch($operation) { |
|
1459 | + switch ($operation) { |
|
1460 | 1460 | case 1 : |
1461 | 1461 | $result['added'][] = $uri; |
1462 | 1462 | break; |
@@ -1526,10 +1526,10 @@ discard block |
||
1526 | 1526 | ->from('calendarsubscriptions') |
1527 | 1527 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
1528 | 1528 | ->orderBy('calendarorder', 'asc'); |
1529 | - $stmt =$query->execute(); |
|
1529 | + $stmt = $query->execute(); |
|
1530 | 1530 | |
1531 | 1531 | $subscriptions = []; |
1532 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1532 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1533 | 1533 | |
1534 | 1534 | $subscription = [ |
1535 | 1535 | 'id' => $row['id'], |
@@ -1538,10 +1538,10 @@ discard block |
||
1538 | 1538 | 'source' => $row['source'], |
1539 | 1539 | 'lastmodified' => $row['lastmodified'], |
1540 | 1540 | |
1541 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
1541 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
1542 | 1542 | ]; |
1543 | 1543 | |
1544 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1544 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1545 | 1545 | if (!is_null($row[$dbName])) { |
1546 | 1546 | $subscription[$xmlName] = $row[$dbName]; |
1547 | 1547 | } |
@@ -1580,7 +1580,7 @@ discard block |
||
1580 | 1580 | |
1581 | 1581 | $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; |
1582 | 1582 | |
1583 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1583 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1584 | 1584 | if (array_key_exists($xmlName, $properties)) { |
1585 | 1585 | $values[$dbName] = $properties[$xmlName]; |
1586 | 1586 | if (in_array($dbName, $propertiesBoolean)) { |
@@ -1631,7 +1631,7 @@ discard block |
||
1631 | 1631 | |
1632 | 1632 | $newValues = []; |
1633 | 1633 | |
1634 | - foreach($mutations as $propertyName=>$propertyValue) { |
|
1634 | + foreach ($mutations as $propertyName=>$propertyValue) { |
|
1635 | 1635 | if ($propertyName === '{http://calendarserver.org/ns/}source') { |
1636 | 1636 | $newValues['source'] = $propertyValue->getHref(); |
1637 | 1637 | } else { |
@@ -1643,7 +1643,7 @@ discard block |
||
1643 | 1643 | $query = $this->db->getQueryBuilder(); |
1644 | 1644 | $query->update('calendarsubscriptions') |
1645 | 1645 | ->set('lastmodified', $query->createNamedParameter(time())); |
1646 | - foreach($newValues as $fieldName=>$value) { |
|
1646 | + foreach ($newValues as $fieldName=>$value) { |
|
1647 | 1647 | $query->set($fieldName, $query->createNamedParameter($value)); |
1648 | 1648 | } |
1649 | 1649 | $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
@@ -1693,7 +1693,7 @@ discard block |
||
1693 | 1693 | |
1694 | 1694 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
1695 | 1695 | |
1696 | - if(!$row) { |
|
1696 | + if (!$row) { |
|
1697 | 1697 | return null; |
1698 | 1698 | } |
1699 | 1699 | |
@@ -1701,8 +1701,8 @@ discard block |
||
1701 | 1701 | 'uri' => $row['uri'], |
1702 | 1702 | 'calendardata' => $row['calendardata'], |
1703 | 1703 | 'lastmodified' => $row['lastmodified'], |
1704 | - 'etag' => '"' . $row['etag'] . '"', |
|
1705 | - 'size' => (int)$row['size'], |
|
1704 | + 'etag' => '"'.$row['etag'].'"', |
|
1705 | + 'size' => (int) $row['size'], |
|
1706 | 1706 | ]; |
1707 | 1707 | } |
1708 | 1708 | |
@@ -1725,13 +1725,13 @@ discard block |
||
1725 | 1725 | ->execute(); |
1726 | 1726 | |
1727 | 1727 | $result = []; |
1728 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
1728 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
1729 | 1729 | $result[] = [ |
1730 | 1730 | 'calendardata' => $row['calendardata'], |
1731 | 1731 | 'uri' => $row['uri'], |
1732 | 1732 | 'lastmodified' => $row['lastmodified'], |
1733 | - 'etag' => '"' . $row['etag'] . '"', |
|
1734 | - 'size' => (int)$row['size'], |
|
1733 | + 'etag' => '"'.$row['etag'].'"', |
|
1734 | + 'size' => (int) $row['size'], |
|
1735 | 1735 | ]; |
1736 | 1736 | } |
1737 | 1737 | |
@@ -1823,10 +1823,10 @@ discard block |
||
1823 | 1823 | $lastOccurrence = null; |
1824 | 1824 | $uid = null; |
1825 | 1825 | $classification = self::CLASSIFICATION_PUBLIC; |
1826 | - foreach($vObject->getComponents() as $component) { |
|
1827 | - if ($component->name!=='VTIMEZONE') { |
|
1826 | + foreach ($vObject->getComponents() as $component) { |
|
1827 | + if ($component->name !== 'VTIMEZONE') { |
|
1828 | 1828 | $componentType = $component->name; |
1829 | - $uid = (string)$component->UID; |
|
1829 | + $uid = (string) $component->UID; |
|
1830 | 1830 | break; |
1831 | 1831 | } |
1832 | 1832 | } |
@@ -1851,13 +1851,13 @@ discard block |
||
1851 | 1851 | $lastOccurrence = $firstOccurrence; |
1852 | 1852 | } |
1853 | 1853 | } else { |
1854 | - $it = new EventIterator($vObject, (string)$component->UID); |
|
1854 | + $it = new EventIterator($vObject, (string) $component->UID); |
|
1855 | 1855 | $maxDate = new \DateTime(self::MAX_DATE); |
1856 | 1856 | if ($it->isInfinite()) { |
1857 | 1857 | $lastOccurrence = $maxDate->getTimestamp(); |
1858 | 1858 | } else { |
1859 | 1859 | $end = $it->getDtEnd(); |
1860 | - while($it->valid() && $end < $maxDate) { |
|
1860 | + while ($it->valid() && $end < $maxDate) { |
|
1861 | 1861 | $end = $it->getDtEnd(); |
1862 | 1862 | $it->next(); |
1863 | 1863 | |
@@ -2092,7 +2092,7 @@ discard block |
||
2092 | 2092 | $result = $query->execute(); |
2093 | 2093 | |
2094 | 2094 | $calendarUris = []; |
2095 | - while($row = $result->fetch()) { |
|
2095 | + while ($row = $result->fetch()) { |
|
2096 | 2096 | $calendarUris[] = $row['uri']; |
2097 | 2097 | } |
2098 | 2098 | return $calendarUris; |
@@ -2140,10 +2140,10 @@ discard block |
||
2140 | 2140 | $result->closeCursor(); |
2141 | 2141 | |
2142 | 2142 | if (!isset($objectIds['id'])) { |
2143 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
2143 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
2144 | 2144 | } |
2145 | 2145 | |
2146 | - return (int)$objectIds['id']; |
|
2146 | + return (int) $objectIds['id']; |
|
2147 | 2147 | } |
2148 | 2148 | |
2149 | 2149 | private function convertPrincipal($principalUri, $toV2) { |
@@ -2158,8 +2158,8 @@ discard block |
||
2158 | 2158 | } |
2159 | 2159 | |
2160 | 2160 | private function addOwnerPrincipal(&$calendarInfo) { |
2161 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
2162 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
2161 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
2162 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
2163 | 2163 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
2164 | 2164 | $uri = $calendarInfo[$ownerPrincipalKey]; |
2165 | 2165 | } else { |