Passed
Push — master ( 645109...008e6d )
by Christoph
12:14 queued 12s
created
apps/dav/lib/DAV/Sharing/Plugin.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	function initialize(Server $server) {
104 104
 		$this->server = $server;
105
-		$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = ShareRequest::class;
106
-		$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = Invite::class;
105
+		$this->server->xml->elementMap['{'.Plugin::NS_OWNCLOUD.'}share'] = ShareRequest::class;
106
+		$this->server->xml->elementMap['{'.Plugin::NS_OWNCLOUD.'}invite'] = Invite::class;
107 107
 
108 108
 		$this->server->on('method:POST', [$this, 'httpPost']);
109
-		$this->server->on('propFind',    [$this, 'propFind']);
109
+		$this->server->on('propFind', [$this, 'propFind']);
110 110
 	}
111 111
 
112 112
 	/**
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 			// Dealing with the 'share' document, which modified invitees on a
151 151
 			// calendar.
152
-			case '{' . self::NS_OWNCLOUD . '}share':
152
+			case '{'.self::NS_OWNCLOUD.'}share':
153 153
 
154 154
 				// We can only deal with IShareableCalendar objects
155 155
 				if (!$node instanceof IShareable) {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	function propFind(PropFind $propFind, INode $node) {
193 193
 		if ($node instanceof IShareable) {
194 194
 
195
-			$propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function () use ($node) {
195
+			$propFind->handle('{'.Plugin::NS_OWNCLOUD.'}invite', function() use ($node) {
196 196
 				return new Invite(
197 197
 					$node->getShares()
198 198
 				);
Please login to merge, or discard this patch.
apps/dav/lib/Command/MoveCalendar.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -121,19 +121,19 @@  discard block
 block discarded – undo
121 121
 
122 122
 		$name = $input->getArgument('name');
123 123
 
124
-		$calendar = $this->calDav->getCalendarByUri(self::URI_USERS . $userOrigin, $name);
124
+		$calendar = $this->calDav->getCalendarByUri(self::URI_USERS.$userOrigin, $name);
125 125
 
126 126
 		if (null === $calendar) {
127 127
 			throw new \InvalidArgumentException("User <$userOrigin> has no calendar named <$name>. You can run occ dav:list-calendars to list calendars URIs for this user.");
128 128
 		}
129 129
 
130
-		if (null !== $this->calDav->getCalendarByUri(self::URI_USERS . $userDestination, $name)) {
130
+		if (null !== $this->calDav->getCalendarByUri(self::URI_USERS.$userDestination, $name)) {
131 131
 			throw new \InvalidArgumentException("User <$userDestination> already has a calendar named <$name>.");
132 132
 		}
133 133
 
134 134
 		$this->checkShares($calendar, $userOrigin, $userDestination, $input->getOption('force'));
135 135
 
136
-		$this->calDav->moveCalendar($name, self::URI_USERS . $userOrigin, self::URI_USERS . $userDestination);
136
+		$this->calDav->moveCalendar($name, self::URI_USERS.$userOrigin, self::URI_USERS.$userDestination);
137 137
 
138 138
 		$this->io->success("Calendar <$name> was moved from user <$userOrigin> to <$userDestination>");
139 139
 	}
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
 			 */
159 159
 			if ($this->shareManager->shareWithGroupMembersOnly() === true && 'groups' === $prefix && !$this->groupManager->isInGroup($userDestination, $userOrGroup)) {
160 160
 				if ($force) {
161
-					$this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config), [], ['href' => 'principal:principals/groups/' . $userOrGroup]);
161
+					$this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config), [], ['href' => 'principal:principals/groups/'.$userOrGroup]);
162 162
 				} else {
163
-					throw new \InvalidArgumentException("User <$userDestination> is not part of the group <$userOrGroup> with whom the calendar <" . $calendar['uri'] . "> was shared. You may use -f to move the calendar while deleting this share.");
163
+					throw new \InvalidArgumentException("User <$userDestination> is not part of the group <$userOrGroup> with whom the calendar <".$calendar['uri']."> was shared. You may use -f to move the calendar while deleting this share.");
164 164
 				}
165 165
 			}
166 166
 
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
 			 */
170 170
 			if ($userOrGroup === $userDestination) {
171 171
 				if ($force) {
172
-					$this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config), [], ['href' => 'principal:principals/users/' . $userOrGroup]);
172
+					$this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config), [], ['href' => 'principal:principals/users/'.$userOrGroup]);
173 173
 				} else {
174
-					throw new \InvalidArgumentException("The calendar <" . $calendar['uri'] . "> is already shared to user <$userDestination>.You may use -f to move the calendar while deleting this share.");
174
+					throw new \InvalidArgumentException("The calendar <".$calendar['uri']."> is already shared to user <$userDestination>.You may use -f to move the calendar while deleting this share.");
175 175
 				}
176 176
 			}
177 177
 		}
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 		 */
181 181
 		if (count($shares) > 0) {
182 182
 			$this->io->note([
183
-				"Please note that moving calendar " . $calendar['uri'] . " from user <$userOrigin> to <$userDestination> has caused share links to change.",
184
-				"Sharees will need to change \"example.com/remote.php/dav/calendars/uid/" . $calendar['uri'] . "_shared_by_$userOrigin\" to \"example.com/remote.php/dav/calendars/uid/" . $calendar['uri'] . "_shared_by_$userDestination\""
183
+				"Please note that moving calendar ".$calendar['uri']." from user <$userOrigin> to <$userDestination> has caused share links to change.",
184
+				"Sharees will need to change \"example.com/remote.php/dav/calendars/uid/".$calendar['uri']."_shared_by_$userOrigin\" to \"example.com/remote.php/dav/calendars/uid/".$calendar['uri']."_shared_by_$userDestination\""
185 185
 			]);
186 186
 		}
187 187
 	}
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/CachedSubscription.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
 			],
61 61
 			[
62 62
 				'privilege' => '{DAV:}read',
63
-				'principal' => $this->getOwner() . '/calendar-proxy-write',
63
+				'principal' => $this->getOwner().'/calendar-proxy-write',
64 64
 				'protected' => true,
65 65
 			],
66 66
 			[
67 67
 				'privilege' => '{DAV:}read',
68
-				'principal' => $this->getOwner() . '/calendar-proxy-read',
68
+				'principal' => $this->getOwner().'/calendar-proxy-read',
69 69
 				'protected' => true,
70 70
 			],
71 71
 			[
72
-				'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
72
+				'privilege' => '{'.Plugin::NS_CALDAV.'}read-free-busy',
73 73
 				'principal' => '{DAV:}authenticated',
74 74
 				'protected' => true,
75 75
 			],
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 
90 90
 			[
91 91
 				'privilege' => '{DAV:}read',
92
-				'principal' => $this->getOwner() . '/calendar-proxy-write',
92
+				'principal' => $this->getOwner().'/calendar-proxy-write',
93 93
 				'protected' => true,
94 94
 			],
95 95
 			[
96 96
 				'privilege' => '{DAV:}read',
97
-				'principal' => $this->getOwner() . '/calendar-proxy-read',
97
+				'principal' => $this->getOwner().'/calendar-proxy-read',
98 98
 				'protected' => true,
99 99
 			],
100 100
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id'], CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
147 147
 
148 148
 		$children = [];
149
-		foreach($objs as $obj) {
149
+		foreach ($objs as $obj) {
150 150
 			$children[] = new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj);
151 151
 		}
152 152
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		$objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
162 162
 
163 163
 		$children = [];
164
-		foreach($objs as $obj) {
164
+		foreach ($objs as $obj) {
165 165
 			$children[] = new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj);
166 166
 		}
167 167
 
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/CalDavBackend.php 1 patch
Spacing   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			$query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)));
227 227
 		}
228 228
 
229
-		return (int)$query->execute()->fetchColumn();
229
+		return (int) $query->execute()->fetchColumn();
230 230
 	}
231 231
 
232 232
 	/**
@@ -273,25 +273,25 @@  discard block
 block discarded – undo
273 273
 		$stmt = $query->execute();
274 274
 
275 275
 		$calendars = [];
276
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
276
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
277 277
 
278 278
 			$components = [];
279 279
 			if ($row['components']) {
280
-				$components = explode(',',$row['components']);
280
+				$components = explode(',', $row['components']);
281 281
 			}
282 282
 
283 283
 			$calendar = [
284 284
 				'id' => $row['id'],
285 285
 				'uri' => $row['uri'],
286 286
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
287
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
288
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
289
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
290
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
291
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
287
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
288
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
289
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
290
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
291
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
292 292
 			];
293 293
 
294
-			foreach($this->propertyMap as $xmlName=>$dbName) {
294
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
295 295
 				$calendar[$xmlName] = $row[$dbName];
296 296
 			}
297 297
 
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 		$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
309 309
 		$principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal));
310 310
 
311
-		$principals = array_map(function ($principal) {
311
+		$principals = array_map(function($principal) {
312 312
 			return urldecode($principal);
313 313
 		}, $principals);
314
-		$principals[]= $principalUri;
314
+		$principals[] = $principalUri;
315 315
 
316 316
 		$fields = array_values($this->propertyMap);
317 317
 		$fields[] = 'a.id';
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 			->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY)
332 332
 			->execute();
333 333
 
334
-		$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
335
-		while($row = $result->fetch()) {
334
+		$readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only';
335
+		while ($row = $result->fetch()) {
336 336
 			if ($row['principaluri'] === $principalUri) {
337 337
 				continue;
338 338
 			}
@@ -351,25 +351,25 @@  discard block
 block discarded – undo
351 351
 			}
352 352
 
353 353
 			list(, $name) = Uri\split($row['principaluri']);
354
-			$uri = $row['uri'] . '_shared_by_' . $name;
355
-			$row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
354
+			$uri = $row['uri'].'_shared_by_'.$name;
355
+			$row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')';
356 356
 			$components = [];
357 357
 			if ($row['components']) {
358
-				$components = explode(',',$row['components']);
358
+				$components = explode(',', $row['components']);
359 359
 			}
360 360
 			$calendar = [
361 361
 				'id' => $row['id'],
362 362
 				'uri' => $uri,
363 363
 				'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
364
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
365
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
366
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
367
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
368
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
364
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
365
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
366
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
367
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
368
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
369 369
 				$readOnlyPropertyName => $readOnly,
370 370
 			];
371 371
 
372
-			foreach($this->propertyMap as $xmlName=>$dbName) {
372
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
373 373
 				$calendar[$xmlName] = $row[$dbName];
374 374
 			}
375 375
 
@@ -402,21 +402,21 @@  discard block
 block discarded – undo
402 402
 			->orderBy('calendarorder', 'ASC');
403 403
 		$stmt = $query->execute();
404 404
 		$calendars = [];
405
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
405
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
406 406
 			$components = [];
407 407
 			if ($row['components']) {
408
-				$components = explode(',',$row['components']);
408
+				$components = explode(',', $row['components']);
409 409
 			}
410 410
 			$calendar = [
411 411
 				'id' => $row['id'],
412 412
 				'uri' => $row['uri'],
413 413
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
414
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
415
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
416
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
417
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
414
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
415
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
416
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
417
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
418 418
 			];
419
-			foreach($this->propertyMap as $xmlName=>$dbName) {
419
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
420 420
 				$calendar[$xmlName] = $row[$dbName];
421 421
 			}
422 422
 
@@ -471,27 +471,27 @@  discard block
 block discarded – undo
471 471
 			->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
472 472
 			->execute();
473 473
 
474
-		while($row = $result->fetch()) {
474
+		while ($row = $result->fetch()) {
475 475
 			list(, $name) = Uri\split($row['principaluri']);
476
-			$row['displayname'] = $row['displayname'] . "($name)";
476
+			$row['displayname'] = $row['displayname']."($name)";
477 477
 			$components = [];
478 478
 			if ($row['components']) {
479
-				$components = explode(',',$row['components']);
479
+				$components = explode(',', $row['components']);
480 480
 			}
481 481
 			$calendar = [
482 482
 				'id' => $row['id'],
483 483
 				'uri' => $row['publicuri'],
484 484
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
485
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
486
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
487
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
488
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
489
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
490
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
491
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
485
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
486
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
487
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
488
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
489
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
490
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
491
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
492 492
 			];
493 493
 
494
-			foreach($this->propertyMap as $xmlName=>$dbName) {
494
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
495 495
 				$calendar[$xmlName] = $row[$dbName];
496 496
 			}
497 497
 
@@ -535,29 +535,29 @@  discard block
 block discarded – undo
535 535
 		$result->closeCursor();
536 536
 
537 537
 		if ($row === false) {
538
-			throw new NotFound('Node with name \'' . $uri . '\' could not be found');
538
+			throw new NotFound('Node with name \''.$uri.'\' could not be found');
539 539
 		}
540 540
 
541 541
 		list(, $name) = Uri\split($row['principaluri']);
542
-		$row['displayname'] = $row['displayname'] . ' ' . "($name)";
542
+		$row['displayname'] = $row['displayname'].' '."($name)";
543 543
 		$components = [];
544 544
 		if ($row['components']) {
545
-			$components = explode(',',$row['components']);
545
+			$components = explode(',', $row['components']);
546 546
 		}
547 547
 		$calendar = [
548 548
 			'id' => $row['id'],
549 549
 			'uri' => $row['publicuri'],
550 550
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
551
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
552
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
553
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
554
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
555
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
556
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
557
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
551
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
552
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
553
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
554
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
555
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
556
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
557
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
558 558
 		];
559 559
 
560
-		foreach($this->propertyMap as $xmlName=>$dbName) {
560
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
561 561
 			$calendar[$xmlName] = $row[$dbName];
562 562
 		}
563 563
 
@@ -597,20 +597,20 @@  discard block
 block discarded – undo
597 597
 
598 598
 		$components = [];
599 599
 		if ($row['components']) {
600
-			$components = explode(',',$row['components']);
600
+			$components = explode(',', $row['components']);
601 601
 		}
602 602
 
603 603
 		$calendar = [
604 604
 			'id' => $row['id'],
605 605
 			'uri' => $row['uri'],
606 606
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
607
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
608
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
609
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
610
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
607
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
608
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
609
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
610
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
611 611
 		];
612 612
 
613
-		foreach($this->propertyMap as $xmlName=>$dbName) {
613
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
614 614
 			$calendar[$xmlName] = $row[$dbName];
615 615
 		}
616 616
 
@@ -647,20 +647,20 @@  discard block
 block discarded – undo
647 647
 
648 648
 		$components = [];
649 649
 		if ($row['components']) {
650
-			$components = explode(',',$row['components']);
650
+			$components = explode(',', $row['components']);
651 651
 		}
652 652
 
653 653
 		$calendar = [
654 654
 			'id' => $row['id'],
655 655
 			'uri' => $row['uri'],
656 656
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
657
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
658
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
659
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
660
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
657
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
658
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
659
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
660
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
661 661
 		];
662 662
 
663
-		foreach($this->propertyMap as $xmlName=>$dbName) {
663
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
664 664
 			$calendar[$xmlName] = $row[$dbName];
665 665
 		}
666 666
 
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 			->from('calendarsubscriptions')
687 687
 			->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
688 688
 			->orderBy('calendarorder', 'asc');
689
-		$stmt =$query->execute();
689
+		$stmt = $query->execute();
690 690
 
691 691
 		$row = $stmt->fetch(\PDO::FETCH_ASSOC);
692 692
 		$stmt->closeCursor();
@@ -700,11 +700,11 @@  discard block
 block discarded – undo
700 700
 			'principaluri' => $row['principaluri'],
701 701
 			'source'       => $row['source'],
702 702
 			'lastmodified' => $row['lastmodified'],
703
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
704
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
703
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
704
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
705 705
 		];
706 706
 
707
-		foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
707
+		foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
708 708
 			if (!is_null($row[$dbName])) {
709 709
 				$subscription[$xmlName] = $row[$dbName];
710 710
 			}
@@ -739,21 +739,21 @@  discard block
 block discarded – undo
739 739
 		$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
740 740
 		if (isset($properties[$sccs])) {
741 741
 			if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) {
742
-				throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
742
+				throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
743 743
 			}
744
-			$values['components'] = implode(',',$properties[$sccs]->getValue());
744
+			$values['components'] = implode(',', $properties[$sccs]->getValue());
745 745
 		} else if (isset($properties['components'])) {
746 746
 			// Allow to provide components internally without having
747 747
 			// to create a SupportedCalendarComponentSet object
748 748
 			$values['components'] = $properties['components'];
749 749
 		}
750 750
 
751
-		$transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
751
+		$transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
752 752
 		if (isset($properties[$transp])) {
753 753
 			$values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent');
754 754
 		}
755 755
 
756
-		foreach($this->propertyMap as $xmlName=>$dbName) {
756
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
757 757
 			if (isset($properties[$xmlName])) {
758 758
 				$values[$dbName] = $properties[$xmlName];
759 759
 			}
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 
762 762
 		$query = $this->db->getQueryBuilder();
763 763
 		$query->insert('calendars');
764
-		foreach($values as $column => $value) {
764
+		foreach ($values as $column => $value) {
765 765
 			$query->setValue($column, $query->createNamedParameter($value));
766 766
 		}
767 767
 		$query->execute();
@@ -795,17 +795,17 @@  discard block
 block discarded – undo
795 795
 	 */
796 796
 	function updateCalendar($calendarId, PropPatch $propPatch) {
797 797
 		$supportedProperties = array_keys($this->propertyMap);
798
-		$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
798
+		$supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
799 799
 
800 800
 		/**
801 801
 		 * @suppress SqlInjectionChecker
802 802
 		 */
803
-		$propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) {
803
+		$propPatch->handle($supportedProperties, function($mutations) use ($calendarId) {
804 804
 			$newValues = [];
805 805
 			foreach ($mutations as $propertyName => $propertyValue) {
806 806
 
807 807
 				switch ($propertyName) {
808
-					case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp':
808
+					case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp':
809 809
 						$fieldName = 'transparent';
810 810
 						$newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent');
811 811
 						break;
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 	 * @param int $calendarType
915 915
 	 * @return array
916 916
 	 */
917
-	public function getCalendarObjects($id, $calendarType=self::CALENDAR_TYPE_CALENDAR):array {
917
+	public function getCalendarObjects($id, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
918 918
 		$query = $this->db->getQueryBuilder();
919 919
 		$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification'])
920 920
 			->from('calendarobjects')
@@ -923,16 +923,16 @@  discard block
 block discarded – undo
923 923
 		$stmt = $query->execute();
924 924
 
925 925
 		$result = [];
926
-		foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
926
+		foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
927 927
 			$result[] = [
928 928
 				'id'           => $row['id'],
929 929
 				'uri'          => $row['uri'],
930 930
 				'lastmodified' => $row['lastmodified'],
931
-				'etag'         => '"' . $row['etag'] . '"',
931
+				'etag'         => '"'.$row['etag'].'"',
932 932
 				'calendarid'   => $row['calendarid'],
933
-				'size'         => (int)$row['size'],
933
+				'size'         => (int) $row['size'],
934 934
 				'component'    => strtolower($row['componenttype']),
935
-				'classification'=> (int)$row['classification']
935
+				'classification'=> (int) $row['classification']
936 936
 			];
937 937
 		}
938 938
 
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 	 * @param int $calendarType
957 957
 	 * @return array|null
958 958
 	 */
959
-	public function getCalendarObject($id, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
959
+	public function getCalendarObject($id, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
960 960
 		$query = $this->db->getQueryBuilder();
961 961
 		$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
962 962
 			->from('calendarobjects')
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 		$stmt = $query->execute();
967 967
 		$row = $stmt->fetch(\PDO::FETCH_ASSOC);
968 968
 
969
-		if(!$row) {
969
+		if (!$row) {
970 970
 			return null;
971 971
 		}
972 972
 
@@ -974,12 +974,12 @@  discard block
 block discarded – undo
974 974
 			'id'            => $row['id'],
975 975
 			'uri'           => $row['uri'],
976 976
 			'lastmodified'  => $row['lastmodified'],
977
-			'etag'          => '"' . $row['etag'] . '"',
977
+			'etag'          => '"'.$row['etag'].'"',
978 978
 			'calendarid'    => $row['calendarid'],
979
-			'size'          => (int)$row['size'],
979
+			'size'          => (int) $row['size'],
980 980
 			'calendardata'  => $this->readBlob($row['calendardata']),
981 981
 			'component'     => strtolower($row['componenttype']),
982
-			'classification'=> (int)$row['classification']
982
+			'classification'=> (int) $row['classification']
983 983
 		];
984 984
 	}
985 985
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 	 * @param int $calendarType
997 997
 	 * @return array
998 998
 	 */
999
-	public function getMultipleCalendarObjects($id, array $uris, $calendarType=self::CALENDAR_TYPE_CALENDAR):array {
999
+	public function getMultipleCalendarObjects($id, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1000 1000
 		if (empty($uris)) {
1001 1001
 			return [];
1002 1002
 		}
@@ -1020,12 +1020,12 @@  discard block
 block discarded – undo
1020 1020
 					'id'           => $row['id'],
1021 1021
 					'uri'          => $row['uri'],
1022 1022
 					'lastmodified' => $row['lastmodified'],
1023
-					'etag'         => '"' . $row['etag'] . '"',
1023
+					'etag'         => '"'.$row['etag'].'"',
1024 1024
 					'calendarid'   => $row['calendarid'],
1025
-					'size'         => (int)$row['size'],
1025
+					'size'         => (int) $row['size'],
1026 1026
 					'calendardata' => $this->readBlob($row['calendardata']),
1027 1027
 					'component'    => strtolower($row['componenttype']),
1028
-					'classification' => (int)$row['classification']
1028
+					'classification' => (int) $row['classification']
1029 1029
 				];
1030 1030
 			}
1031 1031
 			$result->closeCursor();
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
 	 * @param int $calendarType
1054 1054
 	 * @return string
1055 1055
 	 */
1056
-	function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
1056
+	function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1057 1057
 		$extraData = $this->getDenormalizedData($calendarData);
1058 1058
 
1059 1059
 		$q = $this->db->getQueryBuilder();
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 		}
1115 1115
 		$this->addChange($calendarId, $objectUri, 1, $calendarType);
1116 1116
 
1117
-		return '"' . $extraData['etag'] . '"';
1117
+		return '"'.$extraData['etag'].'"';
1118 1118
 	}
1119 1119
 
1120 1120
 	/**
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 	 * @param int $calendarType
1137 1137
 	 * @return string
1138 1138
 	 */
1139
-	function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
1139
+	function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1140 1140
 		$extraData = $this->getDenormalizedData($calendarData);
1141 1141
 		$query = $this->db->getQueryBuilder();
1142 1142
 		$query->update('calendarobjects')
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 		}
1183 1183
 		$this->addChange($calendarId, $objectUri, 2, $calendarType);
1184 1184
 
1185
-		return '"' . $extraData['etag'] . '"';
1185
+		return '"'.$extraData['etag'].'"';
1186 1186
 	}
1187 1187
 
1188 1188
 	/**
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 	 * @param int $calendarType
1213 1213
 	 * @return void
1214 1214
 	 */
1215
-	function deleteCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
1215
+	function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1216 1216
 		$data = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1217 1217
 		if (is_array($data)) {
1218 1218
 			if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
@@ -1298,7 +1298,7 @@  discard block
 block discarded – undo
1298 1298
 	 * @param int $calendarType
1299 1299
 	 * @return array
1300 1300
 	 */
1301
-	public function calendarQuery($id, array $filters, $calendarType=self::CALENDAR_TYPE_CALENDAR):array {
1301
+	public function calendarQuery($id, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1302 1302
 		$componentType = null;
1303 1303
 		$requirePostFilter = true;
1304 1304
 		$timeRange = null;
@@ -1352,13 +1352,13 @@  discard block
 block discarded – undo
1352 1352
 		$stmt = $query->execute();
1353 1353
 
1354 1354
 		$result = [];
1355
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1355
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1356 1356
 			if ($requirePostFilter) {
1357 1357
 				// validateFilterForObject will parse the calendar data
1358 1358
 				// catch parsing errors
1359 1359
 				try {
1360 1360
 					$matches = $this->validateFilterForObject($row, $filters);
1361
-				} catch(ParseException $ex) {
1361
+				} catch (ParseException $ex) {
1362 1362
 					$this->logger->logException($ex, [
1363 1363
 						'app' => 'dav',
1364 1364
 						'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri']
@@ -1393,14 +1393,14 @@  discard block
 block discarded – undo
1393 1393
 	 * @param integer|null $offset
1394 1394
 	 * @return array
1395 1395
 	 */
1396
-	public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) {
1396
+	public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) {
1397 1397
 		$calendars = $this->getCalendarsForUser($principalUri);
1398 1398
 		$ownCalendars = [];
1399 1399
 		$sharedCalendars = [];
1400 1400
 
1401 1401
 		$uriMapper = [];
1402 1402
 
1403
-		foreach($calendars as $calendar) {
1403
+		foreach ($calendars as $calendar) {
1404 1404
 			if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) {
1405 1405
 				$ownCalendars[] = $calendar['id'];
1406 1406
 			} else {
@@ -1415,14 +1415,14 @@  discard block
 block discarded – undo
1415 1415
 		$query = $this->db->getQueryBuilder();
1416 1416
 		// Calendar id expressions
1417 1417
 		$calendarExpressions = [];
1418
-		foreach($ownCalendars as $id) {
1418
+		foreach ($ownCalendars as $id) {
1419 1419
 			$calendarExpressions[] = $query->expr()->andX(
1420 1420
 				$query->expr()->eq('c.calendarid',
1421 1421
 					$query->createNamedParameter($id)),
1422 1422
 				$query->expr()->eq('c.calendartype',
1423 1423
 						$query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1424 1424
 		}
1425
-		foreach($sharedCalendars as $id) {
1425
+		foreach ($sharedCalendars as $id) {
1426 1426
 			$calendarExpressions[] = $query->expr()->andX(
1427 1427
 				$query->expr()->eq('c.calendarid',
1428 1428
 					$query->createNamedParameter($id)),
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 
1441 1441
 		// Component expressions
1442 1442
 		$compExpressions = [];
1443
-		foreach($filters['comps'] as $comp) {
1443
+		foreach ($filters['comps'] as $comp) {
1444 1444
 			$compExpressions[] = $query->expr()
1445 1445
 				->eq('c.componenttype', $query->createNamedParameter($comp));
1446 1446
 		}
@@ -1459,13 +1459,13 @@  discard block
 block discarded – undo
1459 1459
 		}
1460 1460
 
1461 1461
 		$propParamExpressions = [];
1462
-		foreach($filters['props'] as $prop) {
1462
+		foreach ($filters['props'] as $prop) {
1463 1463
 			$propParamExpressions[] = $query->expr()->andX(
1464 1464
 				$query->expr()->eq('i.name', $query->createNamedParameter($prop)),
1465 1465
 				$query->expr()->isNull('i.parameter')
1466 1466
 			);
1467 1467
 		}
1468
-		foreach($filters['params'] as $param) {
1468
+		foreach ($filters['params'] as $param) {
1469 1469
 			$propParamExpressions[] = $query->expr()->andX(
1470 1470
 				$query->expr()->eq('i.name', $query->createNamedParameter($param['property'])),
1471 1471
 				$query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter']))
@@ -1497,8 +1497,8 @@  discard block
 block discarded – undo
1497 1497
 		$stmt = $query->execute();
1498 1498
 
1499 1499
 		$result = [];
1500
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1501
-			$path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
1500
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1501
+			$path = $uriMapper[$row['calendarid']].'/'.$row['uri'];
1502 1502
 			if (!in_array($path, $result)) {
1503 1503
 				$result[] = $path;
1504 1504
 			}
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
 		}
1539 1539
 
1540 1540
 		$or = $innerQuery->expr()->orX();
1541
-		foreach($searchProperties as $searchProperty) {
1541
+		foreach ($searchProperties as $searchProperty) {
1542 1542
 			$or->add($innerQuery->expr()->eq('op.name',
1543 1543
 				$outerQuery->createNamedParameter($searchProperty)));
1544 1544
 		}
@@ -1546,8 +1546,8 @@  discard block
 block discarded – undo
1546 1546
 
1547 1547
 		if ($pattern !== '') {
1548 1548
 			$innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
1549
-				$outerQuery->createNamedParameter('%' .
1550
-					$this->db->escapeLikeParameter($pattern) . '%')));
1549
+				$outerQuery->createNamedParameter('%'.
1550
+					$this->db->escapeLikeParameter($pattern).'%')));
1551 1551
 		}
1552 1552
 
1553 1553
 		$outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
 
1568 1568
 		if (isset($options['types'])) {
1569 1569
 			$or = $outerQuery->expr()->orX();
1570
-			foreach($options['types'] as $type) {
1570
+			foreach ($options['types'] as $type) {
1571 1571
 				$or->add($outerQuery->expr()->eq('componenttype',
1572 1572
 					$outerQuery->createNamedParameter($type)));
1573 1573
 			}
@@ -1587,12 +1587,12 @@  discard block
 block discarded – undo
1587 1587
 		$result = $outerQuery->execute();
1588 1588
 		$calendarObjects = $result->fetchAll();
1589 1589
 
1590
-		return array_map(function ($o) {
1590
+		return array_map(function($o) {
1591 1591
 			$calendarData = Reader::read($o['calendardata']);
1592 1592
 			$comps = $calendarData->getComponents();
1593 1593
 			$objects = [];
1594 1594
 			$timezones = [];
1595
-			foreach($comps as $comp) {
1595
+			foreach ($comps as $comp) {
1596 1596
 				if ($comp instanceof VTimeZone) {
1597 1597
 					$timezones[] = $comp;
1598 1598
 				} else {
@@ -1605,10 +1605,10 @@  discard block
 block discarded – undo
1605 1605
 				'type' => $o['componenttype'],
1606 1606
 				'uid' => $o['uid'],
1607 1607
 				'uri' => $o['uri'],
1608
-				'objects' => array_map(function ($c) {
1608
+				'objects' => array_map(function($c) {
1609 1609
 					return $this->transformSearchData($c);
1610 1610
 				}, $objects),
1611
-				'timezones' => array_map(function ($c) {
1611
+				'timezones' => array_map(function($c) {
1612 1612
 					return $this->transformSearchData($c);
1613 1613
 				}, $timezones),
1614 1614
 			];
@@ -1624,12 +1624,12 @@  discard block
 block discarded – undo
1624 1624
 		/** @var Component[] $subComponents */
1625 1625
 		$subComponents = $comp->getComponents();
1626 1626
 		/** @var Property[] $properties */
1627
-		$properties = array_filter($comp->children(), function ($c) {
1627
+		$properties = array_filter($comp->children(), function($c) {
1628 1628
 			return $c instanceof Property;
1629 1629
 		});
1630 1630
 		$validationRules = $comp->getValidationRules();
1631 1631
 
1632
-		foreach($subComponents as $subComponent) {
1632
+		foreach ($subComponents as $subComponent) {
1633 1633
 			$name = $subComponent->name;
1634 1634
 			if (!isset($data[$name])) {
1635 1635
 				$data[$name] = [];
@@ -1637,7 +1637,7 @@  discard block
 block discarded – undo
1637 1637
 			$data[$name][] = $this->transformSearchData($subComponent);
1638 1638
 		}
1639 1639
 
1640
-		foreach($properties as $property) {
1640
+		foreach ($properties as $property) {
1641 1641
 			$name = $property->name;
1642 1642
 			if (!isset($validationRules[$name])) {
1643 1643
 				$validationRules[$name] = '*';
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
 		$stmt = $query->execute();
1709 1709
 
1710 1710
 		if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1711
-			return $row['calendaruri'] . '/' . $row['objecturi'];
1711
+			return $row['calendaruri'].'/'.$row['objecturi'];
1712 1712
 		}
1713 1713
 
1714 1714
 		return null;
@@ -1771,10 +1771,10 @@  discard block
 block discarded – undo
1771 1771
 	 * @param int $calendarType
1772 1772
 	 * @return array
1773 1773
 	 */
1774
-	function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
1774
+	function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1775 1775
 		// Current synctoken
1776 1776
 		$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
1777
-		$stmt->execute([ $calendarId ]);
1777
+		$stmt->execute([$calendarId]);
1778 1778
 		$currentToken = $stmt->fetchColumn(0);
1779 1779
 
1780 1780
 		if (is_null($currentToken)) {
@@ -1791,8 +1791,8 @@  discard block
 block discarded – undo
1791 1791
 		if ($syncToken) {
1792 1792
 
1793 1793
 			$query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? AND `calendartype` = ? ORDER BY `synctoken`";
1794
-			if ($limit>0) {
1795
-				$query.= " LIMIT " . (int)$limit;
1794
+			if ($limit > 0) {
1795
+				$query .= " LIMIT ".(int) $limit;
1796 1796
 			}
1797 1797
 
1798 1798
 			// Fetching all changes
@@ -1803,15 +1803,15 @@  discard block
 block discarded – undo
1803 1803
 
1804 1804
 			// This loop ensures that any duplicates are overwritten, only the
1805 1805
 			// last change on a node is relevant.
1806
-			while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1806
+			while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1807 1807
 
1808 1808
 				$changes[$row['uri']] = $row['operation'];
1809 1809
 
1810 1810
 			}
1811 1811
 
1812
-			foreach($changes as $uri => $operation) {
1812
+			foreach ($changes as $uri => $operation) {
1813 1813
 
1814
-				switch($operation) {
1814
+				switch ($operation) {
1815 1815
 					case 1:
1816 1816
 						$result['added'][] = $uri;
1817 1817
 						break;
@@ -1882,10 +1882,10 @@  discard block
 block discarded – undo
1882 1882
 			->from('calendarsubscriptions')
1883 1883
 			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
1884 1884
 			->orderBy('calendarorder', 'asc');
1885
-		$stmt =$query->execute();
1885
+		$stmt = $query->execute();
1886 1886
 
1887 1887
 		$subscriptions = [];
1888
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1888
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1889 1889
 
1890 1890
 			$subscription = [
1891 1891
 				'id'           => $row['id'],
@@ -1894,11 +1894,11 @@  discard block
 block discarded – undo
1894 1894
 				'source'       => $row['source'],
1895 1895
 				'lastmodified' => $row['lastmodified'],
1896 1896
 
1897
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
1898
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
1897
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
1898
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
1899 1899
 			];
1900 1900
 
1901
-			foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1901
+			foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1902 1902
 				if (!is_null($row[$dbName])) {
1903 1903
 					$subscription[$xmlName] = $row[$dbName];
1904 1904
 				}
@@ -1937,7 +1937,7 @@  discard block
 block discarded – undo
1937 1937
 
1938 1938
 		$propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
1939 1939
 
1940
-		foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1940
+		foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1941 1941
 			if (array_key_exists($xmlName, $properties)) {
1942 1942
 					$values[$dbName] = $properties[$xmlName];
1943 1943
 					if (in_array($dbName, $propertiesBoolean)) {
@@ -1993,11 +1993,11 @@  discard block
 block discarded – undo
1993 1993
 		/**
1994 1994
 		 * @suppress SqlInjectionChecker
1995 1995
 		 */
1996
-		$propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
1996
+		$propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) {
1997 1997
 
1998 1998
 			$newValues = [];
1999 1999
 
2000
-			foreach($mutations as $propertyName=>$propertyValue) {
2000
+			foreach ($mutations as $propertyName=>$propertyValue) {
2001 2001
 				if ($propertyName === '{http://calendarserver.org/ns/}source') {
2002 2002
 					$newValues['source'] = $propertyValue->getHref();
2003 2003
 				} else {
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
 			$query = $this->db->getQueryBuilder();
2010 2010
 			$query->update('calendarsubscriptions')
2011 2011
 				->set('lastmodified', $query->createNamedParameter(time()));
2012
-			foreach($newValues as $fieldName=>$value) {
2012
+			foreach ($newValues as $fieldName=>$value) {
2013 2013
 				$query->set($fieldName, $query->createNamedParameter($value));
2014 2014
 			}
2015 2015
 			$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
@@ -2090,7 +2090,7 @@  discard block
 block discarded – undo
2090 2090
 
2091 2091
 		$row = $stmt->fetch(\PDO::FETCH_ASSOC);
2092 2092
 
2093
-		if(!$row) {
2093
+		if (!$row) {
2094 2094
 			return null;
2095 2095
 		}
2096 2096
 
@@ -2098,8 +2098,8 @@  discard block
 block discarded – undo
2098 2098
 			'uri'          => $row['uri'],
2099 2099
 			'calendardata' => $row['calendardata'],
2100 2100
 			'lastmodified' => $row['lastmodified'],
2101
-			'etag'         => '"' . $row['etag'] . '"',
2102
-			'size'         => (int)$row['size'],
2101
+			'etag'         => '"'.$row['etag'].'"',
2102
+			'size'         => (int) $row['size'],
2103 2103
 		];
2104 2104
 	}
2105 2105
 
@@ -2122,13 +2122,13 @@  discard block
 block discarded – undo
2122 2122
 				->execute();
2123 2123
 
2124 2124
 		$result = [];
2125
-		foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
2125
+		foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
2126 2126
 			$result[] = [
2127 2127
 				'calendardata' => $row['calendardata'],
2128 2128
 				'uri'          => $row['uri'],
2129 2129
 				'lastmodified' => $row['lastmodified'],
2130
-				'etag'         => '"' . $row['etag'] . '"',
2131
-				'size'         => (int)$row['size'],
2130
+				'etag'         => '"'.$row['etag'].'"',
2131
+				'size'         => (int) $row['size'],
2132 2132
 			];
2133 2133
 		}
2134 2134
 
@@ -2181,14 +2181,14 @@  discard block
 block discarded – undo
2181 2181
 	 * @param int $calendarType
2182 2182
 	 * @return void
2183 2183
 	 */
2184
-	protected function addChange($calendarId, $objectUri, $operation, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
2185
-		$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
2184
+	protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2185
+		$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions';
2186 2186
 
2187 2187
 		$query = $this->db->getQueryBuilder();
2188 2188
 		$query->select('synctoken')
2189 2189
 			->from($table)
2190 2190
 			->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
2191
-		$syncToken = (int)$query->execute()->fetchColumn();
2191
+		$syncToken = (int) $query->execute()->fetchColumn();
2192 2192
 
2193 2193
 		$query = $this->db->getQueryBuilder();
2194 2194
 		$query->insert('calendarchanges')
@@ -2232,10 +2232,10 @@  discard block
 block discarded – undo
2232 2232
 		$lastOccurrence = null;
2233 2233
 		$uid = null;
2234 2234
 		$classification = self::CLASSIFICATION_PUBLIC;
2235
-		foreach($vObject->getComponents() as $component) {
2236
-			if ($component->name!=='VTIMEZONE') {
2235
+		foreach ($vObject->getComponents() as $component) {
2236
+			if ($component->name !== 'VTIMEZONE') {
2237 2237
 				$componentType = $component->name;
2238
-				$uid = (string)$component->UID;
2238
+				$uid = (string) $component->UID;
2239 2239
 				break;
2240 2240
 			}
2241 2241
 		}
@@ -2260,13 +2260,13 @@  discard block
 block discarded – undo
2260 2260
 					$lastOccurrence = $firstOccurrence;
2261 2261
 				}
2262 2262
 			} else {
2263
-				$it = new EventIterator($vObject, (string)$component->UID);
2263
+				$it = new EventIterator($vObject, (string) $component->UID);
2264 2264
 				$maxDate = new DateTime(self::MAX_DATE);
2265 2265
 				if ($it->isInfinite()) {
2266 2266
 					$lastOccurrence = $maxDate->getTimestamp();
2267 2267
 				} else {
2268 2268
 					$end = $it->getDtEnd();
2269
-					while($it->valid() && $end < $maxDate) {
2269
+					while ($it->valid() && $end < $maxDate) {
2270 2270
 						$end = $it->getDtEnd();
2271 2271
 						$it->next();
2272 2272
 
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
 	 * @param int $calendarType
2337 2337
 	 * @return array
2338 2338
 	 */
2339
-	public function getShares($resourceId, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
2339
+	public function getShares($resourceId, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2340 2340
 		return $this->calendarSharingBackend->getShares($resourceId);
2341 2341
 	}
2342 2342
 
@@ -2413,7 +2413,7 @@  discard block
 block discarded – undo
2413 2413
 	 * @param string $calendarData
2414 2414
 	 * @param int $calendarType
2415 2415
 	 */
2416
-	public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
2416
+	public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2417 2417
 		$objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType);
2418 2418
 
2419 2419
 		try {
@@ -2490,7 +2490,7 @@  discard block
 block discarded – undo
2490 2490
 			->execute();
2491 2491
 
2492 2492
 		$ids = $result->fetchAll();
2493
-		foreach($ids as $id) {
2493
+		foreach ($ids as $id) {
2494 2494
 			$this->deleteCalendar($id['id']);
2495 2495
 		}
2496 2496
 	}
@@ -2507,7 +2507,7 @@  discard block
 block discarded – undo
2507 2507
 		$stmt = $query->execute();
2508 2508
 
2509 2509
 		$uris = [];
2510
-		foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
2510
+		foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
2511 2511
 			$uris[] = $row['uri'];
2512 2512
 		}
2513 2513
 		$stmt->closeCursor();
@@ -2528,7 +2528,7 @@  discard block
 block discarded – undo
2528 2528
 			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2529 2529
 			->execute();
2530 2530
 
2531
-		foreach($uris as $uri) {
2531
+		foreach ($uris as $uri) {
2532 2532
 			$this->addChange($subscriptionId, $uri, 3, self::CALENDAR_TYPE_SUBSCRIPTION);
2533 2533
 		}
2534 2534
 	}
@@ -2595,10 +2595,10 @@  discard block
 block discarded – undo
2595 2595
 		$result->closeCursor();
2596 2596
 
2597 2597
 		if (!isset($objectIds['id'])) {
2598
-			throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri);
2598
+			throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri);
2599 2599
 		}
2600 2600
 
2601
-		return (int)$objectIds['id'];
2601
+		return (int) $objectIds['id'];
2602 2602
 	}
2603 2603
 
2604 2604
 	/**
@@ -2625,8 +2625,8 @@  discard block
 block discarded – undo
2625 2625
 	 * @param $calendarInfo
2626 2626
 	 */
2627 2627
 	private function addOwnerPrincipal(&$calendarInfo) {
2628
-		$ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
2629
-		$displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
2628
+		$ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal';
2629
+		$displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname';
2630 2630
 		if (isset($calendarInfo[$ownerPrincipalKey])) {
2631 2631
 			$uri = $calendarInfo[$ownerPrincipalKey];
2632 2632
 		} else {
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/File.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 				throw new Forbidden();
127 127
 			}
128 128
 		} catch (StorageNotAvailableException $e) {
129
-			throw new ServiceUnavailable("File is not updatable: " . $e->getMessage());
129
+			throw new ServiceUnavailable("File is not updatable: ".$e->getMessage());
130 130
 		}
131 131
 
132 132
 		// verify path of the target
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 		if ($needsPartFile) {
151 151
 			// mark file as partial while uploading (ignored by the scanner)
152
-			$partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part';
152
+			$partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part';
153 153
 
154 154
 			if (!$view->isCreatable($partFilePath) && $view->isUpdatable($this->path)) {
155 155
 				$needsPartFile = false;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 				}
187 187
 
188 188
 				$isEOF = false;
189
-				$wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function ($stream) use (&$isEOF) {
189
+				$wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function($stream) use (&$isEOF) {
190 190
 					$isEOF = feof($stream);
191 191
 				});
192 192
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 					$expected = $_SERVER['CONTENT_LENGTH'];
218 218
 				}
219 219
 				if ($expected !== "0") {
220
-					throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )');
220
+					throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )');
221 221
 				}
222 222
 			}
223 223
 
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 			// double check if the file was fully received
226 226
 			// compare expected and actual size
227 227
 			if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
228
-				$expected = (int)$_SERVER['CONTENT_LENGTH'];
228
+				$expected = (int) $_SERVER['CONTENT_LENGTH'];
229 229
 				if ($count !== $expected) {
230
-					throw new BadRequest('Expected filesize of ' . $expected . ' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) ' . $count . ' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.');
230
+					throw new BadRequest('Expected filesize of '.$expected.' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) '.$count.' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.');
231 231
 				}
232 232
 			}
233 233
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 					$renameOkay = $storage->moveFromStorage($partStorage, $internalPartPath, $internalPath);
278 278
 					$fileExists = $storage->file_exists($internalPath);
279 279
 					if ($renameOkay === false || $fileExists === false) {
280
-						\OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: ' . ($renameOkay ? 'true' : 'false') . ', $fileExists: ' . ($fileExists ? 'true' : 'false') . ')', ['app' => 'webdav']);
280
+						\OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: '.($renameOkay ? 'true' : 'false').', $fileExists: '.($fileExists ? 'true' : 'false').')', ['app' => 'webdav']);
281 281
 						throw new Exception('Could not rename part file to final file');
282 282
 					}
283 283
 				} catch (ForbiddenException $ex) {
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 			}
335 335
 
336 336
 		} catch (StorageNotAvailableException $e) {
337
-			throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage(), 0, $e);
337
+			throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage(), 0, $e);
338 338
 		}
339 339
 
340
-		return '"' . $this->info->getEtag() . '"';
340
+		return '"'.$this->info->getEtag().'"';
341 341
 	}
342 342
 
343 343
 	private function getPartFileBasePath($path) {
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
 			return $res;
425 425
 		} catch (GenericEncryptionException $e) {
426 426
 			// returning 503 will allow retry of the operation at a later point in time
427
-			throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage());
427
+			throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage());
428 428
 		} catch (StorageNotAvailableException $e) {
429
-			throw new ServiceUnavailable("Failed to open file: " . $e->getMessage());
429
+			throw new ServiceUnavailable("Failed to open file: ".$e->getMessage());
430 430
 		} catch (ForbiddenException $ex) {
431 431
 			throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry());
432 432
 		} catch (LockedException $e) {
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 				throw new Forbidden();
452 452
 			}
453 453
 		} catch (StorageNotAvailableException $e) {
454
-			throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage());
454
+			throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage());
455 455
 		} catch (ForbiddenException $ex) {
456 456
 			throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry());
457 457
 		} catch (LockedException $e) {
@@ -514,10 +514,10 @@  discard block
 block discarded – undo
514 514
 		//detect aborted upload
515 515
 		if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
516 516
 			if (isset($_SERVER['CONTENT_LENGTH'])) {
517
-				$expected = (int)$_SERVER['CONTENT_LENGTH'];
517
+				$expected = (int) $_SERVER['CONTENT_LENGTH'];
518 518
 				if ($bytesWritten !== $expected) {
519 519
 					$chunk_handler->remove($info['index']);
520
-					throw new BadRequest('Expected filesize of ' . $expected . ' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) ' . $bytesWritten . ' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.');
520
+					throw new BadRequest('Expected filesize of '.$expected.' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) '.$bytesWritten.' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.');
521 521
 				}
522 522
 			}
523 523
 		}
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 			$needsPartFile = $storage->needsPartFile();
529 529
 			$partFile = null;
530 530
 
531
-			$targetPath = $path . '/' . $info['name'];
531
+			$targetPath = $path.'/'.$info['name'];
532 532
 			/** @var \OC\Files\Storage\Storage $targetStorage */
533 533
 			list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath);
534 534
 
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 
545 545
 				if ($needsPartFile) {
546 546
 					// we first assembly the target file as a part file
547
-					$partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part';
547
+					$partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part';
548 548
 					/** @var \OC\Files\Storage\Storage $targetStorage */
549 549
 					list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile);
550 550
 
@@ -648,13 +648,13 @@  discard block
 block discarded – undo
648 648
 		}
649 649
 		if ($e instanceof GenericEncryptionException) {
650 650
 			// returning 503 will allow retry of the operation at a later point in time
651
-			throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e);
651
+			throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e);
652 652
 		}
653 653
 		if ($e instanceof StorageNotAvailableException) {
654
-			throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e);
654
+			throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e);
655 655
 		}
656 656
 		if ($e instanceof NotFoundException) {
657
-			throw new NotFound('File not found: ' . $e->getMessage(), 0, $e);
657
+			throw new NotFound('File not found: '.$e->getMessage(), 0, $e);
658 658
 		}
659 659
 
660 660
 		throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e);
Please login to merge, or discard this patch.
apps/dav/lib/CardDAV/CardDavBackend.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			->from('addressbooks')
125 125
 			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
126 126
 
127
-		return (int)$query->execute()->fetchColumn();
127
+		return (int) $query->execute()->fetchColumn();
128 128
 	}
129 129
 
130 130
 	/**
@@ -155,15 +155,15 @@  discard block
 block discarded – undo
155 155
 		$addressBooks = [];
156 156
 
157 157
 		$result = $query->execute();
158
-		while($row = $result->fetch()) {
158
+		while ($row = $result->fetch()) {
159 159
 			$addressBooks[$row['id']] = [
160 160
 				'id'  => $row['id'],
161 161
 				'uri' => $row['uri'],
162 162
 				'principaluri' => $this->convertPrincipal($row['principaluri'], false),
163 163
 				'{DAV:}displayname' => $row['displayname'],
164
-				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
164
+				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
165 165
 				'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
166
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
166
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
167 167
 			];
168 168
 
169 169
 			$this->addOwnerPrincipal($addressBooks[$row['id']]);
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 		$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
175 175
 		$principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal));
176 176
 
177
-		$principals = array_map(function ($principal) {
177
+		$principals = array_map(function($principal) {
178 178
 			return urldecode($principal);
179 179
 		}, $principals);
180
-		$principals[]= $principalUri;
180
+		$principals[] = $principalUri;
181 181
 
182 182
 		$query = $this->db->getQueryBuilder();
183 183
 		$result = $query->select(['a.id', 'a.uri', 'a.displayname', 'a.principaluri', 'a.description', 'a.synctoken', 's.access'])
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 			->setParameter('principaluri', $principals, IQueryBuilder::PARAM_STR_ARRAY)
190 190
 			->execute();
191 191
 
192
-		$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
193
-		while($row = $result->fetch()) {
192
+		$readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only';
193
+		while ($row = $result->fetch()) {
194 194
 			if ($row['principaluri'] === $principalUri) {
195 195
 				continue;
196 196
 			}
@@ -209,18 +209,18 @@  discard block
 block discarded – undo
209 209
 			}
210 210
 
211 211
 			list(, $name) = \Sabre\Uri\split($row['principaluri']);
212
-			$uri = $row['uri'] . '_shared_by_' . $name;
213
-			$displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
212
+			$uri = $row['uri'].'_shared_by_'.$name;
213
+			$displayName = $row['displayname'].' ('.$this->getUserDisplayName($name).')';
214 214
 
215 215
 			$addressBooks[$row['id']] = [
216 216
 				'id'  => $row['id'],
217 217
 				'uri' => $uri,
218 218
 				'principaluri' => $principalUriOriginal,
219 219
 				'{DAV:}displayname' => $displayName,
220
-				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
220
+				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
221 221
 				'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
222
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
223
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'],
222
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
223
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'],
224 224
 				$readOnlyPropertyName => $readOnly,
225 225
 			];
226 226
 
@@ -241,15 +241,15 @@  discard block
 block discarded – undo
241 241
 		$addressBooks = [];
242 242
 
243 243
 		$result = $query->execute();
244
-		while($row = $result->fetch()) {
244
+		while ($row = $result->fetch()) {
245 245
 			$addressBooks[$row['id']] = [
246 246
 				'id'  => $row['id'],
247 247
 				'uri' => $row['uri'],
248 248
 				'principaluri' => $this->convertPrincipal($row['principaluri'], false),
249 249
 				'{DAV:}displayname' => $row['displayname'],
250
-				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
250
+				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
251 251
 				'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
252
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
252
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
253 253
 			];
254 254
 
255 255
 			$this->addOwnerPrincipal($addressBooks[$row['id']]);
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 			'uri' => $row['uri'],
295 295
 			'principaluri' => $row['principaluri'],
296 296
 			'{DAV:}displayname' => $row['displayname'],
297
-			'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
297
+			'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
298 298
 			'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
299
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
299
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
300 300
 		];
301 301
 
302 302
 		$this->addOwnerPrincipal($addressBook);
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
 			'uri' => $row['uri'],
329 329
 			'principaluri' => $row['principaluri'],
330 330
 			'{DAV:}displayname' => $row['displayname'],
331
-			'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
331
+			'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
332 332
 			'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
333
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
333
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
334 334
 		];
335 335
 
336 336
 		$this->addOwnerPrincipal($addressBook);
@@ -357,22 +357,22 @@  discard block
 block discarded – undo
357 357
 	function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) {
358 358
 		$supportedProperties = [
359 359
 			'{DAV:}displayname',
360
-			'{' . Plugin::NS_CARDDAV . '}addressbook-description',
360
+			'{'.Plugin::NS_CARDDAV.'}addressbook-description',
361 361
 		];
362 362
 
363 363
 		/**
364 364
 		 * @suppress SqlInjectionChecker
365 365
 		 */
366
-		$propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) {
366
+		$propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) {
367 367
 
368 368
 			$updates = [];
369
-			foreach($mutations as $property=>$newValue) {
369
+			foreach ($mutations as $property=>$newValue) {
370 370
 
371
-				switch($property) {
371
+				switch ($property) {
372 372
 					case '{DAV:}displayname':
373 373
 						$updates['displayname'] = $newValue;
374 374
 						break;
375
-					case '{' . Plugin::NS_CARDDAV . '}addressbook-description':
375
+					case '{'.Plugin::NS_CARDDAV.'}addressbook-description':
376 376
 						$updates['description'] = $newValue;
377 377
 						break;
378 378
 				}
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 			$query = $this->db->getQueryBuilder();
381 381
 			$query->update('addressbooks');
382 382
 
383
-			foreach($updates as $key=>$value) {
383
+			foreach ($updates as $key=>$value) {
384 384
 				$query->set($key, $query->createNamedParameter($value));
385 385
 			}
386 386
 			$query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId)))
@@ -411,24 +411,24 @@  discard block
 block discarded – undo
411 411
 			'synctoken' => 1
412 412
 		];
413 413
 
414
-		foreach($properties as $property=>$newValue) {
414
+		foreach ($properties as $property=>$newValue) {
415 415
 
416
-			switch($property) {
416
+			switch ($property) {
417 417
 				case '{DAV:}displayname':
418 418
 					$values['displayname'] = $newValue;
419 419
 					break;
420
-				case '{' . Plugin::NS_CARDDAV . '}addressbook-description':
420
+				case '{'.Plugin::NS_CARDDAV.'}addressbook-description':
421 421
 					$values['description'] = $newValue;
422 422
 					break;
423 423
 				default:
424
-					throw new BadRequest('Unknown property: ' . $property);
424
+					throw new BadRequest('Unknown property: '.$property);
425 425
 			}
426 426
 
427 427
 		}
428 428
 
429 429
 		// Fallback to make sure the displayname is set. Some clients may refuse
430 430
 		// to work with addressbooks not having a displayname.
431
-		if(is_null($values['displayname'])) {
431
+		if (is_null($values['displayname'])) {
432 432
 			$values['displayname'] = $url;
433 433
 		}
434 434
 
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 		$cards = [];
507 507
 
508 508
 		$result = $query->execute();
509
-		while($row = $result->fetch()) {
510
-			$row['etag'] = '"' . $row['etag'] . '"';
509
+		while ($row = $result->fetch()) {
510
+			$row['etag'] = '"'.$row['etag'].'"';
511 511
 			$row['carddata'] = $this->readBlob($row['carddata']);
512 512
 			$cards[] = $row;
513 513
 		}
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 		if (!$row) {
542 542
 			return false;
543 543
 		}
544
-		$row['etag'] = '"' . $row['etag'] . '"';
544
+		$row['etag'] = '"'.$row['etag'].'"';
545 545
 		$row['carddata'] = $this->readBlob($row['carddata']);
546 546
 
547 547
 		return $row;
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 			$result = $query->execute();
579 579
 
580 580
 			while ($row = $result->fetch()) {
581
-				$row['etag'] = '"' . $row['etag'] . '"';
581
+				$row['etag'] = '"'.$row['etag'].'"';
582 582
 				$row['carddata'] = $this->readBlob($row['carddata']);
583 583
 				$cards[] = $row;
584 584
 			}
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 				'cardUri' => $cardUri,
652 652
 				'cardData' => $cardData]));
653 653
 
654
-		return '"' . $etag . '"';
654
+		return '"'.$etag.'"';
655 655
 	}
656 656
 
657 657
 	/**
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 				'cardUri' => $cardUri,
704 704
 				'cardData' => $cardData]));
705 705
 
706
-		return '"' . $etag . '"';
706
+		return '"'.$etag.'"';
707 707
 	}
708 708
 
709 709
 	/**
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) {
802 802
 		// Current synctoken
803 803
 		$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?');
804
-		$stmt->execute([ $addressBookId ]);
804
+		$stmt->execute([$addressBookId]);
805 805
 		$currentToken = $stmt->fetchColumn(0);
806 806
 
807 807
 		if (is_null($currentToken)) return null;
@@ -816,8 +816,8 @@  discard block
 block discarded – undo
816 816
 		if ($syncToken) {
817 817
 
818 818
 			$query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`";
819
-			if ($limit>0) {
820
-				$query .= " LIMIT " . (int)$limit;
819
+			if ($limit > 0) {
820
+				$query .= " LIMIT ".(int) $limit;
821 821
 			}
822 822
 
823 823
 			// Fetching all changes
@@ -828,15 +828,15 @@  discard block
 block discarded – undo
828 828
 
829 829
 			// This loop ensures that any duplicates are overwritten, only the
830 830
 			// last change on a node is relevant.
831
-			while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
831
+			while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
832 832
 
833 833
 				$changes[$row['uri']] = $row['operation'];
834 834
 
835 835
 			}
836 836
 
837
-			foreach($changes as $uri => $operation) {
837
+			foreach ($changes as $uri => $operation) {
838 838
 
839
-				switch($operation) {
839
+				switch ($operation) {
840 840
 					case 1:
841 841
 						$result['added'][] = $uri;
842 842
 						break;
@@ -924,10 +924,10 @@  discard block
 block discarded – undo
924 924
 
925 925
 		// No need for like when the pattern is empty
926 926
 		if ('' !== $pattern) {
927
-			if(\array_key_exists('escape_like_param', $options) && $options['escape_like_param'] === false) {
927
+			if (\array_key_exists('escape_like_param', $options) && $options['escape_like_param'] === false) {
928 928
 				$query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter($pattern)));
929 929
 			} else {
930
-				$query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
930
+				$query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%')));
931 931
 			}
932 932
 		}
933 933
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 
940 940
 		$result->closeCursor();
941 941
 
942
-		return array_map(function ($array) {
942
+		return array_map(function($array) {
943 943
 			$array['carddata'] = $this->readBlob($array['carddata']);
944 944
 			return $array;
945 945
 		}, $cards);
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 		$result->closeCursor();
982 982
 
983 983
 		if (!isset($uri['uri'])) {
984
-			throw new \InvalidArgumentException('Card does not exists: ' . $id);
984
+			throw new \InvalidArgumentException('Card does not exists: '.$id);
985 985
 		}
986 986
 
987 987
 		return $uri['uri'];
@@ -1053,11 +1053,11 @@  discard block
 block discarded – undo
1053 1053
 			);
1054 1054
 
1055 1055
 		foreach ($vCard->children() as $property) {
1056
-			if(!in_array($property->name, self::$indexProperties)) {
1056
+			if (!in_array($property->name, self::$indexProperties)) {
1057 1057
 				continue;
1058 1058
 			}
1059 1059
 			$preferred = 0;
1060
-			foreach($property->parameters as $parameter) {
1060
+			foreach ($property->parameters as $parameter) {
1061 1061
 				if ($parameter->name === 'TYPE' && strtoupper($parameter->getValue()) === 'PREF') {
1062 1062
 					$preferred = 1;
1063 1063
 					break;
@@ -1112,10 +1112,10 @@  discard block
 block discarded – undo
1112 1112
 		$result->closeCursor();
1113 1113
 
1114 1114
 		if (!isset($cardIds['id'])) {
1115
-			throw new \InvalidArgumentException('Card does not exists: ' . $uri);
1115
+			throw new \InvalidArgumentException('Card does not exists: '.$uri);
1116 1116
 		}
1117 1117
 
1118
-		return (int)$cardIds['id'];
1118
+		return (int) $cardIds['id'];
1119 1119
 	}
1120 1120
 
1121 1121
 	/**
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
 	}
1141 1141
 
1142 1142
 	private function addOwnerPrincipal(&$addressbookInfo) {
1143
-		$ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
1144
-		$displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
1143
+		$ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal';
1144
+		$displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname';
1145 1145
 		if (isset($addressbookInfo[$ownerPrincipalKey])) {
1146 1146
 			$uri = $addressbookInfo[$ownerPrincipalKey];
1147 1147
 		} else {
Please login to merge, or discard this patch.
apps/files/templates/list.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 	*/ ?>
13 13
 	<input type="hidden" name="permissions" value="" id="permissions">
14 14
 	<input type="hidden" id="free_space" value="<?php isset($_['freeSpace']) ? p($_['freeSpace']) : '' ?>">
15
-	<?php if(isset($_['dirToken'])):?>
15
+	<?php if (isset($_['dirToken'])):?>
16 16
 	<input type="hidden" id="publicUploadRequestToken" name="requesttoken" value="<?php p($_['requesttoken']) ?>" />
17 17
 	<input type="hidden" id="dirToken" name="dirToken" value="<?php p($_['dirToken']) ?>" />
18
-	<?php endif;?>
18
+	<?php endif; ?>
19 19
 	<input type="hidden" class="max_human_file_size"
20 20
 		   value="(max <?php isset($_['uploadMaxHumanFilesize']) ? p($_['uploadMaxHumanFilesize']) : ''; ?>)">
21 21
 </div>
@@ -77,6 +77,6 @@  discard block
 block discarded – undo
77 77
 <div id="editor"></div><!-- FIXME Do not use this div in your app! It is deprecated and will be removed in the future! -->
78 78
 <div id="uploadsize-message" title="<?php p($l->t('Upload too large'))?>">
79 79
 	<p>
80
-	<?php p($l->t('The files you are trying to upload exceed the maximum size for file uploads on this server.'));?>
80
+	<?php p($l->t('The files you are trying to upload exceed the maximum size for file uploads on this server.')); ?>
81 81
 	</p>
82 82
 </div>
Please login to merge, or discard this patch.
apps/files/lib/Command/Scan.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		$path = basename($fullPath);
111 111
 
112 112
 		if ($normalizedPath !== $path) {
113
-			$output->writeln("\t<error>Entry \"" . $fullPath . '" will not be accessible due to incompatible encoding</error>');
113
+			$output->writeln("\t<error>Entry \"".$fullPath.'" will not be accessible due to incompatible encoding</error>');
114 114
 		}
115 115
 	}
116 116
 
@@ -120,27 +120,27 @@  discard block
 block discarded – undo
120 120
 
121 121
 		# check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception
122 122
 
123
-		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) {
123
+		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) {
124 124
 			$output->writeln("\tFile\t<info>$path</info>", OutputInterface::VERBOSITY_VERBOSE);
125 125
 			++$this->filesCounter;
126 126
 			$this->abortIfInterrupted();
127 127
 		});
128 128
 
129
-		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) {
129
+		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function($path) use ($output) {
130 130
 			$output->writeln("\tFolder\t<info>$path</info>", OutputInterface::VERBOSITY_VERBOSE);
131 131
 			++$this->foldersCounter;
132 132
 			$this->abortIfInterrupted();
133 133
 		});
134 134
 
135
-		$scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output) {
136
-			$output->writeln('Error while scanning, storage not available (' . $e->getMessage() . ')', OutputInterface::VERBOSITY_VERBOSE);
135
+		$scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function(StorageNotAvailableException $e) use ($output) {
136
+			$output->writeln('Error while scanning, storage not available ('.$e->getMessage().')', OutputInterface::VERBOSITY_VERBOSE);
137 137
 		});
138 138
 
139
-		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) {
139
+		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) {
140 140
 			$this->checkScanWarning($path, $output);
141 141
 		});
142 142
 
143
-		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) {
143
+		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function($path) use ($output) {
144 144
 			$this->checkScanWarning($path, $output);
145 145
 		});
146 146
 
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 			# exit the function if ctrl-c has been pressed
158 158
 			$output->writeln('Interrupted by user');
159 159
 		} catch (NotFoundException $e) {
160
-			$output->writeln('<error>Path not found: ' . $e->getMessage() . '</error>');
160
+			$output->writeln('<error>Path not found: '.$e->getMessage().'</error>');
161 161
 		} catch (\Exception $e) {
162
-			$output->writeln('<error>Exception during scan: ' . $e->getMessage() . '</error>');
163
-			$output->writeln('<error>' . $e->getTraceAsString() . '</error>');
162
+			$output->writeln('<error>Exception during scan: '.$e->getMessage().'</error>');
163
+			$output->writeln('<error>'.$e->getTraceAsString().'</error>');
164 164
 		}
165 165
 	}
166 166
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	protected function execute(InputInterface $input, OutputInterface $output) {
173 173
 		$inputPath = $input->getOption('path');
174 174
 		if ($inputPath) {
175
-			$inputPath = '/' . trim($inputPath, '/');
175
+			$inputPath = '/'.trim($inputPath, '/');
176 176
 			list(, $user,) = explode('/', $inputPath, 3);
177 177
 			$users = [$user];
178 178
 		} else if ($input->getOption('all')) {
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			if (is_object($user)) {
201 201
 				$user = $user->getUID();
202 202
 			}
203
-			$path = $inputPath ? $inputPath : '/' . $user;
203
+			$path = $inputPath ? $inputPath : '/'.$user;
204 204
 			++$user_count;
205 205
 			if ($this->userManager->userExists($user)) {
206 206
 				$output->writeln("Starting scan for user $user_count out of $users_total ($user)");
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	protected function formatExecTime() {
298 298
 		$secs = round($this->execTime);
299 299
 		# convert seconds into HH:MM:SS form
300
-		return sprintf('%02d:%02d:%02d', ($secs/3600), ($secs/60%60), $secs%60);
300
+		return sprintf('%02d:%02d:%02d', ($secs / 3600), ($secs / 60 % 60), $secs % 60);
301 301
 	}
302 302
 
303 303
 	/**
Please login to merge, or discard this patch.
apps/settings/templates/settings/admin/sharing.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -27,82 +27,82 @@  discard block
 block discarded – undo
27 27
 ?>
28 28
 
29 29
 <div class="section" id="shareAPI">
30
-	<h2><?php p($l->t('Sharing'));?></h2>
30
+	<h2><?php p($l->t('Sharing')); ?></h2>
31 31
 	<a target="_blank" rel="noreferrer noopener" class="icon-info"
32
-	   title="<?php p($l->t('Open documentation'));?>"
32
+	   title="<?php p($l->t('Open documentation')); ?>"
33 33
 	   href="<?php p(link_to_docs('admin-sharing')); ?>"></a>
34
-        <p class="settings-hint"><?php p($l->t('As admin you can fine-tune the sharing behavior. Please see the documentation for more information.'));?></p>
34
+        <p class="settings-hint"><?php p($l->t('As admin you can fine-tune the sharing behavior. Please see the documentation for more information.')); ?></p>
35 35
 	<p id="enable">
36 36
 		<input type="checkbox" name="shareapi_enabled" id="shareAPIEnabled" class="checkbox"
37 37
 			   value="1" <?php if ($_['shareAPIEnabled'] === 'yes') print_unescaped('checked="checked"'); ?> />
38
-		<label for="shareAPIEnabled"><?php p($l->t('Allow apps to use the Share API'));?></label><br/>
38
+		<label for="shareAPIEnabled"><?php p($l->t('Allow apps to use the Share API')); ?></label><br/>
39 39
 	</p>
40 40
 
41 41
 	<p id="internalShareSettings" class="indent <?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
42 42
 		<input type="checkbox" name="shareapi_default_internal_expire_date" id="shareapiDefaultInternalExpireDate" class="checkbox"
43 43
 			   value="1" <?php if ($_['shareDefaultInternalExpireDateSet'] === 'yes') print_unescaped('checked="checked"'); ?> />
44
-		<label for="shareapiDefaultInternalExpireDate"><?php p($l->t('Set default expiration date for shares'));?></label><br/>
44
+		<label for="shareapiDefaultInternalExpireDate"><?php p($l->t('Set default expiration date for shares')); ?></label><br/>
45 45
 	</p>
46
-	<p id="setDefaultInternalExpireDate" class="double-indent <?php if ($_['shareDefaultInternalExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') p('hidden');?>">
46
+	<p id="setDefaultInternalExpireDate" class="double-indent <?php if ($_['shareDefaultInternalExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
47 47
 		<?php p($l->t('Expire after ')); ?>
48 48
 		<input type="text" name='shareapi_internal_expire_after_n_days' id="shareapiInternalExpireAfterNDays" placeholder="<?php p('7')?>"
49 49
 			   value='<?php p($_['shareInternalExpireAfterNDays']) ?>' />
50 50
 		<?php p($l->t('days')); ?>
51 51
 		<input type="checkbox" name="shareapi_internal_enforce_expire_date" id="shareapiInternalEnforceExpireDate" class="checkbox"
52 52
 			   value="1" <?php if ($_['shareInternalEnforceExpireDate'] === 'yes') print_unescaped('checked="checked"'); ?> />
53
-		<label for="shareapiInternalEnforceExpireDate"><?php p($l->t('Enforce expiration date'));?></label><br/>
53
+		<label for="shareapiInternalEnforceExpireDate"><?php p($l->t('Enforce expiration date')); ?></label><br/>
54 54
 	</p>
55 55
 
56
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
56
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
57 57
 		<input type="checkbox" name="shareapi_allow_links" id="allowLinks" class="checkbox"
58 58
 			   value="1" <?php if ($_['allowLinks'] === 'yes') print_unescaped('checked="checked"'); ?> />
59
-		<label for="allowLinks"><?php p($l->t('Allow users to share via link'));?></label><br/>
59
+		<label for="allowLinks"><?php p($l->t('Allow users to share via link')); ?></label><br/>
60 60
 	</p>
61 61
 
62 62
 	<p id="publicLinkSettings" class="indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
63 63
 		<input type="checkbox" name="shareapi_allow_public_upload" id="allowPublicUpload" class="checkbox"
64 64
 			   value="1" <?php if ($_['allowPublicUpload'] == 'yes') print_unescaped('checked="checked"'); ?> />
65
-		<label for="allowPublicUpload"><?php p($l->t('Allow public uploads'));?></label><br/>
65
+		<label for="allowPublicUpload"><?php p($l->t('Allow public uploads')); ?></label><br/>
66 66
 		<input type="checkbox" name="shareapi_enable_link_password_by_default" id="enableLinkPasswordByDefault" class="checkbox"
67 67
 			   value="1" <?php if ($_['enableLinkPasswordByDefault'] === 'yes') print_unescaped('checked="checked"'); ?> />
68
-		<label for="enableLinkPasswordByDefault"><?php p($l->t('Always ask for a password'));?></label><br/>
68
+		<label for="enableLinkPasswordByDefault"><?php p($l->t('Always ask for a password')); ?></label><br/>
69 69
 		<input type="checkbox" name="shareapi_enforce_links_password" id="enforceLinkPassword" class="checkbox"
70 70
 			   value="1" <?php if ($_['enforceLinkPassword']) print_unescaped('checked="checked"'); ?> />
71
-		<label for="enforceLinkPassword"><?php p($l->t('Enforce password protection'));?></label><br/>
71
+		<label for="enforceLinkPassword"><?php p($l->t('Enforce password protection')); ?></label><br/>
72 72
 
73 73
 		<input type="checkbox" name="shareapi_default_expire_date" id="shareapiDefaultExpireDate" class="checkbox"
74 74
 			   value="1" <?php if ($_['shareDefaultExpireDateSet'] === 'yes') print_unescaped('checked="checked"'); ?> />
75
-		<label for="shareapiDefaultExpireDate"><?php p($l->t('Set default expiration date for link shares'));?></label><br/>
75
+		<label for="shareapiDefaultExpireDate"><?php p($l->t('Set default expiration date for link shares')); ?></label><br/>
76 76
 
77 77
 	</p>
78
-	<p id="setDefaultExpireDate" class="double-indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareDefaultExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') p('hidden');?>">
78
+	<p id="setDefaultExpireDate" class="double-indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareDefaultExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
79 79
 		<?php p($l->t('Expire after ')); ?>
80 80
 		<input type="text" name='shareapi_expire_after_n_days' id="shareapiExpireAfterNDays" placeholder="<?php p('7')?>"
81 81
 			   value='<?php p($_['shareExpireAfterNDays']) ?>' />
82 82
 		<?php p($l->t('days')); ?>
83 83
 		<input type="checkbox" name="shareapi_enforce_expire_date" id="shareapiEnforceExpireDate" class="checkbox"
84 84
 			   value="1" <?php if ($_['shareEnforceExpireDate'] === 'yes') print_unescaped('checked="checked"'); ?> />
85
-		<label for="shareapiEnforceExpireDate"><?php p($l->t('Enforce expiration date'));?></label><br/>
85
+		<label for="shareapiEnforceExpireDate"><?php p($l->t('Enforce expiration date')); ?></label><br/>
86 86
 	</p>
87
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
87
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
88 88
 		<input type="checkbox" name="shareapi_allow_resharing" id="allowResharing" class="checkbox"
89 89
 			   value="1" <?php if ($_['allowResharing'] === 'yes') print_unescaped('checked="checked"'); ?> />
90
-		<label for="allowResharing"><?php p($l->t('Allow resharing'));?></label><br/>
90
+		<label for="allowResharing"><?php p($l->t('Allow resharing')); ?></label><br/>
91 91
 	</p>
92
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
92
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
93 93
 		<input type="checkbox" name="shareapi_allow_group_sharing" id="allowGroupSharing" class="checkbox"
94 94
 			   value="1" <?php if ($_['allowGroupSharing'] === 'yes') print_unescaped('checked="checked"'); ?> />
95
-		<label for="allowGroupSharing"><?php p($l->t('Allow sharing with groups'));?></label><br />
95
+		<label for="allowGroupSharing"><?php p($l->t('Allow sharing with groups')); ?></label><br />
96 96
 	</p>
97
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
97
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
98 98
 		<input type="checkbox" name="shareapi_only_share_with_group_members" id="onlyShareWithGroupMembers" class="checkbox"
99 99
 			   value="1" <?php if ($_['onlyShareWithGroupMembers']) print_unescaped('checked="checked"'); ?> />
100
-		<label for="onlyShareWithGroupMembers"><?php p($l->t('Restrict users to only share with users in their groups'));?></label><br/>
100
+		<label for="onlyShareWithGroupMembers"><?php p($l->t('Restrict users to only share with users in their groups')); ?></label><br/>
101 101
 	</p>
102
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
102
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
103 103
 		<input type="checkbox" name="shareapi_exclude_groups" id="shareapiExcludeGroups" class="checkbox"
104 104
 			   value="1" <?php if ($_['shareExcludeGroups']) print_unescaped('checked="checked"'); ?> />
105
-		<label for="shareapiExcludeGroups"><?php p($l->t('Exclude groups from sharing'));?></label><br/>
105
+		<label for="shareapiExcludeGroups"><?php p($l->t('Exclude groups from sharing')); ?></label><br/>
106 106
 	</p>
107 107
 	<p id="selectExcludedGroups" class="indent <?php if (!$_['shareExcludeGroups'] || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
108 108
 		<input name="shareapi_exclude_groups_list" type="hidden" id="excludedGroups" value="<?php p($_['shareExcludedGroupsList']) ?>" style="width: 400px" class="noJSAutoUpdate"/>
@@ -110,35 +110,35 @@  discard block
 block discarded – undo
110 110
 		<em><?php p($l->t('These groups will still be able to receive shares, but not to initiate them.')); ?></em>
111 111
 	</p>
112 112
 
113
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
113
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
114 114
 		<input type="checkbox" name="shareapi_allow_share_dialog_user_enumeration" value="1" id="shareapi_allow_share_dialog_user_enumeration" class="checkbox"
115 115
 			<?php if ($_['allowShareDialogUserEnumeration'] === 'yes') print_unescaped('checked="checked"'); ?> />
116
-		<label for="shareapi_allow_share_dialog_user_enumeration"><?php p($l->t('Allow username autocompletion in share dialog. If this is disabled the full username or email address needs to be entered.'));?></label><br />
116
+		<label for="shareapi_allow_share_dialog_user_enumeration"><?php p($l->t('Allow username autocompletion in share dialog. If this is disabled the full username or email address needs to be entered.')); ?></label><br />
117 117
 	</p>
118 118
 
119
-	<p id="shareapi_restrict_user_enumeration_to_group_setting" class="indent <?php if ($_['shareAPIEnabled'] === 'no' || $_['allowShareDialogUserEnumeration'] === 'no') p('hidden');?>">
119
+	<p id="shareapi_restrict_user_enumeration_to_group_setting" class="indent <?php if ($_['shareAPIEnabled'] === 'no' || $_['allowShareDialogUserEnumeration'] === 'no') p('hidden'); ?>">
120 120
 		<input type="checkbox" name="shareapi_restrict_user_enumeration_to_group" value="1" id="shareapi_restrict_user_enumeration_to_group" class="checkbox"
121 121
 			<?php if ($_['restrictUserEnumerationToGroup'] === 'yes') print_unescaped('checked="checked"'); ?> />
122
-		<label for="shareapi_restrict_user_enumeration_to_group"><?php p($l->t('Restrict username autocompletion to users within the same groups'));?></label><br />
122
+		<label for="shareapi_restrict_user_enumeration_to_group"><?php p($l->t('Restrict username autocompletion to users within the same groups')); ?></label><br />
123 123
 	</p>
124 124
 
125 125
 	<p>
126 126
 		<input type="checkbox" id="publicShareDisclaimer" class="checkbox noJSAutoUpdate"
127 127
 			<?php if ($_['publicShareDisclaimerText'] !== null) print_unescaped('checked="checked"'); ?> />
128
-		<label for="publicShareDisclaimer"><?php p($l->t('Show disclaimer text on the public link upload page. (Only shown when the file list is hidden.)'));?></label>
128
+		<label for="publicShareDisclaimer"><?php p($l->t('Show disclaimer text on the public link upload page. (Only shown when the file list is hidden.)')); ?></label>
129 129
 		<span id="publicShareDisclaimerStatus" class="msg" style="display:none"></span>
130 130
 		<br/>
131 131
 		<textarea placeholder="<?php p($l->t('This text will be shown on the public link upload page when the file list is hidden.')) ?>" id="publicShareDisclaimerText" <?php if ($_['publicShareDisclaimerText'] === null) { print_unescaped('class="hidden"'); } ?>><?php p($_['publicShareDisclaimerText']) ?></textarea>
132 132
 	</p>
133 133
 
134
-	<h3><?php p($l->t('Default share permissions'));?></h3>
134
+	<h3><?php p($l->t('Default share permissions')); ?></h3>
135 135
 	<input type="hidden" name="shareapi_default_permissions" id="shareApiDefaultPermissions" class="checkbox"
136 136
 		   value="<?php p($_['shareApiDefaultPermissions']) ?>" />
137 137
 	<p id="shareApiDefaultPermissionsSection" class="indent <?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
138 138
 		<?php foreach ($_['shareApiDefaultPermissionsCheckboxes'] as $perm): ?>
139 139
 			<input type="checkbox" name="shareapi_default_permission_<?php p($perm['id']) ?>" id="shareapi_default_permission_<?php p($perm['id']) ?>"
140 140
 				   class="noautosave checkbox" value="<?php p($perm['value']) ?>" <?php if (($_['shareApiDefaultPermissions'] & $perm['value']) !== 0) print_unescaped('checked="checked"'); ?> />
141
-			<label for="shareapi_default_permission_<?php p($perm['id']) ?>"><?php p($perm['label']);?></label>
141
+			<label for="shareapi_default_permission_<?php p($perm['id']) ?>"><?php p($perm['label']); ?></label>
142 142
 		<?php endforeach ?>
143 143
 	</p>
144 144
 </div>
Please login to merge, or discard this patch.