@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - return (int)$query->execute()->fetchColumn(); |
|
| 226 | + return (int) $query->execute()->fetchColumn(); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -270,25 +270,25 @@ discard block |
||
| 270 | 270 | $stmt = $query->execute(); |
| 271 | 271 | |
| 272 | 272 | $calendars = []; |
| 273 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 273 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 274 | 274 | |
| 275 | 275 | $components = []; |
| 276 | 276 | if ($row['components']) { |
| 277 | - $components = explode(',',$row['components']); |
|
| 277 | + $components = explode(',', $row['components']); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | $calendar = [ |
| 281 | 281 | 'id' => $row['id'], |
| 282 | 282 | 'uri' => $row['uri'], |
| 283 | 283 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 284 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 285 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 286 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 287 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 288 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 284 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 285 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 286 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 287 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 288 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 289 | 289 | ]; |
| 290 | 290 | |
| 291 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 291 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 292 | 292 | $calendar[$xmlName] = $row[$dbName]; |
| 293 | 293 | } |
| 294 | 294 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | $principals = array_map(function($principal) { |
| 309 | 309 | return urldecode($principal); |
| 310 | 310 | }, $principals); |
| 311 | - $principals[]= $principalUri; |
|
| 311 | + $principals[] = $principalUri; |
|
| 312 | 312 | |
| 313 | 313 | $fields = array_values($this->propertyMap); |
| 314 | 314 | $fields[] = 'a.id'; |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) |
| 329 | 329 | ->execute(); |
| 330 | 330 | |
| 331 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 332 | - while($row = $result->fetch()) { |
|
| 331 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
| 332 | + while ($row = $result->fetch()) { |
|
| 333 | 333 | if ($row['principaluri'] === $principalUri) { |
| 334 | 334 | continue; |
| 335 | 335 | } |
@@ -348,25 +348,25 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | list(, $name) = Uri\split($row['principaluri']); |
| 351 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 352 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
| 351 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
| 352 | + $row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
| 353 | 353 | $components = []; |
| 354 | 354 | if ($row['components']) { |
| 355 | - $components = explode(',',$row['components']); |
|
| 355 | + $components = explode(',', $row['components']); |
|
| 356 | 356 | } |
| 357 | 357 | $calendar = [ |
| 358 | 358 | 'id' => $row['id'], |
| 359 | 359 | 'uri' => $uri, |
| 360 | 360 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
| 361 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 362 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 363 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 364 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 365 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 361 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 362 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 363 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 364 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 365 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 366 | 366 | $readOnlyPropertyName => $readOnly, |
| 367 | 367 | ]; |
| 368 | 368 | |
| 369 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 369 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 370 | 370 | $calendar[$xmlName] = $row[$dbName]; |
| 371 | 371 | } |
| 372 | 372 | |
@@ -399,21 +399,21 @@ discard block |
||
| 399 | 399 | ->orderBy('calendarorder', 'ASC'); |
| 400 | 400 | $stmt = $query->execute(); |
| 401 | 401 | $calendars = []; |
| 402 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 402 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 403 | 403 | $components = []; |
| 404 | 404 | if ($row['components']) { |
| 405 | - $components = explode(',',$row['components']); |
|
| 405 | + $components = explode(',', $row['components']); |
|
| 406 | 406 | } |
| 407 | 407 | $calendar = [ |
| 408 | 408 | 'id' => $row['id'], |
| 409 | 409 | 'uri' => $row['uri'], |
| 410 | 410 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 411 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 412 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 413 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 414 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 411 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 412 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 413 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 414 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 415 | 415 | ]; |
| 416 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 416 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 417 | 417 | $calendar[$xmlName] = $row[$dbName]; |
| 418 | 418 | } |
| 419 | 419 | |
@@ -468,27 +468,27 @@ discard block |
||
| 468 | 468 | ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
| 469 | 469 | ->execute(); |
| 470 | 470 | |
| 471 | - while($row = $result->fetch()) { |
|
| 471 | + while ($row = $result->fetch()) { |
|
| 472 | 472 | list(, $name) = Uri\split($row['principaluri']); |
| 473 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
| 473 | + $row['displayname'] = $row['displayname']."($name)"; |
|
| 474 | 474 | $components = []; |
| 475 | 475 | if ($row['components']) { |
| 476 | - $components = explode(',',$row['components']); |
|
| 476 | + $components = explode(',', $row['components']); |
|
| 477 | 477 | } |
| 478 | 478 | $calendar = [ |
| 479 | 479 | 'id' => $row['id'], |
| 480 | 480 | 'uri' => $row['publicuri'], |
| 481 | 481 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 482 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 483 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 484 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 485 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 486 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 487 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 488 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 482 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 483 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 484 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 485 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 486 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 487 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
| 488 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 489 | 489 | ]; |
| 490 | 490 | |
| 491 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 491 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 492 | 492 | $calendar[$xmlName] = $row[$dbName]; |
| 493 | 493 | } |
| 494 | 494 | |
@@ -532,29 +532,29 @@ discard block |
||
| 532 | 532 | $result->closeCursor(); |
| 533 | 533 | |
| 534 | 534 | if ($row === false) { |
| 535 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
| 535 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | list(, $name) = Uri\split($row['principaluri']); |
| 539 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
| 539 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
| 540 | 540 | $components = []; |
| 541 | 541 | if ($row['components']) { |
| 542 | - $components = explode(',',$row['components']); |
|
| 542 | + $components = explode(',', $row['components']); |
|
| 543 | 543 | } |
| 544 | 544 | $calendar = [ |
| 545 | 545 | 'id' => $row['id'], |
| 546 | 546 | 'uri' => $row['publicuri'], |
| 547 | 547 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 548 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 549 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 550 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 551 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 552 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 553 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 554 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 548 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 549 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 550 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 551 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 552 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 553 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
| 554 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 555 | 555 | ]; |
| 556 | 556 | |
| 557 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 557 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 558 | 558 | $calendar[$xmlName] = $row[$dbName]; |
| 559 | 559 | } |
| 560 | 560 | |
@@ -594,20 +594,20 @@ discard block |
||
| 594 | 594 | |
| 595 | 595 | $components = []; |
| 596 | 596 | if ($row['components']) { |
| 597 | - $components = explode(',',$row['components']); |
|
| 597 | + $components = explode(',', $row['components']); |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | $calendar = [ |
| 601 | 601 | 'id' => $row['id'], |
| 602 | 602 | 'uri' => $row['uri'], |
| 603 | 603 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 604 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 605 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 606 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 607 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 604 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 605 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 606 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 607 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 608 | 608 | ]; |
| 609 | 609 | |
| 610 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 610 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 611 | 611 | $calendar[$xmlName] = $row[$dbName]; |
| 612 | 612 | } |
| 613 | 613 | |
@@ -644,20 +644,20 @@ discard block |
||
| 644 | 644 | |
| 645 | 645 | $components = []; |
| 646 | 646 | if ($row['components']) { |
| 647 | - $components = explode(',',$row['components']); |
|
| 647 | + $components = explode(',', $row['components']); |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | $calendar = [ |
| 651 | 651 | 'id' => $row['id'], |
| 652 | 652 | 'uri' => $row['uri'], |
| 653 | 653 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 654 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 655 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 656 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 657 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 654 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 655 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 656 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 657 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 658 | 658 | ]; |
| 659 | 659 | |
| 660 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 660 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 661 | 661 | $calendar[$xmlName] = $row[$dbName]; |
| 662 | 662 | } |
| 663 | 663 | |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | ->from('calendarsubscriptions') |
| 684 | 684 | ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
| 685 | 685 | ->orderBy('calendarorder', 'asc'); |
| 686 | - $stmt =$query->execute(); |
|
| 686 | + $stmt = $query->execute(); |
|
| 687 | 687 | |
| 688 | 688 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
| 689 | 689 | $stmt->closeCursor(); |
@@ -697,11 +697,11 @@ discard block |
||
| 697 | 697 | 'principaluri' => $row['principaluri'], |
| 698 | 698 | 'source' => $row['source'], |
| 699 | 699 | 'lastmodified' => $row['lastmodified'], |
| 700 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 701 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 700 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 701 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 702 | 702 | ]; |
| 703 | 703 | |
| 704 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 704 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 705 | 705 | if (!is_null($row[$dbName])) { |
| 706 | 706 | $subscription[$xmlName] = $row[$dbName]; |
| 707 | 707 | } |
@@ -736,21 +736,21 @@ discard block |
||
| 736 | 736 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
| 737 | 737 | if (isset($properties[$sccs])) { |
| 738 | 738 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
| 739 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 739 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 740 | 740 | } |
| 741 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
| 741 | + $values['components'] = implode(',', $properties[$sccs]->getValue()); |
|
| 742 | 742 | } else if (isset($properties['components'])) { |
| 743 | 743 | // Allow to provide components internally without having |
| 744 | 744 | // to create a SupportedCalendarComponentSet object |
| 745 | 745 | $values['components'] = $properties['components']; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 748 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 749 | 749 | if (isset($properties[$transp])) { |
| 750 | 750 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 753 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 754 | 754 | if (isset($properties[$xmlName])) { |
| 755 | 755 | $values[$dbName] = $properties[$xmlName]; |
| 756 | 756 | } |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | |
| 759 | 759 | $query = $this->db->getQueryBuilder(); |
| 760 | 760 | $query->insert('calendars'); |
| 761 | - foreach($values as $column => $value) { |
|
| 761 | + foreach ($values as $column => $value) { |
|
| 762 | 762 | $query->setValue($column, $query->createNamedParameter($value)); |
| 763 | 763 | } |
| 764 | 764 | $query->execute(); |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | */ |
| 793 | 793 | function updateCalendar($calendarId, PropPatch $propPatch) { |
| 794 | 794 | $supportedProperties = array_keys($this->propertyMap); |
| 795 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 795 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 796 | 796 | |
| 797 | 797 | /** |
| 798 | 798 | * @suppress SqlInjectionChecker |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | foreach ($mutations as $propertyName => $propertyValue) { |
| 803 | 803 | |
| 804 | 804 | switch ($propertyName) { |
| 805 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' : |
|
| 805 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' : |
|
| 806 | 806 | $fieldName = 'transparent'; |
| 807 | 807 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
| 808 | 808 | break; |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | * @param int $calendarType |
| 912 | 912 | * @return array |
| 913 | 913 | */ |
| 914 | - public function getCalendarObjects($id, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { |
|
| 914 | + public function getCalendarObjects($id, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
|
| 915 | 915 | $query = $this->db->getQueryBuilder(); |
| 916 | 916 | $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification']) |
| 917 | 917 | ->from('calendarobjects') |
@@ -920,16 +920,16 @@ discard block |
||
| 920 | 920 | $stmt = $query->execute(); |
| 921 | 921 | |
| 922 | 922 | $result = []; |
| 923 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 923 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 924 | 924 | $result[] = [ |
| 925 | 925 | 'id' => $row['id'], |
| 926 | 926 | 'uri' => $row['uri'], |
| 927 | 927 | 'lastmodified' => $row['lastmodified'], |
| 928 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 928 | + 'etag' => '"'.$row['etag'].'"', |
|
| 929 | 929 | 'calendarid' => $row['calendarid'], |
| 930 | - 'size' => (int)$row['size'], |
|
| 930 | + 'size' => (int) $row['size'], |
|
| 931 | 931 | 'component' => strtolower($row['componenttype']), |
| 932 | - 'classification'=> (int)$row['classification'] |
|
| 932 | + 'classification'=> (int) $row['classification'] |
|
| 933 | 933 | ]; |
| 934 | 934 | } |
| 935 | 935 | |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | * @param int $calendarType |
| 954 | 954 | * @return array|null |
| 955 | 955 | */ |
| 956 | - public function getCalendarObject($id, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 956 | + public function getCalendarObject($id, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 957 | 957 | $query = $this->db->getQueryBuilder(); |
| 958 | 958 | $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification']) |
| 959 | 959 | ->from('calendarobjects') |
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | $stmt = $query->execute(); |
| 964 | 964 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
| 965 | 965 | |
| 966 | - if(!$row) { |
|
| 966 | + if (!$row) { |
|
| 967 | 967 | return null; |
| 968 | 968 | } |
| 969 | 969 | |
@@ -971,12 +971,12 @@ discard block |
||
| 971 | 971 | 'id' => $row['id'], |
| 972 | 972 | 'uri' => $row['uri'], |
| 973 | 973 | 'lastmodified' => $row['lastmodified'], |
| 974 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 974 | + 'etag' => '"'.$row['etag'].'"', |
|
| 975 | 975 | 'calendarid' => $row['calendarid'], |
| 976 | - 'size' => (int)$row['size'], |
|
| 976 | + 'size' => (int) $row['size'], |
|
| 977 | 977 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 978 | 978 | 'component' => strtolower($row['componenttype']), |
| 979 | - 'classification'=> (int)$row['classification'] |
|
| 979 | + 'classification'=> (int) $row['classification'] |
|
| 980 | 980 | ]; |
| 981 | 981 | } |
| 982 | 982 | |
@@ -993,7 +993,7 @@ discard block |
||
| 993 | 993 | * @param int $calendarType |
| 994 | 994 | * @return array |
| 995 | 995 | */ |
| 996 | - public function getMultipleCalendarObjects($id, array $uris, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { |
|
| 996 | + public function getMultipleCalendarObjects($id, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
|
| 997 | 997 | if (empty($uris)) { |
| 998 | 998 | return []; |
| 999 | 999 | } |
@@ -1017,12 +1017,12 @@ discard block |
||
| 1017 | 1017 | 'id' => $row['id'], |
| 1018 | 1018 | 'uri' => $row['uri'], |
| 1019 | 1019 | 'lastmodified' => $row['lastmodified'], |
| 1020 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1020 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1021 | 1021 | 'calendarid' => $row['calendarid'], |
| 1022 | - 'size' => (int)$row['size'], |
|
| 1022 | + 'size' => (int) $row['size'], |
|
| 1023 | 1023 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 1024 | 1024 | 'component' => strtolower($row['componenttype']), |
| 1025 | - 'classification' => (int)$row['classification'] |
|
| 1025 | + 'classification' => (int) $row['classification'] |
|
| 1026 | 1026 | ]; |
| 1027 | 1027 | } |
| 1028 | 1028 | $result->closeCursor(); |
@@ -1050,7 +1050,7 @@ discard block |
||
| 1050 | 1050 | * @param int $calendarType |
| 1051 | 1051 | * @return string |
| 1052 | 1052 | */ |
| 1053 | - function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 1053 | + function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1054 | 1054 | $extraData = $this->getDenormalizedData($calendarData); |
| 1055 | 1055 | |
| 1056 | 1056 | $q = $this->db->getQueryBuilder(); |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | } |
| 1112 | 1112 | $this->addChange($calendarId, $objectUri, 1, $calendarType); |
| 1113 | 1113 | |
| 1114 | - return '"' . $extraData['etag'] . '"'; |
|
| 1114 | + return '"'.$extraData['etag'].'"'; |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | /** |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | * @param int $calendarType |
| 1134 | 1134 | * @return string |
| 1135 | 1135 | */ |
| 1136 | - function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 1136 | + function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1137 | 1137 | $extraData = $this->getDenormalizedData($calendarData); |
| 1138 | 1138 | |
| 1139 | 1139 | $query = $this->db->getQueryBuilder(); |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | } |
| 1181 | 1181 | $this->addChange($calendarId, $objectUri, 2, $calendarType); |
| 1182 | 1182 | |
| 1183 | - return '"' . $extraData['etag'] . '"'; |
|
| 1183 | + return '"'.$extraData['etag'].'"'; |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /** |
@@ -1210,7 +1210,7 @@ discard block |
||
| 1210 | 1210 | * @param int $calendarType |
| 1211 | 1211 | * @return void |
| 1212 | 1212 | */ |
| 1213 | - function deleteCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 1213 | + function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1214 | 1214 | $data = $this->getCalendarObject($calendarId, $objectUri, $calendarType); |
| 1215 | 1215 | if (is_array($data)) { |
| 1216 | 1216 | if ($calendarType === self::CALENDAR_TYPE_CALENDAR) { |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | * @param int $calendarType |
| 1295 | 1295 | * @return array |
| 1296 | 1296 | */ |
| 1297 | - public function calendarQuery($id, array $filters, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { |
|
| 1297 | + public function calendarQuery($id, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
|
| 1298 | 1298 | $componentType = null; |
| 1299 | 1299 | $requirePostFilter = true; |
| 1300 | 1300 | $timeRange = null; |
@@ -1348,13 +1348,13 @@ discard block |
||
| 1348 | 1348 | $stmt = $query->execute(); |
| 1349 | 1349 | |
| 1350 | 1350 | $result = []; |
| 1351 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1351 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1352 | 1352 | if ($requirePostFilter) { |
| 1353 | 1353 | // validateFilterForObject will parse the calendar data |
| 1354 | 1354 | // catch parsing errors |
| 1355 | 1355 | try { |
| 1356 | 1356 | $matches = $this->validateFilterForObject($row, $filters); |
| 1357 | - } catch(ParseException $ex) { |
|
| 1357 | + } catch (ParseException $ex) { |
|
| 1358 | 1358 | $this->logger->logException($ex, [ |
| 1359 | 1359 | 'app' => 'dav', |
| 1360 | 1360 | 'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri'] |
@@ -1389,14 +1389,14 @@ discard block |
||
| 1389 | 1389 | * @param integer|null $offset |
| 1390 | 1390 | * @return array |
| 1391 | 1391 | */ |
| 1392 | - public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) { |
|
| 1392 | + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
|
| 1393 | 1393 | $calendars = $this->getCalendarsForUser($principalUri); |
| 1394 | 1394 | $ownCalendars = []; |
| 1395 | 1395 | $sharedCalendars = []; |
| 1396 | 1396 | |
| 1397 | 1397 | $uriMapper = []; |
| 1398 | 1398 | |
| 1399 | - foreach($calendars as $calendar) { |
|
| 1399 | + foreach ($calendars as $calendar) { |
|
| 1400 | 1400 | if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { |
| 1401 | 1401 | $ownCalendars[] = $calendar['id']; |
| 1402 | 1402 | } else { |
@@ -1411,14 +1411,14 @@ discard block |
||
| 1411 | 1411 | $query = $this->db->getQueryBuilder(); |
| 1412 | 1412 | // Calendar id expressions |
| 1413 | 1413 | $calendarExpressions = []; |
| 1414 | - foreach($ownCalendars as $id) { |
|
| 1414 | + foreach ($ownCalendars as $id) { |
|
| 1415 | 1415 | $calendarExpressions[] = $query->expr()->andX( |
| 1416 | 1416 | $query->expr()->eq('c.calendarid', |
| 1417 | 1417 | $query->createNamedParameter($id)), |
| 1418 | 1418 | $query->expr()->eq('c.calendartype', |
| 1419 | 1419 | $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
| 1420 | 1420 | } |
| 1421 | - foreach($sharedCalendars as $id) { |
|
| 1421 | + foreach ($sharedCalendars as $id) { |
|
| 1422 | 1422 | $calendarExpressions[] = $query->expr()->andX( |
| 1423 | 1423 | $query->expr()->eq('c.calendarid', |
| 1424 | 1424 | $query->createNamedParameter($id)), |
@@ -1436,7 +1436,7 @@ discard block |
||
| 1436 | 1436 | |
| 1437 | 1437 | // Component expressions |
| 1438 | 1438 | $compExpressions = []; |
| 1439 | - foreach($filters['comps'] as $comp) { |
|
| 1439 | + foreach ($filters['comps'] as $comp) { |
|
| 1440 | 1440 | $compExpressions[] = $query->expr() |
| 1441 | 1441 | ->eq('c.componenttype', $query->createNamedParameter($comp)); |
| 1442 | 1442 | } |
@@ -1455,13 +1455,13 @@ discard block |
||
| 1455 | 1455 | } |
| 1456 | 1456 | |
| 1457 | 1457 | $propParamExpressions = []; |
| 1458 | - foreach($filters['props'] as $prop) { |
|
| 1458 | + foreach ($filters['props'] as $prop) { |
|
| 1459 | 1459 | $propParamExpressions[] = $query->expr()->andX( |
| 1460 | 1460 | $query->expr()->eq('i.name', $query->createNamedParameter($prop)), |
| 1461 | 1461 | $query->expr()->isNull('i.parameter') |
| 1462 | 1462 | ); |
| 1463 | 1463 | } |
| 1464 | - foreach($filters['params'] as $param) { |
|
| 1464 | + foreach ($filters['params'] as $param) { |
|
| 1465 | 1465 | $propParamExpressions[] = $query->expr()->andX( |
| 1466 | 1466 | $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), |
| 1467 | 1467 | $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) |
@@ -1493,8 +1493,8 @@ discard block |
||
| 1493 | 1493 | $stmt = $query->execute(); |
| 1494 | 1494 | |
| 1495 | 1495 | $result = []; |
| 1496 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1497 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
| 1496 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1497 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
| 1498 | 1498 | if (!in_array($path, $result)) { |
| 1499 | 1499 | $result[] = $path; |
| 1500 | 1500 | } |
@@ -1534,7 +1534,7 @@ discard block |
||
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | 1536 | $or = $innerQuery->expr()->orX(); |
| 1537 | - foreach($searchProperties as $searchProperty) { |
|
| 1537 | + foreach ($searchProperties as $searchProperty) { |
|
| 1538 | 1538 | $or->add($innerQuery->expr()->eq('op.name', |
| 1539 | 1539 | $outerQuery->createNamedParameter($searchProperty))); |
| 1540 | 1540 | } |
@@ -1542,8 +1542,8 @@ discard block |
||
| 1542 | 1542 | |
| 1543 | 1543 | if ($pattern !== '') { |
| 1544 | 1544 | $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
| 1545 | - $outerQuery->createNamedParameter('%' . |
|
| 1546 | - $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1545 | + $outerQuery->createNamedParameter('%'. |
|
| 1546 | + $this->db->escapeLikeParameter($pattern).'%'))); |
|
| 1547 | 1547 | } |
| 1548 | 1548 | |
| 1549 | 1549 | $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri') |
@@ -1563,7 +1563,7 @@ discard block |
||
| 1563 | 1563 | |
| 1564 | 1564 | if (isset($options['types'])) { |
| 1565 | 1565 | $or = $outerQuery->expr()->orX(); |
| 1566 | - foreach($options['types'] as $type) { |
|
| 1566 | + foreach ($options['types'] as $type) { |
|
| 1567 | 1567 | $or->add($outerQuery->expr()->eq('componenttype', |
| 1568 | 1568 | $outerQuery->createNamedParameter($type))); |
| 1569 | 1569 | } |
@@ -1588,7 +1588,7 @@ discard block |
||
| 1588 | 1588 | $comps = $calendarData->getComponents(); |
| 1589 | 1589 | $objects = []; |
| 1590 | 1590 | $timezones = []; |
| 1591 | - foreach($comps as $comp) { |
|
| 1591 | + foreach ($comps as $comp) { |
|
| 1592 | 1592 | if ($comp instanceof VTimeZone) { |
| 1593 | 1593 | $timezones[] = $comp; |
| 1594 | 1594 | } else { |
@@ -1625,7 +1625,7 @@ discard block |
||
| 1625 | 1625 | }); |
| 1626 | 1626 | $validationRules = $comp->getValidationRules(); |
| 1627 | 1627 | |
| 1628 | - foreach($subComponents as $subComponent) { |
|
| 1628 | + foreach ($subComponents as $subComponent) { |
|
| 1629 | 1629 | $name = $subComponent->name; |
| 1630 | 1630 | if (!isset($data[$name])) { |
| 1631 | 1631 | $data[$name] = []; |
@@ -1633,7 +1633,7 @@ discard block |
||
| 1633 | 1633 | $data[$name][] = $this->transformSearchData($subComponent); |
| 1634 | 1634 | } |
| 1635 | 1635 | |
| 1636 | - foreach($properties as $property) { |
|
| 1636 | + foreach ($properties as $property) { |
|
| 1637 | 1637 | $name = $property->name; |
| 1638 | 1638 | if (!isset($validationRules[$name])) { |
| 1639 | 1639 | $validationRules[$name] = '*'; |
@@ -1704,7 +1704,7 @@ discard block |
||
| 1704 | 1704 | $stmt = $query->execute(); |
| 1705 | 1705 | |
| 1706 | 1706 | if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
| 1707 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
| 1707 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
| 1708 | 1708 | } |
| 1709 | 1709 | |
| 1710 | 1710 | return null; |
@@ -1767,10 +1767,10 @@ discard block |
||
| 1767 | 1767 | * @param int $calendarType |
| 1768 | 1768 | * @return array |
| 1769 | 1769 | */ |
| 1770 | - function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 1770 | + function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1771 | 1771 | // Current synctoken |
| 1772 | 1772 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); |
| 1773 | - $stmt->execute([ $calendarId ]); |
|
| 1773 | + $stmt->execute([$calendarId]); |
|
| 1774 | 1774 | $currentToken = $stmt->fetchColumn(0); |
| 1775 | 1775 | |
| 1776 | 1776 | if (is_null($currentToken)) { |
@@ -1787,8 +1787,8 @@ discard block |
||
| 1787 | 1787 | if ($syncToken) { |
| 1788 | 1788 | |
| 1789 | 1789 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? AND `calendartype` = ? ORDER BY `synctoken`"; |
| 1790 | - if ($limit>0) { |
|
| 1791 | - $query.= " LIMIT " . (int)$limit; |
|
| 1790 | + if ($limit > 0) { |
|
| 1791 | + $query .= " LIMIT ".(int) $limit; |
|
| 1792 | 1792 | } |
| 1793 | 1793 | |
| 1794 | 1794 | // Fetching all changes |
@@ -1799,15 +1799,15 @@ discard block |
||
| 1799 | 1799 | |
| 1800 | 1800 | // This loop ensures that any duplicates are overwritten, only the |
| 1801 | 1801 | // last change on a node is relevant. |
| 1802 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1802 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1803 | 1803 | |
| 1804 | 1804 | $changes[$row['uri']] = $row['operation']; |
| 1805 | 1805 | |
| 1806 | 1806 | } |
| 1807 | 1807 | |
| 1808 | - foreach($changes as $uri => $operation) { |
|
| 1808 | + foreach ($changes as $uri => $operation) { |
|
| 1809 | 1809 | |
| 1810 | - switch($operation) { |
|
| 1810 | + switch ($operation) { |
|
| 1811 | 1811 | case 1 : |
| 1812 | 1812 | $result['added'][] = $uri; |
| 1813 | 1813 | break; |
@@ -1878,10 +1878,10 @@ discard block |
||
| 1878 | 1878 | ->from('calendarsubscriptions') |
| 1879 | 1879 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
| 1880 | 1880 | ->orderBy('calendarorder', 'asc'); |
| 1881 | - $stmt =$query->execute(); |
|
| 1881 | + $stmt = $query->execute(); |
|
| 1882 | 1882 | |
| 1883 | 1883 | $subscriptions = []; |
| 1884 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1884 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1885 | 1885 | |
| 1886 | 1886 | $subscription = [ |
| 1887 | 1887 | 'id' => $row['id'], |
@@ -1890,11 +1890,11 @@ discard block |
||
| 1890 | 1890 | 'source' => $row['source'], |
| 1891 | 1891 | 'lastmodified' => $row['lastmodified'], |
| 1892 | 1892 | |
| 1893 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 1894 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 1893 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 1894 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 1895 | 1895 | ]; |
| 1896 | 1896 | |
| 1897 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1897 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1898 | 1898 | if (!is_null($row[$dbName])) { |
| 1899 | 1899 | $subscription[$xmlName] = $row[$dbName]; |
| 1900 | 1900 | } |
@@ -1933,7 +1933,7 @@ discard block |
||
| 1933 | 1933 | |
| 1934 | 1934 | $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; |
| 1935 | 1935 | |
| 1936 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1936 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1937 | 1937 | if (array_key_exists($xmlName, $properties)) { |
| 1938 | 1938 | $values[$dbName] = $properties[$xmlName]; |
| 1939 | 1939 | if (in_array($dbName, $propertiesBoolean)) { |
@@ -1993,7 +1993,7 @@ discard block |
||
| 1993 | 1993 | |
| 1994 | 1994 | $newValues = []; |
| 1995 | 1995 | |
| 1996 | - foreach($mutations as $propertyName=>$propertyValue) { |
|
| 1996 | + foreach ($mutations as $propertyName=>$propertyValue) { |
|
| 1997 | 1997 | if ($propertyName === '{http://calendarserver.org/ns/}source') { |
| 1998 | 1998 | $newValues['source'] = $propertyValue->getHref(); |
| 1999 | 1999 | } else { |
@@ -2005,7 +2005,7 @@ discard block |
||
| 2005 | 2005 | $query = $this->db->getQueryBuilder(); |
| 2006 | 2006 | $query->update('calendarsubscriptions') |
| 2007 | 2007 | ->set('lastmodified', $query->createNamedParameter(time())); |
| 2008 | - foreach($newValues as $fieldName=>$value) { |
|
| 2008 | + foreach ($newValues as $fieldName=>$value) { |
|
| 2009 | 2009 | $query->set($fieldName, $query->createNamedParameter($value)); |
| 2010 | 2010 | } |
| 2011 | 2011 | $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
@@ -2086,7 +2086,7 @@ discard block |
||
| 2086 | 2086 | |
| 2087 | 2087 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
| 2088 | 2088 | |
| 2089 | - if(!$row) { |
|
| 2089 | + if (!$row) { |
|
| 2090 | 2090 | return null; |
| 2091 | 2091 | } |
| 2092 | 2092 | |
@@ -2094,8 +2094,8 @@ discard block |
||
| 2094 | 2094 | 'uri' => $row['uri'], |
| 2095 | 2095 | 'calendardata' => $row['calendardata'], |
| 2096 | 2096 | 'lastmodified' => $row['lastmodified'], |
| 2097 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2098 | - 'size' => (int)$row['size'], |
|
| 2097 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2098 | + 'size' => (int) $row['size'], |
|
| 2099 | 2099 | ]; |
| 2100 | 2100 | } |
| 2101 | 2101 | |
@@ -2118,13 +2118,13 @@ discard block |
||
| 2118 | 2118 | ->execute(); |
| 2119 | 2119 | |
| 2120 | 2120 | $result = []; |
| 2121 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 2121 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 2122 | 2122 | $result[] = [ |
| 2123 | 2123 | 'calendardata' => $row['calendardata'], |
| 2124 | 2124 | 'uri' => $row['uri'], |
| 2125 | 2125 | 'lastmodified' => $row['lastmodified'], |
| 2126 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2127 | - 'size' => (int)$row['size'], |
|
| 2126 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2127 | + 'size' => (int) $row['size'], |
|
| 2128 | 2128 | ]; |
| 2129 | 2129 | } |
| 2130 | 2130 | |
@@ -2177,14 +2177,14 @@ discard block |
||
| 2177 | 2177 | * @param int $calendarType |
| 2178 | 2178 | * @return void |
| 2179 | 2179 | */ |
| 2180 | - protected function addChange($calendarId, $objectUri, $operation, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 2181 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
| 2180 | + protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 2181 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
| 2182 | 2182 | |
| 2183 | 2183 | $query = $this->db->getQueryBuilder(); |
| 2184 | 2184 | $query->select('synctoken') |
| 2185 | 2185 | ->from($table) |
| 2186 | 2186 | ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
| 2187 | - $syncToken = (int)$query->execute()->fetchColumn(); |
|
| 2187 | + $syncToken = (int) $query->execute()->fetchColumn(); |
|
| 2188 | 2188 | |
| 2189 | 2189 | $query = $this->db->getQueryBuilder(); |
| 2190 | 2190 | $query->insert('calendarchanges') |
@@ -2228,10 +2228,10 @@ discard block |
||
| 2228 | 2228 | $lastOccurrence = null; |
| 2229 | 2229 | $uid = null; |
| 2230 | 2230 | $classification = self::CLASSIFICATION_PUBLIC; |
| 2231 | - foreach($vObject->getComponents() as $component) { |
|
| 2232 | - if ($component->name!=='VTIMEZONE') { |
|
| 2231 | + foreach ($vObject->getComponents() as $component) { |
|
| 2232 | + if ($component->name !== 'VTIMEZONE') { |
|
| 2233 | 2233 | $componentType = $component->name; |
| 2234 | - $uid = (string)$component->UID; |
|
| 2234 | + $uid = (string) $component->UID; |
|
| 2235 | 2235 | break; |
| 2236 | 2236 | } |
| 2237 | 2237 | } |
@@ -2256,13 +2256,13 @@ discard block |
||
| 2256 | 2256 | $lastOccurrence = $firstOccurrence; |
| 2257 | 2257 | } |
| 2258 | 2258 | } else { |
| 2259 | - $it = new EventIterator($vObject, (string)$component->UID); |
|
| 2259 | + $it = new EventIterator($vObject, (string) $component->UID); |
|
| 2260 | 2260 | $maxDate = new \DateTime(self::MAX_DATE); |
| 2261 | 2261 | if ($it->isInfinite()) { |
| 2262 | 2262 | $lastOccurrence = $maxDate->getTimestamp(); |
| 2263 | 2263 | } else { |
| 2264 | 2264 | $end = $it->getDtEnd(); |
| 2265 | - while($it->valid() && $end < $maxDate) { |
|
| 2265 | + while ($it->valid() && $end < $maxDate) { |
|
| 2266 | 2266 | $end = $it->getDtEnd(); |
| 2267 | 2267 | $it->next(); |
| 2268 | 2268 | |
@@ -2332,7 +2332,7 @@ discard block |
||
| 2332 | 2332 | * @param int $calendarType |
| 2333 | 2333 | * @return array |
| 2334 | 2334 | */ |
| 2335 | - public function getShares($resourceId, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 2335 | + public function getShares($resourceId, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 2336 | 2336 | return $this->calendarSharingBackend->getShares($resourceId); |
| 2337 | 2337 | } |
| 2338 | 2338 | |
@@ -2409,7 +2409,7 @@ discard block |
||
| 2409 | 2409 | * @param string $calendarData |
| 2410 | 2410 | * @param int $calendarType |
| 2411 | 2411 | */ |
| 2412 | - public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 2412 | + public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 2413 | 2413 | $objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType); |
| 2414 | 2414 | |
| 2415 | 2415 | try { |
@@ -2487,7 +2487,7 @@ discard block |
||
| 2487 | 2487 | ->execute(); |
| 2488 | 2488 | |
| 2489 | 2489 | $ids = $result->fetchAll(); |
| 2490 | - foreach($ids as $id) { |
|
| 2490 | + foreach ($ids as $id) { |
|
| 2491 | 2491 | $this->deleteCalendar($id['id']); |
| 2492 | 2492 | } |
| 2493 | 2493 | } |
@@ -2504,7 +2504,7 @@ discard block |
||
| 2504 | 2504 | $stmt = $query->execute(); |
| 2505 | 2505 | |
| 2506 | 2506 | $uris = []; |
| 2507 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 2507 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 2508 | 2508 | $uris[] = $row['uri']; |
| 2509 | 2509 | } |
| 2510 | 2510 | $stmt->closeCursor(); |
@@ -2525,7 +2525,7 @@ discard block |
||
| 2525 | 2525 | ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) |
| 2526 | 2526 | ->execute(); |
| 2527 | 2527 | |
| 2528 | - foreach($uris as $uri) { |
|
| 2528 | + foreach ($uris as $uri) { |
|
| 2529 | 2529 | $this->addChange($subscriptionId, $uri, 3, self::CALENDAR_TYPE_SUBSCRIPTION); |
| 2530 | 2530 | } |
| 2531 | 2531 | } |
@@ -2592,10 +2592,10 @@ discard block |
||
| 2592 | 2592 | $result->closeCursor(); |
| 2593 | 2593 | |
| 2594 | 2594 | if (!isset($objectIds['id'])) { |
| 2595 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
| 2595 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
| 2596 | 2596 | } |
| 2597 | 2597 | |
| 2598 | - return (int)$objectIds['id']; |
|
| 2598 | + return (int) $objectIds['id']; |
|
| 2599 | 2599 | } |
| 2600 | 2600 | |
| 2601 | 2601 | /** |
@@ -2622,8 +2622,8 @@ discard block |
||
| 2622 | 2622 | * @param $calendarInfo |
| 2623 | 2623 | */ |
| 2624 | 2624 | private function addOwnerPrincipal(&$calendarInfo) { |
| 2625 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 2626 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 2625 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
| 2626 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
| 2627 | 2627 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
| 2628 | 2628 | $uri = $calendarInfo[$ownerPrincipalKey]; |
| 2629 | 2629 | } else { |