@@ -174,21 +174,21 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) { |
176 | 176 | //fix types |
177 | - $data['fileid'] = (int)$data['fileid']; |
|
178 | - $data['parent'] = (int)$data['parent']; |
|
177 | + $data['fileid'] = (int) $data['fileid']; |
|
178 | + $data['parent'] = (int) $data['parent']; |
|
179 | 179 | $data['size'] = 0 + $data['size']; |
180 | - $data['mtime'] = (int)$data['mtime']; |
|
181 | - $data['storage_mtime'] = (int)$data['storage_mtime']; |
|
182 | - $data['encryptedVersion'] = (int)$data['encrypted']; |
|
183 | - $data['encrypted'] = (bool)$data['encrypted']; |
|
180 | + $data['mtime'] = (int) $data['mtime']; |
|
181 | + $data['storage_mtime'] = (int) $data['storage_mtime']; |
|
182 | + $data['encryptedVersion'] = (int) $data['encrypted']; |
|
183 | + $data['encrypted'] = (bool) $data['encrypted']; |
|
184 | 184 | $data['storage_id'] = $data['storage']; |
185 | - $data['storage'] = (int)$data['storage']; |
|
185 | + $data['storage'] = (int) $data['storage']; |
|
186 | 186 | $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']); |
187 | 187 | $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']); |
188 | 188 | if ($data['storage_mtime'] == 0) { |
189 | 189 | $data['storage_mtime'] = $data['mtime']; |
190 | 190 | } |
191 | - $data['permissions'] = (int)$data['permissions']; |
|
191 | + $data['permissions'] = (int) $data['permissions']; |
|
192 | 192 | if (isset($data['creation_time'])) { |
193 | 193 | $data['creation_time'] = (int) $data['creation_time']; |
194 | 194 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $files = $result->fetchAll(); |
227 | 227 | $result->closeCursor(); |
228 | 228 | |
229 | - return array_map(function (array $data) { |
|
229 | + return array_map(function(array $data) { |
|
230 | 230 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
231 | 231 | }, $files); |
232 | 232 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | |
353 | 353 | $query->update('filecache') |
354 | 354 | ->whereFileId($id) |
355 | - ->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) { |
|
355 | + ->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) { |
|
356 | 356 | return $query->expr()->orX( |
357 | 357 | $query->expr()->neq($key, $query->createNamedParameter($value)), |
358 | 358 | $query->expr()->isNull($key) |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | $query = $this->getQueryBuilder(); |
382 | 382 | $query->update('filecache_extended') |
383 | 383 | ->whereFileId($id) |
384 | - ->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) { |
|
384 | + ->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) { |
|
385 | 385 | return $query->expr()->orX( |
386 | 386 | $query->expr()->neq($key, $query->createNamedParameter($value)), |
387 | 387 | $query->expr()->isNull($key) |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | $id = $result->fetchColumn(); |
477 | 477 | $result->closeCursor(); |
478 | 478 | |
479 | - return $id === false ? -1 : (int)$id; |
|
479 | + return $id === false ? -1 : (int) $id; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | /** |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | return -1; |
491 | 491 | } else { |
492 | 492 | $parent = $this->getParentPath($file); |
493 | - return (int)$this->getId($parent); |
|
493 | + return (int) $this->getId($parent); |
|
494 | 494 | } |
495 | 495 | } |
496 | 496 | |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | */ |
548 | 548 | private function getSubFolders(ICacheEntry $entry) { |
549 | 549 | $children = $this->getFolderContentsById($entry->getId()); |
550 | - return array_filter($children, function ($child) { |
|
550 | + return array_filter($children, function($child) { |
|
551 | 551 | return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; |
552 | 552 | }); |
553 | 553 | } |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | // and collecting all folder ids to later use to delete the filecache entries |
567 | 567 | while ($entryId = array_pop($queue)) { |
568 | 568 | $children = $this->getFolderContentsById($entryId); |
569 | - $childIds = array_map(function (ICacheEntry $cacheEntry) { |
|
569 | + $childIds = array_map(function(ICacheEntry $cacheEntry) { |
|
570 | 570 | return $cacheEntry->getId(); |
571 | 571 | }, $children); |
572 | 572 | |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | $query->execute(); |
577 | 577 | |
578 | 578 | /** @var ICacheEntry[] $childFolders */ |
579 | - $childFolders = array_filter($children, function ($child) { |
|
579 | + $childFolders = array_filter($children, function($child) { |
|
580 | 580 | return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; |
581 | 581 | }); |
582 | 582 | foreach ($childFolders as $folder) { |
@@ -634,10 +634,10 @@ discard block |
||
634 | 634 | [$targetStorageId, $targetPath] = $this->getMoveInfo($targetPath); |
635 | 635 | |
636 | 636 | if (is_null($sourceStorageId) || $sourceStorageId === false) { |
637 | - throw new \Exception('Invalid source storage id: ' . $sourceStorageId); |
|
637 | + throw new \Exception('Invalid source storage id: '.$sourceStorageId); |
|
638 | 638 | } |
639 | 639 | if (is_null($targetStorageId) || $targetStorageId === false) { |
640 | - throw new \Exception('Invalid target storage id: ' . $targetStorageId); |
|
640 | + throw new \Exception('Invalid target storage id: '.$targetStorageId); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | $this->connection->beginTransaction(); |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | ->set('path_hash', $fun->md5($newPathFunction)) |
657 | 657 | ->set('path', $newPathFunction) |
658 | 658 | ->where($query->expr()->eq('storage', $query->createNamedParameter($sourceStorageId, IQueryBuilder::PARAM_INT))) |
659 | - ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath) . '/%'))); |
|
659 | + ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath).'/%'))); |
|
660 | 660 | |
661 | 661 | try { |
662 | 662 | $query->execute(); |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | $result->closeCursor(); |
725 | 725 | |
726 | 726 | if ($size !== false) { |
727 | - if ((int)$size === -1) { |
|
727 | + if ((int) $size === -1) { |
|
728 | 728 | return self::SHALLOW; |
729 | 729 | } else { |
730 | 730 | return self::COMPLETE; |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | $files = $result->fetchAll(); |
762 | 762 | $result->closeCursor(); |
763 | 763 | |
764 | - return array_map(function (array $data) { |
|
764 | + return array_map(function(array $data) { |
|
765 | 765 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
766 | 766 | }, $files); |
767 | 767 | } |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | private function searchResultToCacheEntries(Statement $result) { |
774 | 774 | $files = $result->fetchAll(); |
775 | 775 | |
776 | - return array_map(function (array $data) { |
|
776 | + return array_map(function(array $data) { |
|
777 | 777 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
778 | 778 | }, $files); |
779 | 779 | } |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | $files = $result->fetchAll(); |
803 | 803 | $result->closeCursor(); |
804 | 804 | |
805 | - return array_map(function (array $data) { |
|
805 | + return array_map(function(array $data) { |
|
806 | 806 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
807 | 807 | }, $files); |
808 | 808 | } |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | ->andWhere($query->expr()->lt('size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))); |
887 | 887 | |
888 | 888 | $result = $query->execute(); |
889 | - $size = (int)$result->fetchColumn(); |
|
889 | + $size = (int) $result->fetchColumn(); |
|
890 | 890 | $result->closeCursor(); |
891 | 891 | |
892 | 892 | return $size; |
@@ -952,8 +952,8 @@ discard block |
||
952 | 952 | $files = $result->fetchAll(\PDO::FETCH_COLUMN); |
953 | 953 | $result->closeCursor(); |
954 | 954 | |
955 | - return array_map(function ($id) { |
|
956 | - return (int)$id; |
|
955 | + return array_map(function($id) { |
|
956 | + return (int) $id; |
|
957 | 957 | }, $files); |
958 | 958 | } |
959 | 959 |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | |
93 | 93 | public function registerMounts(IUser $user, array $mounts) { |
94 | 94 | // filter out non-proper storages coming from unit tests |
95 | - $mounts = array_filter($mounts, function (IMountPoint $mount) { |
|
95 | + $mounts = array_filter($mounts, function(IMountPoint $mount) { |
|
96 | 96 | return $mount instanceof SharedMount || $mount->getStorage() && $mount->getStorage()->getCache(); |
97 | 97 | }); |
98 | 98 | /** @var ICachedMountInfo[] $newMounts */ |
99 | - $newMounts = array_map(function (IMountPoint $mount) use ($user) { |
|
99 | + $newMounts = array_map(function(IMountPoint $mount) use ($user) { |
|
100 | 100 | // filter out any storages which aren't scanned yet since we aren't interested in files from those storages (yet) |
101 | 101 | if ($mount->getStorageRootId() === -1) { |
102 | 102 | return null; |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | } |
106 | 106 | }, $mounts); |
107 | 107 | $newMounts = array_values(array_filter($newMounts)); |
108 | - $newMountRootIds = array_map(function (ICachedMountInfo $mount) { |
|
108 | + $newMountRootIds = array_map(function(ICachedMountInfo $mount) { |
|
109 | 109 | return $mount->getRootId(); |
110 | 110 | }, $newMounts); |
111 | 111 | $newMounts = array_combine($newMountRootIds, $newMounts); |
112 | 112 | |
113 | 113 | $cachedMounts = $this->getMountsForUser($user); |
114 | - $cachedMountRootIds = array_map(function (ICachedMountInfo $mount) { |
|
114 | + $cachedMountRootIds = array_map(function(ICachedMountInfo $mount) { |
|
115 | 115 | return $mount->getRootId(); |
116 | 116 | }, $cachedMounts); |
117 | 117 | $cachedMounts = array_combine($cachedMountRootIds, $cachedMounts); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | ], ['root_id', 'user_id']); |
186 | 186 | } else { |
187 | 187 | // in some cases this is legitimate, like orphaned shares |
188 | - $this->logger->debug('Could not get storage info for mount at ' . $mount->getMountPoint()); |
|
188 | + $this->logger->debug('Could not get storage info for mount at '.$mount->getMountPoint()); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | } |
219 | 219 | $mount_id = $row['mount_id']; |
220 | 220 | if (!is_null($mount_id)) { |
221 | - $mount_id = (int)$mount_id; |
|
221 | + $mount_id = (int) $mount_id; |
|
222 | 222 | } |
223 | - return new CachedMountInfo($user, (int)$row['storage_id'], (int)$row['root_id'], $row['mount_point'], $mount_id, isset($row['path']) ? $row['path'] : ''); |
|
223 | + return new CachedMountInfo($user, (int) $row['storage_id'], (int) $row['root_id'], $row['mount_point'], $mount_id, isset($row['path']) ? $row['path'] : ''); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -303,12 +303,12 @@ discard block |
||
303 | 303 | |
304 | 304 | if (is_array($row)) { |
305 | 305 | $this->cacheInfoCache[$fileId] = [ |
306 | - (int)$row['storage'], |
|
306 | + (int) $row['storage'], |
|
307 | 307 | $row['path'], |
308 | - (int)$row['mimetype'] |
|
308 | + (int) $row['mimetype'] |
|
309 | 309 | ]; |
310 | 310 | } else { |
311 | - throw new NotFoundException('File with id "' . $fileId . '" not found'); |
|
311 | + throw new NotFoundException('File with id "'.$fileId.'" not found'); |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | return $this->cacheInfoCache[$fileId]; |
@@ -329,16 +329,16 @@ discard block |
||
329 | 329 | $mountsForStorage = $this->getMountsForStorageId($storageId, $user); |
330 | 330 | |
331 | 331 | // filter mounts that are from the same storage but a different directory |
332 | - $filteredMounts = array_filter($mountsForStorage, function (ICachedMountInfo $mount) use ($internalPath, $fileId) { |
|
332 | + $filteredMounts = array_filter($mountsForStorage, function(ICachedMountInfo $mount) use ($internalPath, $fileId) { |
|
333 | 333 | if ($fileId === $mount->getRootId()) { |
334 | 334 | return true; |
335 | 335 | } |
336 | 336 | $internalMountPath = $mount->getRootInternalPath(); |
337 | 337 | |
338 | - return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath . '/'; |
|
338 | + return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath.'/'; |
|
339 | 339 | }); |
340 | 340 | |
341 | - return array_map(function (ICachedMountInfo $mount) use ($internalPath) { |
|
341 | + return array_map(function(ICachedMountInfo $mount) use ($internalPath) { |
|
342 | 342 | return new CachedMountFileInfo( |
343 | 343 | $mount->getUser(), |
344 | 344 | $mount->getStorageId(), |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $slash |
396 | 396 | ); |
397 | 397 | |
398 | - $userIds = array_map(function (IUser $user) { |
|
398 | + $userIds = array_map(function(IUser $user) { |
|
399 | 399 | return $user->getUID(); |
400 | 400 | }, $users); |
401 | 401 |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | return []; |
175 | 175 | } |
176 | 176 | |
177 | - usort($this->tags, function ($a, $b) { |
|
177 | + usort($this->tags, function($a, $b) { |
|
178 | 178 | return strnatcasecmp($a->getName(), $b->getName()); |
179 | 179 | }); |
180 | 180 | $tagMap = []; |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function getTagsForUser($user) { |
198 | 198 | return array_filter($this->tags, |
199 | - function ($tag) use ($user) { |
|
199 | + function($tag) use ($user) { |
|
200 | 200 | return $tag->getOwner() === $user; |
201 | 201 | } |
202 | 202 | ); |
@@ -217,21 +217,21 @@ discard block |
||
217 | 217 | $chunks = array_chunk($objIds, 900, false); |
218 | 218 | foreach ($chunks as $chunk) { |
219 | 219 | $result = $conn->executeQuery( |
220 | - 'SELECT `category`, `categoryid`, `objid` ' . |
|
221 | - 'FROM `' . self::RELATION_TABLE . '` r, `' . self::TAG_TABLE . '` ' . |
|
220 | + 'SELECT `category`, `categoryid`, `objid` '. |
|
221 | + 'FROM `'.self::RELATION_TABLE.'` r, `'.self::TAG_TABLE.'` '. |
|
222 | 222 | 'WHERE `categoryid` = `id` AND `uid` = ? AND r.`type` = ? AND `objid` IN (?)', |
223 | 223 | [$this->user, $this->type, $chunk], |
224 | 224 | [null, null, IQueryBuilder::PARAM_INT_ARRAY] |
225 | 225 | ); |
226 | 226 | while ($row = $result->fetch()) { |
227 | - $objId = (int)$row['objid']; |
|
227 | + $objId = (int) $row['objid']; |
|
228 | 228 | if (!isset($entries[$objId])) { |
229 | 229 | $entries[$objId] = []; |
230 | 230 | } |
231 | 231 | $entries[$objId][] = $row['category']; |
232 | 232 | } |
233 | 233 | if ($result === null) { |
234 | - \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
234 | + \OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
235 | 235 | return false; |
236 | 236 | } |
237 | 237 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | $ids = []; |
281 | - $sql = 'SELECT `objid` FROM `' . self::RELATION_TABLE |
|
281 | + $sql = 'SELECT `objid` FROM `'.self::RELATION_TABLE |
|
282 | 282 | . '` WHERE `categoryid` = ?'; |
283 | 283 | |
284 | 284 | try { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $result = $stmt->execute([$tagId]); |
287 | 287 | if ($result === null) { |
288 | 288 | $stmt->closeCursor(); |
289 | - \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
289 | + \OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
290 | 290 | return false; |
291 | 291 | } |
292 | 292 | } catch (\Exception $e) { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | if (!is_null($result)) { |
302 | 302 | while ($row = $result->fetchRow()) { |
303 | - $ids[] = (int)$row['objid']; |
|
303 | + $ids[] = (int) $row['objid']; |
|
304 | 304 | } |
305 | 305 | $result->closeCursor(); |
306 | 306 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | return false; |
346 | 346 | } |
347 | 347 | if ($this->userHasTag($name, $this->user)) { |
348 | - \OCP\Util::writeLog('core', __METHOD__.', name: ' . $name. ' exists already', ILogger::DEBUG); |
|
348 | + \OCP\Util::writeLog('core', __METHOD__.', name: '.$name.' exists already', ILogger::DEBUG); |
|
349 | 349 | return false; |
350 | 350 | } |
351 | 351 | try { |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | ]); |
361 | 361 | return false; |
362 | 362 | } |
363 | - \OCP\Util::writeLog('core', __METHOD__.', id: ' . $tag->getId(), ILogger::DEBUG); |
|
363 | + \OCP\Util::writeLog('core', __METHOD__.', id: '.$tag->getId(), ILogger::DEBUG); |
|
364 | 364 | return $tag->getId(); |
365 | 365 | } |
366 | 366 | |
@@ -386,13 +386,13 @@ discard block |
||
386 | 386 | $key = $this->getTagByName($from); |
387 | 387 | } |
388 | 388 | if ($key === false) { |
389 | - \OCP\Util::writeLog('core', __METHOD__.', tag: ' . $from. ' does not exist', ILogger::DEBUG); |
|
389 | + \OCP\Util::writeLog('core', __METHOD__.', tag: '.$from.' does not exist', ILogger::DEBUG); |
|
390 | 390 | return false; |
391 | 391 | } |
392 | 392 | $tag = $this->tags[$key]; |
393 | 393 | |
394 | 394 | if ($this->userHasTag($to, $tag->getOwner())) { |
395 | - \OCP\Util::writeLog('core', __METHOD__.', A tag named ' . $to. ' already exists for user ' . $tag->getOwner() . '.', ILogger::DEBUG); |
|
395 | + \OCP\Util::writeLog('core', __METHOD__.', A tag named '.$to.' already exists for user '.$tag->getOwner().'.', ILogger::DEBUG); |
|
396 | 396 | return false; |
397 | 397 | } |
398 | 398 | |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | |
466 | 466 | // reload tags to get the proper ids. |
467 | 467 | $this->tags = $this->mapper->loadTags($this->owners, $this->type); |
468 | - \OCP\Util::writeLog('core', __METHOD__.', tags: ' . print_r($this->tags, true), |
|
468 | + \OCP\Util::writeLog('core', __METHOD__.', tags: '.print_r($this->tags, true), |
|
469 | 469 | ILogger::DEBUG); |
470 | 470 | // Loop through temporarily cached objectid/tagname pairs |
471 | 471 | // and save relations. |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | $dbConnection = \OC::$server->getDatabaseConnection(); |
476 | 476 | foreach (self::$relations as $relation) { |
477 | 477 | $tagId = $this->getTagId($relation['tag']); |
478 | - \OCP\Util::writeLog('core', __METHOD__ . 'catid, ' . $relation['tag'] . ' ' . $tagId, ILogger::DEBUG); |
|
478 | + \OCP\Util::writeLog('core', __METHOD__.'catid, '.$relation['tag'].' '.$tagId, ILogger::DEBUG); |
|
479 | 479 | if ($tagId) { |
480 | 480 | try { |
481 | 481 | $dbConnection->insertIfNotExist(self::RELATION_TABLE, |
@@ -511,11 +511,11 @@ discard block |
||
511 | 511 | // Find all objectid/tagId pairs. |
512 | 512 | $result = null; |
513 | 513 | try { |
514 | - $stmt = \OC_DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` ' |
|
514 | + $stmt = \OC_DB::prepare('SELECT `id` FROM `'.self::TAG_TABLE.'` ' |
|
515 | 515 | . 'WHERE `uid` = ?'); |
516 | 516 | $result = $stmt->execute([$arguments['uid']]); |
517 | 517 | if ($result === null) { |
518 | - \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
518 | + \OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
519 | 519 | } |
520 | 520 | } catch (\Exception $e) { |
521 | 521 | \OC::$server->getLogger()->logException($e, [ |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | |
528 | 528 | if (!is_null($result)) { |
529 | 529 | try { |
530 | - $stmt = \OC_DB::prepare('DELETE FROM `' . self::RELATION_TABLE . '` ' |
|
530 | + $stmt = \OC_DB::prepare('DELETE FROM `'.self::RELATION_TABLE.'` ' |
|
531 | 531 | . 'WHERE `categoryid` = ?'); |
532 | 532 | while ($row = $result->fetchRow()) { |
533 | 533 | try { |
@@ -550,11 +550,11 @@ discard block |
||
550 | 550 | } |
551 | 551 | } |
552 | 552 | try { |
553 | - $stmt = \OC_DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` ' |
|
553 | + $stmt = \OC_DB::prepare('DELETE FROM `'.self::TAG_TABLE.'` ' |
|
554 | 554 | . 'WHERE `uid` = ?'); |
555 | 555 | $result = $stmt->execute([$arguments['uid']]); |
556 | 556 | if ($result === null) { |
557 | - \OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
557 | + \OCP\Util::writeLog('core', __METHOD__.', DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
558 | 558 | } |
559 | 559 | } catch (\Exception $e) { |
560 | 560 | \OC::$server->getLogger()->logException($e, [ |
@@ -578,14 +578,14 @@ discard block |
||
578 | 578 | } |
579 | 579 | $updates = $ids; |
580 | 580 | try { |
581 | - $query = 'DELETE FROM `' . self::RELATION_TABLE . '` '; |
|
582 | - $query .= 'WHERE `objid` IN (' . str_repeat('?,', count($ids) - 1) . '?) '; |
|
581 | + $query = 'DELETE FROM `'.self::RELATION_TABLE.'` '; |
|
582 | + $query .= 'WHERE `objid` IN ('.str_repeat('?,', count($ids) - 1).'?) '; |
|
583 | 583 | $query .= 'AND `type`= ?'; |
584 | 584 | $updates[] = $this->type; |
585 | 585 | $stmt = \OC_DB::prepare($query); |
586 | 586 | $result = $stmt->execute($updates); |
587 | 587 | if ($result === null) { |
588 | - \OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
588 | + \OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR); |
|
589 | 589 | return false; |
590 | 590 | } |
591 | 591 | } catch (\Exception $e) { |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | } |
704 | 704 | |
705 | 705 | try { |
706 | - $sql = 'DELETE FROM `' . self::RELATION_TABLE . '` ' |
|
706 | + $sql = 'DELETE FROM `'.self::RELATION_TABLE.'` ' |
|
707 | 707 | . 'WHERE `objid` = ? AND `categoryid` = ? AND `type` = ?'; |
708 | 708 | $stmt = \OC_DB::prepare($sql); |
709 | 709 | $stmt->execute([$objid, $tagId, $this->type]); |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | $names = array_map('trim', $names); |
733 | 733 | array_filter($names); |
734 | 734 | |
735 | - \OCP\Util::writeLog('core', __METHOD__ . ', before: ' |
|
735 | + \OCP\Util::writeLog('core', __METHOD__.', before: ' |
|
736 | 736 | . print_r($this->tags, true), ILogger::DEBUG); |
737 | 737 | foreach ($names as $name) { |
738 | 738 | $id = null; |
@@ -748,18 +748,18 @@ discard block |
||
748 | 748 | unset($this->tags[$key]); |
749 | 749 | $this->mapper->delete($tag); |
750 | 750 | } else { |
751 | - \OCP\Util::writeLog('core', __METHOD__ . 'Cannot delete tag ' . $name |
|
751 | + \OCP\Util::writeLog('core', __METHOD__.'Cannot delete tag '.$name |
|
752 | 752 | . ': not found.', ILogger::ERROR); |
753 | 753 | } |
754 | 754 | if (!is_null($id) && $id !== false) { |
755 | 755 | try { |
756 | - $sql = 'DELETE FROM `' . self::RELATION_TABLE . '` ' |
|
756 | + $sql = 'DELETE FROM `'.self::RELATION_TABLE.'` ' |
|
757 | 757 | . 'WHERE `categoryid` = ?'; |
758 | 758 | $stmt = \OC_DB::prepare($sql); |
759 | 759 | $result = $stmt->execute([$id]); |
760 | 760 | if ($result === null) { |
761 | 761 | \OCP\Util::writeLog('core', |
762 | - __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), |
|
762 | + __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), |
|
763 | 763 | ILogger::ERROR); |
764 | 764 | return false; |
765 | 765 | } |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | return false; |
783 | 783 | } |
784 | 784 | return array_search(strtolower($needle), array_map( |
785 | - function ($tag) use ($mem) { |
|
785 | + function($tag) use ($mem) { |
|
786 | 786 | return strtolower(call_user_func([$tag, $mem])); |
787 | 787 | }, $haystack) |
788 | 788 | ); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | $select = self::createSelectStatement(self::FORMAT_NONE, $fileDependent); |
152 | 152 | |
153 | - $where .= ' `' . $column . '` = ? AND `item_type` = ? '; |
|
153 | + $where .= ' `'.$column.'` = ? AND `item_type` = ? '; |
|
154 | 154 | $arguments = [$itemSource, $itemType]; |
155 | 155 | // for link shares $user === null |
156 | 156 | if ($user !== null) { |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $arguments[] = $owner; |
169 | 169 | } |
170 | 170 | |
171 | - $query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $fileDependentWhere . $where); |
|
171 | + $query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$fileDependentWhere.$where); |
|
172 | 172 | |
173 | 173 | $result = \OC_DB::executeAudited($query, $arguments); |
174 | 174 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if ($fileDependent && !self::isFileReachable($row['path'], $row['storage_id'])) { |
177 | 177 | continue; |
178 | 178 | } |
179 | - if ($fileDependent && (int)$row['file_parent'] === -1) { |
|
179 | + if ($fileDependent && (int) $row['file_parent'] === -1) { |
|
180 | 180 | // if it is a mount point we need to get the path from the mount manager |
181 | 181 | $mountManager = \OC\Files\Filesystem::getMountManager(); |
182 | 182 | $mountPoint = $mountManager->findByStorageId($row['storage_id']); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $row['path'] = $path; |
188 | 188 | } else { |
189 | 189 | \OC::$server->getLogger()->warning( |
190 | - 'Could not resolve mount point for ' . $row['storage_id'], |
|
190 | + 'Could not resolve mount point for '.$row['storage_id'], |
|
191 | 191 | ['app' => 'OCP\Share'] |
192 | 192 | ); |
193 | 193 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | if (!empty($groups)) { |
208 | - $where = $fileDependentWhere . ' WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)'; |
|
208 | + $where = $fileDependentWhere.' WHERE `'.$column.'` = ? AND `item_type` = ? AND `share_with` in (?)'; |
|
209 | 209 | $arguments = [$itemSource, $itemType, $groups]; |
210 | 210 | $types = [null, null, IQueryBuilder::PARAM_STR_ARRAY]; |
211 | 211 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | // class isn't static anymore... |
220 | 220 | $conn = \OC::$server->getDatabaseConnection(); |
221 | 221 | $result = $conn->executeQuery( |
222 | - 'SELECT ' . $select . ' FROM `*PREFIX*share` ' . $where, |
|
222 | + 'SELECT '.$select.' FROM `*PREFIX*share` '.$where, |
|
223 | 223 | $arguments, |
224 | 224 | $types |
225 | 225 | ); |
@@ -286,12 +286,12 @@ discard block |
||
286 | 286 | $currentUser = $owner ? $owner : \OC_User::getUser(); |
287 | 287 | foreach ($items as $item) { |
288 | 288 | // delete the item with the expected share_type and owner |
289 | - if ((int)$item['share_type'] === (int)$shareType && $item['uid_owner'] === $currentUser) { |
|
289 | + if ((int) $item['share_type'] === (int) $shareType && $item['uid_owner'] === $currentUser) { |
|
290 | 290 | $toDelete = $item; |
291 | 291 | // if there is more then one result we don't have to delete the children |
292 | 292 | // but update their parent. For group shares the new parent should always be |
293 | 293 | // the original group share and not the db entry with the unique name |
294 | - } elseif ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) { |
|
294 | + } elseif ((int) $item['share_type'] === self::$shareTypeGroupUserUnique) { |
|
295 | 295 | $newParent = $item['parent']; |
296 | 296 | } else { |
297 | 297 | $newParent = $item['id']; |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @return null |
349 | 349 | */ |
350 | 350 | protected static function unshareItem(array $item, $newParent = null) { |
351 | - $shareType = (int)$item['share_type']; |
|
351 | + $shareType = (int) $item['share_type']; |
|
352 | 352 | $shareWith = null; |
353 | 353 | if ($shareType !== IShare::TYPE_LINK) { |
354 | 354 | $shareWith = $item['share_with']; |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | $deletedShares[] = $hookParams; |
375 | 375 | $hookParams['deletedShares'] = $deletedShares; |
376 | 376 | \OC_Hook::emit(\OCP\Share::class, 'post_unshare', $hookParams); |
377 | - if ((int)$item['share_type'] === IShare::TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { |
|
377 | + if ((int) $item['share_type'] === IShare::TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { |
|
378 | 378 | list(, $remote) = Helper::splitUserRemote($item['share_with']); |
379 | 379 | self::sendRemoteUnshare($remote, $item['id'], $item['token']); |
380 | 380 | } |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | $result = $query->execute($queryArgs); |
630 | 630 | if ($result === false) { |
631 | 631 | \OCP\Util::writeLog('OCP\Share', |
632 | - \OC_DB::getErrorMessage() . ', select=' . $select . ' where=', |
|
632 | + \OC_DB::getErrorMessage().', select='.$select.' where=', |
|
633 | 633 | ILogger::ERROR); |
634 | 634 | } |
635 | 635 | $items = []; |
@@ -671,14 +671,14 @@ discard block |
||
671 | 671 | } |
672 | 672 | // Switch ids if sharing permission is granted on only |
673 | 673 | // one share to ensure correct parent is used if resharing |
674 | - if (~(int)$items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE |
|
675 | - && (int)$row['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
674 | + if (~(int) $items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE |
|
675 | + && (int) $row['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
676 | 676 | $items[$row['id']] = $items[$id]; |
677 | 677 | $switchedItems[$id] = $row['id']; |
678 | 678 | unset($items[$id]); |
679 | 679 | $id = $row['id']; |
680 | 680 | } |
681 | - $items[$id]['permissions'] |= (int)$row['permissions']; |
|
681 | + $items[$id]['permissions'] |= (int) $row['permissions']; |
|
682 | 682 | } |
683 | 683 | continue; |
684 | 684 | } elseif (!empty($row['parent'])) { |
@@ -698,8 +698,8 @@ discard block |
||
698 | 698 | $parentResult->closeCursor(); |
699 | 699 | |
700 | 700 | if ($parentRow === false) { |
701 | - \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' . |
|
702 | - \OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where, |
|
701 | + \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: '. |
|
702 | + \OC_DB::getErrorMessage().', select='.$select.' where='.$where, |
|
703 | 703 | ILogger::ERROR); |
704 | 704 | } else { |
705 | 705 | $tmpPath = $parentRow['file_target']; |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | $subPath = substr($row['path'], $pos); |
709 | 709 | $splitPath = explode('/', $subPath); |
710 | 710 | foreach (array_slice($splitPath, 2) as $pathPart) { |
711 | - $tmpPath = $tmpPath . '/' . $pathPart; |
|
711 | + $tmpPath = $tmpPath.'/'.$pathPart; |
|
712 | 712 | } |
713 | 713 | $row['path'] = $tmpPath; |
714 | 714 | } |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | |
859 | 859 | // filter out invalid items, these can appear when subshare entries exist |
860 | 860 | // for a group in which the requested user isn't a member any more |
861 | - $items = array_filter($items, function ($item) { |
|
861 | + $items = array_filter($items, function($item) { |
|
862 | 862 | return $item['share_type'] !== self::$shareTypeGroupUserUnique; |
863 | 863 | }); |
864 | 864 | |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | * @param array $parameters additional format parameters |
1017 | 1017 | * @return array format result |
1018 | 1018 | */ |
1019 | - private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) { |
|
1019 | + private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE, $parameters = null) { |
|
1020 | 1020 | if ($format === self::FORMAT_NONE) { |
1021 | 1021 | return $items; |
1022 | 1022 | } elseif ($format === self::FORMAT_STATUSES) { |
@@ -1073,13 +1073,13 @@ discard block |
||
1073 | 1073 | $try = 0; |
1074 | 1074 | $discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class); |
1075 | 1075 | while ($result['success'] === false && $try < 2) { |
1076 | - $federationEndpoints = $discoveryService->discover($protocol . $remoteDomain, 'FEDERATED_SHARING'); |
|
1076 | + $federationEndpoints = $discoveryService->discover($protocol.$remoteDomain, 'FEDERATED_SHARING'); |
|
1077 | 1077 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
1078 | 1078 | $client = \OC::$server->getHTTPClientService()->newClient(); |
1079 | 1079 | |
1080 | 1080 | try { |
1081 | 1081 | $response = $client->post( |
1082 | - $protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, |
|
1082 | + $protocol.$remoteDomain.$endpoint.$urlSuffix.'?format='.self::RESPONSE_FORMAT, |
|
1083 | 1083 | [ |
1084 | 1084 | 'body' => $fields, |
1085 | 1085 | 'connect_timeout' => 10, |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | * @return int |
1121 | 1121 | */ |
1122 | 1122 | public static function getExpireInterval() { |
1123 | - return (int)\OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1123 | + return (int) \OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1124 | 1124 | } |
1125 | 1125 | |
1126 | 1126 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $value = $this->crypto->encrypt(json_encode($credentials)); |
64 | 64 | |
65 | 65 | $this->dbConnection->setValues(self::DB_TABLE, [ |
66 | - 'user' => (string)$userId, |
|
66 | + 'user' => (string) $userId, |
|
67 | 67 | 'identifier' => $identifier, |
68 | 68 | ], [ |
69 | 69 | 'credentials' => $value, |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $qb = $this->dbConnection->getQueryBuilder(); |
82 | 82 | $qb->select('credentials') |
83 | 83 | ->from(self::DB_TABLE) |
84 | - ->where($qb->expr()->eq('user', $qb->createNamedParameter((string)$userId))) |
|
84 | + ->where($qb->expr()->eq('user', $qb->createNamedParameter((string) $userId))) |
|
85 | 85 | ->andWhere($qb->expr()->eq('identifier', $qb->createNamedParameter($identifier))) |
86 | 86 | ; |
87 | 87 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function delete($userId, $identifier) { |
108 | 108 | $qb = $this->dbConnection->getQueryBuilder(); |
109 | 109 | $qb->delete(self::DB_TABLE) |
110 | - ->where($qb->expr()->eq('user', $qb->createNamedParameter((string)$userId))) |
|
110 | + ->where($qb->expr()->eq('user', $qb->createNamedParameter((string) $userId))) |
|
111 | 111 | ->andWhere($qb->expr()->eq('identifier', $qb->createNamedParameter($identifier))) |
112 | 112 | ; |
113 | 113 | return $qb->execute(); |
@@ -73,7 +73,7 @@ |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | $query = $this->db->getQueryBuilder(); |
76 | - $query->select($query->createFunction('MAX(' . $query->getColumnName('id') . ')')) |
|
76 | + $query->select($query->createFunction('MAX('.$query->getColumnName('id').')')) |
|
77 | 77 | ->from('calendarobjects'); |
78 | 78 | $result = $query->execute(); |
79 | 79 | $maxId = (int) $result->fetchColumn(); |
@@ -84,7 +84,7 @@ |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | $query = $this->db->getQueryBuilder(); |
87 | - $query->select($query->createFunction('MAX(' . $query->getColumnName('id') . ')')) |
|
87 | + $query->select($query->createFunction('MAX('.$query->getColumnName('id').')')) |
|
88 | 88 | ->from('calendarobjects'); |
89 | 89 | $result = $query->execute(); |
90 | 90 | $maxId = (int) $result->fetchColumn(); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | } |
251 | 251 | |
252 | 252 | $result = $query->execute(); |
253 | - $column = (int)$result->fetchColumn(); |
|
253 | + $column = (int) $result->fetchColumn(); |
|
254 | 254 | $result->closeCursor(); |
255 | 255 | return $column; |
256 | 256 | } |
@@ -302,18 +302,18 @@ discard block |
||
302 | 302 | while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
303 | 303 | $components = []; |
304 | 304 | if ($row['components']) { |
305 | - $components = explode(',',$row['components']); |
|
305 | + $components = explode(',', $row['components']); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | $calendar = [ |
309 | 309 | 'id' => $row['id'], |
310 | 310 | 'uri' => $row['uri'], |
311 | 311 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
312 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
313 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
314 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
315 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
316 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
312 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
313 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
314 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
315 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
316 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
317 | 317 | ]; |
318 | 318 | |
319 | 319 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); |
334 | 334 | $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal)); |
335 | 335 | |
336 | - $principals = array_map(function ($principal) { |
|
336 | + $principals = array_map(function($principal) { |
|
337 | 337 | return urldecode($principal); |
338 | 338 | }, $principals); |
339 | 339 | $principals[] = $principalUri; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) |
357 | 357 | ->execute(); |
358 | 358 | |
359 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
359 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
360 | 360 | while ($row = $result->fetch()) { |
361 | 361 | if ($row['principaluri'] === $principalUri) { |
362 | 362 | continue; |
@@ -376,21 +376,21 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | list(, $name) = Uri\split($row['principaluri']); |
379 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
380 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
379 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
380 | + $row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
381 | 381 | $components = []; |
382 | 382 | if ($row['components']) { |
383 | - $components = explode(',',$row['components']); |
|
383 | + $components = explode(',', $row['components']); |
|
384 | 384 | } |
385 | 385 | $calendar = [ |
386 | 386 | 'id' => $row['id'], |
387 | 387 | 'uri' => $uri, |
388 | 388 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
389 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
390 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
391 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
392 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
393 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
389 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
390 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
391 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
392 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
393 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
394 | 394 | $readOnlyPropertyName => $readOnly, |
395 | 395 | ]; |
396 | 396 | |
@@ -430,16 +430,16 @@ discard block |
||
430 | 430 | while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
431 | 431 | $components = []; |
432 | 432 | if ($row['components']) { |
433 | - $components = explode(',',$row['components']); |
|
433 | + $components = explode(',', $row['components']); |
|
434 | 434 | } |
435 | 435 | $calendar = [ |
436 | 436 | 'id' => $row['id'], |
437 | 437 | 'uri' => $row['uri'], |
438 | 438 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
439 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
440 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
441 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
442 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
439 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
440 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
441 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
442 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
443 | 443 | ]; |
444 | 444 | foreach ($this->propertyMap as $xmlName => $dbName) { |
445 | 445 | $calendar[$xmlName] = $row[$dbName]; |
@@ -498,22 +498,22 @@ discard block |
||
498 | 498 | |
499 | 499 | while ($row = $result->fetch()) { |
500 | 500 | list(, $name) = Uri\split($row['principaluri']); |
501 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
501 | + $row['displayname'] = $row['displayname']."($name)"; |
|
502 | 502 | $components = []; |
503 | 503 | if ($row['components']) { |
504 | - $components = explode(',',$row['components']); |
|
504 | + $components = explode(',', $row['components']); |
|
505 | 505 | } |
506 | 506 | $calendar = [ |
507 | 507 | 'id' => $row['id'], |
508 | 508 | 'uri' => $row['publicuri'], |
509 | 509 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
510 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
511 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
512 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
513 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
514 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
515 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
516 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
510 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
511 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
512 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
513 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
514 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
515 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
516 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
517 | 517 | ]; |
518 | 518 | |
519 | 519 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -560,26 +560,26 @@ discard block |
||
560 | 560 | $result->closeCursor(); |
561 | 561 | |
562 | 562 | if ($row === false) { |
563 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
563 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | list(, $name) = Uri\split($row['principaluri']); |
567 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
567 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
568 | 568 | $components = []; |
569 | 569 | if ($row['components']) { |
570 | - $components = explode(',',$row['components']); |
|
570 | + $components = explode(',', $row['components']); |
|
571 | 571 | } |
572 | 572 | $calendar = [ |
573 | 573 | 'id' => $row['id'], |
574 | 574 | 'uri' => $row['publicuri'], |
575 | 575 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
576 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
577 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
578 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
579 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
580 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
581 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
582 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
576 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
577 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
578 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
579 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
580 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
581 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
582 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
583 | 583 | ]; |
584 | 584 | |
585 | 585 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -621,17 +621,17 @@ discard block |
||
621 | 621 | |
622 | 622 | $components = []; |
623 | 623 | if ($row['components']) { |
624 | - $components = explode(',',$row['components']); |
|
624 | + $components = explode(',', $row['components']); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | $calendar = [ |
628 | 628 | 'id' => $row['id'], |
629 | 629 | 'uri' => $row['uri'], |
630 | 630 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
631 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
632 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
633 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
634 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
631 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
632 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
633 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
634 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
635 | 635 | ]; |
636 | 636 | |
637 | 637 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -671,17 +671,17 @@ discard block |
||
671 | 671 | |
672 | 672 | $components = []; |
673 | 673 | if ($row['components']) { |
674 | - $components = explode(',',$row['components']); |
|
674 | + $components = explode(',', $row['components']); |
|
675 | 675 | } |
676 | 676 | |
677 | 677 | $calendar = [ |
678 | 678 | 'id' => $row['id'], |
679 | 679 | 'uri' => $row['uri'], |
680 | 680 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
681 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
682 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
683 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
684 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
681 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
682 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
683 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
684 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
685 | 685 | ]; |
686 | 686 | |
687 | 687 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -724,8 +724,8 @@ discard block |
||
724 | 724 | 'principaluri' => $row['principaluri'], |
725 | 725 | 'source' => $row['source'], |
726 | 726 | 'lastmodified' => $row['lastmodified'], |
727 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
728 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
727 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
728 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
729 | 729 | ]; |
730 | 730 | |
731 | 731 | foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) { |
@@ -762,16 +762,16 @@ discard block |
||
762 | 762 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
763 | 763 | if (isset($properties[$sccs])) { |
764 | 764 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
765 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
765 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
766 | 766 | } |
767 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
767 | + $values['components'] = implode(',', $properties[$sccs]->getValue()); |
|
768 | 768 | } elseif (isset($properties['components'])) { |
769 | 769 | // Allow to provide components internally without having |
770 | 770 | // to create a SupportedCalendarComponentSet object |
771 | 771 | $values['components'] = $properties['components']; |
772 | 772 | } |
773 | 773 | |
774 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
774 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
775 | 775 | if (isset($properties[$transp])) { |
776 | 776 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
777 | 777 | } |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | $calendarId = $query->getLastInsertId(); |
792 | 792 | |
793 | 793 | $calendarData = $this->getCalendarById($calendarId); |
794 | - $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData)); |
|
794 | + $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData)); |
|
795 | 795 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent( |
796 | 796 | '\OCA\DAV\CalDAV\CalDavBackend::createCalendar', |
797 | 797 | [ |
@@ -820,13 +820,13 @@ discard block |
||
820 | 820 | */ |
821 | 821 | public function updateCalendar($calendarId, PropPatch $propPatch) { |
822 | 822 | $supportedProperties = array_keys($this->propertyMap); |
823 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
823 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
824 | 824 | |
825 | - $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) { |
|
825 | + $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { |
|
826 | 826 | $newValues = []; |
827 | 827 | foreach ($mutations as $propertyName => $propertyValue) { |
828 | 828 | switch ($propertyName) { |
829 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp': |
|
829 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp': |
|
830 | 830 | $fieldName = 'transparent'; |
831 | 831 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
832 | 832 | break; |
@@ -848,7 +848,7 @@ discard block |
||
848 | 848 | |
849 | 849 | $calendarData = $this->getCalendarById($calendarId); |
850 | 850 | $shares = $this->getShares($calendarId); |
851 | - $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations)); |
|
851 | + $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int) $calendarId, $calendarData, $shares, $mutations)); |
|
852 | 852 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent( |
853 | 853 | '\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', |
854 | 854 | [ |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | ->execute(); |
899 | 899 | |
900 | 900 | if ($calendarData) { |
901 | - $this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares)); |
|
901 | + $this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int) $calendarId, $calendarData, $shares)); |
|
902 | 902 | } |
903 | 903 | } |
904 | 904 | |
@@ -958,11 +958,11 @@ discard block |
||
958 | 958 | 'id' => $row['id'], |
959 | 959 | 'uri' => $row['uri'], |
960 | 960 | 'lastmodified' => $row['lastmodified'], |
961 | - 'etag' => '"' . $row['etag'] . '"', |
|
961 | + 'etag' => '"'.$row['etag'].'"', |
|
962 | 962 | 'calendarid' => $row['calendarid'], |
963 | - 'size' => (int)$row['size'], |
|
963 | + 'size' => (int) $row['size'], |
|
964 | 964 | 'component' => strtolower($row['componenttype']), |
965 | - 'classification' => (int)$row['classification'] |
|
965 | + 'classification' => (int) $row['classification'] |
|
966 | 966 | ]; |
967 | 967 | } |
968 | 968 | |
@@ -1004,12 +1004,12 @@ discard block |
||
1004 | 1004 | 'id' => $row['id'], |
1005 | 1005 | 'uri' => $row['uri'], |
1006 | 1006 | 'lastmodified' => $row['lastmodified'], |
1007 | - 'etag' => '"' . $row['etag'] . '"', |
|
1007 | + 'etag' => '"'.$row['etag'].'"', |
|
1008 | 1008 | 'calendarid' => $row['calendarid'], |
1009 | - 'size' => (int)$row['size'], |
|
1009 | + 'size' => (int) $row['size'], |
|
1010 | 1010 | 'calendardata' => $this->readBlob($row['calendardata']), |
1011 | 1011 | 'component' => strtolower($row['componenttype']), |
1012 | - 'classification' => (int)$row['classification'] |
|
1012 | + 'classification' => (int) $row['classification'] |
|
1013 | 1013 | ]; |
1014 | 1014 | } |
1015 | 1015 | |
@@ -1050,12 +1050,12 @@ discard block |
||
1050 | 1050 | 'id' => $row['id'], |
1051 | 1051 | 'uri' => $row['uri'], |
1052 | 1052 | 'lastmodified' => $row['lastmodified'], |
1053 | - 'etag' => '"' . $row['etag'] . '"', |
|
1053 | + 'etag' => '"'.$row['etag'].'"', |
|
1054 | 1054 | 'calendarid' => $row['calendarid'], |
1055 | - 'size' => (int)$row['size'], |
|
1055 | + 'size' => (int) $row['size'], |
|
1056 | 1056 | 'calendardata' => $this->readBlob($row['calendardata']), |
1057 | 1057 | 'component' => strtolower($row['componenttype']), |
1058 | - 'classification' => (int)$row['classification'] |
|
1058 | + 'classification' => (int) $row['classification'] |
|
1059 | 1059 | ]; |
1060 | 1060 | } |
1061 | 1061 | $result->closeCursor(); |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | $calendarRow = $this->getCalendarById($calendarId); |
1128 | 1128 | $shares = $this->getShares($calendarId); |
1129 | 1129 | |
1130 | - $this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); |
|
1130 | + $this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow)); |
|
1131 | 1131 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent( |
1132 | 1132 | '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', |
1133 | 1133 | [ |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | } else { |
1141 | 1141 | $subscriptionRow = $this->getSubscriptionById($calendarId); |
1142 | 1142 | |
1143 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); |
|
1143 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow)); |
|
1144 | 1144 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent( |
1145 | 1145 | '\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', |
1146 | 1146 | [ |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | )); |
1153 | 1153 | } |
1154 | 1154 | |
1155 | - return '"' . $extraData['etag'] . '"'; |
|
1155 | + return '"'.$extraData['etag'].'"'; |
|
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | /** |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | $calendarRow = $this->getCalendarById($calendarId); |
1202 | 1202 | $shares = $this->getShares($calendarId); |
1203 | 1203 | |
1204 | - $this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); |
|
1204 | + $this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow)); |
|
1205 | 1205 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent( |
1206 | 1206 | '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', |
1207 | 1207 | [ |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | } else { |
1215 | 1215 | $subscriptionRow = $this->getSubscriptionById($calendarId); |
1216 | 1216 | |
1217 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); |
|
1217 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow)); |
|
1218 | 1218 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent( |
1219 | 1219 | '\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', |
1220 | 1220 | [ |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | } |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - return '"' . $extraData['etag'] . '"'; |
|
1230 | + return '"'.$extraData['etag'].'"'; |
|
1231 | 1231 | } |
1232 | 1232 | |
1233 | 1233 | /** |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | $calendarRow = $this->getCalendarById($calendarId); |
1265 | 1265 | $shares = $this->getShares($calendarId); |
1266 | 1266 | |
1267 | - $this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data)); |
|
1267 | + $this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int) $calendarId, $calendarRow, $shares, $data)); |
|
1268 | 1268 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent( |
1269 | 1269 | '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', |
1270 | 1270 | [ |
@@ -1277,7 +1277,7 @@ discard block |
||
1277 | 1277 | } else { |
1278 | 1278 | $subscriptionRow = $this->getSubscriptionById($calendarId); |
1279 | 1279 | |
1280 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int)$calendarId, $subscriptionRow, [], $data)); |
|
1280 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int) $calendarId, $subscriptionRow, [], $data)); |
|
1281 | 1281 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent( |
1282 | 1282 | '\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', |
1283 | 1283 | [ |
@@ -1549,7 +1549,7 @@ discard block |
||
1549 | 1549 | |
1550 | 1550 | $result = []; |
1551 | 1551 | while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
1552 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
1552 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
1553 | 1553 | if (!in_array($path, $result)) { |
1554 | 1554 | $result[] = $path; |
1555 | 1555 | } |
@@ -1597,8 +1597,8 @@ discard block |
||
1597 | 1597 | |
1598 | 1598 | if ($pattern !== '') { |
1599 | 1599 | $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
1600 | - $outerQuery->createNamedParameter('%' . |
|
1601 | - $this->db->escapeLikeParameter($pattern) . '%'))); |
|
1600 | + $outerQuery->createNamedParameter('%'. |
|
1601 | + $this->db->escapeLikeParameter($pattern).'%'))); |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | 1604 | $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri') |
@@ -1637,7 +1637,7 @@ discard block |
||
1637 | 1637 | $result = $outerQuery->execute(); |
1638 | 1638 | $calendarObjects = $result->fetchAll(); |
1639 | 1639 | |
1640 | - return array_map(function ($o) { |
|
1640 | + return array_map(function($o) { |
|
1641 | 1641 | $calendarData = Reader::read($o['calendardata']); |
1642 | 1642 | $comps = $calendarData->getComponents(); |
1643 | 1643 | $objects = []; |
@@ -1655,10 +1655,10 @@ discard block |
||
1655 | 1655 | 'type' => $o['componenttype'], |
1656 | 1656 | 'uid' => $o['uid'], |
1657 | 1657 | 'uri' => $o['uri'], |
1658 | - 'objects' => array_map(function ($c) { |
|
1658 | + 'objects' => array_map(function($c) { |
|
1659 | 1659 | return $this->transformSearchData($c); |
1660 | 1660 | }, $objects), |
1661 | - 'timezones' => array_map(function ($c) { |
|
1661 | + 'timezones' => array_map(function($c) { |
|
1662 | 1662 | return $this->transformSearchData($c); |
1663 | 1663 | }, $timezones), |
1664 | 1664 | ]; |
@@ -1674,7 +1674,7 @@ discard block |
||
1674 | 1674 | /** @var Component[] $subComponents */ |
1675 | 1675 | $subComponents = $comp->getComponents(); |
1676 | 1676 | /** @var Property[] $properties */ |
1677 | - $properties = array_filter($comp->children(), function ($c) { |
|
1677 | + $properties = array_filter($comp->children(), function($c) { |
|
1678 | 1678 | return $c instanceof Property; |
1679 | 1679 | }); |
1680 | 1680 | $validationRules = $comp->getValidationRules(); |
@@ -1752,7 +1752,7 @@ discard block |
||
1752 | 1752 | $subscriptions = $this->getSubscriptionsForUser($principalUri); |
1753 | 1753 | foreach ($calendars as $calendar) { |
1754 | 1754 | $calendarAnd = $calendarObjectIdQuery->expr()->andX(); |
1755 | - $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id']))); |
|
1755 | + $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id']))); |
|
1756 | 1756 | $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
1757 | 1757 | |
1758 | 1758 | // If it's shared, limit search to public events |
@@ -1764,7 +1764,7 @@ discard block |
||
1764 | 1764 | } |
1765 | 1765 | foreach ($subscriptions as $subscription) { |
1766 | 1766 | $subscriptionAnd = $calendarObjectIdQuery->expr()->andX(); |
1767 | - $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id']))); |
|
1767 | + $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id']))); |
|
1768 | 1768 | $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))); |
1769 | 1769 | |
1770 | 1770 | // If it's shared, limit search to public events |
@@ -1808,7 +1808,7 @@ discard block |
||
1808 | 1808 | if (!$escapePattern) { |
1809 | 1809 | $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern))); |
1810 | 1810 | } else { |
1811 | - $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
1811 | + $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
1812 | 1812 | } |
1813 | 1813 | } |
1814 | 1814 | |
@@ -1822,7 +1822,7 @@ discard block |
||
1822 | 1822 | $result = $calendarObjectIdQuery->execute(); |
1823 | 1823 | $matches = $result->fetchAll(); |
1824 | 1824 | $result->closeCursor(); |
1825 | - $matches = array_map(static function (array $match):int { |
|
1825 | + $matches = array_map(static function(array $match):int { |
|
1826 | 1826 | return (int) $match['objectid']; |
1827 | 1827 | }, $matches); |
1828 | 1828 | |
@@ -1835,9 +1835,9 @@ discard block |
||
1835 | 1835 | $calendarObjects = $result->fetchAll(); |
1836 | 1836 | $result->closeCursor(); |
1837 | 1837 | |
1838 | - return array_map(function (array $array): array { |
|
1839 | - $array['calendarid'] = (int)$array['calendarid']; |
|
1840 | - $array['calendartype'] = (int)$array['calendartype']; |
|
1838 | + return array_map(function(array $array): array { |
|
1839 | + $array['calendarid'] = (int) $array['calendarid']; |
|
1840 | + $array['calendartype'] = (int) $array['calendartype']; |
|
1841 | 1841 | $array['calendardata'] = $this->readBlob($array['calendardata']); |
1842 | 1842 | |
1843 | 1843 | return $array; |
@@ -1874,7 +1874,7 @@ discard block |
||
1874 | 1874 | $stmt = $query->execute(); |
1875 | 1875 | |
1876 | 1876 | if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
1877 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
1877 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
1878 | 1878 | } |
1879 | 1879 | |
1880 | 1880 | return null; |
@@ -1940,7 +1940,7 @@ discard block |
||
1940 | 1940 | public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
1941 | 1941 | // Current synctoken |
1942 | 1942 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); |
1943 | - $stmt->execute([ $calendarId ]); |
|
1943 | + $stmt->execute([$calendarId]); |
|
1944 | 1944 | $currentToken = $stmt->fetchColumn(0); |
1945 | 1945 | |
1946 | 1946 | if (is_null($currentToken)) { |
@@ -1957,7 +1957,7 @@ discard block |
||
1957 | 1957 | if ($syncToken) { |
1958 | 1958 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? AND `calendartype` = ? ORDER BY `synctoken`"; |
1959 | 1959 | if ($limit > 0) { |
1960 | - $query .= " LIMIT " . (int)$limit; |
|
1960 | + $query .= " LIMIT ".(int) $limit; |
|
1961 | 1961 | } |
1962 | 1962 | |
1963 | 1963 | // Fetching all changes |
@@ -2053,8 +2053,8 @@ discard block |
||
2053 | 2053 | 'source' => $row['source'], |
2054 | 2054 | 'lastmodified' => $row['lastmodified'], |
2055 | 2055 | |
2056 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
2057 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
2056 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
2057 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
2058 | 2058 | ]; |
2059 | 2059 | |
2060 | 2060 | foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) { |
@@ -2118,7 +2118,7 @@ discard block |
||
2118 | 2118 | $subscriptionId = $this->db->lastInsertId('*PREFIX*calendarsubscriptions'); |
2119 | 2119 | |
2120 | 2120 | $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
2121 | - $this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent((int)$subscriptionId, $subscriptionRow)); |
|
2121 | + $this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent((int) $subscriptionId, $subscriptionRow)); |
|
2122 | 2122 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', new GenericEvent( |
2123 | 2123 | '\OCA\DAV\CalDAV\CalDavBackend::createSubscription', |
2124 | 2124 | [ |
@@ -2149,7 +2149,7 @@ discard block |
||
2149 | 2149 | $supportedProperties = array_keys($this->subscriptionPropertyMap); |
2150 | 2150 | $supportedProperties[] = '{http://calendarserver.org/ns/}source'; |
2151 | 2151 | |
2152 | - $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) { |
|
2152 | + $propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) { |
|
2153 | 2153 | $newValues = []; |
2154 | 2154 | |
2155 | 2155 | foreach ($mutations as $propertyName => $propertyValue) { |
@@ -2171,7 +2171,7 @@ discard block |
||
2171 | 2171 | ->execute(); |
2172 | 2172 | |
2173 | 2173 | $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
2174 | - $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); |
|
2174 | + $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations)); |
|
2175 | 2175 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent( |
2176 | 2176 | '\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', |
2177 | 2177 | [ |
@@ -2222,7 +2222,7 @@ discard block |
||
2222 | 2222 | ->execute(); |
2223 | 2223 | |
2224 | 2224 | if ($subscriptionRow) { |
2225 | - $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); |
|
2225 | + $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, [])); |
|
2226 | 2226 | } |
2227 | 2227 | } |
2228 | 2228 | |
@@ -2260,8 +2260,8 @@ discard block |
||
2260 | 2260 | 'uri' => $row['uri'], |
2261 | 2261 | 'calendardata' => $row['calendardata'], |
2262 | 2262 | 'lastmodified' => $row['lastmodified'], |
2263 | - 'etag' => '"' . $row['etag'] . '"', |
|
2264 | - 'size' => (int)$row['size'], |
|
2263 | + 'etag' => '"'.$row['etag'].'"', |
|
2264 | + 'size' => (int) $row['size'], |
|
2265 | 2265 | ]; |
2266 | 2266 | } |
2267 | 2267 | |
@@ -2289,8 +2289,8 @@ discard block |
||
2289 | 2289 | 'calendardata' => $row['calendardata'], |
2290 | 2290 | 'uri' => $row['uri'], |
2291 | 2291 | 'lastmodified' => $row['lastmodified'], |
2292 | - 'etag' => '"' . $row['etag'] . '"', |
|
2293 | - 'size' => (int)$row['size'], |
|
2292 | + 'etag' => '"'.$row['etag'].'"', |
|
2293 | + 'size' => (int) $row['size'], |
|
2294 | 2294 | ]; |
2295 | 2295 | } |
2296 | 2296 | |
@@ -2344,14 +2344,14 @@ discard block |
||
2344 | 2344 | * @return void |
2345 | 2345 | */ |
2346 | 2346 | protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
2347 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
2347 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
2348 | 2348 | |
2349 | 2349 | $query = $this->db->getQueryBuilder(); |
2350 | 2350 | $query->select('synctoken') |
2351 | 2351 | ->from($table) |
2352 | 2352 | ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
2353 | 2353 | $result = $query->execute(); |
2354 | - $syncToken = (int)$result->fetchColumn(); |
|
2354 | + $syncToken = (int) $result->fetchColumn(); |
|
2355 | 2355 | $result->closeCursor(); |
2356 | 2356 | |
2357 | 2357 | $query = $this->db->getQueryBuilder(); |
@@ -2408,7 +2408,7 @@ discard block |
||
2408 | 2408 | // Track first component type and uid |
2409 | 2409 | if ($uid === null) { |
2410 | 2410 | $componentType = $component->name; |
2411 | - $uid = (string)$component->UID; |
|
2411 | + $uid = (string) $component->UID; |
|
2412 | 2412 | } |
2413 | 2413 | } |
2414 | 2414 | } |
@@ -2507,7 +2507,7 @@ discard block |
||
2507 | 2507 | ])); |
2508 | 2508 | $this->calendarSharingBackend->updateShares($shareable, $add, $remove); |
2509 | 2509 | |
2510 | - $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int)$calendarId, $calendarRow, $oldShares, $add, $remove)); |
|
2510 | + $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int) $calendarId, $calendarRow, $oldShares, $add, $remove)); |
|
2511 | 2511 | } |
2512 | 2512 | |
2513 | 2513 | /** |
@@ -2548,7 +2548,7 @@ discard block |
||
2548 | 2548 | ]); |
2549 | 2549 | $query->execute(); |
2550 | 2550 | |
2551 | - $this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri)); |
|
2551 | + $this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int) $calendarId, $calendarData, $publicUri)); |
|
2552 | 2552 | return $publicUri; |
2553 | 2553 | } |
2554 | 2554 | $query->delete('dav_shares') |
@@ -2556,7 +2556,7 @@ discard block |
||
2556 | 2556 | ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))); |
2557 | 2557 | $query->execute(); |
2558 | 2558 | |
2559 | - $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData)); |
|
2559 | + $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int) $calendarId, $calendarData)); |
|
2560 | 2560 | return null; |
2561 | 2561 | } |
2562 | 2562 | |
@@ -2777,10 +2777,10 @@ discard block |
||
2777 | 2777 | $result->closeCursor(); |
2778 | 2778 | |
2779 | 2779 | if (!isset($objectIds['id'])) { |
2780 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
2780 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
2781 | 2781 | } |
2782 | 2782 | |
2783 | - return (int)$objectIds['id']; |
|
2783 | + return (int) $objectIds['id']; |
|
2784 | 2784 | } |
2785 | 2785 | |
2786 | 2786 | /** |
@@ -2807,8 +2807,8 @@ discard block |
||
2807 | 2807 | * @param $calendarInfo |
2808 | 2808 | */ |
2809 | 2809 | private function addOwnerPrincipal(&$calendarInfo) { |
2810 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
2811 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
2810 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
2811 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
2812 | 2812 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
2813 | 2813 | $uri = $calendarInfo[$ownerPrincipalKey]; |
2814 | 2814 | } else { |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | 'uri' => $row['uri'], |
179 | 179 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
180 | 180 | '{DAV:}displayname' => $row['displayname'], |
181 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
181 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
182 | 182 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
183 | 183 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
184 | 184 | ]; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); |
192 | 192 | $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal)); |
193 | 193 | |
194 | - $principals = array_map(function ($principal) { |
|
194 | + $principals = array_map(function($principal) { |
|
195 | 195 | return urldecode($principal); |
196 | 196 | }, $principals); |
197 | 197 | $principals[] = $principalUri; |
@@ -206,13 +206,13 @@ discard block |
||
206 | 206 | ->setParameter('principaluri', $principals, IQueryBuilder::PARAM_STR_ARRAY) |
207 | 207 | ->execute(); |
208 | 208 | |
209 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
209 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
210 | 210 | while ($row = $result->fetch()) { |
211 | 211 | if ($row['principaluri'] === $principalUri) { |
212 | 212 | continue; |
213 | 213 | } |
214 | 214 | |
215 | - $readOnly = (int)$row['access'] === Backend::ACCESS_READ; |
|
215 | + $readOnly = (int) $row['access'] === Backend::ACCESS_READ; |
|
216 | 216 | if (isset($addressBooks[$row['id']])) { |
217 | 217 | if ($readOnly) { |
218 | 218 | // New share can not have more permissions then the old one. |
@@ -226,18 +226,18 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | list(, $name) = \Sabre\Uri\split($row['principaluri']); |
229 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
230 | - $displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
229 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
230 | + $displayName = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
231 | 231 | |
232 | 232 | $addressBooks[$row['id']] = [ |
233 | 233 | 'id' => $row['id'], |
234 | 234 | 'uri' => $uri, |
235 | 235 | 'principaluri' => $principalUriOriginal, |
236 | 236 | '{DAV:}displayname' => $displayName, |
237 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
237 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
238 | 238 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
239 | 239 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
240 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'], |
|
240 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'], |
|
241 | 241 | $readOnlyPropertyName => $readOnly, |
242 | 242 | ]; |
243 | 243 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | 'uri' => $row['uri'], |
265 | 265 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
266 | 266 | '{DAV:}displayname' => $row['displayname'], |
267 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
267 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
268 | 268 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
269 | 269 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
270 | 270 | ]; |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | 'uri' => $row['uri'], |
312 | 312 | 'principaluri' => $row['principaluri'], |
313 | 313 | '{DAV:}displayname' => $row['displayname'], |
314 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
314 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
315 | 315 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
316 | 316 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
317 | 317 | ]; |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | 'uri' => $row['uri'], |
346 | 346 | 'principaluri' => $row['principaluri'], |
347 | 347 | '{DAV:}displayname' => $row['displayname'], |
348 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
348 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
349 | 349 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
350 | 350 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
351 | 351 | ]; |
@@ -374,17 +374,17 @@ discard block |
||
374 | 374 | public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) { |
375 | 375 | $supportedProperties = [ |
376 | 376 | '{DAV:}displayname', |
377 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description', |
|
377 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description', |
|
378 | 378 | ]; |
379 | 379 | |
380 | - $propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) { |
|
380 | + $propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) { |
|
381 | 381 | $updates = []; |
382 | 382 | foreach ($mutations as $property => $newValue) { |
383 | 383 | switch ($property) { |
384 | 384 | case '{DAV:}displayname': |
385 | 385 | $updates['displayname'] = $newValue; |
386 | 386 | break; |
387 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description': |
|
387 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description': |
|
388 | 388 | $updates['description'] = $newValue; |
389 | 389 | break; |
390 | 390 | } |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | |
401 | 401 | $this->addChange($addressBookId, "", 2); |
402 | 402 | |
403 | - $addressBookRow = $this->getAddressBookById((int)$addressBookId); |
|
403 | + $addressBookRow = $this->getAddressBookById((int) $addressBookId); |
|
404 | 404 | $shares = $this->getShares($addressBookId); |
405 | - $this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int)$addressBookId, $addressBookRow, $shares, $mutations)); |
|
405 | + $this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int) $addressBookId, $addressBookRow, $shares, $mutations)); |
|
406 | 406 | |
407 | 407 | return true; |
408 | 408 | }); |
@@ -431,11 +431,11 @@ discard block |
||
431 | 431 | case '{DAV:}displayname': |
432 | 432 | $values['displayname'] = $newValue; |
433 | 433 | break; |
434 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description': |
|
434 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description': |
|
435 | 435 | $values['description'] = $newValue; |
436 | 436 | break; |
437 | 437 | default: |
438 | - throw new BadRequest('Unknown property: ' . $property); |
|
438 | + throw new BadRequest('Unknown property: '.$property); |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | |
460 | 460 | $addressBookId = $query->getLastInsertId(); |
461 | 461 | $addressBookRow = $this->getAddressBookById($addressBookId); |
462 | - $this->dispatcher->dispatchTyped(new AddressBookCreatedEvent((int)$addressBookId, $addressBookRow)); |
|
462 | + $this->dispatcher->dispatchTyped(new AddressBookCreatedEvent((int) $addressBookId, $addressBookRow)); |
|
463 | 463 | |
464 | 464 | return $addressBookId; |
465 | 465 | } |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | |
531 | 531 | $result = $query->execute(); |
532 | 532 | while ($row = $result->fetch()) { |
533 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
533 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
534 | 534 | |
535 | 535 | $modified = false; |
536 | 536 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | if (!$row) { |
571 | 571 | return false; |
572 | 572 | } |
573 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
573 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
574 | 574 | |
575 | 575 | $modified = false; |
576 | 576 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | $result = $query->execute(); |
613 | 613 | |
614 | 614 | while ($row = $result->fetch()) { |
615 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
615 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
616 | 616 | |
617 | 617 | $modified = false; |
618 | 618 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | ->andWhere($q->expr()->eq('uid', $q->createNamedParameter($uid))) |
664 | 664 | ->setMaxResults(1); |
665 | 665 | $result = $q->execute(); |
666 | - $count = (bool)$result->fetchColumn(); |
|
666 | + $count = (bool) $result->fetchColumn(); |
|
667 | 667 | $result->closeCursor(); |
668 | 668 | if ($count) { |
669 | 669 | throw new \Sabre\DAV\Exception\BadRequest('VCard object with uid already exists in this addressbook collection.'); |
@@ -691,14 +691,14 @@ discard block |
||
691 | 691 | $addressBookData = $this->getAddressBookById($addressBookId); |
692 | 692 | $shares = $this->getShares($addressBookId); |
693 | 693 | $objectRow = $this->getCard($addressBookId, $cardUri); |
694 | - $this->dispatcher->dispatchTyped(new CardCreatedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); |
|
694 | + $this->dispatcher->dispatchTyped(new CardCreatedEvent((int) $addressBookId, $addressBookData, $shares, $objectRow)); |
|
695 | 695 | $this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::createCard', |
696 | 696 | new GenericEvent(null, [ |
697 | 697 | 'addressBookId' => $addressBookId, |
698 | 698 | 'cardUri' => $cardUri, |
699 | 699 | 'cardData' => $cardData])); |
700 | 700 | |
701 | - return '"' . $etag . '"'; |
|
701 | + return '"'.$etag.'"'; |
|
702 | 702 | } |
703 | 703 | |
704 | 704 | /** |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | // check for recently stored etag and stop if it is the same |
735 | 735 | $etagCacheKey = "$addressBookId#$cardUri"; |
736 | 736 | if (isset($this->etagCache[$etagCacheKey]) && $this->etagCache[$etagCacheKey] === $etag) { |
737 | - return '"' . $etag . '"'; |
|
737 | + return '"'.$etag.'"'; |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | $query->update($this->dbCardsTable) |
@@ -755,14 +755,14 @@ discard block |
||
755 | 755 | $addressBookData = $this->getAddressBookById($addressBookId); |
756 | 756 | $shares = $this->getShares($addressBookId); |
757 | 757 | $objectRow = $this->getCard($addressBookId, $cardUri); |
758 | - $this->dispatcher->dispatchTyped(new CardUpdatedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); |
|
758 | + $this->dispatcher->dispatchTyped(new CardUpdatedEvent((int) $addressBookId, $addressBookData, $shares, $objectRow)); |
|
759 | 759 | $this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::updateCard', |
760 | 760 | new GenericEvent(null, [ |
761 | 761 | 'addressBookId' => $addressBookId, |
762 | 762 | 'cardUri' => $cardUri, |
763 | 763 | 'cardData' => $cardData])); |
764 | 764 | |
765 | - return '"' . $etag . '"'; |
|
765 | + return '"'.$etag.'"'; |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | /** |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | if ($ret === 1) { |
794 | 794 | if ($cardId !== null) { |
795 | - $this->dispatcher->dispatchTyped(new CardDeletedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); |
|
795 | + $this->dispatcher->dispatchTyped(new CardDeletedEvent((int) $addressBookId, $addressBookData, $shares, $objectRow)); |
|
796 | 796 | $this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', |
797 | 797 | new GenericEvent(null, [ |
798 | 798 | 'addressBookId' => $addressBookId, |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | if ($syncToken) { |
883 | 883 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`"; |
884 | 884 | if ($limit > 0) { |
885 | - $query .= " LIMIT " . (int)$limit; |
|
885 | + $query .= " LIMIT ".(int) $limit; |
|
886 | 886 | } |
887 | 887 | |
888 | 888 | // Fetching all changes |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | string $pattern, |
1026 | 1026 | array $searchProperties, |
1027 | 1027 | array $options = []): array { |
1028 | - $addressBookIds = array_map(static function ($row):int { |
|
1028 | + $addressBookIds = array_map(static function($row):int { |
|
1029 | 1029 | return (int) $row['id']; |
1030 | 1030 | }, $this->getAddressBooksForUser($principalUri)); |
1031 | 1031 | |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | if (!$escapePattern) { |
1089 | 1089 | $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter($pattern))); |
1090 | 1090 | } else { |
1091 | - $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
1091 | + $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
1092 | 1092 | } |
1093 | 1093 | } |
1094 | 1094 | |
@@ -1102,8 +1102,8 @@ discard block |
||
1102 | 1102 | $result = $query2->execute(); |
1103 | 1103 | $matches = $result->fetchAll(); |
1104 | 1104 | $result->closeCursor(); |
1105 | - $matches = array_map(function ($match) { |
|
1106 | - return (int)$match['cardid']; |
|
1105 | + $matches = array_map(function($match) { |
|
1106 | + return (int) $match['cardid']; |
|
1107 | 1107 | }, $matches); |
1108 | 1108 | |
1109 | 1109 | $query = $this->db->getQueryBuilder(); |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | |
1117 | 1117 | $result->closeCursor(); |
1118 | 1118 | |
1119 | - return array_map(function ($array) { |
|
1119 | + return array_map(function($array) { |
|
1120 | 1120 | $array['addressbookid'] = (int) $array['addressbookid']; |
1121 | 1121 | $modified = false; |
1122 | 1122 | $array['carddata'] = $this->readBlob($array['carddata'], $modified); |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | $result->closeCursor(); |
1164 | 1164 | |
1165 | 1165 | if (!isset($uri['uri'])) { |
1166 | - throw new \InvalidArgumentException('Card does not exists: ' . $id); |
|
1166 | + throw new \InvalidArgumentException('Card does not exists: '.$id); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | return $uri['uri']; |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | |
1189 | 1189 | if (is_array($contact)) { |
1190 | 1190 | $modified = false; |
1191 | - $contact['etag'] = '"' . $contact['etag'] . '"'; |
|
1191 | + $contact['etag'] = '"'.$contact['etag'].'"'; |
|
1192 | 1192 | $contact['carddata'] = $this->readBlob($contact['carddata'], $modified); |
1193 | 1193 | if ($modified) { |
1194 | 1194 | $contact['size'] = strlen($contact['carddata']); |
@@ -1301,10 +1301,10 @@ discard block |
||
1301 | 1301 | $result->closeCursor(); |
1302 | 1302 | |
1303 | 1303 | if (!isset($cardIds['id'])) { |
1304 | - throw new \InvalidArgumentException('Card does not exists: ' . $uri); |
|
1304 | + throw new \InvalidArgumentException('Card does not exists: '.$uri); |
|
1305 | 1305 | } |
1306 | 1306 | |
1307 | - return (int)$cardIds['id']; |
|
1307 | + return (int) $cardIds['id']; |
|
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | /** |
@@ -1330,8 +1330,8 @@ discard block |
||
1330 | 1330 | } |
1331 | 1331 | |
1332 | 1332 | private function addOwnerPrincipal(&$addressbookInfo) { |
1333 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
1334 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
1333 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
1334 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
1335 | 1335 | if (isset($addressbookInfo[$ownerPrincipalKey])) { |
1336 | 1336 | $uri = $addressbookInfo[$ownerPrincipalKey]; |
1337 | 1337 | } else { |