@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); |
195 | 195 | } |
196 | 196 | |
197 | - return (int)$query->execute()->fetchColumn(); |
|
197 | + return (int) $query->execute()->fetchColumn(); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -241,25 +241,25 @@ discard block |
||
241 | 241 | $stmt = $query->execute(); |
242 | 242 | |
243 | 243 | $calendars = []; |
244 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
244 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
245 | 245 | |
246 | 246 | $components = []; |
247 | 247 | if ($row['components']) { |
248 | - $components = explode(',',$row['components']); |
|
248 | + $components = explode(',', $row['components']); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | $calendar = [ |
252 | 252 | 'id' => $row['id'], |
253 | 253 | 'uri' => $row['uri'], |
254 | 254 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
255 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
256 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
257 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
258 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
259 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
255 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
256 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
257 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
258 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
259 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
260 | 260 | ]; |
261 | 261 | |
262 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
262 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
263 | 263 | $calendar[$xmlName] = $row[$dbName]; |
264 | 264 | } |
265 | 265 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | // query for shared calendars |
274 | 274 | $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); |
275 | - $principals[]= $principalUri; |
|
275 | + $principals[] = $principalUri; |
|
276 | 276 | |
277 | 277 | $fields = array_values($this->propertyMap); |
278 | 278 | $fields[] = 'a.id'; |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) |
293 | 293 | ->execute(); |
294 | 294 | |
295 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
296 | - while($row = $result->fetch()) { |
|
295 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
296 | + while ($row = $result->fetch()) { |
|
297 | 297 | if ($row['principaluri'] === $principalUri) { |
298 | 298 | continue; |
299 | 299 | } |
@@ -312,25 +312,25 @@ discard block |
||
312 | 312 | } |
313 | 313 | |
314 | 314 | list(, $name) = URLUtil::splitPath($row['principaluri']); |
315 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
316 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
315 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
316 | + $row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
317 | 317 | $components = []; |
318 | 318 | if ($row['components']) { |
319 | - $components = explode(',',$row['components']); |
|
319 | + $components = explode(',', $row['components']); |
|
320 | 320 | } |
321 | 321 | $calendar = [ |
322 | 322 | 'id' => $row['id'], |
323 | 323 | 'uri' => $uri, |
324 | 324 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
325 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
326 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
327 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
328 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
329 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
325 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
326 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
327 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
328 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
329 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
330 | 330 | $readOnlyPropertyName => $readOnly, |
331 | 331 | ]; |
332 | 332 | |
333 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
333 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
334 | 334 | $calendar[$xmlName] = $row[$dbName]; |
335 | 335 | } |
336 | 336 | |
@@ -357,21 +357,21 @@ discard block |
||
357 | 357 | ->orderBy('calendarorder', 'ASC'); |
358 | 358 | $stmt = $query->execute(); |
359 | 359 | $calendars = []; |
360 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
360 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
361 | 361 | $components = []; |
362 | 362 | if ($row['components']) { |
363 | - $components = explode(',',$row['components']); |
|
363 | + $components = explode(',', $row['components']); |
|
364 | 364 | } |
365 | 365 | $calendar = [ |
366 | 366 | 'id' => $row['id'], |
367 | 367 | 'uri' => $row['uri'], |
368 | 368 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
369 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
370 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
371 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
372 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
369 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
370 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
371 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
372 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
373 | 373 | ]; |
374 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
374 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
375 | 375 | $calendar[$xmlName] = $row[$dbName]; |
376 | 376 | } |
377 | 377 | if (!isset($calendars[$calendar['id']])) { |
@@ -419,27 +419,27 @@ discard block |
||
419 | 419 | ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
420 | 420 | ->execute(); |
421 | 421 | |
422 | - while($row = $result->fetch()) { |
|
422 | + while ($row = $result->fetch()) { |
|
423 | 423 | list(, $name) = URLUtil::splitPath($row['principaluri']); |
424 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
424 | + $row['displayname'] = $row['displayname']."($name)"; |
|
425 | 425 | $components = []; |
426 | 426 | if ($row['components']) { |
427 | - $components = explode(',',$row['components']); |
|
427 | + $components = explode(',', $row['components']); |
|
428 | 428 | } |
429 | 429 | $calendar = [ |
430 | 430 | 'id' => $row['id'], |
431 | 431 | 'uri' => $row['publicuri'], |
432 | 432 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
433 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
434 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
435 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
436 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
437 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
438 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
439 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
433 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
434 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
435 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
436 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
437 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
438 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
439 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
440 | 440 | ]; |
441 | 441 | |
442 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
442 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
443 | 443 | $calendar[$xmlName] = $row[$dbName]; |
444 | 444 | } |
445 | 445 | |
@@ -481,29 +481,29 @@ discard block |
||
481 | 481 | $result->closeCursor(); |
482 | 482 | |
483 | 483 | if ($row === false) { |
484 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
484 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | list(, $name) = URLUtil::splitPath($row['principaluri']); |
488 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
488 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
489 | 489 | $components = []; |
490 | 490 | if ($row['components']) { |
491 | - $components = explode(',',$row['components']); |
|
491 | + $components = explode(',', $row['components']); |
|
492 | 492 | } |
493 | 493 | $calendar = [ |
494 | 494 | 'id' => $row['id'], |
495 | 495 | 'uri' => $row['publicuri'], |
496 | 496 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
497 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
498 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
499 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
500 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
501 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
502 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
503 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
497 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
498 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
499 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
500 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
501 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
502 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
503 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
504 | 504 | ]; |
505 | 505 | |
506 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
506 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
507 | 507 | $calendar[$xmlName] = $row[$dbName]; |
508 | 508 | } |
509 | 509 | |
@@ -541,20 +541,20 @@ discard block |
||
541 | 541 | |
542 | 542 | $components = []; |
543 | 543 | if ($row['components']) { |
544 | - $components = explode(',',$row['components']); |
|
544 | + $components = explode(',', $row['components']); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | $calendar = [ |
548 | 548 | 'id' => $row['id'], |
549 | 549 | 'uri' => $row['uri'], |
550 | 550 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
551 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
552 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
553 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
554 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
551 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
552 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
553 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
554 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
555 | 555 | ]; |
556 | 556 | |
557 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
557 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
558 | 558 | $calendar[$xmlName] = $row[$dbName]; |
559 | 559 | } |
560 | 560 | |
@@ -585,20 +585,20 @@ discard block |
||
585 | 585 | |
586 | 586 | $components = []; |
587 | 587 | if ($row['components']) { |
588 | - $components = explode(',',$row['components']); |
|
588 | + $components = explode(',', $row['components']); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | $calendar = [ |
592 | 592 | 'id' => $row['id'], |
593 | 593 | 'uri' => $row['uri'], |
594 | 594 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
595 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
596 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
597 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
598 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
595 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
596 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
597 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
598 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
599 | 599 | ]; |
600 | 600 | |
601 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
601 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
602 | 602 | $calendar[$xmlName] = $row[$dbName]; |
603 | 603 | } |
604 | 604 | |
@@ -630,16 +630,16 @@ discard block |
||
630 | 630 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
631 | 631 | if (isset($properties[$sccs])) { |
632 | 632 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
633 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
633 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
634 | 634 | } |
635 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
635 | + $values['components'] = implode(',', $properties[$sccs]->getValue()); |
|
636 | 636 | } |
637 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
637 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
638 | 638 | if (isset($properties[$transp])) { |
639 | 639 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
640 | 640 | } |
641 | 641 | |
642 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
642 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
643 | 643 | if (isset($properties[$xmlName])) { |
644 | 644 | $values[$dbName] = $properties[$xmlName]; |
645 | 645 | } |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | |
648 | 648 | $query = $this->db->getQueryBuilder(); |
649 | 649 | $query->insert('calendars'); |
650 | - foreach($values as $column => $value) { |
|
650 | + foreach ($values as $column => $value) { |
|
651 | 651 | $query->setValue($column, $query->createNamedParameter($value)); |
652 | 652 | } |
653 | 653 | $query->execute(); |
@@ -680,14 +680,14 @@ discard block |
||
680 | 680 | */ |
681 | 681 | function updateCalendar($calendarId, PropPatch $propPatch) { |
682 | 682 | $supportedProperties = array_keys($this->propertyMap); |
683 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
683 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
684 | 684 | |
685 | 685 | $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { |
686 | 686 | $newValues = []; |
687 | 687 | foreach ($mutations as $propertyName => $propertyValue) { |
688 | 688 | |
689 | 689 | switch ($propertyName) { |
690 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' : |
|
690 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' : |
|
691 | 691 | $fieldName = 'transparent'; |
692 | 692 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
693 | 693 | break; |
@@ -802,16 +802,16 @@ discard block |
||
802 | 802 | $stmt = $query->execute(); |
803 | 803 | |
804 | 804 | $result = []; |
805 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
805 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
806 | 806 | $result[] = [ |
807 | 807 | 'id' => $row['id'], |
808 | 808 | 'uri' => $row['uri'], |
809 | 809 | 'lastmodified' => $row['lastmodified'], |
810 | - 'etag' => '"' . $row['etag'] . '"', |
|
810 | + 'etag' => '"'.$row['etag'].'"', |
|
811 | 811 | 'calendarid' => $row['calendarid'], |
812 | - 'size' => (int)$row['size'], |
|
812 | + 'size' => (int) $row['size'], |
|
813 | 813 | 'component' => strtolower($row['componenttype']), |
814 | - 'classification'=> (int)$row['classification'] |
|
814 | + 'classification'=> (int) $row['classification'] |
|
815 | 815 | ]; |
816 | 816 | } |
817 | 817 | |
@@ -844,18 +844,18 @@ discard block |
||
844 | 844 | $stmt = $query->execute(); |
845 | 845 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
846 | 846 | |
847 | - if(!$row) return null; |
|
847 | + if (!$row) return null; |
|
848 | 848 | |
849 | 849 | return [ |
850 | 850 | 'id' => $row['id'], |
851 | 851 | 'uri' => $row['uri'], |
852 | 852 | 'lastmodified' => $row['lastmodified'], |
853 | - 'etag' => '"' . $row['etag'] . '"', |
|
853 | + 'etag' => '"'.$row['etag'].'"', |
|
854 | 854 | 'calendarid' => $row['calendarid'], |
855 | - 'size' => (int)$row['size'], |
|
855 | + 'size' => (int) $row['size'], |
|
856 | 856 | 'calendardata' => $this->readBlob($row['calendardata']), |
857 | 857 | 'component' => strtolower($row['componenttype']), |
858 | - 'classification'=> (int)$row['classification'] |
|
858 | + 'classification'=> (int) $row['classification'] |
|
859 | 859 | ]; |
860 | 860 | } |
861 | 861 | |
@@ -894,12 +894,12 @@ discard block |
||
894 | 894 | 'id' => $row['id'], |
895 | 895 | 'uri' => $row['uri'], |
896 | 896 | 'lastmodified' => $row['lastmodified'], |
897 | - 'etag' => '"' . $row['etag'] . '"', |
|
897 | + 'etag' => '"'.$row['etag'].'"', |
|
898 | 898 | 'calendarid' => $row['calendarid'], |
899 | - 'size' => (int)$row['size'], |
|
899 | + 'size' => (int) $row['size'], |
|
900 | 900 | 'calendardata' => $this->readBlob($row['calendardata']), |
901 | 901 | 'component' => strtolower($row['componenttype']), |
902 | - 'classification' => (int)$row['classification'] |
|
902 | + 'classification' => (int) $row['classification'] |
|
903 | 903 | ]; |
904 | 904 | } |
905 | 905 | $result->closeCursor(); |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | )); |
959 | 959 | $this->addChange($calendarId, $objectUri, 1); |
960 | 960 | |
961 | - return '"' . $extraData['etag'] . '"'; |
|
961 | + return '"'.$extraData['etag'].'"'; |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | /** |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | } |
1014 | 1014 | $this->addChange($calendarId, $objectUri, 2); |
1015 | 1015 | |
1016 | - return '"' . $extraData['etag'] . '"'; |
|
1016 | + return '"'.$extraData['etag'].'"'; |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | /** |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | $stmt = $query->execute(); |
1167 | 1167 | |
1168 | 1168 | $result = []; |
1169 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1169 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1170 | 1170 | if ($requirePostFilter) { |
1171 | 1171 | if (!$this->validateFilterForObject($row, $filters)) { |
1172 | 1172 | continue; |
@@ -1187,14 +1187,14 @@ discard block |
||
1187 | 1187 | * @param integer|null $offset |
1188 | 1188 | * @return array |
1189 | 1189 | */ |
1190 | - public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) { |
|
1190 | + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
|
1191 | 1191 | $calendars = $this->getCalendarsForUser($principalUri); |
1192 | 1192 | $ownCalendars = []; |
1193 | 1193 | $sharedCalendars = []; |
1194 | 1194 | |
1195 | 1195 | $uriMapper = []; |
1196 | 1196 | |
1197 | - foreach($calendars as $calendar) { |
|
1197 | + foreach ($calendars as $calendar) { |
|
1198 | 1198 | if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { |
1199 | 1199 | $ownCalendars[] = $calendar['id']; |
1200 | 1200 | } else { |
@@ -1209,11 +1209,11 @@ discard block |
||
1209 | 1209 | $query = $this->db->getQueryBuilder(); |
1210 | 1210 | // Calendar id expressions |
1211 | 1211 | $calendarExpressions = []; |
1212 | - foreach($ownCalendars as $id) { |
|
1212 | + foreach ($ownCalendars as $id) { |
|
1213 | 1213 | $calendarExpressions[] = $query->expr() |
1214 | 1214 | ->eq('c.calendarid', $query->createNamedParameter($id)); |
1215 | 1215 | } |
1216 | - foreach($sharedCalendars as $id) { |
|
1216 | + foreach ($sharedCalendars as $id) { |
|
1217 | 1217 | $calendarExpressions[] = $query->expr()->andX( |
1218 | 1218 | $query->expr()->eq('c.calendarid', |
1219 | 1219 | $query->createNamedParameter($id)), |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | |
1231 | 1231 | // Component expressions |
1232 | 1232 | $compExpressions = []; |
1233 | - foreach($filters['comps'] as $comp) { |
|
1233 | + foreach ($filters['comps'] as $comp) { |
|
1234 | 1234 | $compExpressions[] = $query->expr() |
1235 | 1235 | ->eq('c.componenttype', $query->createNamedParameter($comp)); |
1236 | 1236 | } |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | $propExpressions = []; |
1245 | - foreach($filters['props'] as $prop) { |
|
1245 | + foreach ($filters['props'] as $prop) { |
|
1246 | 1246 | $propExpressions[] = $query->expr()->andX( |
1247 | 1247 | $query->expr()->eq('i.name', $query->createNamedParameter($prop)), |
1248 | 1248 | $query->expr()->isNull('i.parameter') |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | } |
1257 | 1257 | |
1258 | 1258 | $paramExpressions = []; |
1259 | - foreach($filters['params'] as $param) { |
|
1259 | + foreach ($filters['params'] as $param) { |
|
1260 | 1260 | $paramExpressions[] = $query->expr()->andX( |
1261 | 1261 | $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), |
1262 | 1262 | $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) |
@@ -1284,8 +1284,8 @@ discard block |
||
1284 | 1284 | $stmt = $query->execute(); |
1285 | 1285 | |
1286 | 1286 | $result = []; |
1287 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1288 | - $result[] = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
1287 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1288 | + $result[] = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
1289 | 1289 | } |
1290 | 1290 | |
1291 | 1291 | return $result; |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | $stmt = $query->execute(); |
1343 | 1343 | |
1344 | 1344 | if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
1345 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
1345 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | return null; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) { |
1408 | 1408 | // Current synctoken |
1409 | 1409 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); |
1410 | - $stmt->execute([ $calendarId ]); |
|
1410 | + $stmt->execute([$calendarId]); |
|
1411 | 1411 | $currentToken = $stmt->fetchColumn(0); |
1412 | 1412 | |
1413 | 1413 | if (is_null($currentToken)) { |
@@ -1424,8 +1424,8 @@ discard block |
||
1424 | 1424 | if ($syncToken) { |
1425 | 1425 | |
1426 | 1426 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`"; |
1427 | - if ($limit>0) { |
|
1428 | - $query.= " `LIMIT` " . (int)$limit; |
|
1427 | + if ($limit > 0) { |
|
1428 | + $query .= " `LIMIT` ".(int) $limit; |
|
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | // Fetching all changes |
@@ -1436,15 +1436,15 @@ discard block |
||
1436 | 1436 | |
1437 | 1437 | // This loop ensures that any duplicates are overwritten, only the |
1438 | 1438 | // last change on a node is relevant. |
1439 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1439 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1440 | 1440 | |
1441 | 1441 | $changes[$row['uri']] = $row['operation']; |
1442 | 1442 | |
1443 | 1443 | } |
1444 | 1444 | |
1445 | - foreach($changes as $uri => $operation) { |
|
1445 | + foreach ($changes as $uri => $operation) { |
|
1446 | 1446 | |
1447 | - switch($operation) { |
|
1447 | + switch ($operation) { |
|
1448 | 1448 | case 1 : |
1449 | 1449 | $result['added'][] = $uri; |
1450 | 1450 | break; |
@@ -1514,10 +1514,10 @@ discard block |
||
1514 | 1514 | ->from('calendarsubscriptions') |
1515 | 1515 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
1516 | 1516 | ->orderBy('calendarorder', 'asc'); |
1517 | - $stmt =$query->execute(); |
|
1517 | + $stmt = $query->execute(); |
|
1518 | 1518 | |
1519 | 1519 | $subscriptions = []; |
1520 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1520 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1521 | 1521 | |
1522 | 1522 | $subscription = [ |
1523 | 1523 | 'id' => $row['id'], |
@@ -1526,10 +1526,10 @@ discard block |
||
1526 | 1526 | 'source' => $row['source'], |
1527 | 1527 | 'lastmodified' => $row['lastmodified'], |
1528 | 1528 | |
1529 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
1529 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
1530 | 1530 | ]; |
1531 | 1531 | |
1532 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1532 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1533 | 1533 | if (!is_null($row[$dbName])) { |
1534 | 1534 | $subscription[$xmlName] = $row[$dbName]; |
1535 | 1535 | } |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | |
1569 | 1569 | $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; |
1570 | 1570 | |
1571 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1571 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1572 | 1572 | if (array_key_exists($xmlName, $properties)) { |
1573 | 1573 | $values[$dbName] = $properties[$xmlName]; |
1574 | 1574 | if (in_array($dbName, $propertiesBoolean)) { |
@@ -1616,7 +1616,7 @@ discard block |
||
1616 | 1616 | |
1617 | 1617 | $newValues = []; |
1618 | 1618 | |
1619 | - foreach($mutations as $propertyName=>$propertyValue) { |
|
1619 | + foreach ($mutations as $propertyName=>$propertyValue) { |
|
1620 | 1620 | if ($propertyName === '{http://calendarserver.org/ns/}source') { |
1621 | 1621 | $newValues['source'] = $propertyValue->getHref(); |
1622 | 1622 | } else { |
@@ -1628,7 +1628,7 @@ discard block |
||
1628 | 1628 | $query = $this->db->getQueryBuilder(); |
1629 | 1629 | $query->update('calendarsubscriptions') |
1630 | 1630 | ->set('lastmodified', $query->createNamedParameter(time())); |
1631 | - foreach($newValues as $fieldName=>$value) { |
|
1631 | + foreach ($newValues as $fieldName=>$value) { |
|
1632 | 1632 | $query->set($fieldName, $query->createNamedParameter($value)); |
1633 | 1633 | } |
1634 | 1634 | $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
@@ -1678,7 +1678,7 @@ discard block |
||
1678 | 1678 | |
1679 | 1679 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
1680 | 1680 | |
1681 | - if(!$row) { |
|
1681 | + if (!$row) { |
|
1682 | 1682 | return null; |
1683 | 1683 | } |
1684 | 1684 | |
@@ -1686,8 +1686,8 @@ discard block |
||
1686 | 1686 | 'uri' => $row['uri'], |
1687 | 1687 | 'calendardata' => $row['calendardata'], |
1688 | 1688 | 'lastmodified' => $row['lastmodified'], |
1689 | - 'etag' => '"' . $row['etag'] . '"', |
|
1690 | - 'size' => (int)$row['size'], |
|
1689 | + 'etag' => '"'.$row['etag'].'"', |
|
1690 | + 'size' => (int) $row['size'], |
|
1691 | 1691 | ]; |
1692 | 1692 | } |
1693 | 1693 | |
@@ -1710,13 +1710,13 @@ discard block |
||
1710 | 1710 | ->execute(); |
1711 | 1711 | |
1712 | 1712 | $result = []; |
1713 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
1713 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
1714 | 1714 | $result[] = [ |
1715 | 1715 | 'calendardata' => $row['calendardata'], |
1716 | 1716 | 'uri' => $row['uri'], |
1717 | 1717 | 'lastmodified' => $row['lastmodified'], |
1718 | - 'etag' => '"' . $row['etag'] . '"', |
|
1719 | - 'size' => (int)$row['size'], |
|
1718 | + 'etag' => '"'.$row['etag'].'"', |
|
1719 | + 'size' => (int) $row['size'], |
|
1720 | 1720 | ]; |
1721 | 1721 | } |
1722 | 1722 | |
@@ -1808,10 +1808,10 @@ discard block |
||
1808 | 1808 | $lastOccurrence = null; |
1809 | 1809 | $uid = null; |
1810 | 1810 | $classification = self::CLASSIFICATION_PUBLIC; |
1811 | - foreach($vObject->getComponents() as $component) { |
|
1812 | - if ($component->name!=='VTIMEZONE') { |
|
1811 | + foreach ($vObject->getComponents() as $component) { |
|
1812 | + if ($component->name !== 'VTIMEZONE') { |
|
1813 | 1813 | $componentType = $component->name; |
1814 | - $uid = (string)$component->UID; |
|
1814 | + $uid = (string) $component->UID; |
|
1815 | 1815 | break; |
1816 | 1816 | } |
1817 | 1817 | } |
@@ -1836,13 +1836,13 @@ discard block |
||
1836 | 1836 | $lastOccurrence = $firstOccurrence; |
1837 | 1837 | } |
1838 | 1838 | } else { |
1839 | - $it = new EventIterator($vObject, (string)$component->UID); |
|
1839 | + $it = new EventIterator($vObject, (string) $component->UID); |
|
1840 | 1840 | $maxDate = new \DateTime(self::MAX_DATE); |
1841 | 1841 | if ($it->isInfinite()) { |
1842 | 1842 | $lastOccurrence = $maxDate->getTimestamp(); |
1843 | 1843 | } else { |
1844 | 1844 | $end = $it->getDtEnd(); |
1845 | - while($it->valid() && $end < $maxDate) { |
|
1845 | + while ($it->valid() && $end < $maxDate) { |
|
1846 | 1846 | $end = $it->getDtEnd(); |
1847 | 1847 | $it->next(); |
1848 | 1848 | |
@@ -2081,10 +2081,10 @@ discard block |
||
2081 | 2081 | $result->closeCursor(); |
2082 | 2082 | |
2083 | 2083 | if (!isset($objectIds['id'])) { |
2084 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
2084 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
2085 | 2085 | } |
2086 | 2086 | |
2087 | - return (int)$objectIds['id']; |
|
2087 | + return (int) $objectIds['id']; |
|
2088 | 2088 | } |
2089 | 2089 | |
2090 | 2090 | private function convertPrincipal($principalUri, $toV2) { |