@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); |
197 | 197 | } |
198 | 198 | |
199 | - return (int)$query->execute()->fetchColumn(); |
|
199 | + return (int) $query->execute()->fetchColumn(); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -243,25 +243,25 @@ discard block |
||
243 | 243 | $stmt = $query->execute(); |
244 | 244 | |
245 | 245 | $calendars = []; |
246 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
246 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
247 | 247 | |
248 | 248 | $components = []; |
249 | 249 | if ($row['components']) { |
250 | - $components = explode(',',$row['components']); |
|
250 | + $components = explode(',', $row['components']); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | $calendar = [ |
254 | 254 | 'id' => $row['id'], |
255 | 255 | 'uri' => $row['uri'], |
256 | 256 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
257 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
258 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
259 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
260 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
261 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
257 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
258 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
259 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
260 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
261 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
262 | 262 | ]; |
263 | 263 | |
264 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
264 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
265 | 265 | $calendar[$xmlName] = $row[$dbName]; |
266 | 266 | } |
267 | 267 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $principals = array_map(function($principal) { |
280 | 280 | return urldecode($principal); |
281 | 281 | }, $principals); |
282 | - $principals[]= $principalUri; |
|
282 | + $principals[] = $principalUri; |
|
283 | 283 | |
284 | 284 | $fields = array_values($this->propertyMap); |
285 | 285 | $fields[] = 'a.id'; |
@@ -299,8 +299,8 @@ discard block |
||
299 | 299 | ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) |
300 | 300 | ->execute(); |
301 | 301 | |
302 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
303 | - while($row = $result->fetch()) { |
|
302 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
303 | + while ($row = $result->fetch()) { |
|
304 | 304 | if ($row['principaluri'] === $principalUri) { |
305 | 305 | continue; |
306 | 306 | } |
@@ -319,25 +319,25 @@ discard block |
||
319 | 319 | } |
320 | 320 | |
321 | 321 | list(, $name) = URLUtil::splitPath($row['principaluri']); |
322 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
323 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
322 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
323 | + $row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
324 | 324 | $components = []; |
325 | 325 | if ($row['components']) { |
326 | - $components = explode(',',$row['components']); |
|
326 | + $components = explode(',', $row['components']); |
|
327 | 327 | } |
328 | 328 | $calendar = [ |
329 | 329 | 'id' => $row['id'], |
330 | 330 | 'uri' => $uri, |
331 | 331 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
332 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
333 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
334 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
335 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
336 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
332 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
333 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
334 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
335 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
336 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
337 | 337 | $readOnlyPropertyName => $readOnly, |
338 | 338 | ]; |
339 | 339 | |
340 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
340 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
341 | 341 | $calendar[$xmlName] = $row[$dbName]; |
342 | 342 | } |
343 | 343 | |
@@ -366,21 +366,21 @@ discard block |
||
366 | 366 | ->orderBy('calendarorder', 'ASC'); |
367 | 367 | $stmt = $query->execute(); |
368 | 368 | $calendars = []; |
369 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
369 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
370 | 370 | $components = []; |
371 | 371 | if ($row['components']) { |
372 | - $components = explode(',',$row['components']); |
|
372 | + $components = explode(',', $row['components']); |
|
373 | 373 | } |
374 | 374 | $calendar = [ |
375 | 375 | 'id' => $row['id'], |
376 | 376 | 'uri' => $row['uri'], |
377 | 377 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
378 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
379 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
380 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
381 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
378 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
379 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
380 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
381 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
382 | 382 | ]; |
383 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
383 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
384 | 384 | $calendar[$xmlName] = $row[$dbName]; |
385 | 385 | } |
386 | 386 | |
@@ -431,27 +431,27 @@ discard block |
||
431 | 431 | ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
432 | 432 | ->execute(); |
433 | 433 | |
434 | - while($row = $result->fetch()) { |
|
434 | + while ($row = $result->fetch()) { |
|
435 | 435 | list(, $name) = URLUtil::splitPath($row['principaluri']); |
436 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
436 | + $row['displayname'] = $row['displayname']."($name)"; |
|
437 | 437 | $components = []; |
438 | 438 | if ($row['components']) { |
439 | - $components = explode(',',$row['components']); |
|
439 | + $components = explode(',', $row['components']); |
|
440 | 440 | } |
441 | 441 | $calendar = [ |
442 | 442 | 'id' => $row['id'], |
443 | 443 | 'uri' => $row['publicuri'], |
444 | 444 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
445 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
446 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
447 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
448 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
449 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
450 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
451 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
445 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
446 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
447 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
448 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
449 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
450 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
451 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
452 | 452 | ]; |
453 | 453 | |
454 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
454 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
455 | 455 | $calendar[$xmlName] = $row[$dbName]; |
456 | 456 | } |
457 | 457 | |
@@ -495,29 +495,29 @@ discard block |
||
495 | 495 | $result->closeCursor(); |
496 | 496 | |
497 | 497 | if ($row === false) { |
498 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
498 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | list(, $name) = URLUtil::splitPath($row['principaluri']); |
502 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
502 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
503 | 503 | $components = []; |
504 | 504 | if ($row['components']) { |
505 | - $components = explode(',',$row['components']); |
|
505 | + $components = explode(',', $row['components']); |
|
506 | 506 | } |
507 | 507 | $calendar = [ |
508 | 508 | 'id' => $row['id'], |
509 | 509 | 'uri' => $row['publicuri'], |
510 | 510 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
511 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
512 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
513 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
514 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
515 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
516 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
517 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
511 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
512 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
513 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
514 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
515 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
516 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
517 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
518 | 518 | ]; |
519 | 519 | |
520 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
520 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
521 | 521 | $calendar[$xmlName] = $row[$dbName]; |
522 | 522 | } |
523 | 523 | |
@@ -557,20 +557,20 @@ discard block |
||
557 | 557 | |
558 | 558 | $components = []; |
559 | 559 | if ($row['components']) { |
560 | - $components = explode(',',$row['components']); |
|
560 | + $components = explode(',', $row['components']); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | $calendar = [ |
564 | 564 | 'id' => $row['id'], |
565 | 565 | 'uri' => $row['uri'], |
566 | 566 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
567 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
568 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
569 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
570 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
567 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
568 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
569 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
570 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
571 | 571 | ]; |
572 | 572 | |
573 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
573 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
574 | 574 | $calendar[$xmlName] = $row[$dbName]; |
575 | 575 | } |
576 | 576 | |
@@ -603,20 +603,20 @@ discard block |
||
603 | 603 | |
604 | 604 | $components = []; |
605 | 605 | if ($row['components']) { |
606 | - $components = explode(',',$row['components']); |
|
606 | + $components = explode(',', $row['components']); |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | $calendar = [ |
610 | 610 | 'id' => $row['id'], |
611 | 611 | 'uri' => $row['uri'], |
612 | 612 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
613 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
614 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
615 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
616 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
613 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
614 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
615 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
616 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
617 | 617 | ]; |
618 | 618 | |
619 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
619 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
620 | 620 | $calendar[$xmlName] = $row[$dbName]; |
621 | 621 | } |
622 | 622 | |
@@ -651,16 +651,16 @@ discard block |
||
651 | 651 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
652 | 652 | if (isset($properties[$sccs])) { |
653 | 653 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
654 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
654 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
655 | 655 | } |
656 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
656 | + $values['components'] = implode(',', $properties[$sccs]->getValue()); |
|
657 | 657 | } |
658 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
658 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
659 | 659 | if (isset($properties[$transp])) { |
660 | 660 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
661 | 661 | } |
662 | 662 | |
663 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
663 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
664 | 664 | if (isset($properties[$xmlName])) { |
665 | 665 | $values[$dbName] = $properties[$xmlName]; |
666 | 666 | } |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | |
669 | 669 | $query = $this->db->getQueryBuilder(); |
670 | 670 | $query->insert('calendars'); |
671 | - foreach($values as $column => $value) { |
|
671 | + foreach ($values as $column => $value) { |
|
672 | 672 | $query->setValue($column, $query->createNamedParameter($value)); |
673 | 673 | } |
674 | 674 | $query->execute(); |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | */ |
703 | 703 | function updateCalendar($calendarId, PropPatch $propPatch) { |
704 | 704 | $supportedProperties = array_keys($this->propertyMap); |
705 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
705 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
706 | 706 | |
707 | 707 | /** |
708 | 708 | * @suppress SqlInjectionChecker |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | foreach ($mutations as $propertyName => $propertyValue) { |
713 | 713 | |
714 | 714 | switch ($propertyName) { |
715 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' : |
|
715 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' : |
|
716 | 716 | $fieldName = 'transparent'; |
717 | 717 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
718 | 718 | break; |
@@ -827,16 +827,16 @@ discard block |
||
827 | 827 | $stmt = $query->execute(); |
828 | 828 | |
829 | 829 | $result = []; |
830 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
830 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
831 | 831 | $result[] = [ |
832 | 832 | 'id' => $row['id'], |
833 | 833 | 'uri' => $row['uri'], |
834 | 834 | 'lastmodified' => $row['lastmodified'], |
835 | - 'etag' => '"' . $row['etag'] . '"', |
|
835 | + 'etag' => '"'.$row['etag'].'"', |
|
836 | 836 | 'calendarid' => $row['calendarid'], |
837 | - 'size' => (int)$row['size'], |
|
837 | + 'size' => (int) $row['size'], |
|
838 | 838 | 'component' => strtolower($row['componenttype']), |
839 | - 'classification'=> (int)$row['classification'] |
|
839 | + 'classification'=> (int) $row['classification'] |
|
840 | 840 | ]; |
841 | 841 | } |
842 | 842 | |
@@ -869,18 +869,18 @@ discard block |
||
869 | 869 | $stmt = $query->execute(); |
870 | 870 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
871 | 871 | |
872 | - if(!$row) return null; |
|
872 | + if (!$row) return null; |
|
873 | 873 | |
874 | 874 | return [ |
875 | 875 | 'id' => $row['id'], |
876 | 876 | 'uri' => $row['uri'], |
877 | 877 | 'lastmodified' => $row['lastmodified'], |
878 | - 'etag' => '"' . $row['etag'] . '"', |
|
878 | + 'etag' => '"'.$row['etag'].'"', |
|
879 | 879 | 'calendarid' => $row['calendarid'], |
880 | - 'size' => (int)$row['size'], |
|
880 | + 'size' => (int) $row['size'], |
|
881 | 881 | 'calendardata' => $this->readBlob($row['calendardata']), |
882 | 882 | 'component' => strtolower($row['componenttype']), |
883 | - 'classification'=> (int)$row['classification'] |
|
883 | + 'classification'=> (int) $row['classification'] |
|
884 | 884 | ]; |
885 | 885 | } |
886 | 886 | |
@@ -919,12 +919,12 @@ discard block |
||
919 | 919 | 'id' => $row['id'], |
920 | 920 | 'uri' => $row['uri'], |
921 | 921 | 'lastmodified' => $row['lastmodified'], |
922 | - 'etag' => '"' . $row['etag'] . '"', |
|
922 | + 'etag' => '"'.$row['etag'].'"', |
|
923 | 923 | 'calendarid' => $row['calendarid'], |
924 | - 'size' => (int)$row['size'], |
|
924 | + 'size' => (int) $row['size'], |
|
925 | 925 | 'calendardata' => $this->readBlob($row['calendardata']), |
926 | 926 | 'component' => strtolower($row['componenttype']), |
927 | - 'classification' => (int)$row['classification'] |
|
927 | + 'classification' => (int) $row['classification'] |
|
928 | 928 | ]; |
929 | 929 | } |
930 | 930 | $result->closeCursor(); |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | )); |
984 | 984 | $this->addChange($calendarId, $objectUri, 1); |
985 | 985 | |
986 | - return '"' . $extraData['etag'] . '"'; |
|
986 | + return '"'.$extraData['etag'].'"'; |
|
987 | 987 | } |
988 | 988 | |
989 | 989 | /** |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | } |
1039 | 1039 | $this->addChange($calendarId, $objectUri, 2); |
1040 | 1040 | |
1041 | - return '"' . $extraData['etag'] . '"'; |
|
1041 | + return '"'.$extraData['etag'].'"'; |
|
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | /** |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | $stmt = $query->execute(); |
1192 | 1192 | |
1193 | 1193 | $result = []; |
1194 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1194 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1195 | 1195 | if ($requirePostFilter) { |
1196 | 1196 | if (!$this->validateFilterForObject($row, $filters)) { |
1197 | 1197 | continue; |
@@ -1212,14 +1212,14 @@ discard block |
||
1212 | 1212 | * @param integer|null $offset |
1213 | 1213 | * @return array |
1214 | 1214 | */ |
1215 | - public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) { |
|
1215 | + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
|
1216 | 1216 | $calendars = $this->getCalendarsForUser($principalUri); |
1217 | 1217 | $ownCalendars = []; |
1218 | 1218 | $sharedCalendars = []; |
1219 | 1219 | |
1220 | 1220 | $uriMapper = []; |
1221 | 1221 | |
1222 | - foreach($calendars as $calendar) { |
|
1222 | + foreach ($calendars as $calendar) { |
|
1223 | 1223 | if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { |
1224 | 1224 | $ownCalendars[] = $calendar['id']; |
1225 | 1225 | } else { |
@@ -1234,11 +1234,11 @@ discard block |
||
1234 | 1234 | $query = $this->db->getQueryBuilder(); |
1235 | 1235 | // Calendar id expressions |
1236 | 1236 | $calendarExpressions = []; |
1237 | - foreach($ownCalendars as $id) { |
|
1237 | + foreach ($ownCalendars as $id) { |
|
1238 | 1238 | $calendarExpressions[] = $query->expr() |
1239 | 1239 | ->eq('c.calendarid', $query->createNamedParameter($id)); |
1240 | 1240 | } |
1241 | - foreach($sharedCalendars as $id) { |
|
1241 | + foreach ($sharedCalendars as $id) { |
|
1242 | 1242 | $calendarExpressions[] = $query->expr()->andX( |
1243 | 1243 | $query->expr()->eq('c.calendarid', |
1244 | 1244 | $query->createNamedParameter($id)), |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | |
1256 | 1256 | // Component expressions |
1257 | 1257 | $compExpressions = []; |
1258 | - foreach($filters['comps'] as $comp) { |
|
1258 | + foreach ($filters['comps'] as $comp) { |
|
1259 | 1259 | $compExpressions[] = $query->expr() |
1260 | 1260 | ->eq('c.componenttype', $query->createNamedParameter($comp)); |
1261 | 1261 | } |
@@ -1274,13 +1274,13 @@ discard block |
||
1274 | 1274 | } |
1275 | 1275 | |
1276 | 1276 | $propParamExpressions = []; |
1277 | - foreach($filters['props'] as $prop) { |
|
1277 | + foreach ($filters['props'] as $prop) { |
|
1278 | 1278 | $propParamExpressions[] = $query->expr()->andX( |
1279 | 1279 | $query->expr()->eq('i.name', $query->createNamedParameter($prop)), |
1280 | 1280 | $query->expr()->isNull('i.parameter') |
1281 | 1281 | ); |
1282 | 1282 | } |
1283 | - foreach($filters['params'] as $param) { |
|
1283 | + foreach ($filters['params'] as $param) { |
|
1284 | 1284 | $propParamExpressions[] = $query->expr()->andX( |
1285 | 1285 | $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), |
1286 | 1286 | $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) |
@@ -1312,8 +1312,8 @@ discard block |
||
1312 | 1312 | $stmt = $query->execute(); |
1313 | 1313 | |
1314 | 1314 | $result = []; |
1315 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1316 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
1315 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1316 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
1317 | 1317 | if (!in_array($path, $result)) { |
1318 | 1318 | $result[] = $path; |
1319 | 1319 | } |
@@ -1353,7 +1353,7 @@ discard block |
||
1353 | 1353 | $stmt = $query->execute(); |
1354 | 1354 | |
1355 | 1355 | if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
1356 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
1356 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
1357 | 1357 | } |
1358 | 1358 | |
1359 | 1359 | return null; |
@@ -1418,7 +1418,7 @@ discard block |
||
1418 | 1418 | function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) { |
1419 | 1419 | // Current synctoken |
1420 | 1420 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); |
1421 | - $stmt->execute([ $calendarId ]); |
|
1421 | + $stmt->execute([$calendarId]); |
|
1422 | 1422 | $currentToken = $stmt->fetchColumn(0); |
1423 | 1423 | |
1424 | 1424 | if (is_null($currentToken)) { |
@@ -1435,8 +1435,8 @@ discard block |
||
1435 | 1435 | if ($syncToken) { |
1436 | 1436 | |
1437 | 1437 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`"; |
1438 | - if ($limit>0) { |
|
1439 | - $query.= " `LIMIT` " . (int)$limit; |
|
1438 | + if ($limit > 0) { |
|
1439 | + $query .= " `LIMIT` ".(int) $limit; |
|
1440 | 1440 | } |
1441 | 1441 | |
1442 | 1442 | // Fetching all changes |
@@ -1447,15 +1447,15 @@ discard block |
||
1447 | 1447 | |
1448 | 1448 | // This loop ensures that any duplicates are overwritten, only the |
1449 | 1449 | // last change on a node is relevant. |
1450 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1450 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1451 | 1451 | |
1452 | 1452 | $changes[$row['uri']] = $row['operation']; |
1453 | 1453 | |
1454 | 1454 | } |
1455 | 1455 | |
1456 | - foreach($changes as $uri => $operation) { |
|
1456 | + foreach ($changes as $uri => $operation) { |
|
1457 | 1457 | |
1458 | - switch($operation) { |
|
1458 | + switch ($operation) { |
|
1459 | 1459 | case 1 : |
1460 | 1460 | $result['added'][] = $uri; |
1461 | 1461 | break; |
@@ -1525,10 +1525,10 @@ discard block |
||
1525 | 1525 | ->from('calendarsubscriptions') |
1526 | 1526 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
1527 | 1527 | ->orderBy('calendarorder', 'asc'); |
1528 | - $stmt =$query->execute(); |
|
1528 | + $stmt = $query->execute(); |
|
1529 | 1529 | |
1530 | 1530 | $subscriptions = []; |
1531 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1531 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1532 | 1532 | |
1533 | 1533 | $subscription = [ |
1534 | 1534 | 'id' => $row['id'], |
@@ -1537,10 +1537,10 @@ discard block |
||
1537 | 1537 | 'source' => $row['source'], |
1538 | 1538 | 'lastmodified' => $row['lastmodified'], |
1539 | 1539 | |
1540 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
1540 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
1541 | 1541 | ]; |
1542 | 1542 | |
1543 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1543 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1544 | 1544 | if (!is_null($row[$dbName])) { |
1545 | 1545 | $subscription[$xmlName] = $row[$dbName]; |
1546 | 1546 | } |
@@ -1579,7 +1579,7 @@ discard block |
||
1579 | 1579 | |
1580 | 1580 | $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; |
1581 | 1581 | |
1582 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1582 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1583 | 1583 | if (array_key_exists($xmlName, $properties)) { |
1584 | 1584 | $values[$dbName] = $properties[$xmlName]; |
1585 | 1585 | if (in_array($dbName, $propertiesBoolean)) { |
@@ -1630,7 +1630,7 @@ discard block |
||
1630 | 1630 | |
1631 | 1631 | $newValues = []; |
1632 | 1632 | |
1633 | - foreach($mutations as $propertyName=>$propertyValue) { |
|
1633 | + foreach ($mutations as $propertyName=>$propertyValue) { |
|
1634 | 1634 | if ($propertyName === '{http://calendarserver.org/ns/}source') { |
1635 | 1635 | $newValues['source'] = $propertyValue->getHref(); |
1636 | 1636 | } else { |
@@ -1642,7 +1642,7 @@ discard block |
||
1642 | 1642 | $query = $this->db->getQueryBuilder(); |
1643 | 1643 | $query->update('calendarsubscriptions') |
1644 | 1644 | ->set('lastmodified', $query->createNamedParameter(time())); |
1645 | - foreach($newValues as $fieldName=>$value) { |
|
1645 | + foreach ($newValues as $fieldName=>$value) { |
|
1646 | 1646 | $query->set($fieldName, $query->createNamedParameter($value)); |
1647 | 1647 | } |
1648 | 1648 | $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
@@ -1692,7 +1692,7 @@ discard block |
||
1692 | 1692 | |
1693 | 1693 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
1694 | 1694 | |
1695 | - if(!$row) { |
|
1695 | + if (!$row) { |
|
1696 | 1696 | return null; |
1697 | 1697 | } |
1698 | 1698 | |
@@ -1700,8 +1700,8 @@ discard block |
||
1700 | 1700 | 'uri' => $row['uri'], |
1701 | 1701 | 'calendardata' => $row['calendardata'], |
1702 | 1702 | 'lastmodified' => $row['lastmodified'], |
1703 | - 'etag' => '"' . $row['etag'] . '"', |
|
1704 | - 'size' => (int)$row['size'], |
|
1703 | + 'etag' => '"'.$row['etag'].'"', |
|
1704 | + 'size' => (int) $row['size'], |
|
1705 | 1705 | ]; |
1706 | 1706 | } |
1707 | 1707 | |
@@ -1724,13 +1724,13 @@ discard block |
||
1724 | 1724 | ->execute(); |
1725 | 1725 | |
1726 | 1726 | $result = []; |
1727 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
1727 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
1728 | 1728 | $result[] = [ |
1729 | 1729 | 'calendardata' => $row['calendardata'], |
1730 | 1730 | 'uri' => $row['uri'], |
1731 | 1731 | 'lastmodified' => $row['lastmodified'], |
1732 | - 'etag' => '"' . $row['etag'] . '"', |
|
1733 | - 'size' => (int)$row['size'], |
|
1732 | + 'etag' => '"'.$row['etag'].'"', |
|
1733 | + 'size' => (int) $row['size'], |
|
1734 | 1734 | ]; |
1735 | 1735 | } |
1736 | 1736 | |
@@ -1822,10 +1822,10 @@ discard block |
||
1822 | 1822 | $lastOccurrence = null; |
1823 | 1823 | $uid = null; |
1824 | 1824 | $classification = self::CLASSIFICATION_PUBLIC; |
1825 | - foreach($vObject->getComponents() as $component) { |
|
1826 | - if ($component->name!=='VTIMEZONE') { |
|
1825 | + foreach ($vObject->getComponents() as $component) { |
|
1826 | + if ($component->name !== 'VTIMEZONE') { |
|
1827 | 1827 | $componentType = $component->name; |
1828 | - $uid = (string)$component->UID; |
|
1828 | + $uid = (string) $component->UID; |
|
1829 | 1829 | break; |
1830 | 1830 | } |
1831 | 1831 | } |
@@ -1850,13 +1850,13 @@ discard block |
||
1850 | 1850 | $lastOccurrence = $firstOccurrence; |
1851 | 1851 | } |
1852 | 1852 | } else { |
1853 | - $it = new EventIterator($vObject, (string)$component->UID); |
|
1853 | + $it = new EventIterator($vObject, (string) $component->UID); |
|
1854 | 1854 | $maxDate = new \DateTime(self::MAX_DATE); |
1855 | 1855 | if ($it->isInfinite()) { |
1856 | 1856 | $lastOccurrence = $maxDate->getTimestamp(); |
1857 | 1857 | } else { |
1858 | 1858 | $end = $it->getDtEnd(); |
1859 | - while($it->valid() && $end < $maxDate) { |
|
1859 | + while ($it->valid() && $end < $maxDate) { |
|
1860 | 1860 | $end = $it->getDtEnd(); |
1861 | 1861 | $it->next(); |
1862 | 1862 | |
@@ -2096,10 +2096,10 @@ discard block |
||
2096 | 2096 | $result->closeCursor(); |
2097 | 2097 | |
2098 | 2098 | if (!isset($objectIds['id'])) { |
2099 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
2099 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
2100 | 2100 | } |
2101 | 2101 | |
2102 | - return (int)$objectIds['id']; |
|
2102 | + return (int) $objectIds['id']; |
|
2103 | 2103 | } |
2104 | 2104 | |
2105 | 2105 | private function convertPrincipal($principalUri, $toV2) { |
@@ -2114,8 +2114,8 @@ discard block |
||
2114 | 2114 | } |
2115 | 2115 | |
2116 | 2116 | private function addOwnerPrincipal(&$calendarInfo) { |
2117 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
2118 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
2117 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
2118 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
2119 | 2119 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
2120 | 2120 | $uri = $calendarInfo[$ownerPrincipalKey]; |
2121 | 2121 | } else { |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | ->from('addressbooks') |
115 | 115 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); |
116 | 116 | |
117 | - return (int)$query->execute()->fetchColumn(); |
|
117 | + return (int) $query->execute()->fetchColumn(); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | $addressBooks = []; |
146 | 146 | |
147 | 147 | $result = $query->execute(); |
148 | - while($row = $result->fetch()) { |
|
148 | + while ($row = $result->fetch()) { |
|
149 | 149 | $addressBooks[$row['id']] = [ |
150 | 150 | 'id' => $row['id'], |
151 | 151 | 'uri' => $row['uri'], |
152 | 152 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
153 | 153 | '{DAV:}displayname' => $row['displayname'], |
154 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
154 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
155 | 155 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
156 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
156 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
157 | 157 | ]; |
158 | 158 | |
159 | 159 | $this->addOwnerPrincipal($addressBooks[$row['id']]); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $principals = array_map(function($principal) { |
166 | 166 | return urldecode($principal); |
167 | 167 | }, $principals); |
168 | - $principals[]= $principalUri; |
|
168 | + $principals[] = $principalUri; |
|
169 | 169 | |
170 | 170 | $query = $this->db->getQueryBuilder(); |
171 | 171 | $result = $query->select(['a.id', 'a.uri', 'a.displayname', 'a.principaluri', 'a.description', 'a.synctoken', 's.access']) |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | ->setParameter('principaluri', $principals, IQueryBuilder::PARAM_STR_ARRAY) |
178 | 178 | ->execute(); |
179 | 179 | |
180 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
181 | - while($row = $result->fetch()) { |
|
180 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
181 | + while ($row = $result->fetch()) { |
|
182 | 182 | if ($row['principaluri'] === $principalUri) { |
183 | 183 | continue; |
184 | 184 | } |
@@ -197,18 +197,18 @@ discard block |
||
197 | 197 | } |
198 | 198 | |
199 | 199 | list(, $name) = URLUtil::splitPath($row['principaluri']); |
200 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
201 | - $displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
200 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
201 | + $displayName = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
202 | 202 | |
203 | 203 | $addressBooks[$row['id']] = [ |
204 | 204 | 'id' => $row['id'], |
205 | 205 | 'uri' => $uri, |
206 | 206 | 'principaluri' => $principalUriOriginal, |
207 | 207 | '{DAV:}displayname' => $displayName, |
208 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
208 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
209 | 209 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
210 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
211 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'], |
|
210 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
211 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'], |
|
212 | 212 | $readOnlyPropertyName => $readOnly, |
213 | 213 | ]; |
214 | 214 | |
@@ -229,15 +229,15 @@ discard block |
||
229 | 229 | $addressBooks = []; |
230 | 230 | |
231 | 231 | $result = $query->execute(); |
232 | - while($row = $result->fetch()) { |
|
232 | + while ($row = $result->fetch()) { |
|
233 | 233 | $addressBooks[$row['id']] = [ |
234 | 234 | 'id' => $row['id'], |
235 | 235 | 'uri' => $row['uri'], |
236 | 236 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
237 | 237 | '{DAV:}displayname' => $row['displayname'], |
238 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
238 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
239 | 239 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
240 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
240 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
241 | 241 | ]; |
242 | 242 | |
243 | 243 | $this->addOwnerPrincipal($addressBooks[$row['id']]); |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | 'uri' => $row['uri'], |
283 | 283 | 'principaluri' => $row['principaluri'], |
284 | 284 | '{DAV:}displayname' => $row['displayname'], |
285 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
285 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
286 | 286 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
287 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
287 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
288 | 288 | ]; |
289 | 289 | |
290 | 290 | $this->addOwnerPrincipal($addressBook); |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | 'uri' => $row['uri'], |
317 | 317 | 'principaluri' => $row['principaluri'], |
318 | 318 | '{DAV:}displayname' => $row['displayname'], |
319 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
319 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
320 | 320 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
321 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
321 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
322 | 322 | ]; |
323 | 323 | |
324 | 324 | $this->addOwnerPrincipal($addressBook); |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) { |
346 | 346 | $supportedProperties = [ |
347 | 347 | '{DAV:}displayname', |
348 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description', |
|
348 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description', |
|
349 | 349 | ]; |
350 | 350 | |
351 | 351 | /** |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | $propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) { |
355 | 355 | |
356 | 356 | $updates = []; |
357 | - foreach($mutations as $property=>$newValue) { |
|
357 | + foreach ($mutations as $property=>$newValue) { |
|
358 | 358 | |
359 | - switch($property) { |
|
359 | + switch ($property) { |
|
360 | 360 | case '{DAV:}displayname' : |
361 | 361 | $updates['displayname'] = $newValue; |
362 | 362 | break; |
363 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description' : |
|
363 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description' : |
|
364 | 364 | $updates['description'] = $newValue; |
365 | 365 | break; |
366 | 366 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | $query = $this->db->getQueryBuilder(); |
369 | 369 | $query->update('addressbooks'); |
370 | 370 | |
371 | - foreach($updates as $key=>$value) { |
|
371 | + foreach ($updates as $key=>$value) { |
|
372 | 372 | $query->set($key, $query->createNamedParameter($value)); |
373 | 373 | } |
374 | 374 | $query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId))) |
@@ -399,24 +399,24 @@ discard block |
||
399 | 399 | 'synctoken' => 1 |
400 | 400 | ]; |
401 | 401 | |
402 | - foreach($properties as $property=>$newValue) { |
|
402 | + foreach ($properties as $property=>$newValue) { |
|
403 | 403 | |
404 | - switch($property) { |
|
404 | + switch ($property) { |
|
405 | 405 | case '{DAV:}displayname' : |
406 | 406 | $values['displayname'] = $newValue; |
407 | 407 | break; |
408 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description' : |
|
408 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description' : |
|
409 | 409 | $values['description'] = $newValue; |
410 | 410 | break; |
411 | 411 | default : |
412 | - throw new BadRequest('Unknown property: ' . $property); |
|
412 | + throw new BadRequest('Unknown property: '.$property); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | } |
416 | 416 | |
417 | 417 | // Fallback to make sure the displayname is set. Some clients may refuse |
418 | 418 | // to work with addressbooks not having a displayname. |
419 | - if(is_null($values['displayname'])) { |
|
419 | + if (is_null($values['displayname'])) { |
|
420 | 420 | $values['displayname'] = $url; |
421 | 421 | } |
422 | 422 | |
@@ -494,8 +494,8 @@ discard block |
||
494 | 494 | $cards = []; |
495 | 495 | |
496 | 496 | $result = $query->execute(); |
497 | - while($row = $result->fetch()) { |
|
498 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
497 | + while ($row = $result->fetch()) { |
|
498 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
499 | 499 | $row['carddata'] = $this->readBlob($row['carddata']); |
500 | 500 | $cards[] = $row; |
501 | 501 | } |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | if (!$row) { |
530 | 530 | return false; |
531 | 531 | } |
532 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
532 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
533 | 533 | $row['carddata'] = $this->readBlob($row['carddata']); |
534 | 534 | |
535 | 535 | return $row; |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | $result = $query->execute(); |
567 | 567 | |
568 | 568 | while ($row = $result->fetch()) { |
569 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
569 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
570 | 570 | $row['carddata'] = $this->readBlob($row['carddata']); |
571 | 571 | $cards[] = $row; |
572 | 572 | } |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | 'cardUri' => $cardUri, |
625 | 625 | 'cardData' => $cardData])); |
626 | 626 | |
627 | - return '"' . $etag . '"'; |
|
627 | + return '"'.$etag.'"'; |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | /** |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | 'cardUri' => $cardUri, |
675 | 675 | 'cardData' => $cardData])); |
676 | 676 | |
677 | - return '"' . $etag . '"'; |
|
677 | + return '"'.$etag.'"'; |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | /** |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) { |
773 | 773 | // Current synctoken |
774 | 774 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?'); |
775 | - $stmt->execute([ $addressBookId ]); |
|
775 | + $stmt->execute([$addressBookId]); |
|
776 | 776 | $currentToken = $stmt->fetchColumn(0); |
777 | 777 | |
778 | 778 | if (is_null($currentToken)) return null; |
@@ -787,8 +787,8 @@ discard block |
||
787 | 787 | if ($syncToken) { |
788 | 788 | |
789 | 789 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`"; |
790 | - if ($limit>0) { |
|
791 | - $query .= " `LIMIT` " . (int)$limit; |
|
790 | + if ($limit > 0) { |
|
791 | + $query .= " `LIMIT` ".(int) $limit; |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | // Fetching all changes |
@@ -799,15 +799,15 @@ discard block |
||
799 | 799 | |
800 | 800 | // This loop ensures that any duplicates are overwritten, only the |
801 | 801 | // last change on a node is relevant. |
802 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
802 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
803 | 803 | |
804 | 804 | $changes[$row['uri']] = $row['operation']; |
805 | 805 | |
806 | 806 | } |
807 | 807 | |
808 | - foreach($changes as $uri => $operation) { |
|
808 | + foreach ($changes as $uri => $operation) { |
|
809 | 809 | |
810 | - switch($operation) { |
|
810 | + switch ($operation) { |
|
811 | 811 | case 1: |
812 | 812 | $result['added'][] = $uri; |
813 | 813 | break; |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | $or->add($query2->expr()->eq('cp.name', $query->createNamedParameter($property))); |
891 | 891 | } |
892 | 892 | $query2->andWhere($or); |
893 | - $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
893 | + $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
894 | 894 | |
895 | 895 | $query->select('c.carddata', 'c.uri')->from($this->dbCardsTable, 'c') |
896 | 896 | ->where($query->expr()->in('c.id', $query->createFunction($query2->getSQL()))); |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | $result->closeCursor(); |
943 | 943 | |
944 | 944 | if (!isset($uri['uri'])) { |
945 | - throw new \InvalidArgumentException('Card does not exists: ' . $id); |
|
945 | + throw new \InvalidArgumentException('Card does not exists: '.$id); |
|
946 | 946 | } |
947 | 947 | |
948 | 948 | return $uri['uri']; |
@@ -1014,11 +1014,11 @@ discard block |
||
1014 | 1014 | ); |
1015 | 1015 | |
1016 | 1016 | foreach ($vCard->children() as $property) { |
1017 | - if(!in_array($property->name, self::$indexProperties)) { |
|
1017 | + if (!in_array($property->name, self::$indexProperties)) { |
|
1018 | 1018 | continue; |
1019 | 1019 | } |
1020 | 1020 | $preferred = 0; |
1021 | - foreach($property->parameters as $parameter) { |
|
1021 | + foreach ($property->parameters as $parameter) { |
|
1022 | 1022 | if ($parameter->name == 'TYPE' && strtoupper($parameter->getValue()) == 'PREF') { |
1023 | 1023 | $preferred = 1; |
1024 | 1024 | break; |
@@ -1073,10 +1073,10 @@ discard block |
||
1073 | 1073 | $result->closeCursor(); |
1074 | 1074 | |
1075 | 1075 | if (!isset($cardIds['id'])) { |
1076 | - throw new \InvalidArgumentException('Card does not exists: ' . $uri); |
|
1076 | + throw new \InvalidArgumentException('Card does not exists: '.$uri); |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | - return (int)$cardIds['id']; |
|
1079 | + return (int) $cardIds['id']; |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | /** |
@@ -1101,8 +1101,8 @@ discard block |
||
1101 | 1101 | } |
1102 | 1102 | |
1103 | 1103 | private function addOwnerPrincipal(&$addressbookInfo) { |
1104 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
1105 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
1104 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
1105 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
1106 | 1106 | if (isset($addressbookInfo[$ownerPrincipalKey])) { |
1107 | 1107 | $uri = $addressbookInfo[$ownerPrincipalKey]; |
1108 | 1108 | } else { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @suppress SqlInjectionChecker |
62 | 62 | */ |
63 | 63 | public function propagateChange($internalPath, $time, $sizeDifference = 0) { |
64 | - $storageId = (int)$this->storage->getStorageCache()->getNumericId(); |
|
64 | + $storageId = (int) $this->storage->getStorageCache()->getNumericId(); |
|
65 | 65 | |
66 | 66 | $parents = $this->getParents($internalPath); |
67 | 67 | |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | $etag = uniqid(); // since we give all folders the same etag we don't ask the storage for the etag |
77 | 77 | |
78 | 78 | $builder = $this->connection->getQueryBuilder(); |
79 | - $hashParams = array_map(function ($hash) use ($builder) { |
|
79 | + $hashParams = array_map(function($hash) use ($builder) { |
|
80 | 80 | return $builder->expr()->literal($hash); |
81 | 81 | }, $parentHashes); |
82 | 82 | |
83 | 83 | $builder->update('filecache') |
84 | - ->set('mtime', $builder->createFunction('GREATEST(`mtime`, ' . $builder->createNamedParameter((int)$time, IQueryBuilder::PARAM_INT) . ')')) |
|
84 | + ->set('mtime', $builder->createFunction('GREATEST(`mtime`, '.$builder->createNamedParameter((int) $time, IQueryBuilder::PARAM_INT).')')) |
|
85 | 85 | ->set('etag', $builder->createNamedParameter($etag, IQueryBuilder::PARAM_STR)) |
86 | 86 | ->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))) |
87 | 87 | ->andWhere($builder->expr()->in('path_hash', $hashParams)); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | // we need to do size separably so we can ignore entries with uncalculated size |
93 | 93 | $builder = $this->connection->getQueryBuilder(); |
94 | 94 | $builder->update('filecache') |
95 | - ->set('size', $builder->createFunction('`size` + ' . $builder->createNamedParameter($sizeDifference))) |
|
95 | + ->set('size', $builder->createFunction('`size` + '.$builder->createNamedParameter($sizeDifference))) |
|
96 | 96 | ->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))) |
97 | 97 | ->andWhere($builder->expr()->in('path_hash', $hashParams)) |
98 | 98 | ->andWhere($builder->expr()->gt('size', $builder->expr()->literal(-1, IQueryBuilder::PARAM_INT))); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $parents = []; |
108 | 108 | foreach ($parts as $part) { |
109 | 109 | $parents[] = $parent; |
110 | - $parent = trim($parent . '/' . $part, '/'); |
|
110 | + $parent = trim($parent.'/'.$part, '/'); |
|
111 | 111 | } |
112 | 112 | return $parents; |
113 | 113 | } |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | $this->connection->beginTransaction(); |
153 | 153 | |
154 | 154 | $query = $this->connection->getQueryBuilder(); |
155 | - $storageId = (int)$this->storage->getStorageCache()->getNumericId(); |
|
155 | + $storageId = (int) $this->storage->getStorageCache()->getNumericId(); |
|
156 | 156 | |
157 | 157 | $query->update('filecache') |
158 | - ->set('mtime', $query->createFunction('GREATEST(`mtime`, ' . $query->createParameter('time') . ')')) |
|
158 | + ->set('mtime', $query->createFunction('GREATEST(`mtime`, '.$query->createParameter('time').')')) |
|
159 | 159 | ->set('etag', $query->expr()->literal(uniqid())) |
160 | 160 | ->where($query->expr()->eq('storage', $query->expr()->literal($storageId, IQueryBuilder::PARAM_INT))) |
161 | 161 | ->andWhere($query->expr()->eq('path_hash', $query->createParameter('hash'))); |
162 | 162 | |
163 | 163 | $sizeQuery = $this->connection->getQueryBuilder(); |
164 | 164 | $sizeQuery->update('filecache') |
165 | - ->set('size', $sizeQuery->createFunction('`size` + ' . $sizeQuery->createParameter('size'))) |
|
165 | + ->set('size', $sizeQuery->createFunction('`size` + '.$sizeQuery->createParameter('size'))) |
|
166 | 166 | ->where($query->expr()->eq('storage', $query->expr()->literal($storageId, IQueryBuilder::PARAM_INT))) |
167 | 167 | ->andWhere($query->expr()->eq('path_hash', $query->createParameter('hash'))) |
168 | 168 | ->andWhere($sizeQuery->expr()->gt('size', $sizeQuery->expr()->literal(-1, IQueryBuilder::PARAM_INT))); |