@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | $name = $input->getArgument('name'); |
| 115 | 115 | $this->caldav = new CalDavBackend($this->dbConnection, $principalBackend, $this->userManager, $random, $dispatcher); |
| 116 | 116 | |
| 117 | - $calendar = $this->caldav->getCalendarByUri(self::URI_USERS . $userOrigin, $name); |
|
| 117 | + $calendar = $this->caldav->getCalendarByUri(self::URI_USERS.$userOrigin, $name); |
|
| 118 | 118 | |
| 119 | 119 | if (null === $calendar) { |
| 120 | 120 | /** If we got no matching calendar with URI, let's try the display names */ |
| 121 | - $suggestedUris = $this->caldav->findCalendarsUrisByDisplayName($name, self::URI_USERS . $userOrigin); |
|
| 121 | + $suggestedUris = $this->caldav->findCalendarsUrisByDisplayName($name, self::URI_USERS.$userOrigin); |
|
| 122 | 122 | if (count($suggestedUris) > 0) { |
| 123 | 123 | $this->io->note('No calendar with this URI was found, but you may want to try with these?'); |
| 124 | 124 | $this->io->listing($suggestedUris); |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | throw new \InvalidArgumentException("User <$userOrigin> has no calendar named <$name>."); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if (null !== $this->caldav->getCalendarByUri(self::URI_USERS . $userDestination, $name)) { |
|
| 129 | + if (null !== $this->caldav->getCalendarByUri(self::URI_USERS.$userDestination, $name)) { |
|
| 130 | 130 | throw new \InvalidArgumentException("User <$userDestination> already has a calendar named <$name>."); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $this->checkShares($calendar, $userDestination, $input->getOption('force')); |
| 134 | 134 | |
| 135 | - $this->caldav->moveCalendar($name, self::URI_USERS . $userOrigin, self::URI_USERS . $userDestination); |
|
| 135 | + $this->caldav->moveCalendar($name, self::URI_USERS.$userOrigin, self::URI_USERS.$userDestination); |
|
| 136 | 136 | |
| 137 | 137 | $this->io->success("Calendar <$name> was moved from user <$userOrigin> to <$userDestination>"); |
| 138 | 138 | } |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | list($prefix, $group) = str_split($share['href'], 28); |
| 153 | 153 | if ('principal:principals/groups/' === $prefix && !$this->groupManager->isInGroup($userDestination, $group)) { |
| 154 | 154 | if ($force) { |
| 155 | - $this->caldav->updateShares(new Calendar($this->caldav, $calendar, $this->l10n), [], ['href' => 'principal:principals/groups/' . $group]); |
|
| 155 | + $this->caldav->updateShares(new Calendar($this->caldav, $calendar, $this->l10n), [], ['href' => 'principal:principals/groups/'.$group]); |
|
| 156 | 156 | } else { |
| 157 | - throw new \InvalidArgumentException("User <$userDestination> is not part of the group <$group> with which the calendar <" . $calendar['uri'] . "> was shared. You may use -f to move the calendar while deleting this share."); |
|
| 157 | + throw new \InvalidArgumentException("User <$userDestination> is not part of the group <$group> with which the calendar <".$calendar['uri']."> was shared. You may use -f to move the calendar while deleting this share."); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - return (int)$query->execute()->fetchColumn(); |
|
| 218 | + return (int) $query->execute()->fetchColumn(); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
@@ -262,25 +262,25 @@ discard block |
||
| 262 | 262 | $stmt = $query->execute(); |
| 263 | 263 | |
| 264 | 264 | $calendars = []; |
| 265 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 265 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 266 | 266 | |
| 267 | 267 | $components = []; |
| 268 | 268 | if ($row['components']) { |
| 269 | - $components = explode(',',$row['components']); |
|
| 269 | + $components = explode(',', $row['components']); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | $calendar = [ |
| 273 | 273 | 'id' => $row['id'], |
| 274 | 274 | 'uri' => $row['uri'], |
| 275 | 275 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 276 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 277 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 278 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 279 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 280 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 276 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 277 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 278 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 279 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 280 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 281 | 281 | ]; |
| 282 | 282 | |
| 283 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 283 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 284 | 284 | $calendar[$xmlName] = $row[$dbName]; |
| 285 | 285 | } |
| 286 | 286 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | $principals = array_map(function($principal) { |
| 299 | 299 | return urldecode($principal); |
| 300 | 300 | }, $principals); |
| 301 | - $principals[]= $principalUri; |
|
| 301 | + $principals[] = $principalUri; |
|
| 302 | 302 | |
| 303 | 303 | $fields = array_values($this->propertyMap); |
| 304 | 304 | $fields[] = 'a.id'; |
@@ -318,8 +318,8 @@ discard block |
||
| 318 | 318 | ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) |
| 319 | 319 | ->execute(); |
| 320 | 320 | |
| 321 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 322 | - while($row = $result->fetch()) { |
|
| 321 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
| 322 | + while ($row = $result->fetch()) { |
|
| 323 | 323 | if ($row['principaluri'] === $principalUri) { |
| 324 | 324 | continue; |
| 325 | 325 | } |
@@ -338,25 +338,25 @@ discard block |
||
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | list(, $name) = Uri\split($row['principaluri']); |
| 341 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 342 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
| 341 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
| 342 | + $row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
| 343 | 343 | $components = []; |
| 344 | 344 | if ($row['components']) { |
| 345 | - $components = explode(',',$row['components']); |
|
| 345 | + $components = explode(',', $row['components']); |
|
| 346 | 346 | } |
| 347 | 347 | $calendar = [ |
| 348 | 348 | 'id' => $row['id'], |
| 349 | 349 | 'uri' => $uri, |
| 350 | 350 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
| 351 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 352 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 353 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 354 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 355 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 351 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 352 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 353 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 354 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 355 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 356 | 356 | $readOnlyPropertyName => $readOnly, |
| 357 | 357 | ]; |
| 358 | 358 | |
| 359 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 359 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 360 | 360 | $calendar[$xmlName] = $row[$dbName]; |
| 361 | 361 | } |
| 362 | 362 | |
@@ -385,21 +385,21 @@ discard block |
||
| 385 | 385 | ->orderBy('calendarorder', 'ASC'); |
| 386 | 386 | $stmt = $query->execute(); |
| 387 | 387 | $calendars = []; |
| 388 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 388 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 389 | 389 | $components = []; |
| 390 | 390 | if ($row['components']) { |
| 391 | - $components = explode(',',$row['components']); |
|
| 391 | + $components = explode(',', $row['components']); |
|
| 392 | 392 | } |
| 393 | 393 | $calendar = [ |
| 394 | 394 | 'id' => $row['id'], |
| 395 | 395 | 'uri' => $row['uri'], |
| 396 | 396 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 397 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 398 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 399 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 400 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 397 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 398 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 399 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 400 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 401 | 401 | ]; |
| 402 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 402 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 403 | 403 | $calendar[$xmlName] = $row[$dbName]; |
| 404 | 404 | } |
| 405 | 405 | |
@@ -450,27 +450,27 @@ discard block |
||
| 450 | 450 | ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) |
| 451 | 451 | ->execute(); |
| 452 | 452 | |
| 453 | - while($row = $result->fetch()) { |
|
| 453 | + while ($row = $result->fetch()) { |
|
| 454 | 454 | list(, $name) = Uri\split($row['principaluri']); |
| 455 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
| 455 | + $row['displayname'] = $row['displayname']."($name)"; |
|
| 456 | 456 | $components = []; |
| 457 | 457 | if ($row['components']) { |
| 458 | - $components = explode(',',$row['components']); |
|
| 458 | + $components = explode(',', $row['components']); |
|
| 459 | 459 | } |
| 460 | 460 | $calendar = [ |
| 461 | 461 | 'id' => $row['id'], |
| 462 | 462 | 'uri' => $row['publicuri'], |
| 463 | 463 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 464 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 465 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 466 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 467 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 468 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 469 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 470 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 464 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 465 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 466 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 467 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 468 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 469 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
| 470 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 471 | 471 | ]; |
| 472 | 472 | |
| 473 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 473 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 474 | 474 | $calendar[$xmlName] = $row[$dbName]; |
| 475 | 475 | } |
| 476 | 476 | |
@@ -514,29 +514,29 @@ discard block |
||
| 514 | 514 | $result->closeCursor(); |
| 515 | 515 | |
| 516 | 516 | if ($row === false) { |
| 517 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
| 517 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | list(, $name) = Uri\split($row['principaluri']); |
| 521 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
| 521 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
| 522 | 522 | $components = []; |
| 523 | 523 | if ($row['components']) { |
| 524 | - $components = explode(',',$row['components']); |
|
| 524 | + $components = explode(',', $row['components']); |
|
| 525 | 525 | } |
| 526 | 526 | $calendar = [ |
| 527 | 527 | 'id' => $row['id'], |
| 528 | 528 | 'uri' => $row['publicuri'], |
| 529 | 529 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 530 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 531 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 532 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 533 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 534 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 535 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 536 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 530 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 531 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 532 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 533 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 534 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 535 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
| 536 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 537 | 537 | ]; |
| 538 | 538 | |
| 539 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 539 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 540 | 540 | $calendar[$xmlName] = $row[$dbName]; |
| 541 | 541 | } |
| 542 | 542 | |
@@ -576,20 +576,20 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | $components = []; |
| 578 | 578 | if ($row['components']) { |
| 579 | - $components = explode(',',$row['components']); |
|
| 579 | + $components = explode(',', $row['components']); |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | $calendar = [ |
| 583 | 583 | 'id' => $row['id'], |
| 584 | 584 | 'uri' => $row['uri'], |
| 585 | 585 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 586 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 587 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 588 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 589 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 586 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 587 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 588 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 589 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 590 | 590 | ]; |
| 591 | 591 | |
| 592 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 592 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 593 | 593 | $calendar[$xmlName] = $row[$dbName]; |
| 594 | 594 | } |
| 595 | 595 | |
@@ -622,20 +622,20 @@ discard block |
||
| 622 | 622 | |
| 623 | 623 | $components = []; |
| 624 | 624 | if ($row['components']) { |
| 625 | - $components = explode(',',$row['components']); |
|
| 625 | + $components = explode(',', $row['components']); |
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | $calendar = [ |
| 629 | 629 | 'id' => $row['id'], |
| 630 | 630 | 'uri' => $row['uri'], |
| 631 | 631 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 632 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 633 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 634 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 635 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 632 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 633 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 634 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 635 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 636 | 636 | ]; |
| 637 | 637 | |
| 638 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 638 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 639 | 639 | $calendar[$xmlName] = $row[$dbName]; |
| 640 | 640 | } |
| 641 | 641 | |
@@ -670,16 +670,16 @@ discard block |
||
| 670 | 670 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
| 671 | 671 | if (isset($properties[$sccs])) { |
| 672 | 672 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
| 673 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 673 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 674 | 674 | } |
| 675 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
| 675 | + $values['components'] = implode(',', $properties[$sccs]->getValue()); |
|
| 676 | 676 | } |
| 677 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 677 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 678 | 678 | if (isset($properties[$transp])) { |
| 679 | 679 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | - foreach($this->propertyMap as $xmlName=>$dbName) { |
|
| 682 | + foreach ($this->propertyMap as $xmlName=>$dbName) { |
|
| 683 | 683 | if (isset($properties[$xmlName])) { |
| 684 | 684 | $values[$dbName] = $properties[$xmlName]; |
| 685 | 685 | } |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | |
| 688 | 688 | $query = $this->db->getQueryBuilder(); |
| 689 | 689 | $query->insert('calendars'); |
| 690 | - foreach($values as $column => $value) { |
|
| 690 | + foreach ($values as $column => $value) { |
|
| 691 | 691 | $query->setValue($column, $query->createNamedParameter($value)); |
| 692 | 692 | } |
| 693 | 693 | $query->execute(); |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | */ |
| 722 | 722 | function updateCalendar($calendarId, PropPatch $propPatch) { |
| 723 | 723 | $supportedProperties = array_keys($this->propertyMap); |
| 724 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 724 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 725 | 725 | |
| 726 | 726 | /** |
| 727 | 727 | * @suppress SqlInjectionChecker |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | foreach ($mutations as $propertyName => $propertyValue) { |
| 732 | 732 | |
| 733 | 733 | switch ($propertyName) { |
| 734 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' : |
|
| 734 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' : |
|
| 735 | 735 | $fieldName = 'transparent'; |
| 736 | 736 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
| 737 | 737 | break; |
@@ -846,16 +846,16 @@ discard block |
||
| 846 | 846 | $stmt = $query->execute(); |
| 847 | 847 | |
| 848 | 848 | $result = []; |
| 849 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 849 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 850 | 850 | $result[] = [ |
| 851 | 851 | 'id' => $row['id'], |
| 852 | 852 | 'uri' => $row['uri'], |
| 853 | 853 | 'lastmodified' => $row['lastmodified'], |
| 854 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 854 | + 'etag' => '"'.$row['etag'].'"', |
|
| 855 | 855 | 'calendarid' => $row['calendarid'], |
| 856 | - 'size' => (int)$row['size'], |
|
| 856 | + 'size' => (int) $row['size'], |
|
| 857 | 857 | 'component' => strtolower($row['componenttype']), |
| 858 | - 'classification'=> (int)$row['classification'] |
|
| 858 | + 'classification'=> (int) $row['classification'] |
|
| 859 | 859 | ]; |
| 860 | 860 | } |
| 861 | 861 | |
@@ -888,18 +888,18 @@ discard block |
||
| 888 | 888 | $stmt = $query->execute(); |
| 889 | 889 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
| 890 | 890 | |
| 891 | - if(!$row) return null; |
|
| 891 | + if (!$row) return null; |
|
| 892 | 892 | |
| 893 | 893 | return [ |
| 894 | 894 | 'id' => $row['id'], |
| 895 | 895 | 'uri' => $row['uri'], |
| 896 | 896 | 'lastmodified' => $row['lastmodified'], |
| 897 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 897 | + 'etag' => '"'.$row['etag'].'"', |
|
| 898 | 898 | 'calendarid' => $row['calendarid'], |
| 899 | - 'size' => (int)$row['size'], |
|
| 899 | + 'size' => (int) $row['size'], |
|
| 900 | 900 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 901 | 901 | 'component' => strtolower($row['componenttype']), |
| 902 | - 'classification'=> (int)$row['classification'] |
|
| 902 | + 'classification'=> (int) $row['classification'] |
|
| 903 | 903 | ]; |
| 904 | 904 | } |
| 905 | 905 | |
@@ -938,12 +938,12 @@ discard block |
||
| 938 | 938 | 'id' => $row['id'], |
| 939 | 939 | 'uri' => $row['uri'], |
| 940 | 940 | 'lastmodified' => $row['lastmodified'], |
| 941 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 941 | + 'etag' => '"'.$row['etag'].'"', |
|
| 942 | 942 | 'calendarid' => $row['calendarid'], |
| 943 | - 'size' => (int)$row['size'], |
|
| 943 | + 'size' => (int) $row['size'], |
|
| 944 | 944 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 945 | 945 | 'component' => strtolower($row['componenttype']), |
| 946 | - 'classification' => (int)$row['classification'] |
|
| 946 | + 'classification' => (int) $row['classification'] |
|
| 947 | 947 | ]; |
| 948 | 948 | } |
| 949 | 949 | $result->closeCursor(); |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | )); |
| 1017 | 1017 | $this->addChange($calendarId, $objectUri, 1); |
| 1018 | 1018 | |
| 1019 | - return '"' . $extraData['etag'] . '"'; |
|
| 1019 | + return '"'.$extraData['etag'].'"'; |
|
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | /** |
@@ -1071,7 +1071,7 @@ discard block |
||
| 1071 | 1071 | } |
| 1072 | 1072 | $this->addChange($calendarId, $objectUri, 2); |
| 1073 | 1073 | |
| 1074 | - return '"' . $extraData['etag'] . '"'; |
|
| 1074 | + return '"'.$extraData['etag'].'"'; |
|
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | 1077 | /** |
@@ -1224,13 +1224,13 @@ discard block |
||
| 1224 | 1224 | $stmt = $query->execute(); |
| 1225 | 1225 | |
| 1226 | 1226 | $result = []; |
| 1227 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1227 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1228 | 1228 | if ($requirePostFilter) { |
| 1229 | 1229 | // validateFilterForObject will parse the calendar data |
| 1230 | 1230 | // catch parsing errors |
| 1231 | 1231 | try { |
| 1232 | 1232 | $matches = $this->validateFilterForObject($row, $filters); |
| 1233 | - } catch(ParseException $ex) { |
|
| 1233 | + } catch (ParseException $ex) { |
|
| 1234 | 1234 | $this->logger->logException($ex, [ |
| 1235 | 1235 | 'app' => 'dav', |
| 1236 | 1236 | 'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'] |
@@ -1263,14 +1263,14 @@ discard block |
||
| 1263 | 1263 | * @param integer|null $offset |
| 1264 | 1264 | * @return array |
| 1265 | 1265 | */ |
| 1266 | - public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) { |
|
| 1266 | + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
|
| 1267 | 1267 | $calendars = $this->getCalendarsForUser($principalUri); |
| 1268 | 1268 | $ownCalendars = []; |
| 1269 | 1269 | $sharedCalendars = []; |
| 1270 | 1270 | |
| 1271 | 1271 | $uriMapper = []; |
| 1272 | 1272 | |
| 1273 | - foreach($calendars as $calendar) { |
|
| 1273 | + foreach ($calendars as $calendar) { |
|
| 1274 | 1274 | if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { |
| 1275 | 1275 | $ownCalendars[] = $calendar['id']; |
| 1276 | 1276 | } else { |
@@ -1285,11 +1285,11 @@ discard block |
||
| 1285 | 1285 | $query = $this->db->getQueryBuilder(); |
| 1286 | 1286 | // Calendar id expressions |
| 1287 | 1287 | $calendarExpressions = []; |
| 1288 | - foreach($ownCalendars as $id) { |
|
| 1288 | + foreach ($ownCalendars as $id) { |
|
| 1289 | 1289 | $calendarExpressions[] = $query->expr() |
| 1290 | 1290 | ->eq('c.calendarid', $query->createNamedParameter($id)); |
| 1291 | 1291 | } |
| 1292 | - foreach($sharedCalendars as $id) { |
|
| 1292 | + foreach ($sharedCalendars as $id) { |
|
| 1293 | 1293 | $calendarExpressions[] = $query->expr()->andX( |
| 1294 | 1294 | $query->expr()->eq('c.calendarid', |
| 1295 | 1295 | $query->createNamedParameter($id)), |
@@ -1306,7 +1306,7 @@ discard block |
||
| 1306 | 1306 | |
| 1307 | 1307 | // Component expressions |
| 1308 | 1308 | $compExpressions = []; |
| 1309 | - foreach($filters['comps'] as $comp) { |
|
| 1309 | + foreach ($filters['comps'] as $comp) { |
|
| 1310 | 1310 | $compExpressions[] = $query->expr() |
| 1311 | 1311 | ->eq('c.componenttype', $query->createNamedParameter($comp)); |
| 1312 | 1312 | } |
@@ -1325,13 +1325,13 @@ discard block |
||
| 1325 | 1325 | } |
| 1326 | 1326 | |
| 1327 | 1327 | $propParamExpressions = []; |
| 1328 | - foreach($filters['props'] as $prop) { |
|
| 1328 | + foreach ($filters['props'] as $prop) { |
|
| 1329 | 1329 | $propParamExpressions[] = $query->expr()->andX( |
| 1330 | 1330 | $query->expr()->eq('i.name', $query->createNamedParameter($prop)), |
| 1331 | 1331 | $query->expr()->isNull('i.parameter') |
| 1332 | 1332 | ); |
| 1333 | 1333 | } |
| 1334 | - foreach($filters['params'] as $param) { |
|
| 1334 | + foreach ($filters['params'] as $param) { |
|
| 1335 | 1335 | $propParamExpressions[] = $query->expr()->andX( |
| 1336 | 1336 | $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), |
| 1337 | 1337 | $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) |
@@ -1363,8 +1363,8 @@ discard block |
||
| 1363 | 1363 | $stmt = $query->execute(); |
| 1364 | 1364 | |
| 1365 | 1365 | $result = []; |
| 1366 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1367 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
| 1366 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1367 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
| 1368 | 1368 | if (!in_array($path, $result)) { |
| 1369 | 1369 | $result[] = $path; |
| 1370 | 1370 | } |
@@ -1402,7 +1402,7 @@ discard block |
||
| 1402 | 1402 | } |
| 1403 | 1403 | |
| 1404 | 1404 | $or = $innerQuery->expr()->orX(); |
| 1405 | - foreach($searchProperties as $searchProperty) { |
|
| 1405 | + foreach ($searchProperties as $searchProperty) { |
|
| 1406 | 1406 | $or->add($innerQuery->expr()->eq('op.name', |
| 1407 | 1407 | $outerQuery->createNamedParameter($searchProperty))); |
| 1408 | 1408 | } |
@@ -1410,8 +1410,8 @@ discard block |
||
| 1410 | 1410 | |
| 1411 | 1411 | if ($pattern !== '') { |
| 1412 | 1412 | $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
| 1413 | - $outerQuery->createNamedParameter('%' . |
|
| 1414 | - $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1413 | + $outerQuery->createNamedParameter('%'. |
|
| 1414 | + $this->db->escapeLikeParameter($pattern).'%'))); |
|
| 1415 | 1415 | } |
| 1416 | 1416 | |
| 1417 | 1417 | $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri') |
@@ -1431,7 +1431,7 @@ discard block |
||
| 1431 | 1431 | |
| 1432 | 1432 | if (isset($options['types'])) { |
| 1433 | 1433 | $or = $outerQuery->expr()->orX(); |
| 1434 | - foreach($options['types'] as $type) { |
|
| 1434 | + foreach ($options['types'] as $type) { |
|
| 1435 | 1435 | $or->add($outerQuery->expr()->eq('componenttype', |
| 1436 | 1436 | $outerQuery->createNamedParameter($type))); |
| 1437 | 1437 | } |
@@ -1456,7 +1456,7 @@ discard block |
||
| 1456 | 1456 | $comps = $calendarData->getComponents(); |
| 1457 | 1457 | $objects = []; |
| 1458 | 1458 | $timezones = []; |
| 1459 | - foreach($comps as $comp) { |
|
| 1459 | + foreach ($comps as $comp) { |
|
| 1460 | 1460 | if ($comp instanceof VTimeZone) { |
| 1461 | 1461 | $timezones[] = $comp; |
| 1462 | 1462 | } else { |
@@ -1493,7 +1493,7 @@ discard block |
||
| 1493 | 1493 | }); |
| 1494 | 1494 | $validationRules = $comp->getValidationRules(); |
| 1495 | 1495 | |
| 1496 | - foreach($subComponents as $subComponent) { |
|
| 1496 | + foreach ($subComponents as $subComponent) { |
|
| 1497 | 1497 | $name = $subComponent->name; |
| 1498 | 1498 | if (!isset($data[$name])) { |
| 1499 | 1499 | $data[$name] = []; |
@@ -1501,7 +1501,7 @@ discard block |
||
| 1501 | 1501 | $data[$name][] = $this->transformSearchData($subComponent); |
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | - foreach($properties as $property) { |
|
| 1504 | + foreach ($properties as $property) { |
|
| 1505 | 1505 | $name = $property->name; |
| 1506 | 1506 | if (!isset($validationRules[$name])) { |
| 1507 | 1507 | $validationRules[$name] = '*'; |
@@ -1571,7 +1571,7 @@ discard block |
||
| 1571 | 1571 | $stmt = $query->execute(); |
| 1572 | 1572 | |
| 1573 | 1573 | if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
| 1574 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
| 1574 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
| 1575 | 1575 | } |
| 1576 | 1576 | |
| 1577 | 1577 | return null; |
@@ -1636,7 +1636,7 @@ discard block |
||
| 1636 | 1636 | function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) { |
| 1637 | 1637 | // Current synctoken |
| 1638 | 1638 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); |
| 1639 | - $stmt->execute([ $calendarId ]); |
|
| 1639 | + $stmt->execute([$calendarId]); |
|
| 1640 | 1640 | $currentToken = $stmt->fetchColumn(0); |
| 1641 | 1641 | |
| 1642 | 1642 | if (is_null($currentToken)) { |
@@ -1653,8 +1653,8 @@ discard block |
||
| 1653 | 1653 | if ($syncToken) { |
| 1654 | 1654 | |
| 1655 | 1655 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`"; |
| 1656 | - if ($limit>0) { |
|
| 1657 | - $query.= " LIMIT " . (int)$limit; |
|
| 1656 | + if ($limit > 0) { |
|
| 1657 | + $query .= " LIMIT ".(int) $limit; |
|
| 1658 | 1658 | } |
| 1659 | 1659 | |
| 1660 | 1660 | // Fetching all changes |
@@ -1665,15 +1665,15 @@ discard block |
||
| 1665 | 1665 | |
| 1666 | 1666 | // This loop ensures that any duplicates are overwritten, only the |
| 1667 | 1667 | // last change on a node is relevant. |
| 1668 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1668 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1669 | 1669 | |
| 1670 | 1670 | $changes[$row['uri']] = $row['operation']; |
| 1671 | 1671 | |
| 1672 | 1672 | } |
| 1673 | 1673 | |
| 1674 | - foreach($changes as $uri => $operation) { |
|
| 1674 | + foreach ($changes as $uri => $operation) { |
|
| 1675 | 1675 | |
| 1676 | - switch($operation) { |
|
| 1676 | + switch ($operation) { |
|
| 1677 | 1677 | case 1 : |
| 1678 | 1678 | $result['added'][] = $uri; |
| 1679 | 1679 | break; |
@@ -1743,10 +1743,10 @@ discard block |
||
| 1743 | 1743 | ->from('calendarsubscriptions') |
| 1744 | 1744 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
| 1745 | 1745 | ->orderBy('calendarorder', 'asc'); |
| 1746 | - $stmt =$query->execute(); |
|
| 1746 | + $stmt = $query->execute(); |
|
| 1747 | 1747 | |
| 1748 | 1748 | $subscriptions = []; |
| 1749 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1749 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1750 | 1750 | |
| 1751 | 1751 | $subscription = [ |
| 1752 | 1752 | 'id' => $row['id'], |
@@ -1755,10 +1755,10 @@ discard block |
||
| 1755 | 1755 | 'source' => $row['source'], |
| 1756 | 1756 | 'lastmodified' => $row['lastmodified'], |
| 1757 | 1757 | |
| 1758 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 1758 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 1759 | 1759 | ]; |
| 1760 | 1760 | |
| 1761 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1761 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1762 | 1762 | if (!is_null($row[$dbName])) { |
| 1763 | 1763 | $subscription[$xmlName] = $row[$dbName]; |
| 1764 | 1764 | } |
@@ -1797,7 +1797,7 @@ discard block |
||
| 1797 | 1797 | |
| 1798 | 1798 | $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; |
| 1799 | 1799 | |
| 1800 | - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1800 | + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
|
| 1801 | 1801 | if (array_key_exists($xmlName, $properties)) { |
| 1802 | 1802 | $values[$dbName] = $properties[$xmlName]; |
| 1803 | 1803 | if (in_array($dbName, $propertiesBoolean)) { |
@@ -1848,7 +1848,7 @@ discard block |
||
| 1848 | 1848 | |
| 1849 | 1849 | $newValues = []; |
| 1850 | 1850 | |
| 1851 | - foreach($mutations as $propertyName=>$propertyValue) { |
|
| 1851 | + foreach ($mutations as $propertyName=>$propertyValue) { |
|
| 1852 | 1852 | if ($propertyName === '{http://calendarserver.org/ns/}source') { |
| 1853 | 1853 | $newValues['source'] = $propertyValue->getHref(); |
| 1854 | 1854 | } else { |
@@ -1860,7 +1860,7 @@ discard block |
||
| 1860 | 1860 | $query = $this->db->getQueryBuilder(); |
| 1861 | 1861 | $query->update('calendarsubscriptions') |
| 1862 | 1862 | ->set('lastmodified', $query->createNamedParameter(time())); |
| 1863 | - foreach($newValues as $fieldName=>$value) { |
|
| 1863 | + foreach ($newValues as $fieldName=>$value) { |
|
| 1864 | 1864 | $query->set($fieldName, $query->createNamedParameter($value)); |
| 1865 | 1865 | } |
| 1866 | 1866 | $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
@@ -1910,7 +1910,7 @@ discard block |
||
| 1910 | 1910 | |
| 1911 | 1911 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
| 1912 | 1912 | |
| 1913 | - if(!$row) { |
|
| 1913 | + if (!$row) { |
|
| 1914 | 1914 | return null; |
| 1915 | 1915 | } |
| 1916 | 1916 | |
@@ -1918,8 +1918,8 @@ discard block |
||
| 1918 | 1918 | 'uri' => $row['uri'], |
| 1919 | 1919 | 'calendardata' => $row['calendardata'], |
| 1920 | 1920 | 'lastmodified' => $row['lastmodified'], |
| 1921 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1922 | - 'size' => (int)$row['size'], |
|
| 1921 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1922 | + 'size' => (int) $row['size'], |
|
| 1923 | 1923 | ]; |
| 1924 | 1924 | } |
| 1925 | 1925 | |
@@ -1942,13 +1942,13 @@ discard block |
||
| 1942 | 1942 | ->execute(); |
| 1943 | 1943 | |
| 1944 | 1944 | $result = []; |
| 1945 | - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 1945 | + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { |
|
| 1946 | 1946 | $result[] = [ |
| 1947 | 1947 | 'calendardata' => $row['calendardata'], |
| 1948 | 1948 | 'uri' => $row['uri'], |
| 1949 | 1949 | 'lastmodified' => $row['lastmodified'], |
| 1950 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1951 | - 'size' => (int)$row['size'], |
|
| 1950 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1951 | + 'size' => (int) $row['size'], |
|
| 1952 | 1952 | ]; |
| 1953 | 1953 | } |
| 1954 | 1954 | |
@@ -2040,10 +2040,10 @@ discard block |
||
| 2040 | 2040 | $lastOccurrence = null; |
| 2041 | 2041 | $uid = null; |
| 2042 | 2042 | $classification = self::CLASSIFICATION_PUBLIC; |
| 2043 | - foreach($vObject->getComponents() as $component) { |
|
| 2044 | - if ($component->name!=='VTIMEZONE') { |
|
| 2043 | + foreach ($vObject->getComponents() as $component) { |
|
| 2044 | + if ($component->name !== 'VTIMEZONE') { |
|
| 2045 | 2045 | $componentType = $component->name; |
| 2046 | - $uid = (string)$component->UID; |
|
| 2046 | + $uid = (string) $component->UID; |
|
| 2047 | 2047 | break; |
| 2048 | 2048 | } |
| 2049 | 2049 | } |
@@ -2068,13 +2068,13 @@ discard block |
||
| 2068 | 2068 | $lastOccurrence = $firstOccurrence; |
| 2069 | 2069 | } |
| 2070 | 2070 | } else { |
| 2071 | - $it = new EventIterator($vObject, (string)$component->UID); |
|
| 2071 | + $it = new EventIterator($vObject, (string) $component->UID); |
|
| 2072 | 2072 | $maxDate = new \DateTime(self::MAX_DATE); |
| 2073 | 2073 | if ($it->isInfinite()) { |
| 2074 | 2074 | $lastOccurrence = $maxDate->getTimestamp(); |
| 2075 | 2075 | } else { |
| 2076 | 2076 | $end = $it->getDtEnd(); |
| 2077 | - while($it->valid() && $end < $maxDate) { |
|
| 2077 | + while ($it->valid() && $end < $maxDate) { |
|
| 2078 | 2078 | $end = $it->getDtEnd(); |
| 2079 | 2079 | $it->next(); |
| 2080 | 2080 | |
@@ -2319,7 +2319,7 @@ discard block |
||
| 2319 | 2319 | $result = $query->execute(); |
| 2320 | 2320 | |
| 2321 | 2321 | $calendarUris = []; |
| 2322 | - while($row = $result->fetch()) { |
|
| 2322 | + while ($row = $result->fetch()) { |
|
| 2323 | 2323 | $calendarUris[] = $row['uri']; |
| 2324 | 2324 | } |
| 2325 | 2325 | return $calendarUris; |
@@ -2336,7 +2336,7 @@ discard block |
||
| 2336 | 2336 | ->execute(); |
| 2337 | 2337 | |
| 2338 | 2338 | $ids = $result->fetchAll(); |
| 2339 | - foreach($ids as $id) { |
|
| 2339 | + foreach ($ids as $id) { |
|
| 2340 | 2340 | $this->deleteCalendar($id['id']); |
| 2341 | 2341 | } |
| 2342 | 2342 | } |
@@ -2383,10 +2383,10 @@ discard block |
||
| 2383 | 2383 | $result->closeCursor(); |
| 2384 | 2384 | |
| 2385 | 2385 | if (!isset($objectIds['id'])) { |
| 2386 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
| 2386 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
| 2387 | 2387 | } |
| 2388 | 2388 | |
| 2389 | - return (int)$objectIds['id']; |
|
| 2389 | + return (int) $objectIds['id']; |
|
| 2390 | 2390 | } |
| 2391 | 2391 | |
| 2392 | 2392 | private function convertPrincipal($principalUri, $toV2) { |
@@ -2401,8 +2401,8 @@ discard block |
||
| 2401 | 2401 | } |
| 2402 | 2402 | |
| 2403 | 2403 | private function addOwnerPrincipal(&$calendarInfo) { |
| 2404 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 2405 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 2404 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
| 2405 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
| 2406 | 2406 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
| 2407 | 2407 | $uri = $calendarInfo[$ownerPrincipalKey]; |
| 2408 | 2408 | } else { |