| @@ -1037,7 +1037,7 @@ discard block | ||
| 1037 | 1037 | * @param string $principalUri | 
| 1038 | 1038 | * @param string $uri | 
| 1039 | 1039 | * @param array $properties | 
| 1040 | - * @return mixed | |
| 1040 | + * @return integer | |
| 1041 | 1041 | */ | 
| 1042 | 1042 |  	function createSubscription($principalUri, $uri, array $properties) { | 
| 1043 | 1043 | |
| @@ -1378,6 +1378,9 @@ discard block | ||
| 1378 | 1378 | return $this->sharingBackend->applyShareAcl($resourceId, $acl); | 
| 1379 | 1379 | } | 
| 1380 | 1380 | |
| 1381 | + /** | |
| 1382 | + * @param boolean $toV2 | |
| 1383 | + */ | |
| 1381 | 1384 |  	private function convertPrincipal($principalUri, $toV2) { | 
| 1382 | 1385 |  		if ($this->principalBackend->getPrincipalPrefix() === 'principals') { | 
| 1383 | 1386 | list(, $name) = URLUtil::splitPath($principalUri); | 
| @@ -164,24 +164,24 @@ discard block | ||
| 164 | 164 | $stmt = $query->execute(); | 
| 165 | 165 | |
| 166 | 166 | $calendars = []; | 
| 167 | -		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { | |
| 167 | +		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { | |
| 168 | 168 | |
| 169 | 169 | $components = []; | 
| 170 | 170 |  			if ($row['components']) { | 
| 171 | -				$components = explode(',',$row['components']); | |
| 171 | +				$components = explode(',', $row['components']); | |
| 172 | 172 | } | 
| 173 | 173 | |
| 174 | 174 | $calendar = [ | 
| 175 | 175 | 'id' => $row['id'], | 
| 176 | 176 | 'uri' => $row['uri'], | 
| 177 | 177 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), | 
| 178 | -				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), | |
| 179 | -				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', | |
| 180 | -				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), | |
| 181 | -				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), | |
| 178 | +				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), | |
| 179 | +				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', | |
| 180 | +				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), | |
| 181 | +				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), | |
| 182 | 182 | ]; | 
| 183 | 183 | |
| 184 | -			foreach($this->propertyMap as $xmlName=>$dbName) { | |
| 184 | +			foreach ($this->propertyMap as $xmlName=>$dbName) { | |
| 185 | 185 | $calendar[$xmlName] = $row[$dbName]; | 
| 186 | 186 | } | 
| 187 | 187 | |
| @@ -194,7 +194,7 @@ discard block | ||
| 194 | 194 | |
| 195 | 195 | // query for shared calendars | 
| 196 | 196 | $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); | 
| 197 | - $principals[]= $principalUri; | |
| 197 | + $principals[] = $principalUri; | |
| 198 | 198 | |
| 199 | 199 | $fields = array_values($this->propertyMap); | 
| 200 | 200 | $fields[] = 'a.id'; | 
| @@ -214,27 +214,27 @@ discard block | ||
| 214 | 214 |  			->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) | 
| 215 | 215 | ->execute(); | 
| 216 | 216 | |
| 217 | -		while($row = $result->fetch()) { | |
| 217 | +		while ($row = $result->fetch()) { | |
| 218 | 218 | list(, $name) = URLUtil::splitPath($row['principaluri']); | 
| 219 | - $uri = $row['uri'] . '_shared_by_' . $name; | |
| 220 | - $row['displayname'] = $row['displayname'] . "($name)"; | |
| 219 | + $uri = $row['uri'].'_shared_by_'.$name; | |
| 220 | + $row['displayname'] = $row['displayname']."($name)"; | |
| 221 | 221 | $components = []; | 
| 222 | 222 |  			if ($row['components']) { | 
| 223 | -				$components = explode(',',$row['components']); | |
| 223 | +				$components = explode(',', $row['components']); | |
| 224 | 224 | } | 
| 225 | 225 | $calendar = [ | 
| 226 | 226 | 'id' => $row['id'], | 
| 227 | 227 | 'uri' => $uri, | 
| 228 | 228 | 'principaluri' => $principalUri, | 
| 229 | -				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), | |
| 230 | -				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', | |
| 231 | -				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), | |
| 232 | -				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), | |
| 233 | -				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'], | |
| 234 | -				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, | |
| 229 | +				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), | |
| 230 | +				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', | |
| 231 | +				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), | |
| 232 | +				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), | |
| 233 | +				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'], | |
| 234 | +				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, | |
| 235 | 235 | ]; | 
| 236 | 236 | |
| 237 | -			foreach($this->propertyMap as $xmlName=>$dbName) { | |
| 237 | +			foreach ($this->propertyMap as $xmlName=>$dbName) { | |
| 238 | 238 | $calendar[$xmlName] = $row[$dbName]; | 
| 239 | 239 | } | 
| 240 | 240 | |
| @@ -277,20 +277,20 @@ discard block | ||
| 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' => $row['principaluri'], | 
| 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'), | |
| 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 | 291 | ]; | 
| 292 | 292 | |
| 293 | -		foreach($this->propertyMap as $xmlName=>$dbName) { | |
| 293 | +		foreach ($this->propertyMap as $xmlName=>$dbName) { | |
| 294 | 294 | $calendar[$xmlName] = $row[$dbName]; | 
| 295 | 295 | } | 
| 296 | 296 | |
| @@ -321,20 +321,20 @@ discard block | ||
| 321 | 321 | |
| 322 | 322 | $components = []; | 
| 323 | 323 |  		if ($row['components']) { | 
| 324 | -			$components = explode(',',$row['components']); | |
| 324 | +			$components = explode(',', $row['components']); | |
| 325 | 325 | } | 
| 326 | 326 | |
| 327 | 327 | $calendar = [ | 
| 328 | 328 | 'id' => $row['id'], | 
| 329 | 329 | 'uri' => $row['uri'], | 
| 330 | 330 | 'principaluri' => $row['principaluri'], | 
| 331 | -			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), | |
| 332 | -			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', | |
| 333 | -			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), | |
| 334 | -			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), | |
| 331 | +			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), | |
| 332 | +			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', | |
| 333 | +			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), | |
| 334 | +			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), | |
| 335 | 335 | ]; | 
| 336 | 336 | |
| 337 | -		foreach($this->propertyMap as $xmlName=>$dbName) { | |
| 337 | +		foreach ($this->propertyMap as $xmlName=>$dbName) { | |
| 338 | 338 | $calendar[$xmlName] = $row[$dbName]; | 
| 339 | 339 | } | 
| 340 | 340 | |
| @@ -366,16 +366,16 @@ discard block | ||
| 366 | 366 |  		$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; | 
| 367 | 367 |  		if (isset($properties[$sccs])) { | 
| 368 | 368 |  			if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { | 
| 369 | -				throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); | |
| 369 | +				throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); | |
| 370 | 370 | } | 
| 371 | -			$values['components'] = implode(',',$properties[$sccs]->getValue()); | |
| 371 | +			$values['components'] = implode(',', $properties[$sccs]->getValue()); | |
| 372 | 372 | } | 
| 373 | -		$transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; | |
| 373 | +		$transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; | |
| 374 | 374 |  		if (isset($properties[$transp])) { | 
| 375 | 375 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); | 
| 376 | 376 | } | 
| 377 | 377 | |
| 378 | -		foreach($this->propertyMap as $xmlName=>$dbName) { | |
| 378 | +		foreach ($this->propertyMap as $xmlName=>$dbName) { | |
| 379 | 379 |  			if (isset($properties[$xmlName])) { | 
| 380 | 380 | $values[$dbName] = $properties[$xmlName]; | 
| 381 | 381 | } | 
| @@ -383,7 +383,7 @@ discard block | ||
| 383 | 383 | |
| 384 | 384 | $query = $this->db->getQueryBuilder(); | 
| 385 | 385 |  		$query->insert('calendars'); | 
| 386 | -		foreach($values as $column => $value) { | |
| 386 | +		foreach ($values as $column => $value) { | |
| 387 | 387 | $query->setValue($column, $query->createNamedParameter($value)); | 
| 388 | 388 | } | 
| 389 | 389 | $query->execute(); | 
| @@ -407,14 +407,14 @@ discard block | ||
| 407 | 407 | */ | 
| 408 | 408 |  	function updateCalendar($calendarId, PropPatch $propPatch) { | 
| 409 | 409 | $supportedProperties = array_keys($this->propertyMap); | 
| 410 | -		$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; | |
| 410 | +		$supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; | |
| 411 | 411 | |
| 412 | 412 |  		$propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { | 
| 413 | 413 | $newValues = []; | 
| 414 | 414 |  			foreach ($mutations as $propertyName => $propertyValue) { | 
| 415 | 415 | |
| 416 | 416 |  				switch ($propertyName) { | 
| 417 | -					case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' : | |
| 417 | +					case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' : | |
| 418 | 418 | $fieldName = 'transparent'; | 
| 419 | 419 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); | 
| 420 | 420 | break; | 
| @@ -497,16 +497,16 @@ discard block | ||
| 497 | 497 | $stmt = $query->execute(); | 
| 498 | 498 | |
| 499 | 499 | $result = []; | 
| 500 | -		foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { | |
| 500 | +		foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { | |
| 501 | 501 | $result[] = [ | 
| 502 | 502 | 'id' => $row['id'], | 
| 503 | 503 | 'uri' => $row['uri'], | 
| 504 | 504 | 'lastmodified' => $row['lastmodified'], | 
| 505 | - 'etag' => '"' . $row['etag'] . '"', | |
| 505 | + 'etag' => '"'.$row['etag'].'"', | |
| 506 | 506 | 'calendarid' => $row['calendarid'], | 
| 507 | - 'size' => (int)$row['size'], | |
| 507 | + 'size' => (int) $row['size'], | |
| 508 | 508 | 'component' => strtolower($row['componenttype']), | 
| 509 | - 'classification'=> (int)$row['classification'] | |
| 509 | + 'classification'=> (int) $row['classification'] | |
| 510 | 510 | ]; | 
| 511 | 511 | } | 
| 512 | 512 | |
| @@ -539,18 +539,18 @@ discard block | ||
| 539 | 539 | $stmt = $query->execute(); | 
| 540 | 540 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); | 
| 541 | 541 | |
| 542 | - if(!$row) return null; | |
| 542 | + if (!$row) return null; | |
| 543 | 543 | |
| 544 | 544 | return [ | 
| 545 | 545 | 'id' => $row['id'], | 
| 546 | 546 | 'uri' => $row['uri'], | 
| 547 | 547 | 'lastmodified' => $row['lastmodified'], | 
| 548 | - 'etag' => '"' . $row['etag'] . '"', | |
| 548 | + 'etag' => '"'.$row['etag'].'"', | |
| 549 | 549 | 'calendarid' => $row['calendarid'], | 
| 550 | - 'size' => (int)$row['size'], | |
| 550 | + 'size' => (int) $row['size'], | |
| 551 | 551 | 'calendardata' => $this->readBlob($row['calendardata']), | 
| 552 | 552 | 'component' => strtolower($row['componenttype']), | 
| 553 | - 'classification'=> (int)$row['classification'] | |
| 553 | + 'classification'=> (int) $row['classification'] | |
| 554 | 554 | ]; | 
| 555 | 555 | } | 
| 556 | 556 | |
| @@ -589,12 +589,12 @@ discard block | ||
| 589 | 589 | 'id' => $row['id'], | 
| 590 | 590 | 'uri' => $row['uri'], | 
| 591 | 591 | 'lastmodified' => $row['lastmodified'], | 
| 592 | - 'etag' => '"' . $row['etag'] . '"', | |
| 592 | + 'etag' => '"'.$row['etag'].'"', | |
| 593 | 593 | 'calendarid' => $row['calendarid'], | 
| 594 | - 'size' => (int)$row['size'], | |
| 594 | + 'size' => (int) $row['size'], | |
| 595 | 595 | 'calendardata' => $this->readBlob($row['calendardata']), | 
| 596 | 596 | 'component' => strtolower($row['componenttype']), | 
| 597 | - 'classification' => (int)$row['classification'] | |
| 597 | + 'classification' => (int) $row['classification'] | |
| 598 | 598 | ]; | 
| 599 | 599 | } | 
| 600 | 600 | $result->closeCursor(); | 
| @@ -642,7 +642,7 @@ discard block | ||
| 642 | 642 | |
| 643 | 643 | $this->addChange($calendarId, $objectUri, 1); | 
| 644 | 644 | |
| 645 | - return '"' . $extraData['etag'] . '"'; | |
| 645 | + return '"'.$extraData['etag'].'"'; | |
| 646 | 646 | } | 
| 647 | 647 | |
| 648 | 648 | /** | 
| @@ -683,7 +683,7 @@ discard block | ||
| 683 | 683 | |
| 684 | 684 | $this->addChange($calendarId, $objectUri, 2); | 
| 685 | 685 | |
| 686 | - return '"' . $extraData['etag'] . '"'; | |
| 686 | + return '"'.$extraData['etag'].'"'; | |
| 687 | 687 | } | 
| 688 | 688 | |
| 689 | 689 | /** | 
| @@ -821,7 +821,7 @@ discard block | ||
| 821 | 821 | $stmt = $query->execute(); | 
| 822 | 822 | |
| 823 | 823 | $result = []; | 
| 824 | -		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { | |
| 824 | +		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { | |
| 825 | 825 |  			if ($requirePostFilter) { | 
| 826 | 826 |  				if (!$this->validateFilterForObject($row, $filters)) { | 
| 827 | 827 | continue; | 
| @@ -864,7 +864,7 @@ discard block | ||
| 864 | 864 | $stmt = $query->execute(); | 
| 865 | 865 | |
| 866 | 866 |  		if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { | 
| 867 | - return $row['calendaruri'] . '/' . $row['objecturi']; | |
| 867 | + return $row['calendaruri'].'/'.$row['objecturi']; | |
| 868 | 868 | } | 
| 869 | 869 | |
| 870 | 870 | return null; | 
| @@ -929,7 +929,7 @@ discard block | ||
| 929 | 929 |  	function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) { | 
| 930 | 930 | // Current synctoken | 
| 931 | 931 |  		$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); | 
| 932 | - $stmt->execute([ $calendarId ]); | |
| 932 | + $stmt->execute([$calendarId]); | |
| 933 | 933 | $currentToken = $stmt->fetchColumn(0); | 
| 934 | 934 | |
| 935 | 935 |  		if (is_null($currentToken)) { | 
| @@ -946,8 +946,8 @@ discard block | ||
| 946 | 946 |  		if ($syncToken) { | 
| 947 | 947 | |
| 948 | 948 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`"; | 
| 949 | -			if ($limit>0) { | |
| 950 | - $query.= " `LIMIT` " . (int)$limit; | |
| 949 | +			if ($limit > 0) { | |
| 950 | + $query .= " `LIMIT` ".(int) $limit; | |
| 951 | 951 | } | 
| 952 | 952 | |
| 953 | 953 | // Fetching all changes | 
| @@ -958,15 +958,15 @@ discard block | ||
| 958 | 958 | |
| 959 | 959 | // This loop ensures that any duplicates are overwritten, only the | 
| 960 | 960 | // last change on a node is relevant. | 
| 961 | -			while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { | |
| 961 | +			while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { | |
| 962 | 962 | |
| 963 | 963 | $changes[$row['uri']] = $row['operation']; | 
| 964 | 964 | |
| 965 | 965 | } | 
| 966 | 966 | |
| 967 | -			foreach($changes as $uri => $operation) { | |
| 967 | +			foreach ($changes as $uri => $operation) { | |
| 968 | 968 | |
| 969 | -				switch($operation) { | |
| 969 | +				switch ($operation) { | |
| 970 | 970 | case 1 : | 
| 971 | 971 | $result['added'][] = $uri; | 
| 972 | 972 | break; | 
| @@ -1036,10 +1036,10 @@ discard block | ||
| 1036 | 1036 |  			->from('calendarsubscriptions') | 
| 1037 | 1037 |  			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) | 
| 1038 | 1038 |  			->orderBy('calendarorder', 'asc'); | 
| 1039 | - $stmt =$query->execute(); | |
| 1039 | + $stmt = $query->execute(); | |
| 1040 | 1040 | |
| 1041 | 1041 | $subscriptions = []; | 
| 1042 | -		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { | |
| 1042 | +		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { | |
| 1043 | 1043 | |
| 1044 | 1044 | $subscription = [ | 
| 1045 | 1045 | 'id' => $row['id'], | 
| @@ -1048,10 +1048,10 @@ discard block | ||
| 1048 | 1048 | 'source' => $row['source'], | 
| 1049 | 1049 | 'lastmodified' => $row['lastmodified'], | 
| 1050 | 1050 | |
| 1051 | -				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), | |
| 1051 | +				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), | |
| 1052 | 1052 | ]; | 
| 1053 | 1053 | |
| 1054 | -			foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { | |
| 1054 | +			foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { | |
| 1055 | 1055 |  				if (!is_null($row[$dbName])) { | 
| 1056 | 1056 | $subscription[$xmlName] = $row[$dbName]; | 
| 1057 | 1057 | } | 
| @@ -1090,7 +1090,7 @@ discard block | ||
| 1090 | 1090 | |
| 1091 | 1091 | $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; | 
| 1092 | 1092 | |
| 1093 | -		foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { | |
| 1093 | +		foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { | |
| 1094 | 1094 |  			if (array_key_exists($xmlName, $properties)) { | 
| 1095 | 1095 | $values[$dbName] = $properties[$xmlName]; | 
| 1096 | 1096 |  					if (in_array($dbName, $propertiesBoolean)) { | 
| @@ -1138,7 +1138,7 @@ discard block | ||
| 1138 | 1138 | |
| 1139 | 1139 | $newValues = []; | 
| 1140 | 1140 | |
| 1141 | -			foreach($mutations as $propertyName=>$propertyValue) { | |
| 1141 | +			foreach ($mutations as $propertyName=>$propertyValue) { | |
| 1142 | 1142 |  				if ($propertyName === '{http://calendarserver.org/ns/}source') { | 
| 1143 | 1143 | $newValues['source'] = $propertyValue->getHref(); | 
| 1144 | 1144 |  				} else { | 
| @@ -1150,7 +1150,7 @@ discard block | ||
| 1150 | 1150 | $query = $this->db->getQueryBuilder(); | 
| 1151 | 1151 |  			$query->update('calendarsubscriptions') | 
| 1152 | 1152 |  				->set('lastmodified', $query->createNamedParameter(time())); | 
| 1153 | -			foreach($newValues as $fieldName=>$value) { | |
| 1153 | +			foreach ($newValues as $fieldName=>$value) { | |
| 1154 | 1154 | $query->set($fieldName, $query->createNamedParameter($value)); | 
| 1155 | 1155 | } | 
| 1156 | 1156 |  			$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) | 
| @@ -1200,7 +1200,7 @@ discard block | ||
| 1200 | 1200 | |
| 1201 | 1201 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); | 
| 1202 | 1202 | |
| 1203 | -		if(!$row) { | |
| 1203 | +		if (!$row) { | |
| 1204 | 1204 | return null; | 
| 1205 | 1205 | } | 
| 1206 | 1206 | |
| @@ -1208,8 +1208,8 @@ discard block | ||
| 1208 | 1208 | 'uri' => $row['uri'], | 
| 1209 | 1209 | 'calendardata' => $row['calendardata'], | 
| 1210 | 1210 | 'lastmodified' => $row['lastmodified'], | 
| 1211 | - 'etag' => '"' . $row['etag'] . '"', | |
| 1212 | - 'size' => (int)$row['size'], | |
| 1211 | + 'etag' => '"'.$row['etag'].'"', | |
| 1212 | + 'size' => (int) $row['size'], | |
| 1213 | 1213 | ]; | 
| 1214 | 1214 | } | 
| 1215 | 1215 | |
| @@ -1232,13 +1232,13 @@ discard block | ||
| 1232 | 1232 | ->execute(); | 
| 1233 | 1233 | |
| 1234 | 1234 | $result = []; | 
| 1235 | -		foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { | |
| 1235 | +		foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { | |
| 1236 | 1236 | $result[] = [ | 
| 1237 | 1237 | 'calendardata' => $row['calendardata'], | 
| 1238 | 1238 | 'uri' => $row['uri'], | 
| 1239 | 1239 | 'lastmodified' => $row['lastmodified'], | 
| 1240 | - 'etag' => '"' . $row['etag'] . '"', | |
| 1241 | - 'size' => (int)$row['size'], | |
| 1240 | + 'etag' => '"'.$row['etag'].'"', | |
| 1241 | + 'size' => (int) $row['size'], | |
| 1242 | 1242 | ]; | 
| 1243 | 1243 | } | 
| 1244 | 1244 | |
| @@ -1330,10 +1330,10 @@ discard block | ||
| 1330 | 1330 | $lastOccurrence = null; | 
| 1331 | 1331 | $uid = null; | 
| 1332 | 1332 | $classification = self::CLASSIFICATION_PUBLIC; | 
| 1333 | -		foreach($vObject->getComponents() as $component) { | |
| 1334 | -			if ($component->name!=='VTIMEZONE') { | |
| 1333 | +		foreach ($vObject->getComponents() as $component) { | |
| 1334 | +			if ($component->name !== 'VTIMEZONE') { | |
| 1335 | 1335 | $componentType = $component->name; | 
| 1336 | - $uid = (string)$component->UID; | |
| 1336 | + $uid = (string) $component->UID; | |
| 1337 | 1337 | break; | 
| 1338 | 1338 | } | 
| 1339 | 1339 | } | 
| @@ -1358,13 +1358,13 @@ discard block | ||
| 1358 | 1358 | $lastOccurrence = $firstOccurrence; | 
| 1359 | 1359 | } | 
| 1360 | 1360 |  			} else { | 
| 1361 | - $it = new EventIterator($vObject, (string)$component->UID); | |
| 1361 | + $it = new EventIterator($vObject, (string) $component->UID); | |
| 1362 | 1362 | $maxDate = new \DateTime(self::MAX_DATE); | 
| 1363 | 1363 |  				if ($it->isInfinite()) { | 
| 1364 | 1364 | $lastOccurrence = $maxDate->getTimeStamp(); | 
| 1365 | 1365 |  				} else { | 
| 1366 | 1366 | $end = $it->getDtEnd(); | 
| 1367 | -					while($it->valid() && $end < $maxDate) { | |
| 1367 | +					while ($it->valid() && $end < $maxDate) { | |
| 1368 | 1368 | $end = $it->getDtEnd(); | 
| 1369 | 1369 | $it->next(); | 
| 1370 | 1370 | |
| @@ -188,7 +188,8 @@ discard block | ||
| 188 | 188 | } | 
| 189 | 189 | |
| 190 | 190 | /** | 
| 191 | - * @param $addressBookUri | |
| 191 | + * @param string $addressBookUri | |
| 192 | + * @param string $principal | |
| 192 | 193 | * @return array|null | 
| 193 | 194 | */ | 
| 194 | 195 |  	public function getAddressBooksByUri($principal, $addressBookUri) { | 
| @@ -868,6 +869,7 @@ discard block | ||
| 868 | 869 | * * readOnly - boolean | 
| 869 | 870 | * * summary - Optional, a description for the share | 
| 870 | 871 | * | 
| 872 | + * @param integer $addressBookId | |
| 871 | 873 | * @return array | 
| 872 | 874 | */ | 
| 873 | 875 |  	public function getShares($addressBookId) { | 
| @@ -967,7 +969,7 @@ discard block | ||
| 967 | 969 | |
| 968 | 970 | /** | 
| 969 | 971 | * For shared address books the sharee is set in the ACL of the address book | 
| 970 | - * @param $addressBookId | |
| 972 | + * @param integer $addressBookId | |
| 971 | 973 | * @param $acl | 
| 972 | 974 | * @return array | 
| 973 | 975 | */ | 
| @@ -975,6 +977,9 @@ discard block | ||
| 975 | 977 | return $this->sharingBackend->applyShareAcl($addressBookId, $acl); | 
| 976 | 978 | } | 
| 977 | 979 | |
| 980 | + /** | |
| 981 | + * @param boolean $toV2 | |
| 982 | + */ | |
| 978 | 983 |  	private function convertPrincipal($principalUri, $toV2) { | 
| 979 | 984 |  		if ($this->principalBackend->getPrincipalPrefix() === 'principals') { | 
| 980 | 985 | list(, $name) = URLUtil::splitPath($principalUri); | 
| @@ -113,22 +113,22 @@ discard block | ||
| 113 | 113 | $addressBooks = []; | 
| 114 | 114 | |
| 115 | 115 | $result = $query->execute(); | 
| 116 | -		while($row = $result->fetch()) { | |
| 116 | +		while ($row = $result->fetch()) { | |
| 117 | 117 | $addressBooks[$row['id']] = [ | 
| 118 | 118 | 'id' => $row['id'], | 
| 119 | 119 | 'uri' => $row['uri'], | 
| 120 | 120 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), | 
| 121 | 121 |  				'{DAV:}displayname' => $row['displayname'], | 
| 122 | -				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], | |
| 122 | +				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], | |
| 123 | 123 |  				'{http://calendarserver.org/ns/}getctag' => $row['synctoken'], | 
| 124 | -				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', | |
| 124 | +				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', | |
| 125 | 125 | ]; | 
| 126 | 126 | } | 
| 127 | 127 | $result->closeCursor(); | 
| 128 | 128 | |
| 129 | 129 | // query for shared calendars | 
| 130 | 130 | $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); | 
| 131 | - $principals[]= $principalUri; | |
| 131 | + $principals[] = $principalUri; | |
| 132 | 132 | |
| 133 | 133 | $query = $this->db->getQueryBuilder(); | 
| 134 | 134 | $result = $query->select(['a.id', 'a.uri', 'a.displayname', 'a.principaluri', 'a.description', 'a.synctoken', 's.access']) | 
| @@ -140,21 +140,21 @@ discard block | ||
| 140 | 140 |  			->setParameter('principaluri', $principals, IQueryBuilder::PARAM_STR_ARRAY) | 
| 141 | 141 | ->execute(); | 
| 142 | 142 | |
| 143 | -		while($row = $result->fetch()) { | |
| 143 | +		while ($row = $result->fetch()) { | |
| 144 | 144 | list(, $name) = URLUtil::splitPath($row['principaluri']); | 
| 145 | - $uri = $row['uri'] . '_shared_by_' . $name; | |
| 146 | - $displayName = $row['displayname'] . "($name)"; | |
| 145 | + $uri = $row['uri'].'_shared_by_'.$name; | |
| 146 | + $displayName = $row['displayname']."($name)"; | |
| 147 | 147 |  			if (!isset($addressBooks[$row['id']])) { | 
| 148 | 148 | $addressBooks[$row['id']] = [ | 
| 149 | 149 | 'id' => $row['id'], | 
| 150 | 150 | 'uri' => $uri, | 
| 151 | 151 | 'principaluri' => $principalUri, | 
| 152 | 152 |  					'{DAV:}displayname' => $displayName, | 
| 153 | -					'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], | |
| 153 | +					'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], | |
| 154 | 154 |  					'{http://calendarserver.org/ns/}getctag' => $row['synctoken'], | 
| 155 | -					'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', | |
| 156 | -					'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'], | |
| 157 | -					'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, | |
| 155 | +					'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', | |
| 156 | +					'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'], | |
| 157 | +					'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, | |
| 158 | 158 | ]; | 
| 159 | 159 | } | 
| 160 | 160 | } | 
| @@ -184,9 +184,9 @@ discard block | ||
| 184 | 184 | 'uri' => $row['uri'], | 
| 185 | 185 | 'principaluri' => $row['principaluri'], | 
| 186 | 186 |  			'{DAV:}displayname' => $row['displayname'], | 
| 187 | -			'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], | |
| 187 | +			'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], | |
| 188 | 188 |  			'{http://calendarserver.org/ns/}getctag' => $row['synctoken'], | 
| 189 | -			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', | |
| 189 | +			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', | |
| 190 | 190 | ]; | 
| 191 | 191 | } | 
| 192 | 192 | |
| @@ -214,9 +214,9 @@ discard block | ||
| 214 | 214 | 'uri' => $row['uri'], | 
| 215 | 215 | 'principaluri' => $row['principaluri'], | 
| 216 | 216 |  				'{DAV:}displayname' => $row['displayname'], | 
| 217 | -				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], | |
| 217 | +				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], | |
| 218 | 218 |  				'{http://calendarserver.org/ns/}getctag' => $row['synctoken'], | 
| 219 | -				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', | |
| 219 | +				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', | |
| 220 | 220 | ]; | 
| 221 | 221 | } | 
| 222 | 222 | |
| @@ -239,19 +239,19 @@ discard block | ||
| 239 | 239 |  	function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) { | 
| 240 | 240 | $supportedProperties = [ | 
| 241 | 241 |  			'{DAV:}displayname', | 
| 242 | -			'{' . Plugin::NS_CARDDAV . '}addressbook-description', | |
| 242 | +			'{'.Plugin::NS_CARDDAV.'}addressbook-description', | |
| 243 | 243 | ]; | 
| 244 | 244 | |
| 245 | 245 |  		$propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) { | 
| 246 | 246 | |
| 247 | 247 | $updates = []; | 
| 248 | -			foreach($mutations as $property=>$newValue) { | |
| 248 | +			foreach ($mutations as $property=>$newValue) { | |
| 249 | 249 | |
| 250 | -				switch($property) { | |
| 250 | +				switch ($property) { | |
| 251 | 251 |  					case '{DAV:}displayname' : | 
| 252 | 252 | $updates['displayname'] = $newValue; | 
| 253 | 253 | break; | 
| 254 | -					case '{' . Plugin::NS_CARDDAV . '}addressbook-description' : | |
| 254 | +					case '{'.Plugin::NS_CARDDAV.'}addressbook-description' : | |
| 255 | 255 | $updates['description'] = $newValue; | 
| 256 | 256 | break; | 
| 257 | 257 | } | 
| @@ -259,7 +259,7 @@ discard block | ||
| 259 | 259 | $query = $this->db->getQueryBuilder(); | 
| 260 | 260 |  			$query->update('addressbooks'); | 
| 261 | 261 | |
| 262 | -			foreach($updates as $key=>$value) { | |
| 262 | +			foreach ($updates as $key=>$value) { | |
| 263 | 263 | $query->set($key, $query->createNamedParameter($value)); | 
| 264 | 264 | } | 
| 265 | 265 |  			$query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId))) | 
| @@ -290,24 +290,24 @@ discard block | ||
| 290 | 290 | 'synctoken' => 1 | 
| 291 | 291 | ]; | 
| 292 | 292 | |
| 293 | -		foreach($properties as $property=>$newValue) { | |
| 293 | +		foreach ($properties as $property=>$newValue) { | |
| 294 | 294 | |
| 295 | -			switch($property) { | |
| 295 | +			switch ($property) { | |
| 296 | 296 |  				case '{DAV:}displayname' : | 
| 297 | 297 | $values['displayname'] = $newValue; | 
| 298 | 298 | break; | 
| 299 | -				case '{' . Plugin::NS_CARDDAV . '}addressbook-description' : | |
| 299 | +				case '{'.Plugin::NS_CARDDAV.'}addressbook-description' : | |
| 300 | 300 | $values['description'] = $newValue; | 
| 301 | 301 | break; | 
| 302 | 302 | default : | 
| 303 | -					throw new BadRequest('Unknown property: ' . $property); | |
| 303 | +					throw new BadRequest('Unknown property: '.$property); | |
| 304 | 304 | } | 
| 305 | 305 | |
| 306 | 306 | } | 
| 307 | 307 | |
| 308 | 308 | // Fallback to make sure the displayname is set. Some clients may refuse | 
| 309 | 309 | // to work with addressbooks not having a displayname. | 
| 310 | -		if(is_null($values['displayname'])) { | |
| 310 | +		if (is_null($values['displayname'])) { | |
| 311 | 311 | $values['displayname'] = $url; | 
| 312 | 312 | } | 
| 313 | 313 | |
| @@ -385,8 +385,8 @@ discard block | ||
| 385 | 385 | $cards = []; | 
| 386 | 386 | |
| 387 | 387 | $result = $query->execute(); | 
| 388 | -		while($row = $result->fetch()) { | |
| 389 | - $row['etag'] = '"' . $row['etag'] . '"'; | |
| 388 | +		while ($row = $result->fetch()) { | |
| 389 | + $row['etag'] = '"'.$row['etag'].'"'; | |
| 390 | 390 | $row['carddata'] = $this->readBlob($row['carddata']); | 
| 391 | 391 | $cards[] = $row; | 
| 392 | 392 | } | 
| @@ -420,7 +420,7 @@ discard block | ||
| 420 | 420 |  		if (!$row) { | 
| 421 | 421 | return false; | 
| 422 | 422 | } | 
| 423 | - $row['etag'] = '"' . $row['etag'] . '"'; | |
| 423 | + $row['etag'] = '"'.$row['etag'].'"'; | |
| 424 | 424 | $row['carddata'] = $this->readBlob($row['carddata']); | 
| 425 | 425 | |
| 426 | 426 | return $row; | 
| @@ -457,7 +457,7 @@ discard block | ||
| 457 | 457 | $result = $query->execute(); | 
| 458 | 458 | |
| 459 | 459 |  			while ($row = $result->fetch()) { | 
| 460 | - $row['etag'] = '"' . $row['etag'] . '"'; | |
| 460 | + $row['etag'] = '"'.$row['etag'].'"'; | |
| 461 | 461 | $row['carddata'] = $this->readBlob($row['carddata']); | 
| 462 | 462 | $cards[] = $row; | 
| 463 | 463 | } | 
| @@ -517,7 +517,7 @@ discard block | ||
| 517 | 517 | 'cardData' => $cardData])); | 
| 518 | 518 | } | 
| 519 | 519 | |
| 520 | - return '"' . $etag . '"'; | |
| 520 | + return '"'.$etag.'"'; | |
| 521 | 521 | } | 
| 522 | 522 | |
| 523 | 523 | /** | 
| @@ -569,7 +569,7 @@ discard block | ||
| 569 | 569 | 'cardData' => $cardData])); | 
| 570 | 570 | } | 
| 571 | 571 | |
| 572 | - return '"' . $etag . '"'; | |
| 572 | + return '"'.$etag.'"'; | |
| 573 | 573 | } | 
| 574 | 574 | |
| 575 | 575 | /** | 
| @@ -669,7 +669,7 @@ discard block | ||
| 669 | 669 |  	function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) { | 
| 670 | 670 | // Current synctoken | 
| 671 | 671 |  		$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?'); | 
| 672 | - $stmt->execute([ $addressBookId ]); | |
| 672 | + $stmt->execute([$addressBookId]); | |
| 673 | 673 | $currentToken = $stmt->fetchColumn(0); | 
| 674 | 674 | |
| 675 | 675 | if (is_null($currentToken)) return null; | 
| @@ -684,8 +684,8 @@ discard block | ||
| 684 | 684 |  		if ($syncToken) { | 
| 685 | 685 | |
| 686 | 686 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`"; | 
| 687 | -			if ($limit>0) { | |
| 688 | - $query .= " `LIMIT` " . (int)$limit; | |
| 687 | +			if ($limit > 0) { | |
| 688 | + $query .= " `LIMIT` ".(int) $limit; | |
| 689 | 689 | } | 
| 690 | 690 | |
| 691 | 691 | // Fetching all changes | 
| @@ -696,15 +696,15 @@ discard block | ||
| 696 | 696 | |
| 697 | 697 | // This loop ensures that any duplicates are overwritten, only the | 
| 698 | 698 | // last change on a node is relevant. | 
| 699 | -			while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { | |
| 699 | +			while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { | |
| 700 | 700 | |
| 701 | 701 | $changes[$row['uri']] = $row['operation']; | 
| 702 | 702 | |
| 703 | 703 | } | 
| 704 | 704 | |
| 705 | -			foreach($changes as $uri => $operation) { | |
| 705 | +			foreach ($changes as $uri => $operation) { | |
| 706 | 706 | |
| 707 | -				switch($operation) { | |
| 707 | +				switch ($operation) { | |
| 708 | 708 | case 1: | 
| 709 | 709 | $result['added'][] = $uri; | 
| 710 | 710 | break; | 
| @@ -784,7 +784,7 @@ discard block | ||
| 784 | 784 | $query2->orWhere( | 
| 785 | 785 | $query2->expr()->andX( | 
| 786 | 786 |  					$query2->expr()->eq('cp.name', $query->createNamedParameter($property)), | 
| 787 | -					$query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')) | |
| 787 | +					$query2->expr()->ilike('cp.value', $query->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%')) | |
| 788 | 788 | ) | 
| 789 | 789 | ); | 
| 790 | 790 | } | 
| @@ -840,7 +840,7 @@ discard block | ||
| 840 | 840 | $result->closeCursor(); | 
| 841 | 841 | |
| 842 | 842 |  		if (!isset($uri['uri'])) { | 
| 843 | -			throw new \InvalidArgumentException('Card does not exists: ' . $id); | |
| 843 | +			throw new \InvalidArgumentException('Card does not exists: '.$id); | |
| 844 | 844 | } | 
| 845 | 845 | |
| 846 | 846 | return $uri['uri']; | 
| @@ -912,11 +912,11 @@ discard block | ||
| 912 | 912 | ); | 
| 913 | 913 | |
| 914 | 914 |  		foreach ($vCard->children as $property) { | 
| 915 | -			if(!in_array($property->name, self::$indexProperties)) { | |
| 915 | +			if (!in_array($property->name, self::$indexProperties)) { | |
| 916 | 916 | continue; | 
| 917 | 917 | } | 
| 918 | 918 | $preferred = 0; | 
| 919 | -			foreach($property->parameters as $parameter) { | |
| 919 | +			foreach ($property->parameters as $parameter) { | |
| 920 | 920 |  				if ($parameter->name == 'TYPE' && strtoupper($parameter->getValue()) == 'PREF') { | 
| 921 | 921 | $preferred = 1; | 
| 922 | 922 | break; | 
| @@ -971,10 +971,10 @@ discard block | ||
| 971 | 971 | $result->closeCursor(); | 
| 972 | 972 | |
| 973 | 973 |  		if (!isset($cardIds['id'])) { | 
| 974 | -			throw new \InvalidArgumentException('Card does not exists: ' . $uri); | |
| 974 | +			throw new \InvalidArgumentException('Card does not exists: '.$uri); | |
| 975 | 975 | } | 
| 976 | 976 | |
| 977 | - return (int)$cardIds['id']; | |
| 977 | + return (int) $cardIds['id']; | |
| 978 | 978 | } | 
| 979 | 979 | |
| 980 | 980 | /** | 
| @@ -246,7 +246,7 @@ | ||
| 246 | 246 | } | 
| 247 | 247 | |
| 248 | 248 | /** | 
| 249 | - * @return array|null | |
| 249 | + * @return string | |
| 250 | 250 | */ | 
| 251 | 251 |  	public function getLocalSystemAddressBook() { | 
| 252 | 252 |  		if (is_null($this->localSystemAddressBook)) { | 
| @@ -90,7 +90,7 @@ discard block | ||
| 90 | 90 |  			if ($ex->getCode() === Http::STATUS_UNAUTHORIZED) { | 
| 91 | 91 | // remote server revoked access to the address book, remove it | 
| 92 | 92 | $this->backend->deleteAddressBook($addressBookId); | 
| 93 | -				$this->logger->info('Authorization failed, remove address book: ' . $url, ['app' => 'dav']); | |
| 93 | +				$this->logger->info('Authorization failed, remove address book: '.$url, ['app' => 'dav']); | |
| 94 | 94 | throw $ex; | 
| 95 | 95 | } | 
| 96 | 96 | } | 
| @@ -141,7 +141,7 @@ discard block | ||
| 141 | 141 | */ | 
| 142 | 142 |  	protected function requestSyncReport($url, $userName, $sharedSecret, $syncToken) { | 
| 143 | 143 | $settings = [ | 
| 144 | - 'baseUri' => $url . '/', | |
| 144 | + 'baseUri' => $url.'/', | |
| 145 | 145 | 'userName' => $userName, | 
| 146 | 146 | 'password' => $sharedSecret, | 
| 147 | 147 | ]; | 
| @@ -254,7 +254,7 @@ discard block | ||
| 254 | 254 | */ | 
| 255 | 255 |  	public function deleteUser($userOrCardId) { | 
| 256 | 256 | $systemAddressBook = $this->getLocalSystemAddressBook(); | 
| 257 | -		if ($userOrCardId instanceof IUser){ | |
| 257 | +		if ($userOrCardId instanceof IUser) { | |
| 258 | 258 | $name = $userOrCardId->getBackendClassName(); | 
| 259 | 259 | $userId = $userOrCardId->getUID(); | 
| 260 | 260 | |
| @@ -270,7 +270,7 @@ discard block | ||
| 270 | 270 |  		if (is_null($this->localSystemAddressBook)) { | 
| 271 | 271 | $systemPrincipal = "principals/system/system"; | 
| 272 | 272 | $this->localSystemAddressBook = $this->ensureSystemAddressBookExists($systemPrincipal, 'system', [ | 
| 273 | -				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => 'System addressbook which holds all users of this instance' | |
| 273 | +				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => 'System addressbook which holds all users of this instance' | |
| 274 | 274 | ]); | 
| 275 | 275 | } | 
| 276 | 276 | |
| @@ -288,7 +288,7 @@ discard block | ||
| 288 | 288 | |
| 289 | 289 | // remove no longer existing | 
| 290 | 290 | $allCards = $this->backend->getCards($systemAddressBook['id']); | 
| 291 | -		foreach($allCards as $card) { | |
| 291 | +		foreach ($allCards as $card) { | |
| 292 | 292 | $vCard = Reader::read($card['carddata']); | 
| 293 | 293 | $uid = $vCard->UID->getValue(); | 
| 294 | 294 | // load backend and see if user exists | 
| @@ -93,7 +93,7 @@ | ||
| 93 | 93 | /** | 
| 94 | 94 | * returns a list of all possible property names | 
| 95 | 95 | * | 
| 96 | - * @return array | |
| 96 | + * @return string[] | |
| 97 | 97 | */ | 
| 98 | 98 |  	static public function getPropertyNames() { | 
| 99 | 99 | return [ | 
| @@ -81,11 +81,11 @@ discard block | ||
| 81 | 81 | $this->logger = $logger; | 
| 82 | 82 | |
| 83 | 83 | $methods = get_class_methods($this->comment); | 
| 84 | -		$methods = array_filter($methods, function($name){ | |
| 84 | +		$methods = array_filter($methods, function($name) { | |
| 85 | 85 | return strpos($name, 'get') === 0; | 
| 86 | 86 | }); | 
| 87 | -		foreach($methods as $getter) { | |
| 88 | -			$name = '{'.self::NS_OWNCLOUD.'}' . lcfirst(substr($getter, 3)); | |
| 87 | +		foreach ($methods as $getter) { | |
| 88 | +			$name = '{'.self::NS_OWNCLOUD.'}'.lcfirst(substr($getter, 3)); | |
| 89 | 89 | $this->properties[$name] = $getter; | 
| 90 | 90 | } | 
| 91 | 91 | $this->userManager = $userManager; | 
| @@ -119,7 +119,7 @@ discard block | ||
| 119 | 119 | |
| 120 | 120 |  	protected function checkWriteAccessOnComment() { | 
| 121 | 121 | $user = $this->userSession->getUser(); | 
| 122 | - if( $this->comment->getActorType() !== 'users' | |
| 122 | + if ($this->comment->getActorType() !== 'users' | |
| 123 | 123 | || is_null($user) | 
| 124 | 124 | || $this->comment->getActorId() !== $user->getUID() | 
| 125 | 125 |  		) { | 
| @@ -183,9 +183,9 @@ discard block | ||
| 183 | 183 | return true; | 
| 184 | 184 |  		} catch (\Exception $e) { | 
| 185 | 185 | $this->logger->logException($e, ['app' => 'dav/comments']); | 
| 186 | -			if($e instanceof MessageTooLongException) { | |
| 186 | +			if ($e instanceof MessageTooLongException) { | |
| 187 | 187 | $msg = 'Message exceeds allowed character limit of '; | 
| 188 | - throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e); | |
| 188 | + throw new BadRequest($msg.IComment::MAX_MESSAGE_LENGTH, 0, $e); | |
| 189 | 189 | } | 
| 190 | 190 | throw $e; | 
| 191 | 191 | } | 
| @@ -227,28 +227,28 @@ discard block | ||
| 227 | 227 | $properties = array_keys($this->properties); | 
| 228 | 228 | |
| 229 | 229 | $result = []; | 
| 230 | -		foreach($properties as $property) { | |
| 230 | +		foreach ($properties as $property) { | |
| 231 | 231 | $getter = $this->properties[$property]; | 
| 232 | -			if(method_exists($this->comment, $getter)) { | |
| 232 | +			if (method_exists($this->comment, $getter)) { | |
| 233 | 233 | $result[$property] = $this->comment->$getter(); | 
| 234 | 234 | } | 
| 235 | 235 | } | 
| 236 | 236 | |
| 237 | -		if($this->comment->getActorType() === 'users') { | |
| 237 | +		if ($this->comment->getActorType() === 'users') { | |
| 238 | 238 | $user = $this->userManager->get($this->comment->getActorId()); | 
| 239 | 239 | $displayName = is_null($user) ? null : $user->getDisplayName(); | 
| 240 | 240 | $result[self::PROPERTY_NAME_ACTOR_DISPLAYNAME] = $displayName; | 
| 241 | 241 | } | 
| 242 | 242 | |
| 243 | 243 | $unread = null; | 
| 244 | - $user = $this->userSession->getUser(); | |
| 245 | -		if(!is_null($user)) { | |
| 244 | + $user = $this->userSession->getUser(); | |
| 245 | +		if (!is_null($user)) { | |
| 246 | 246 | $readUntil = $this->commentsManager->getReadMark( | 
| 247 | 247 | $this->comment->getObjectType(), | 
| 248 | 248 | $this->comment->getObjectId(), | 
| 249 | 249 | $user | 
| 250 | 250 | ); | 
| 251 | -			if(is_null($readUntil)) { | |
| 251 | +			if (is_null($readUntil)) { | |
| 252 | 252 | $unread = 'true'; | 
| 253 | 253 |  			} else { | 
| 254 | 254 | $unread = $this->comment->getCreationDateTime() > $readUntil; | 
| @@ -138,7 +138,7 @@ | ||
| 138 | 138 |  	 * This will be used in the {DAV:}supported-report-set property. | 
| 139 | 139 | * | 
| 140 | 140 | * @param string $uri | 
| 141 | - * @return array | |
| 141 | + * @return string[] | |
| 142 | 142 | */ | 
| 143 | 143 |  	public function getSupportedReportSet($uri) { | 
| 144 | 144 | return [self::REPORT_NAME]; | 
| @@ -84,7 +84,7 @@ discard block | ||
| 84 | 84 | */ | 
| 85 | 85 |  	function initialize(Server $server) { | 
| 86 | 86 | $this->server = $server; | 
| 87 | -		if(strpos($this->server->getRequestUri(), 'comments/') !== 0) { | |
| 87 | +		if (strpos($this->server->getRequestUri(), 'comments/') !== 0) { | |
| 88 | 88 | return; | 
| 89 | 89 | } | 
| 90 | 90 | |
| @@ -124,7 +124,7 @@ discard block | ||
| 124 | 124 | // having their own comments marked as unread | 
| 125 | 125 | $node->setReadMarker(null); | 
| 126 | 126 | |
| 127 | - $url = rtrim($request->getUrl(), '/') . '/' . urlencode($comment->getId()); | |
| 127 | + $url = rtrim($request->getUrl(), '/').'/'.urlencode($comment->getId()); | |
| 128 | 128 | |
| 129 | 129 |  		$response->setHeader('Content-Location', $url); | 
| 130 | 130 | |
| @@ -157,7 +157,7 @@ discard block | ||
| 157 | 157 | */ | 
| 158 | 158 |  	public function onReport($reportName, $report, $uri) { | 
| 159 | 159 | $node = $this->server->tree->getNodeForPath($uri); | 
| 160 | -		if(!$node instanceof EntityCollection || $reportName !== self::REPORT_NAME) { | |
| 160 | +		if (!$node instanceof EntityCollection || $reportName !== self::REPORT_NAME) { | |
| 161 | 161 | throw new ReportNotSupported(); | 
| 162 | 162 | } | 
| 163 | 163 | $args = ['limit' => 0, 'offset' => 0, 'datetime' => null]; | 
| @@ -166,27 +166,27 @@ discard block | ||
| 166 | 166 | $this::REPORT_PARAM_OFFSET, | 
| 167 | 167 | $this::REPORT_PARAM_TIMESTAMP | 
| 168 | 168 | ]; | 
| 169 | -		$ns = '{' . $this::NS_OWNCLOUD . '}'; | |
| 170 | -		foreach($report as $parameter) { | |
| 171 | -			if(!in_array($parameter['name'], $acceptableParameters) || empty($parameter['value'])) { | |
| 169 | +		$ns = '{'.$this::NS_OWNCLOUD.'}'; | |
| 170 | +		foreach ($report as $parameter) { | |
| 171 | +			if (!in_array($parameter['name'], $acceptableParameters) || empty($parameter['value'])) { | |
| 172 | 172 | continue; | 
| 173 | 173 | } | 
| 174 | 174 | $args[str_replace($ns, '', $parameter['name'])] = $parameter['value']; | 
| 175 | 175 | } | 
| 176 | 176 | |
| 177 | -		if(!is_null($args['datetime'])) { | |
| 177 | +		if (!is_null($args['datetime'])) { | |
| 178 | 178 | $args['datetime'] = new \DateTime($args['datetime']); | 
| 179 | 179 | } | 
| 180 | 180 | |
| 181 | 181 | $results = $node->findChildren($args['limit'], $args['offset'], $args['datetime']); | 
| 182 | 182 | |
| 183 | 183 | $responses = []; | 
| 184 | -		foreach($results as $node) { | |
| 185 | - $nodePath = $this->server->getRequestUri() . '/' . $node->comment->getId(); | |
| 184 | +		foreach ($results as $node) { | |
| 185 | + $nodePath = $this->server->getRequestUri().'/'.$node->comment->getId(); | |
| 186 | 186 | $resultSet = $this->server->getPropertiesForPath($nodePath, CommentNode::getPropertyNames()); | 
| 187 | -			if(isset($resultSet[0]) && isset($resultSet[0][200])) { | |
| 187 | +			if (isset($resultSet[0]) && isset($resultSet[0][200])) { | |
| 188 | 188 | $responses[] = new Response( | 
| 189 | - $this->server->getBaseUri() . $nodePath, | |
| 189 | + $this->server->getBaseUri().$nodePath, | |
| 190 | 190 | [200 => $resultSet[0][200]], | 
| 191 | 191 | 200 | 
| 192 | 192 | ); | 
| @@ -227,14 +227,14 @@ discard block | ||
| 227 | 227 | |
| 228 | 228 | $actorType = $data['actorType']; | 
| 229 | 229 | $actorId = null; | 
| 230 | -		if($actorType === 'users') { | |
| 230 | +		if ($actorType === 'users') { | |
| 231 | 231 | $user = $this->userSession->getUser(); | 
| 232 | -			if(!is_null($user)) { | |
| 232 | +			if (!is_null($user)) { | |
| 233 | 233 | $actorId = $user->getUID(); | 
| 234 | 234 | } | 
| 235 | 235 | } | 
| 236 | -		if(is_null($actorId)) { | |
| 237 | -			throw new BadRequest('Invalid actor "' .  $actorType .'"'); | |
| 236 | +		if (is_null($actorId)) { | |
| 237 | +			throw new BadRequest('Invalid actor "'.$actorType.'"'); | |
| 238 | 238 | } | 
| 239 | 239 | |
| 240 | 240 |  		try { | 
| @@ -247,7 +247,7 @@ discard block | ||
| 247 | 247 |  			throw new BadRequest('Invalid input values', 0, $e); | 
| 248 | 248 |  		} catch (\OCP\Comments\MessageTooLongException $e) { | 
| 249 | 249 | $msg = 'Message exceeds allowed character limit of '; | 
| 250 | - throw new BadRequest($msg . \OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0, $e); | |
| 250 | + throw new BadRequest($msg.\OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0, $e); | |
| 251 | 251 | } | 
| 252 | 252 | } | 
| 253 | 253 | |
| @@ -115,7 +115,7 @@ | ||
| 115 | 115 | /** | 
| 116 | 116 | * Returns an array with all the child nodes | 
| 117 | 117 | * | 
| 118 | - * @return \Sabre\DAV\INode[] | |
| 118 | + * @return CommentNode[] | |
| 119 | 119 | */ | 
| 120 | 120 |  	function getChildren() { | 
| 121 | 121 | return $this->findChildren(); | 
| @@ -41,7 +41,7 @@ discard block | ||
| 41 | 41 | * @package OCA\DAV\Comments | 
| 42 | 42 | */ | 
| 43 | 43 |  class EntityCollection extends RootCollection implements IProperties { | 
| 44 | -	const PROPERTY_NAME_READ_MARKER  = '{http://owncloud.org/ns}readMarker'; | |
| 44 | +	const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker'; | |
| 45 | 45 | |
| 46 | 46 | /** @var string */ | 
| 47 | 47 | protected $id; | 
| @@ -65,10 +65,10 @@ discard block | ||
| 65 | 65 | IUserSession $userSession, | 
| 66 | 66 | ILogger $logger | 
| 67 | 67 |  	) { | 
| 68 | -		foreach(['id', 'name'] as $property) { | |
| 68 | +		foreach (['id', 'name'] as $property) { | |
| 69 | 69 | $$property = trim($$property); | 
| 70 | -			if(empty($$property) || !is_string($$property)) { | |
| 71 | -				throw new \InvalidArgumentException('"' . $property . '" parameter must be non-empty string'); | |
| 70 | +			if (empty($$property) || !is_string($$property)) { | |
| 71 | +				throw new \InvalidArgumentException('"'.$property.'" parameter must be non-empty string'); | |
| 72 | 72 | } | 
| 73 | 73 | } | 
| 74 | 74 | $this->id = $id; | 
| @@ -134,7 +134,7 @@ discard block | ||
| 134 | 134 |  	function findChildren($limit = 0, $offset = 0, \DateTime $datetime = null) { | 
| 135 | 135 | $comments = $this->commentsManager->getForObject($this->name, $this->id, $limit, $offset, $datetime); | 
| 136 | 136 | $result = []; | 
| 137 | -		foreach($comments as $comment) { | |
| 137 | +		foreach ($comments as $comment) { | |
| 138 | 138 | $result[] = new CommentNode( | 
| 139 | 139 | $this->commentsManager, | 
| 140 | 140 | $comment, | 
| @@ -187,7 +187,7 @@ discard block | ||
| 187 | 187 |  	function getProperties($properties) { | 
| 188 | 188 | $marker = null; | 
| 189 | 189 | $user = $this->userSession->getUser(); | 
| 190 | -		if(!is_null($user)) { | |
| 190 | +		if (!is_null($user)) { | |
| 191 | 191 | $marker = $this->commentsManager->getReadMark($this->name, $this->id, $user); | 
| 192 | 192 | } | 
| 193 | 193 | return [self::PROPERTY_NAME_READ_MARKER => $marker]; | 
| @@ -64,6 +64,9 @@ | ||
| 64 | 64 | ); | 
| 65 | 65 | } | 
| 66 | 66 | |
| 67 | + /** | |
| 68 | + * @param boolean $toV2 | |
| 69 | + */ | |
| 67 | 70 |  	private function convertPrincipal($principal, $toV2) { | 
| 68 | 71 | list(, $name) = URLUtil::splitPath($principal); | 
| 69 | 72 |  		if ($toV2) { | 
| @@ -75,9 +75,9 @@ | ||
| 75 | 75 | |
| 76 | 76 |  	function propFind(PropFind $propFind, INode $node) { | 
| 77 | 77 | /* Overload current-user-principal */ | 
| 78 | -		$propFind->handle('{DAV:}current-user-principal', function () { | |
| 78 | +		$propFind->handle('{DAV:}current-user-principal', function() { | |
| 79 | 79 |  			if ($url = parent::getCurrentUserPrincipal()) { | 
| 80 | - return new Principal(Principal::HREF, $url . '/'); | |
| 80 | + return new Principal(Principal::HREF, $url.'/'); | |
| 81 | 81 |  			} else { | 
| 82 | 82 | return new Principal(Principal::UNAUTHENTICATED); | 
| 83 | 83 | } | 
| @@ -75,7 +75,7 @@ | ||
| 75 | 75 | private $cache = []; | 
| 76 | 76 | |
| 77 | 77 | /** | 
| 78 | - * @param Tree $tree node tree | |
| 78 | + * @param ObjectTree $tree node tree | |
| 79 | 79 | * @param IDBConnection $connection database connection | 
| 80 | 80 | * @param IUser $user owner of the tree and properties | 
| 81 | 81 | */ | 
| @@ -111,7 +111,7 @@ discard block | ||
| 111 | 111 | // we catch the exception to prevent breaking the whole list with a 404 | 
| 112 | 112 | // (soft fail) | 
| 113 | 113 | \OC::$server->getLogger()->warning( | 
| 114 | - 'Could not get node for path: \"' . $path . '\" : ' . $e->getMessage(), | |
| 114 | + 'Could not get node for path: \"'.$path.'\" : '.$e->getMessage(), | |
| 115 | 115 |  				array('app' => 'files') | 
| 116 | 116 | ); | 
| 117 | 117 | return; | 
| @@ -170,7 +170,7 @@ discard block | ||
| 170 | 170 | $statement = $this->connection->prepare( | 
| 171 | 171 | 'DELETE FROM `*PREFIX*properties` WHERE `userid` = ? AND `propertypath` = ?' | 
| 172 | 172 | ); | 
| 173 | - $statement->execute(array($this->user, '/' . $path)); | |
| 173 | + $statement->execute(array($this->user, '/'.$path)); | |
| 174 | 174 | $statement->closeCursor(); | 
| 175 | 175 | |
| 176 | 176 | unset($this->cache[$path]); | 
| @@ -186,10 +186,10 @@ discard block | ||
| 186 | 186 | */ | 
| 187 | 187 |  	public function move($source, $destination) { | 
| 188 | 188 | $statement = $this->connection->prepare( | 
| 189 | - 'UPDATE `*PREFIX*properties` SET `propertypath` = ?' . | |
| 189 | + 'UPDATE `*PREFIX*properties` SET `propertypath` = ?'. | |
| 190 | 190 | ' WHERE `userid` = ? AND `propertypath` = ?' | 
| 191 | 191 | ); | 
| 192 | -		$statement->execute(array('/' . $destination, $this->user, '/' . $source)); | |
| 192 | +		$statement->execute(array('/'.$destination, $this->user, '/'.$source)); | |
| 193 | 193 | $statement->closeCursor(); | 
| 194 | 194 | } | 
| 195 | 195 | |
| @@ -250,13 +250,13 @@ discard block | ||
| 250 | 250 |  	private function updateProperties($node, $properties) { | 
| 251 | 251 | $path = $node->getPath(); | 
| 252 | 252 | |
| 253 | - $deleteStatement = 'DELETE FROM `*PREFIX*properties`' . | |
| 253 | + $deleteStatement = 'DELETE FROM `*PREFIX*properties`'. | |
| 254 | 254 | ' WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?'; | 
| 255 | 255 | |
| 256 | - $insertStatement = 'INSERT INTO `*PREFIX*properties`' . | |
| 256 | + $insertStatement = 'INSERT INTO `*PREFIX*properties`'. | |
| 257 | 257 | ' (`userid`,`propertypath`,`propertyname`,`propertyvalue`) VALUES(?,?,?,?)'; | 
| 258 | 258 | |
| 259 | - $updateStatement = 'UPDATE `*PREFIX*properties` SET `propertyvalue` = ?' . | |
| 259 | + $updateStatement = 'UPDATE `*PREFIX*properties` SET `propertyvalue` = ?'. | |
| 260 | 260 | ' WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?'; | 
| 261 | 261 | |
| 262 | 262 | // TODO: use "insert or update" strategy ? | 
| @@ -329,7 +329,7 @@ discard block | ||
| 329 | 329 | |
| 330 | 330 | $result = $this->connection->executeQuery( | 
| 331 | 331 | $sql, | 
| 332 | - array($this->user, $this->connection->escapeLikeParameter(rtrim($path, '/')) . '/%', $requestedProperties), | |
| 332 | + array($this->user, $this->connection->escapeLikeParameter(rtrim($path, '/')).'/%', $requestedProperties), | |
| 333 | 333 | array(null, null, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) | 
| 334 | 334 | ); | 
| 335 | 335 | |
| @@ -232,6 +232,9 @@ | ||
| 232 | 232 | return '"' . $this->info->getEtag() . '"'; | 
| 233 | 233 | } | 
| 234 | 234 | |
| 235 | + /** | |
| 236 | + * @param string $path | |
| 237 | + */ | |
| 235 | 238 |  	private function getPartFileBasePath($path) { | 
| 236 | 239 |  		$partFileInStorage = \OC::$server->getConfig()->getSystemValue('part_file_in_storage', true); | 
| 237 | 240 |  		if ($partFileInStorage) { | 
| @@ -92,7 +92,7 @@ discard block | ||
| 92 | 92 | throw new Forbidden(); | 
| 93 | 93 | } | 
| 94 | 94 |  		} catch (StorageNotAvailableException $e) { | 
| 95 | -			throw new ServiceUnavailable("File is not updatable: " . $e->getMessage()); | |
| 95 | +			throw new ServiceUnavailable("File is not updatable: ".$e->getMessage()); | |
| 96 | 96 | } | 
| 97 | 97 | |
| 98 | 98 | // verify path of the target | 
| @@ -112,7 +112,7 @@ discard block | ||
| 112 | 112 | |
| 113 | 113 |  		if ($needsPartFile) { | 
| 114 | 114 | // mark file as partial while uploading (ignored by the scanner) | 
| 115 | - $partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part'; | |
| 115 | + $partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part'; | |
| 116 | 116 |  		} else { | 
| 117 | 117 | // upload file directly as the final path | 
| 118 | 118 | $partFilePath = $this->path; | 
| @@ -138,7 +138,7 @@ discard block | ||
| 138 | 138 |  				if (isset($_SERVER['CONTENT_LENGTH'])) { | 
| 139 | 139 | $expected = $_SERVER['CONTENT_LENGTH']; | 
| 140 | 140 | } | 
| 141 | -				throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )'); | |
| 141 | +				throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )'); | |
| 142 | 142 | } | 
| 143 | 143 | |
| 144 | 144 | // if content length is sent by client: | 
| @@ -147,7 +147,7 @@ discard block | ||
| 147 | 147 |  			if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { | 
| 148 | 148 | $expected = $_SERVER['CONTENT_LENGTH']; | 
| 149 | 149 |  				if ($count != $expected) { | 
| 150 | -					throw new BadRequest('expected filesize ' . $expected . ' got ' . $count); | |
| 150 | +					throw new BadRequest('expected filesize '.$expected.' got '.$count); | |
| 151 | 151 | } | 
| 152 | 152 | } | 
| 153 | 153 | |
| @@ -227,10 +227,10 @@ discard block | ||
| 227 | 227 | } | 
| 228 | 228 | |
| 229 | 229 |  		} catch (StorageNotAvailableException $e) { | 
| 230 | -			throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage()); | |
| 230 | +			throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage()); | |
| 231 | 231 | } | 
| 232 | 232 | |
| 233 | - return '"' . $this->info->getEtag() . '"'; | |
| 233 | + return '"'.$this->info->getEtag().'"'; | |
| 234 | 234 | } | 
| 235 | 235 | |
| 236 | 236 |  	private function getPartFileBasePath($path) { | 
| @@ -309,9 +309,9 @@ discard block | ||
| 309 | 309 | return $res; | 
| 310 | 310 |  		} catch (GenericEncryptionException $e) { | 
| 311 | 311 | // returning 503 will allow retry of the operation at a later point in time | 
| 312 | -			throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage()); | |
| 312 | +			throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage()); | |
| 313 | 313 |  		} catch (StorageNotAvailableException $e) { | 
| 314 | -			throw new ServiceUnavailable("Failed to open file: " . $e->getMessage()); | |
| 314 | +			throw new ServiceUnavailable("Failed to open file: ".$e->getMessage()); | |
| 315 | 315 |  		} catch (ForbiddenException $ex) { | 
| 316 | 316 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); | 
| 317 | 317 |  		} catch (LockedException $e) { | 
| @@ -336,7 +336,7 @@ discard block | ||
| 336 | 336 | throw new Forbidden(); | 
| 337 | 337 | } | 
| 338 | 338 |  		} catch (StorageNotAvailableException $e) { | 
| 339 | -			throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage()); | |
| 339 | +			throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage()); | |
| 340 | 340 |  		} catch (ForbiddenException $ex) { | 
| 341 | 341 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); | 
| 342 | 342 |  		} catch (LockedException $e) { | 
| @@ -403,7 +403,7 @@ discard block | ||
| 403 | 403 |  				if ($bytesWritten != $expected) { | 
| 404 | 404 | $chunk_handler->remove($info['index']); | 
| 405 | 405 | throw new BadRequest( | 
| 406 | - 'expected filesize ' . $expected . ' got ' . $bytesWritten); | |
| 406 | + 'expected filesize '.$expected.' got '.$bytesWritten); | |
| 407 | 407 | } | 
| 408 | 408 | } | 
| 409 | 409 | } | 
| @@ -413,7 +413,7 @@ discard block | ||
| 413 | 413 | $needsPartFile = $this->needsPartFile($storage); | 
| 414 | 414 | $partFile = null; | 
| 415 | 415 | |
| 416 | - $targetPath = $path . '/' . $info['name']; | |
| 416 | + $targetPath = $path.'/'.$info['name']; | |
| 417 | 417 | /** @var \OC\Files\Storage\Storage $targetStorage */ | 
| 418 | 418 | list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath); | 
| 419 | 419 | |
| @@ -429,7 +429,7 @@ discard block | ||
| 429 | 429 | |
| 430 | 430 |  				if ($needsPartFile) { | 
| 431 | 431 | // we first assembly the target file as a part file | 
| 432 | - $partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part'; | |
| 432 | + $partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part'; | |
| 433 | 433 | /** @var \OC\Files\Storage\Storage $targetStorage */ | 
| 434 | 434 | list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile); | 
| 435 | 435 | |
| @@ -548,10 +548,10 @@ discard block | ||
| 548 | 548 | } | 
| 549 | 549 |  		if ($e instanceof GenericEncryptionException) { | 
| 550 | 550 | // returning 503 will allow retry of the operation at a later point in time | 
| 551 | -			throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e); | |
| 551 | +			throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e); | |
| 552 | 552 | } | 
| 553 | 553 |  		if ($e instanceof StorageNotAvailableException) { | 
| 554 | -			throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e); | |
| 554 | +			throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e); | |
| 555 | 555 | } | 
| 556 | 556 | |
| 557 | 557 | throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e); |