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