@@ -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 | |
@@ -650,16 +650,16 @@ discard block |
||
650 | 650 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
651 | 651 | if (isset($properties[$sccs])) { |
652 | 652 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
653 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
653 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
654 | 654 | } |
655 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
655 | + $values['components'] = implode(',', $properties[$sccs]->getValue()); |
|
656 | 656 | } |
657 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
657 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
658 | 658 | if (isset($properties[$transp])) { |
659 | 659 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
660 | 660 | } |
661 | 661 | |
662 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
662 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
663 | 663 | if (isset($properties[$xmlName])) { |
664 | 664 | $values[$dbName] = $properties[$xmlName]; |
665 | 665 | } |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | |
668 | 668 | $query = $this->db->getQueryBuilder(); |
669 | 669 | $query->insert('calendars'); |
670 | - foreach($values as $column => $value) { |
|
670 | + foreach ($values as $column => $value) { |
|
671 | 671 | $query->setValue($column, $query->createNamedParameter($value)); |
672 | 672 | } |
673 | 673 | $query->execute(); |
@@ -700,14 +700,14 @@ discard block |
||
700 | 700 | */ |
701 | 701 | function updateCalendar($calendarId, PropPatch $propPatch) { |
702 | 702 | $supportedProperties = array_keys($this->propertyMap); |
703 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
703 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
704 | 704 | |
705 | 705 | $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { |
706 | 706 | $newValues = []; |
707 | 707 | foreach ($mutations as $propertyName => $propertyValue) { |
708 | 708 | |
709 | 709 | switch ($propertyName) { |
710 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' : |
|
710 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' : |
|
711 | 711 | $fieldName = 'transparent'; |
712 | 712 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
713 | 713 | break; |
@@ -822,16 +822,16 @@ discard block |
||
822 | 822 | $stmt = $query->execute(); |
823 | 823 | |
824 | 824 | $result = []; |
825 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
825 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
826 | 826 | $result[] = [ |
827 | 827 | 'id' => $row['id'], |
828 | 828 | 'uri' => $row['uri'], |
829 | 829 | 'lastmodified' => $row['lastmodified'], |
830 | - 'etag' => '"' . $row['etag'] . '"', |
|
830 | + 'etag' => '"'.$row['etag'].'"', |
|
831 | 831 | 'calendarid' => $row['calendarid'], |
832 | - 'size' => (int)$row['size'], |
|
832 | + 'size' => (int) $row['size'], |
|
833 | 833 | 'component' => strtolower($row['componenttype']), |
834 | - 'classification'=> (int)$row['classification'] |
|
834 | + 'classification'=> (int) $row['classification'] |
|
835 | 835 | ]; |
836 | 836 | } |
837 | 837 | |
@@ -864,18 +864,18 @@ discard block |
||
864 | 864 | $stmt = $query->execute(); |
865 | 865 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
866 | 866 | |
867 | - if(!$row) return null; |
|
867 | + if (!$row) return null; |
|
868 | 868 | |
869 | 869 | return [ |
870 | 870 | 'id' => $row['id'], |
871 | 871 | 'uri' => $row['uri'], |
872 | 872 | 'lastmodified' => $row['lastmodified'], |
873 | - 'etag' => '"' . $row['etag'] . '"', |
|
873 | + 'etag' => '"'.$row['etag'].'"', |
|
874 | 874 | 'calendarid' => $row['calendarid'], |
875 | - 'size' => (int)$row['size'], |
|
875 | + 'size' => (int) $row['size'], |
|
876 | 876 | 'calendardata' => $this->readBlob($row['calendardata']), |
877 | 877 | 'component' => strtolower($row['componenttype']), |
878 | - 'classification'=> (int)$row['classification'] |
|
878 | + 'classification'=> (int) $row['classification'] |
|
879 | 879 | ]; |
880 | 880 | } |
881 | 881 | |
@@ -914,12 +914,12 @@ discard block |
||
914 | 914 | 'id' => $row['id'], |
915 | 915 | 'uri' => $row['uri'], |
916 | 916 | 'lastmodified' => $row['lastmodified'], |
917 | - 'etag' => '"' . $row['etag'] . '"', |
|
917 | + 'etag' => '"'.$row['etag'].'"', |
|
918 | 918 | 'calendarid' => $row['calendarid'], |
919 | - 'size' => (int)$row['size'], |
|
919 | + 'size' => (int) $row['size'], |
|
920 | 920 | 'calendardata' => $this->readBlob($row['calendardata']), |
921 | 921 | 'component' => strtolower($row['componenttype']), |
922 | - 'classification' => (int)$row['classification'] |
|
922 | + 'classification' => (int) $row['classification'] |
|
923 | 923 | ]; |
924 | 924 | } |
925 | 925 | $result->closeCursor(); |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | )); |
979 | 979 | $this->addChange($calendarId, $objectUri, 1); |
980 | 980 | |
981 | - return '"' . $extraData['etag'] . '"'; |
|
981 | + return '"'.$extraData['etag'].'"'; |
|
982 | 982 | } |
983 | 983 | |
984 | 984 | /** |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | } |
1034 | 1034 | $this->addChange($calendarId, $objectUri, 2); |
1035 | 1035 | |
1036 | - return '"' . $extraData['etag'] . '"'; |
|
1036 | + return '"'.$extraData['etag'].'"'; |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | /** |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | $stmt = $query->execute(); |
1187 | 1187 | |
1188 | 1188 | $result = []; |
1189 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1189 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1190 | 1190 | if ($requirePostFilter) { |
1191 | 1191 | if (!$this->validateFilterForObject($row, $filters)) { |
1192 | 1192 | continue; |
@@ -1207,14 +1207,14 @@ discard block |
||
1207 | 1207 | * @param integer|null $offset |
1208 | 1208 | * @return array |
1209 | 1209 | */ |
1210 | - public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) { |
|
1210 | + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
|
1211 | 1211 | $calendars = $this->getCalendarsForUser($principalUri); |
1212 | 1212 | $ownCalendars = []; |
1213 | 1213 | $sharedCalendars = []; |
1214 | 1214 | |
1215 | 1215 | $uriMapper = []; |
1216 | 1216 | |
1217 | - foreach($calendars as $calendar) { |
|
1217 | + foreach ($calendars as $calendar) { |
|
1218 | 1218 | if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { |
1219 | 1219 | $ownCalendars[] = $calendar['id']; |
1220 | 1220 | } else { |
@@ -1229,11 +1229,11 @@ discard block |
||
1229 | 1229 | $query = $this->db->getQueryBuilder(); |
1230 | 1230 | // Calendar id expressions |
1231 | 1231 | $calendarExpressions = []; |
1232 | - foreach($ownCalendars as $id) { |
|
1232 | + foreach ($ownCalendars as $id) { |
|
1233 | 1233 | $calendarExpressions[] = $query->expr() |
1234 | 1234 | ->eq('c.calendarid', $query->createNamedParameter($id)); |
1235 | 1235 | } |
1236 | - foreach($sharedCalendars as $id) { |
|
1236 | + foreach ($sharedCalendars as $id) { |
|
1237 | 1237 | $calendarExpressions[] = $query->expr()->andX( |
1238 | 1238 | $query->expr()->eq('c.calendarid', |
1239 | 1239 | $query->createNamedParameter($id)), |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | |
1251 | 1251 | // Component expressions |
1252 | 1252 | $compExpressions = []; |
1253 | - foreach($filters['comps'] as $comp) { |
|
1253 | + foreach ($filters['comps'] as $comp) { |
|
1254 | 1254 | $compExpressions[] = $query->expr() |
1255 | 1255 | ->eq('c.componenttype', $query->createNamedParameter($comp)); |
1256 | 1256 | } |
@@ -1269,13 +1269,13 @@ discard block |
||
1269 | 1269 | } |
1270 | 1270 | |
1271 | 1271 | $propParamExpressions = []; |
1272 | - foreach($filters['props'] as $prop) { |
|
1272 | + foreach ($filters['props'] as $prop) { |
|
1273 | 1273 | $propParamExpressions[] = $query->expr()->andX( |
1274 | 1274 | $query->expr()->eq('i.name', $query->createNamedParameter($prop)), |
1275 | 1275 | $query->expr()->isNull('i.parameter') |
1276 | 1276 | ); |
1277 | 1277 | } |
1278 | - foreach($filters['params'] as $param) { |
|
1278 | + foreach ($filters['params'] as $param) { |
|
1279 | 1279 | $propParamExpressions[] = $query->expr()->andX( |
1280 | 1280 | $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), |
1281 | 1281 | $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) |
@@ -1307,8 +1307,8 @@ discard block |
||
1307 | 1307 | $stmt = $query->execute(); |
1308 | 1308 | |
1309 | 1309 | $result = []; |
1310 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1311 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
1310 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1311 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
1312 | 1312 | if (!in_array($path, $result)) { |
1313 | 1313 | $result[] = $path; |
1314 | 1314 | } |
@@ -1348,7 +1348,7 @@ discard block |
||
1348 | 1348 | $stmt = $query->execute(); |
1349 | 1349 | |
1350 | 1350 | if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
1351 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
1351 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | return null; |
@@ -1413,7 +1413,7 @@ discard block |
||
1413 | 1413 | function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) { |
1414 | 1414 | // Current synctoken |
1415 | 1415 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); |
1416 | - $stmt->execute([ $calendarId ]); |
|
1416 | + $stmt->execute([$calendarId]); |
|
1417 | 1417 | $currentToken = $stmt->fetchColumn(0); |
1418 | 1418 | |
1419 | 1419 | if (is_null($currentToken)) { |
@@ -1430,8 +1430,8 @@ discard block |
||
1430 | 1430 | if ($syncToken) { |
1431 | 1431 | |
1432 | 1432 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`"; |
1433 | - if ($limit>0) { |
|
1434 | - $query.= " `LIMIT` " . (int)$limit; |
|
1433 | + if ($limit > 0) { |
|
1434 | + $query .= " `LIMIT` ".(int) $limit; |
|
1435 | 1435 | } |
1436 | 1436 | |
1437 | 1437 | // Fetching all changes |
@@ -1442,15 +1442,15 @@ discard block |
||
1442 | 1442 | |
1443 | 1443 | // This loop ensures that any duplicates are overwritten, only the |
1444 | 1444 | // last change on a node is relevant. |
1445 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1445 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1446 | 1446 | |
1447 | 1447 | $changes[$row['uri']] = $row['operation']; |
1448 | 1448 | |
1449 | 1449 | } |
1450 | 1450 | |
1451 | - foreach($changes as $uri => $operation) { |
|
1451 | + foreach ($changes as $uri => $operation) { |
|
1452 | 1452 | |
1453 | - switch($operation) { |
|
1453 | + switch ($operation) { |
|
1454 | 1454 | case 1 : |
1455 | 1455 | $result['added'][] = $uri; |
1456 | 1456 | break; |
@@ -1520,10 +1520,10 @@ discard block |
||
1520 | 1520 | ->from('calendarsubscriptions') |
1521 | 1521 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
1522 | 1522 | ->orderBy('calendarorder', 'asc'); |
1523 | - $stmt =$query->execute(); |
|
1523 | + $stmt = $query->execute(); |
|
1524 | 1524 | |
1525 | 1525 | $subscriptions = []; |
1526 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1526 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
1527 | 1527 | |
1528 | 1528 | $subscription = [ |
1529 | 1529 | 'id' => $row['id'], |
@@ -1532,10 +1532,10 @@ discard block |
||
1532 | 1532 | 'source' => $row['source'], |
1533 | 1533 | 'lastmodified' => $row['lastmodified'], |
1534 | 1534 | |
1535 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
1535 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
1536 | 1536 | ]; |
1537 | 1537 | |
1538 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1538 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1539 | 1539 | if (!is_null($row[$dbName])) { |
1540 | 1540 | $subscription[$xmlName] = $row[$dbName]; |
1541 | 1541 | } |
@@ -1574,7 +1574,7 @@ discard block |
||
1574 | 1574 | |
1575 | 1575 | $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; |
1576 | 1576 | |
1577 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1577 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
1578 | 1578 | if (array_key_exists($xmlName, $properties)) { |
1579 | 1579 | $values[$dbName] = $properties[$xmlName]; |
1580 | 1580 | if (in_array($dbName, $propertiesBoolean)) { |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | |
1623 | 1623 | $newValues = []; |
1624 | 1624 | |
1625 | - foreach($mutations as $propertyName=>$propertyValue) { |
|
1625 | + foreach ($mutations as $propertyName=>$propertyValue) { |
|
1626 | 1626 | if ($propertyName === '{http://calendarserver.org/ns/}source') { |
1627 | 1627 | $newValues['source'] = $propertyValue->getHref(); |
1628 | 1628 | } else { |
@@ -1634,7 +1634,7 @@ discard block |
||
1634 | 1634 | $query = $this->db->getQueryBuilder(); |
1635 | 1635 | $query->update('calendarsubscriptions') |
1636 | 1636 | ->set('lastmodified', $query->createNamedParameter(time())); |
1637 | - foreach($newValues as $fieldName=>$value) { |
|
1637 | + foreach ($newValues as $fieldName=>$value) { |
|
1638 | 1638 | $query->set($fieldName, $query->createNamedParameter($value)); |
1639 | 1639 | } |
1640 | 1640 | $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
@@ -1684,7 +1684,7 @@ discard block |
||
1684 | 1684 | |
1685 | 1685 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
1686 | 1686 | |
1687 | - if(!$row) { |
|
1687 | + if (!$row) { |
|
1688 | 1688 | return null; |
1689 | 1689 | } |
1690 | 1690 | |
@@ -1692,8 +1692,8 @@ discard block |
||
1692 | 1692 | 'uri' => $row['uri'], |
1693 | 1693 | 'calendardata' => $row['calendardata'], |
1694 | 1694 | 'lastmodified' => $row['lastmodified'], |
1695 | - 'etag' => '"' . $row['etag'] . '"', |
|
1696 | - 'size' => (int)$row['size'], |
|
1695 | + 'etag' => '"'.$row['etag'].'"', |
|
1696 | + 'size' => (int) $row['size'], |
|
1697 | 1697 | ]; |
1698 | 1698 | } |
1699 | 1699 | |
@@ -1716,13 +1716,13 @@ discard block |
||
1716 | 1716 | ->execute(); |
1717 | 1717 | |
1718 | 1718 | $result = []; |
1719 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
1719 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
1720 | 1720 | $result[] = [ |
1721 | 1721 | 'calendardata' => $row['calendardata'], |
1722 | 1722 | 'uri' => $row['uri'], |
1723 | 1723 | 'lastmodified' => $row['lastmodified'], |
1724 | - 'etag' => '"' . $row['etag'] . '"', |
|
1725 | - 'size' => (int)$row['size'], |
|
1724 | + 'etag' => '"'.$row['etag'].'"', |
|
1725 | + 'size' => (int) $row['size'], |
|
1726 | 1726 | ]; |
1727 | 1727 | } |
1728 | 1728 | |
@@ -1814,10 +1814,10 @@ discard block |
||
1814 | 1814 | $lastOccurrence = null; |
1815 | 1815 | $uid = null; |
1816 | 1816 | $classification = self::CLASSIFICATION_PUBLIC; |
1817 | - foreach($vObject->getComponents() as $component) { |
|
1818 | - if ($component->name!=='VTIMEZONE') { |
|
1817 | + foreach ($vObject->getComponents() as $component) { |
|
1818 | + if ($component->name !== 'VTIMEZONE') { |
|
1819 | 1819 | $componentType = $component->name; |
1820 | - $uid = (string)$component->UID; |
|
1820 | + $uid = (string) $component->UID; |
|
1821 | 1821 | break; |
1822 | 1822 | } |
1823 | 1823 | } |
@@ -1842,13 +1842,13 @@ discard block |
||
1842 | 1842 | $lastOccurrence = $firstOccurrence; |
1843 | 1843 | } |
1844 | 1844 | } else { |
1845 | - $it = new EventIterator($vObject, (string)$component->UID); |
|
1845 | + $it = new EventIterator($vObject, (string) $component->UID); |
|
1846 | 1846 | $maxDate = new \DateTime(self::MAX_DATE); |
1847 | 1847 | if ($it->isInfinite()) { |
1848 | 1848 | $lastOccurrence = $maxDate->getTimestamp(); |
1849 | 1849 | } else { |
1850 | 1850 | $end = $it->getDtEnd(); |
1851 | - while($it->valid() && $end < $maxDate) { |
|
1851 | + while ($it->valid() && $end < $maxDate) { |
|
1852 | 1852 | $end = $it->getDtEnd(); |
1853 | 1853 | $it->next(); |
1854 | 1854 | |
@@ -2088,10 +2088,10 @@ discard block |
||
2088 | 2088 | $result->closeCursor(); |
2089 | 2089 | |
2090 | 2090 | if (!isset($objectIds['id'])) { |
2091 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
2091 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
2092 | 2092 | } |
2093 | 2093 | |
2094 | - return (int)$objectIds['id']; |
|
2094 | + return (int) $objectIds['id']; |
|
2095 | 2095 | } |
2096 | 2096 | |
2097 | 2097 | private function convertPrincipal($principalUri, $toV2) { |
@@ -2106,8 +2106,8 @@ discard block |
||
2106 | 2106 | } |
2107 | 2107 | |
2108 | 2108 | private function addOwnerPrincipal(&$calendarInfo) { |
2109 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
2110 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
2109 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
2110 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
2111 | 2111 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
2112 | 2112 | $uri = $calendarInfo[$ownerPrincipalKey]; |
2113 | 2113 | } 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,19 +345,19 @@ 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 | $propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) { |
352 | 352 | |
353 | 353 | $updates = []; |
354 | - foreach($mutations as $property=>$newValue) { |
|
354 | + foreach ($mutations as $property=>$newValue) { |
|
355 | 355 | |
356 | - switch($property) { |
|
356 | + switch ($property) { |
|
357 | 357 | case '{DAV:}displayname' : |
358 | 358 | $updates['displayname'] = $newValue; |
359 | 359 | break; |
360 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description' : |
|
360 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description' : |
|
361 | 361 | $updates['description'] = $newValue; |
362 | 362 | break; |
363 | 363 | } |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $query = $this->db->getQueryBuilder(); |
366 | 366 | $query->update('addressbooks'); |
367 | 367 | |
368 | - foreach($updates as $key=>$value) { |
|
368 | + foreach ($updates as $key=>$value) { |
|
369 | 369 | $query->set($key, $query->createNamedParameter($value)); |
370 | 370 | } |
371 | 371 | $query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId))) |
@@ -396,24 +396,24 @@ discard block |
||
396 | 396 | 'synctoken' => 1 |
397 | 397 | ]; |
398 | 398 | |
399 | - foreach($properties as $property=>$newValue) { |
|
399 | + foreach ($properties as $property=>$newValue) { |
|
400 | 400 | |
401 | - switch($property) { |
|
401 | + switch ($property) { |
|
402 | 402 | case '{DAV:}displayname' : |
403 | 403 | $values['displayname'] = $newValue; |
404 | 404 | break; |
405 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description' : |
|
405 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description' : |
|
406 | 406 | $values['description'] = $newValue; |
407 | 407 | break; |
408 | 408 | default : |
409 | - throw new BadRequest('Unknown property: ' . $property); |
|
409 | + throw new BadRequest('Unknown property: '.$property); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | } |
413 | 413 | |
414 | 414 | // Fallback to make sure the displayname is set. Some clients may refuse |
415 | 415 | // to work with addressbooks not having a displayname. |
416 | - if(is_null($values['displayname'])) { |
|
416 | + if (is_null($values['displayname'])) { |
|
417 | 417 | $values['displayname'] = $url; |
418 | 418 | } |
419 | 419 | |
@@ -491,8 +491,8 @@ discard block |
||
491 | 491 | $cards = []; |
492 | 492 | |
493 | 493 | $result = $query->execute(); |
494 | - while($row = $result->fetch()) { |
|
495 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
494 | + while ($row = $result->fetch()) { |
|
495 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
496 | 496 | $row['carddata'] = $this->readBlob($row['carddata']); |
497 | 497 | $cards[] = $row; |
498 | 498 | } |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | if (!$row) { |
527 | 527 | return false; |
528 | 528 | } |
529 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
529 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
530 | 530 | $row['carddata'] = $this->readBlob($row['carddata']); |
531 | 531 | |
532 | 532 | return $row; |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | $result = $query->execute(); |
564 | 564 | |
565 | 565 | while ($row = $result->fetch()) { |
566 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
566 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
567 | 567 | $row['carddata'] = $this->readBlob($row['carddata']); |
568 | 568 | $cards[] = $row; |
569 | 569 | } |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | 'cardUri' => $cardUri, |
622 | 622 | 'cardData' => $cardData])); |
623 | 623 | |
624 | - return '"' . $etag . '"'; |
|
624 | + return '"'.$etag.'"'; |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | /** |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | 'cardUri' => $cardUri, |
672 | 672 | 'cardData' => $cardData])); |
673 | 673 | |
674 | - return '"' . $etag . '"'; |
|
674 | + return '"'.$etag.'"'; |
|
675 | 675 | } |
676 | 676 | |
677 | 677 | /** |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) { |
770 | 770 | // Current synctoken |
771 | 771 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?'); |
772 | - $stmt->execute([ $addressBookId ]); |
|
772 | + $stmt->execute([$addressBookId]); |
|
773 | 773 | $currentToken = $stmt->fetchColumn(0); |
774 | 774 | |
775 | 775 | if (is_null($currentToken)) return null; |
@@ -784,8 +784,8 @@ discard block |
||
784 | 784 | if ($syncToken) { |
785 | 785 | |
786 | 786 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`"; |
787 | - if ($limit>0) { |
|
788 | - $query .= " `LIMIT` " . (int)$limit; |
|
787 | + if ($limit > 0) { |
|
788 | + $query .= " `LIMIT` ".(int) $limit; |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | // Fetching all changes |
@@ -796,15 +796,15 @@ discard block |
||
796 | 796 | |
797 | 797 | // This loop ensures that any duplicates are overwritten, only the |
798 | 798 | // last change on a node is relevant. |
799 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
799 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
800 | 800 | |
801 | 801 | $changes[$row['uri']] = $row['operation']; |
802 | 802 | |
803 | 803 | } |
804 | 804 | |
805 | - foreach($changes as $uri => $operation) { |
|
805 | + foreach ($changes as $uri => $operation) { |
|
806 | 806 | |
807 | - switch($operation) { |
|
807 | + switch ($operation) { |
|
808 | 808 | case 1: |
809 | 809 | $result['added'][] = $uri; |
810 | 810 | break; |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | $or->add($query2->expr()->eq('cp.name', $query->createNamedParameter($property))); |
888 | 888 | } |
889 | 889 | $query2->andWhere($or); |
890 | - $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
890 | + $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
891 | 891 | |
892 | 892 | $query->select('c.carddata', 'c.uri')->from($this->dbCardsTable, 'c') |
893 | 893 | ->where($query->expr()->in('c.id', $query->createFunction($query2->getSQL()))); |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | $result->closeCursor(); |
940 | 940 | |
941 | 941 | if (!isset($uri['uri'])) { |
942 | - throw new \InvalidArgumentException('Card does not exists: ' . $id); |
|
942 | + throw new \InvalidArgumentException('Card does not exists: '.$id); |
|
943 | 943 | } |
944 | 944 | |
945 | 945 | return $uri['uri']; |
@@ -1011,11 +1011,11 @@ discard block |
||
1011 | 1011 | ); |
1012 | 1012 | |
1013 | 1013 | foreach ($vCard->children() as $property) { |
1014 | - if(!in_array($property->name, self::$indexProperties)) { |
|
1014 | + if (!in_array($property->name, self::$indexProperties)) { |
|
1015 | 1015 | continue; |
1016 | 1016 | } |
1017 | 1017 | $preferred = 0; |
1018 | - foreach($property->parameters as $parameter) { |
|
1018 | + foreach ($property->parameters as $parameter) { |
|
1019 | 1019 | if ($parameter->name == 'TYPE' && strtoupper($parameter->getValue()) == 'PREF') { |
1020 | 1020 | $preferred = 1; |
1021 | 1021 | break; |
@@ -1070,10 +1070,10 @@ discard block |
||
1070 | 1070 | $result->closeCursor(); |
1071 | 1071 | |
1072 | 1072 | if (!isset($cardIds['id'])) { |
1073 | - throw new \InvalidArgumentException('Card does not exists: ' . $uri); |
|
1073 | + throw new \InvalidArgumentException('Card does not exists: '.$uri); |
|
1074 | 1074 | } |
1075 | 1075 | |
1076 | - return (int)$cardIds['id']; |
|
1076 | + return (int) $cardIds['id']; |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | /** |
@@ -1098,8 +1098,8 @@ discard block |
||
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | private function addOwnerPrincipal(&$addressbookInfo) { |
1101 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
1102 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
1101 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
1102 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
1103 | 1103 | if (isset($addressbookInfo[$ownerPrincipalKey])) { |
1104 | 1104 | $uri = $addressbookInfo[$ownerPrincipalKey]; |
1105 | 1105 | } else { |