@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); |
210 | 210 | } |
211 | 211 | |
212 | - return (int)$query->execute()->fetchColumn(); |
|
212 | + return (int) $query->execute()->fetchColumn(); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -256,25 +256,25 @@ discard block |
||
256 | 256 | $stmt = $query->execute(); |
257 | 257 | |
258 | 258 | $calendars = []; |
259 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
259 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
260 | 260 | |
261 | 261 | $components = []; |
262 | 262 | if ($row['components']) { |
263 | - $components = explode(',',$row['components']); |
|
263 | + $components = explode(',', $row['components']); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | $calendar = [ |
267 | 267 | 'id' => $row['id'], |
268 | 268 | 'uri' => $row['uri'], |
269 | 269 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
270 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
271 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
272 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
273 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
274 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
270 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
271 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
272 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
273 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
274 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
275 | 275 | ]; |
276 | 276 | |
277 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
277 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
278 | 278 | $calendar[$xmlName] = $row[$dbName]; |
279 | 279 | } |
280 | 280 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $principals = array_map(function($principal) { |
293 | 293 | return urldecode($principal); |
294 | 294 | }, $principals); |
295 | - $principals[]= $principalUri; |
|
295 | + $principals[] = $principalUri; |
|
296 | 296 | |
297 | 297 | $fields = array_values($this->propertyMap); |
298 | 298 | $fields[] = 'a.id'; |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) |
313 | 313 | ->execute(); |
314 | 314 | |
315 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
316 | - while($row = $result->fetch()) { |
|
315 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
316 | + while ($row = $result->fetch()) { |
|
317 | 317 | if ($row['principaluri'] === $principalUri) { |
318 | 318 | continue; |
319 | 319 | } |
@@ -332,25 +332,25 @@ discard block |
||
332 | 332 | } |
333 | 333 | |
334 | 334 | list(, $name) = Uri\split($row['principaluri']); |
335 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
336 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
335 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
336 | + $row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
337 | 337 | $components = []; |
338 | 338 | if ($row['components']) { |
339 | - $components = explode(',',$row['components']); |
|
339 | + $components = explode(',', $row['components']); |
|
340 | 340 | } |
341 | 341 | $calendar = [ |
342 | 342 | 'id' => $row['id'], |
343 | 343 | 'uri' => $uri, |
344 | 344 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
345 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
346 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
347 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
348 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
349 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
345 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
346 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
347 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
348 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
349 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
350 | 350 | $readOnlyPropertyName => $readOnly, |
351 | 351 | ]; |
352 | 352 | |
353 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
353 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
354 | 354 | $calendar[$xmlName] = $row[$dbName]; |
355 | 355 | } |
356 | 356 | |
@@ -379,21 +379,21 @@ discard block |
||
379 | 379 | ->orderBy('calendarorder', 'ASC'); |
380 | 380 | $stmt = $query->execute(); |
381 | 381 | $calendars = []; |
382 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
382 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
383 | 383 | $components = []; |
384 | 384 | if ($row['components']) { |
385 | - $components = explode(',',$row['components']); |
|
385 | + $components = explode(',', $row['components']); |
|
386 | 386 | } |
387 | 387 | $calendar = [ |
388 | 388 | 'id' => $row['id'], |
389 | 389 | 'uri' => $row['uri'], |
390 | 390 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
391 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
392 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
393 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
394 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
391 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
392 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
393 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
394 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
395 | 395 | ]; |
396 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
396 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
397 | 397 | $calendar[$xmlName] = $row[$dbName]; |
398 | 398 | } |
399 | 399 | |
@@ -444,27 +444,27 @@ discard block |
||
444 | 444 | ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
445 | 445 | ->execute(); |
446 | 446 | |
447 | - while($row = $result->fetch()) { |
|
447 | + while ($row = $result->fetch()) { |
|
448 | 448 | list(, $name) = Uri\split($row['principaluri']); |
449 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
449 | + $row['displayname'] = $row['displayname']."($name)"; |
|
450 | 450 | $components = []; |
451 | 451 | if ($row['components']) { |
452 | - $components = explode(',',$row['components']); |
|
452 | + $components = explode(',', $row['components']); |
|
453 | 453 | } |
454 | 454 | $calendar = [ |
455 | 455 | 'id' => $row['id'], |
456 | 456 | 'uri' => $row['publicuri'], |
457 | 457 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
458 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
459 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
460 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
461 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
462 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
463 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
464 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
458 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
459 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
460 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
461 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
462 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
463 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
464 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
465 | 465 | ]; |
466 | 466 | |
467 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
467 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
468 | 468 | $calendar[$xmlName] = $row[$dbName]; |
469 | 469 | } |
470 | 470 | |
@@ -508,29 +508,29 @@ discard block |
||
508 | 508 | $result->closeCursor(); |
509 | 509 | |
510 | 510 | if ($row === false) { |
511 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
511 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | list(, $name) = Uri\split($row['principaluri']); |
515 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
515 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
516 | 516 | $components = []; |
517 | 517 | if ($row['components']) { |
518 | - $components = explode(',',$row['components']); |
|
518 | + $components = explode(',', $row['components']); |
|
519 | 519 | } |
520 | 520 | $calendar = [ |
521 | 521 | 'id' => $row['id'], |
522 | 522 | 'uri' => $row['publicuri'], |
523 | 523 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
524 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
525 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
526 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
527 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
528 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
529 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
530 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
524 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
525 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
526 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
527 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
528 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
529 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
530 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
531 | 531 | ]; |
532 | 532 | |
533 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
533 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
534 | 534 | $calendar[$xmlName] = $row[$dbName]; |
535 | 535 | } |
536 | 536 | |
@@ -570,20 +570,20 @@ discard block |
||
570 | 570 | |
571 | 571 | $components = []; |
572 | 572 | if ($row['components']) { |
573 | - $components = explode(',',$row['components']); |
|
573 | + $components = explode(',', $row['components']); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | $calendar = [ |
577 | 577 | 'id' => $row['id'], |
578 | 578 | 'uri' => $row['uri'], |
579 | 579 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
580 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
581 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
582 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
583 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
580 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
581 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
582 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
583 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
584 | 584 | ]; |
585 | 585 | |
586 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
586 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
587 | 587 | $calendar[$xmlName] = $row[$dbName]; |
588 | 588 | } |
589 | 589 | |
@@ -616,20 +616,20 @@ discard block |
||
616 | 616 | |
617 | 617 | $components = []; |
618 | 618 | if ($row['components']) { |
619 | - $components = explode(',',$row['components']); |
|
619 | + $components = explode(',', $row['components']); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | $calendar = [ |
623 | 623 | 'id' => $row['id'], |
624 | 624 | 'uri' => $row['uri'], |
625 | 625 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
626 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
627 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
628 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
629 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
626 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
627 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
628 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
629 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
630 | 630 | ]; |
631 | 631 | |
632 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
632 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
633 | 633 | $calendar[$xmlName] = $row[$dbName]; |
634 | 634 | } |
635 | 635 | |
@@ -664,16 +664,16 @@ discard block |
||
664 | 664 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
665 | 665 | if (isset($properties[$sccs])) { |
666 | 666 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
667 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
667 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
668 | 668 | } |
669 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
669 | + $values['components'] = implode(',', $properties[$sccs]->getValue()); |
|
670 | 670 | } |
671 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
671 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
672 | 672 | if (isset($properties[$transp])) { |
673 | 673 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
674 | 674 | } |
675 | 675 | |
676 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
676 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
677 | 677 | if (isset($properties[$xmlName])) { |
678 | 678 | $values[$dbName] = $properties[$xmlName]; |
679 | 679 | } |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | |
682 | 682 | $query = $this->db->getQueryBuilder(); |
683 | 683 | $query->insert('calendars'); |
684 | - foreach($values as $column => $value) { |
|
684 | + foreach ($values as $column => $value) { |
|
685 | 685 | $query->setValue($column, $query->createNamedParameter($value)); |
686 | 686 | } |
687 | 687 | $query->execute(); |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | */ |
716 | 716 | function updateCalendar($calendarId, PropPatch $propPatch) { |
717 | 717 | $supportedProperties = array_keys($this->propertyMap); |
718 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
718 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
719 | 719 | |
720 | 720 | /** |
721 | 721 | * @suppress SqlInjectionChecker |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | foreach ($mutations as $propertyName => $propertyValue) { |
726 | 726 | |
727 | 727 | switch ($propertyName) { |
728 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' : |
|
728 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' : |
|
729 | 729 | $fieldName = 'transparent'; |
730 | 730 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
731 | 731 | break; |
@@ -840,16 +840,16 @@ discard block |
||
840 | 840 | $stmt = $query->execute(); |
841 | 841 | |
842 | 842 | $result = []; |
843 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
843 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
844 | 844 | $result[] = [ |
845 | 845 | 'id' => $row['id'], |
846 | 846 | 'uri' => $row['uri'], |
847 | 847 | 'lastmodified' => $row['lastmodified'], |
848 | - 'etag' => '"' . $row['etag'] . '"', |
|
848 | + 'etag' => '"'.$row['etag'].'"', |
|
849 | 849 | 'calendarid' => $row['calendarid'], |
850 | - 'size' => (int)$row['size'], |
|
850 | + 'size' => (int) $row['size'], |
|
851 | 851 | 'component' => strtolower($row['componenttype']), |
852 | - 'classification'=> (int)$row['classification'] |
|
852 | + 'classification'=> (int) $row['classification'] |
|
853 | 853 | ]; |
854 | 854 | } |
855 | 855 | |
@@ -882,18 +882,18 @@ discard block |
||
882 | 882 | $stmt = $query->execute(); |
883 | 883 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
884 | 884 | |
885 | - if(!$row) return null; |
|
885 | + if (!$row) return null; |
|
886 | 886 | |
887 | 887 | return [ |
888 | 888 | 'id' => $row['id'], |
889 | 889 | 'uri' => $row['uri'], |
890 | 890 | 'lastmodified' => $row['lastmodified'], |
891 | - 'etag' => '"' . $row['etag'] . '"', |
|
891 | + 'etag' => '"'.$row['etag'].'"', |
|
892 | 892 | 'calendarid' => $row['calendarid'], |
893 | - 'size' => (int)$row['size'], |
|
893 | + 'size' => (int) $row['size'], |
|
894 | 894 | 'calendardata' => $this->readBlob($row['calendardata']), |
895 | 895 | 'component' => strtolower($row['componenttype']), |
896 | - 'classification'=> (int)$row['classification'] |
|
896 | + 'classification'=> (int) $row['classification'] |
|
897 | 897 | ]; |
898 | 898 | } |
899 | 899 | |
@@ -932,12 +932,12 @@ discard block |
||
932 | 932 | 'id' => $row['id'], |
933 | 933 | 'uri' => $row['uri'], |
934 | 934 | 'lastmodified' => $row['lastmodified'], |
935 | - 'etag' => '"' . $row['etag'] . '"', |
|
935 | + 'etag' => '"'.$row['etag'].'"', |
|
936 | 936 | 'calendarid' => $row['calendarid'], |
937 | - 'size' => (int)$row['size'], |
|
937 | + 'size' => (int) $row['size'], |
|
938 | 938 | 'calendardata' => $this->readBlob($row['calendardata']), |
939 | 939 | 'component' => strtolower($row['componenttype']), |
940 | - 'classification' => (int)$row['classification'] |
|
940 | + 'classification' => (int) $row['classification'] |
|
941 | 941 | ]; |
942 | 942 | } |
943 | 943 | $result->closeCursor(); |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | )); |
997 | 997 | $this->addChange($calendarId, $objectUri, 1); |
998 | 998 | |
999 | - return '"' . $extraData['etag'] . '"'; |
|
999 | + return '"'.$extraData['etag'].'"'; |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | /** |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | } |
1052 | 1052 | $this->addChange($calendarId, $objectUri, 2); |
1053 | 1053 | |
1054 | - return '"' . $extraData['etag'] . '"'; |
|
1054 | + return '"'.$extraData['etag'].'"'; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | /** |
@@ -1204,13 +1204,13 @@ discard block |
||
1204 | 1204 | $stmt = $query->execute(); |
1205 | 1205 | |
1206 | 1206 | $result = []; |
1207 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1207 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1208 | 1208 | if ($requirePostFilter) { |
1209 | 1209 | // validateFilterForObject will parse the calendar data |
1210 | 1210 | // catch parsing errors |
1211 | 1211 | try { |
1212 | 1212 | $matches = $this->validateFilterForObject($row, $filters); |
1213 | - } catch(ParseException $ex) { |
|
1213 | + } catch (ParseException $ex) { |
|
1214 | 1214 | $this->logger->logException($ex, [ |
1215 | 1215 | 'app' => 'dav', |
1216 | 1216 | 'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'] |
@@ -1243,14 +1243,14 @@ discard block |
||
1243 | 1243 | * @param integer|null $offset |
1244 | 1244 | * @return array |
1245 | 1245 | */ |
1246 | - public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) { |
|
1246 | + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
|
1247 | 1247 | $calendars = $this->getCalendarsForUser($principalUri); |
1248 | 1248 | $ownCalendars = []; |
1249 | 1249 | $sharedCalendars = []; |
1250 | 1250 | |
1251 | 1251 | $uriMapper = []; |
1252 | 1252 | |
1253 | - foreach($calendars as $calendar) { |
|
1253 | + foreach ($calendars as $calendar) { |
|
1254 | 1254 | if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { |
1255 | 1255 | $ownCalendars[] = $calendar['id']; |
1256 | 1256 | } else { |
@@ -1265,11 +1265,11 @@ discard block |
||
1265 | 1265 | $query = $this->db->getQueryBuilder(); |
1266 | 1266 | // Calendar id expressions |
1267 | 1267 | $calendarExpressions = []; |
1268 | - foreach($ownCalendars as $id) { |
|
1268 | + foreach ($ownCalendars as $id) { |
|
1269 | 1269 | $calendarExpressions[] = $query->expr() |
1270 | 1270 | ->eq('c.calendarid', $query->createNamedParameter($id)); |
1271 | 1271 | } |
1272 | - foreach($sharedCalendars as $id) { |
|
1272 | + foreach ($sharedCalendars as $id) { |
|
1273 | 1273 | $calendarExpressions[] = $query->expr()->andX( |
1274 | 1274 | $query->expr()->eq('c.calendarid', |
1275 | 1275 | $query->createNamedParameter($id)), |
@@ -1286,7 +1286,7 @@ discard block |
||
1286 | 1286 | |
1287 | 1287 | // Component expressions |
1288 | 1288 | $compExpressions = []; |
1289 | - foreach($filters['comps'] as $comp) { |
|
1289 | + foreach ($filters['comps'] as $comp) { |
|
1290 | 1290 | $compExpressions[] = $query->expr() |
1291 | 1291 | ->eq('c.componenttype', $query->createNamedParameter($comp)); |
1292 | 1292 | } |
@@ -1305,13 +1305,13 @@ discard block |
||
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | $propParamExpressions = []; |
1308 | - foreach($filters['props'] as $prop) { |
|
1308 | + foreach ($filters['props'] as $prop) { |
|
1309 | 1309 | $propParamExpressions[] = $query->expr()->andX( |
1310 | 1310 | $query->expr()->eq('i.name', $query->createNamedParameter($prop)), |
1311 | 1311 | $query->expr()->isNull('i.parameter') |
1312 | 1312 | ); |
1313 | 1313 | } |
1314 | - foreach($filters['params'] as $param) { |
|
1314 | + foreach ($filters['params'] as $param) { |
|
1315 | 1315 | $propParamExpressions[] = $query->expr()->andX( |
1316 | 1316 | $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), |
1317 | 1317 | $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) |
@@ -1343,8 +1343,8 @@ discard block |
||
1343 | 1343 | $stmt = $query->execute(); |
1344 | 1344 | |
1345 | 1345 | $result = []; |
1346 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1347 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
1346 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1347 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
1348 | 1348 | if (!in_array($path, $result)) { |
1349 | 1349 | $result[] = $path; |
1350 | 1350 | } |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | $stmt = $query->execute(); |
1385 | 1385 | |
1386 | 1386 | if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
1387 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
1387 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | return null; |
@@ -1449,7 +1449,7 @@ discard block |
||
1449 | 1449 | function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) { |
1450 | 1450 | // Current synctoken |
1451 | 1451 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); |
1452 | - $stmt->execute([ $calendarId ]); |
|
1452 | + $stmt->execute([$calendarId]); |
|
1453 | 1453 | $currentToken = $stmt->fetchColumn(0); |
1454 | 1454 | |
1455 | 1455 | if (is_null($currentToken)) { |
@@ -1466,8 +1466,8 @@ discard block |
||
1466 | 1466 | if ($syncToken) { |
1467 | 1467 | |
1468 | 1468 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`"; |
1469 | - if ($limit>0) { |
|
1470 | - $query.= " LIMIT " . (int)$limit; |
|
1469 | + if ($limit > 0) { |
|
1470 | + $query .= " LIMIT ".(int) $limit; |
|
1471 | 1471 | } |
1472 | 1472 | |
1473 | 1473 | // Fetching all changes |
@@ -1478,15 +1478,15 @@ discard block |
||
1478 | 1478 | |
1479 | 1479 | // This loop ensures that any duplicates are overwritten, only the |
1480 | 1480 | // last change on a node is relevant. |
1481 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1481 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1482 | 1482 | |
1483 | 1483 | $changes[$row['uri']] = $row['operation']; |
1484 | 1484 | |
1485 | 1485 | } |
1486 | 1486 | |
1487 | - foreach($changes as $uri => $operation) { |
|
1487 | + foreach ($changes as $uri => $operation) { |
|
1488 | 1488 | |
1489 | - switch($operation) { |
|
1489 | + switch ($operation) { |
|
1490 | 1490 | case 1 : |
1491 | 1491 | $result['added'][] = $uri; |
1492 | 1492 | break; |
@@ -1556,10 +1556,10 @@ discard block |
||
1556 | 1556 | ->from('calendarsubscriptions') |
1557 | 1557 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
1558 | 1558 | ->orderBy('calendarorder', 'asc'); |
1559 | - $stmt =$query->execute(); |
|
1559 | + $stmt = $query->execute(); |
|
1560 | 1560 | |
1561 | 1561 | $subscriptions = []; |
1562 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1562 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1563 | 1563 | |
1564 | 1564 | $subscription = [ |
1565 | 1565 | 'id' => $row['id'], |
@@ -1568,10 +1568,10 @@ discard block |
||
1568 | 1568 | 'source' => $row['source'], |
1569 | 1569 | 'lastmodified' => $row['lastmodified'], |
1570 | 1570 | |
1571 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
1571 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
1572 | 1572 | ]; |
1573 | 1573 | |
1574 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1574 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1575 | 1575 | if (!is_null($row[$dbName])) { |
1576 | 1576 | $subscription[$xmlName] = $row[$dbName]; |
1577 | 1577 | } |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | |
1611 | 1611 | $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; |
1612 | 1612 | |
1613 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1613 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1614 | 1614 | if (array_key_exists($xmlName, $properties)) { |
1615 | 1615 | $values[$dbName] = $properties[$xmlName]; |
1616 | 1616 | if (in_array($dbName, $propertiesBoolean)) { |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | |
1662 | 1662 | $newValues = []; |
1663 | 1663 | |
1664 | - foreach($mutations as $propertyName=>$propertyValue) { |
|
1664 | + foreach ($mutations as $propertyName=>$propertyValue) { |
|
1665 | 1665 | if ($propertyName === '{http://calendarserver.org/ns/}source') { |
1666 | 1666 | $newValues['source'] = $propertyValue->getHref(); |
1667 | 1667 | } else { |
@@ -1673,7 +1673,7 @@ discard block |
||
1673 | 1673 | $query = $this->db->getQueryBuilder(); |
1674 | 1674 | $query->update('calendarsubscriptions') |
1675 | 1675 | ->set('lastmodified', $query->createNamedParameter(time())); |
1676 | - foreach($newValues as $fieldName=>$value) { |
|
1676 | + foreach ($newValues as $fieldName=>$value) { |
|
1677 | 1677 | $query->set($fieldName, $query->createNamedParameter($value)); |
1678 | 1678 | } |
1679 | 1679 | $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
@@ -1723,7 +1723,7 @@ discard block |
||
1723 | 1723 | |
1724 | 1724 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
1725 | 1725 | |
1726 | - if(!$row) { |
|
1726 | + if (!$row) { |
|
1727 | 1727 | return null; |
1728 | 1728 | } |
1729 | 1729 | |
@@ -1731,8 +1731,8 @@ discard block |
||
1731 | 1731 | 'uri' => $row['uri'], |
1732 | 1732 | 'calendardata' => $row['calendardata'], |
1733 | 1733 | 'lastmodified' => $row['lastmodified'], |
1734 | - 'etag' => '"' . $row['etag'] . '"', |
|
1735 | - 'size' => (int)$row['size'], |
|
1734 | + 'etag' => '"'.$row['etag'].'"', |
|
1735 | + 'size' => (int) $row['size'], |
|
1736 | 1736 | ]; |
1737 | 1737 | } |
1738 | 1738 | |
@@ -1755,13 +1755,13 @@ discard block |
||
1755 | 1755 | ->execute(); |
1756 | 1756 | |
1757 | 1757 | $result = []; |
1758 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
1758 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
1759 | 1759 | $result[] = [ |
1760 | 1760 | 'calendardata' => $row['calendardata'], |
1761 | 1761 | 'uri' => $row['uri'], |
1762 | 1762 | 'lastmodified' => $row['lastmodified'], |
1763 | - 'etag' => '"' . $row['etag'] . '"', |
|
1764 | - 'size' => (int)$row['size'], |
|
1763 | + 'etag' => '"'.$row['etag'].'"', |
|
1764 | + 'size' => (int) $row['size'], |
|
1765 | 1765 | ]; |
1766 | 1766 | } |
1767 | 1767 | |
@@ -1853,10 +1853,10 @@ discard block |
||
1853 | 1853 | $lastOccurrence = null; |
1854 | 1854 | $uid = null; |
1855 | 1855 | $classification = self::CLASSIFICATION_PUBLIC; |
1856 | - foreach($vObject->getComponents() as $component) { |
|
1857 | - if ($component->name!=='VTIMEZONE') { |
|
1856 | + foreach ($vObject->getComponents() as $component) { |
|
1857 | + if ($component->name !== 'VTIMEZONE') { |
|
1858 | 1858 | $componentType = $component->name; |
1859 | - $uid = (string)$component->UID; |
|
1859 | + $uid = (string) $component->UID; |
|
1860 | 1860 | break; |
1861 | 1861 | } |
1862 | 1862 | } |
@@ -1881,13 +1881,13 @@ discard block |
||
1881 | 1881 | $lastOccurrence = $firstOccurrence; |
1882 | 1882 | } |
1883 | 1883 | } else { |
1884 | - $it = new EventIterator($vObject, (string)$component->UID); |
|
1884 | + $it = new EventIterator($vObject, (string) $component->UID); |
|
1885 | 1885 | $maxDate = new \DateTime(self::MAX_DATE); |
1886 | 1886 | if ($it->isInfinite()) { |
1887 | 1887 | $lastOccurrence = $maxDate->getTimestamp(); |
1888 | 1888 | } else { |
1889 | 1889 | $end = $it->getDtEnd(); |
1890 | - while($it->valid() && $end < $maxDate) { |
|
1890 | + while ($it->valid() && $end < $maxDate) { |
|
1891 | 1891 | $end = $it->getDtEnd(); |
1892 | 1892 | $it->next(); |
1893 | 1893 | |
@@ -2127,10 +2127,10 @@ discard block |
||
2127 | 2127 | $result->closeCursor(); |
2128 | 2128 | |
2129 | 2129 | if (!isset($objectIds['id'])) { |
2130 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
2130 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
2131 | 2131 | } |
2132 | 2132 | |
2133 | - return (int)$objectIds['id']; |
|
2133 | + return (int) $objectIds['id']; |
|
2134 | 2134 | } |
2135 | 2135 | |
2136 | 2136 | private function convertPrincipal($principalUri, $toV2) { |
@@ -2145,8 +2145,8 @@ discard block |
||
2145 | 2145 | } |
2146 | 2146 | |
2147 | 2147 | private function addOwnerPrincipal(&$calendarInfo) { |
2148 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
2149 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
2148 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
2149 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
2150 | 2150 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
2151 | 2151 | $uri = $calendarInfo[$ownerPrincipalKey]; |
2152 | 2152 | } else { |