@@ -29,8 +29,8 @@ |
||
29 | 29 | */ |
30 | 30 | interface ICountUsersBackend { |
31 | 31 | |
32 | - /** |
|
33 | - * @since 14.0.0 |
|
34 | - */ |
|
35 | - public function countUsersInGroup(string $gid, string $search = ''): int; |
|
32 | + /** |
|
33 | + * @since 14.0.0 |
|
34 | + */ |
|
35 | + public function countUsersInGroup(string $gid, string $search = ''): int; |
|
36 | 36 | } |
@@ -29,8 +29,8 @@ |
||
29 | 29 | */ |
30 | 30 | interface IAddToGroupBackend { |
31 | 31 | |
32 | - /** |
|
33 | - * @since 14.0.0 |
|
34 | - */ |
|
35 | - public function addToGroup(string $uid, string $gid): bool; |
|
32 | + /** |
|
33 | + * @since 14.0.0 |
|
34 | + */ |
|
35 | + public function addToGroup(string $uid, string $gid): bool; |
|
36 | 36 | } |
@@ -29,8 +29,8 @@ |
||
29 | 29 | */ |
30 | 30 | interface IRemoveFromGroupBackend { |
31 | 31 | |
32 | - /** |
|
33 | - * @since 14.0.0 |
|
34 | - */ |
|
35 | - public function removeFromGroup(string $uid, string $gid); |
|
32 | + /** |
|
33 | + * @since 14.0.0 |
|
34 | + */ |
|
35 | + public function removeFromGroup(string $uid, string $gid); |
|
36 | 36 | } |
@@ -31,37 +31,37 @@ |
||
31 | 31 | */ |
32 | 32 | abstract class ABackend implements GroupInterface { |
33 | 33 | |
34 | - /** |
|
35 | - * @deprecated 14.0.0 |
|
36 | - * |
|
37 | - * @param int $actions The action to check for |
|
38 | - * @return bool |
|
39 | - */ |
|
40 | - public function implementsActions($actions): bool { |
|
41 | - $implements = 0; |
|
34 | + /** |
|
35 | + * @deprecated 14.0.0 |
|
36 | + * |
|
37 | + * @param int $actions The action to check for |
|
38 | + * @return bool |
|
39 | + */ |
|
40 | + public function implementsActions($actions): bool { |
|
41 | + $implements = 0; |
|
42 | 42 | |
43 | - if ($this instanceof IAddToGroupBackend) { |
|
44 | - $implements |= GroupInterface::ADD_TO_GROUP; |
|
45 | - } |
|
46 | - if ($this instanceof ICountUsersBackend) { |
|
47 | - $implements |= GroupInterface::COUNT_USERS; |
|
48 | - } |
|
49 | - if ($this instanceof ICreateGroupBackend) { |
|
50 | - $implements |= GroupInterface::CREATE_GROUP; |
|
51 | - } |
|
52 | - if ($this instanceof IDeleteGroupBackend) { |
|
53 | - $implements |= GroupInterface::DELETE_GROUP; |
|
54 | - } |
|
55 | - if ($this instanceof IGroupDetailsBackend) { |
|
56 | - $implements |= GroupInterface::GROUP_DETAILS; |
|
57 | - } |
|
58 | - if ($this instanceof IIsAdminBackend) { |
|
59 | - $implements |= GroupInterface::IS_ADMIN; |
|
60 | - } |
|
61 | - if ($this instanceof IRemoveFromGroupBackend) { |
|
62 | - $implements |= GroupInterface::REMOVE_FROM_GOUP; |
|
63 | - } |
|
43 | + if ($this instanceof IAddToGroupBackend) { |
|
44 | + $implements |= GroupInterface::ADD_TO_GROUP; |
|
45 | + } |
|
46 | + if ($this instanceof ICountUsersBackend) { |
|
47 | + $implements |= GroupInterface::COUNT_USERS; |
|
48 | + } |
|
49 | + if ($this instanceof ICreateGroupBackend) { |
|
50 | + $implements |= GroupInterface::CREATE_GROUP; |
|
51 | + } |
|
52 | + if ($this instanceof IDeleteGroupBackend) { |
|
53 | + $implements |= GroupInterface::DELETE_GROUP; |
|
54 | + } |
|
55 | + if ($this instanceof IGroupDetailsBackend) { |
|
56 | + $implements |= GroupInterface::GROUP_DETAILS; |
|
57 | + } |
|
58 | + if ($this instanceof IIsAdminBackend) { |
|
59 | + $implements |= GroupInterface::IS_ADMIN; |
|
60 | + } |
|
61 | + if ($this instanceof IRemoveFromGroupBackend) { |
|
62 | + $implements |= GroupInterface::REMOVE_FROM_GOUP; |
|
63 | + } |
|
64 | 64 | |
65 | - return (bool)($actions & $implements); |
|
66 | - } |
|
65 | + return (bool)($actions & $implements); |
|
66 | + } |
|
67 | 67 | } |
@@ -62,6 +62,6 @@ |
||
62 | 62 | $implements |= GroupInterface::REMOVE_FROM_GOUP; |
63 | 63 | } |
64 | 64 | |
65 | - return (bool)($actions & $implements); |
|
65 | + return (bool) ($actions & $implements); |
|
66 | 66 | } |
67 | 67 | } |
@@ -29,8 +29,8 @@ |
||
29 | 29 | */ |
30 | 30 | interface IDeleteGroupBackend { |
31 | 31 | |
32 | - /** |
|
33 | - * @since 14.0.0 |
|
34 | - */ |
|
35 | - public function deleteGroup(string $gid): bool; |
|
32 | + /** |
|
33 | + * @since 14.0.0 |
|
34 | + */ |
|
35 | + public function deleteGroup(string $gid): bool; |
|
36 | 36 | } |
@@ -32,79 +32,79 @@ |
||
32 | 32 | use Sabre\DAV\IFile; |
33 | 33 | |
34 | 34 | class DirectFile implements IFile { |
35 | - /** @var Direct */ |
|
36 | - private $direct; |
|
35 | + /** @var Direct */ |
|
36 | + private $direct; |
|
37 | 37 | |
38 | - /** @var IRootFolder */ |
|
39 | - private $rootFolder; |
|
38 | + /** @var IRootFolder */ |
|
39 | + private $rootFolder; |
|
40 | 40 | |
41 | - /** @var File */ |
|
42 | - private $file; |
|
41 | + /** @var File */ |
|
42 | + private $file; |
|
43 | 43 | |
44 | - public function __construct(Direct $direct, IRootFolder $rootFolder) { |
|
45 | - $this->direct = $direct; |
|
46 | - $this->rootFolder = $rootFolder; |
|
47 | - } |
|
44 | + public function __construct(Direct $direct, IRootFolder $rootFolder) { |
|
45 | + $this->direct = $direct; |
|
46 | + $this->rootFolder = $rootFolder; |
|
47 | + } |
|
48 | 48 | |
49 | - public function put($data) { |
|
50 | - throw new Forbidden(); |
|
51 | - } |
|
49 | + public function put($data) { |
|
50 | + throw new Forbidden(); |
|
51 | + } |
|
52 | 52 | |
53 | - public function get() { |
|
54 | - $this->getFile(); |
|
53 | + public function get() { |
|
54 | + $this->getFile(); |
|
55 | 55 | |
56 | - return $this->file->fopen('rb'); |
|
57 | - } |
|
56 | + return $this->file->fopen('rb'); |
|
57 | + } |
|
58 | 58 | |
59 | - public function getContentType() { |
|
60 | - $this->getFile(); |
|
59 | + public function getContentType() { |
|
60 | + $this->getFile(); |
|
61 | 61 | |
62 | - return $this->file->getMimeType(); |
|
63 | - } |
|
62 | + return $this->file->getMimeType(); |
|
63 | + } |
|
64 | 64 | |
65 | - public function getETag() { |
|
66 | - $this->getFile(); |
|
65 | + public function getETag() { |
|
66 | + $this->getFile(); |
|
67 | 67 | |
68 | - return $this->file->getEtag(); |
|
69 | - } |
|
68 | + return $this->file->getEtag(); |
|
69 | + } |
|
70 | 70 | |
71 | - public function getSize() { |
|
72 | - $this->getFile(); |
|
71 | + public function getSize() { |
|
72 | + $this->getFile(); |
|
73 | 73 | |
74 | - return $this->file->getSize(); |
|
75 | - } |
|
74 | + return $this->file->getSize(); |
|
75 | + } |
|
76 | 76 | |
77 | - public function delete() { |
|
78 | - throw new Forbidden(); |
|
79 | - } |
|
77 | + public function delete() { |
|
78 | + throw new Forbidden(); |
|
79 | + } |
|
80 | 80 | |
81 | - public function getName() { |
|
82 | - return $this->direct->getToken(); |
|
83 | - } |
|
81 | + public function getName() { |
|
82 | + return $this->direct->getToken(); |
|
83 | + } |
|
84 | 84 | |
85 | - public function setName($name) { |
|
86 | - throw new Forbidden(); |
|
87 | - } |
|
85 | + public function setName($name) { |
|
86 | + throw new Forbidden(); |
|
87 | + } |
|
88 | 88 | |
89 | - public function getLastModified() { |
|
90 | - $this->getFile(); |
|
89 | + public function getLastModified() { |
|
90 | + $this->getFile(); |
|
91 | 91 | |
92 | - return $this->file->getMTime(); |
|
93 | - } |
|
92 | + return $this->file->getMTime(); |
|
93 | + } |
|
94 | 94 | |
95 | - private function getFile() { |
|
96 | - if ($this->file === null) { |
|
97 | - $userFolder = $this->rootFolder->getUserFolder($this->direct->getUserId()); |
|
98 | - $files = $userFolder->getById($this->direct->getFileId()); |
|
95 | + private function getFile() { |
|
96 | + if ($this->file === null) { |
|
97 | + $userFolder = $this->rootFolder->getUserFolder($this->direct->getUserId()); |
|
98 | + $files = $userFolder->getById($this->direct->getFileId()); |
|
99 | 99 | |
100 | - if ($files === []) { |
|
101 | - throw new NotFound(); |
|
102 | - } |
|
100 | + if ($files === []) { |
|
101 | + throw new NotFound(); |
|
102 | + } |
|
103 | 103 | |
104 | - $this->file = array_shift($files); |
|
105 | - } |
|
104 | + $this->file = array_shift($files); |
|
105 | + } |
|
106 | 106 | |
107 | - return $this->file; |
|
108 | - } |
|
107 | + return $this->file; |
|
108 | + } |
|
109 | 109 | |
110 | 110 | } |
@@ -29,22 +29,22 @@ |
||
29 | 29 | use OCP\AppFramework\Utility\ITimeFactory; |
30 | 30 | |
31 | 31 | class CleanupDirectLinksJob extends TimedJob { |
32 | - /** @var ITimeFactory */ |
|
33 | - private $timeFactory; |
|
32 | + /** @var ITimeFactory */ |
|
33 | + private $timeFactory; |
|
34 | 34 | |
35 | - /** @var DirectMapper */ |
|
36 | - private $mapper; |
|
35 | + /** @var DirectMapper */ |
|
36 | + private $mapper; |
|
37 | 37 | |
38 | - public function __construct(ITimeFactory $timeFactory, DirectMapper $mapper) { |
|
39 | - $this->setInterval(60*60*24); |
|
38 | + public function __construct(ITimeFactory $timeFactory, DirectMapper $mapper) { |
|
39 | + $this->setInterval(60*60*24); |
|
40 | 40 | |
41 | - $this->timeFactory = $timeFactory; |
|
42 | - $this->mapper = $mapper; |
|
43 | - } |
|
41 | + $this->timeFactory = $timeFactory; |
|
42 | + $this->mapper = $mapper; |
|
43 | + } |
|
44 | 44 | |
45 | - protected function run($argument) { |
|
46 | - // Delete all shares expired 24 hours ago |
|
47 | - $this->mapper->deleteExpired($this->timeFactory->getTime() - 60*60*24); |
|
48 | - } |
|
45 | + protected function run($argument) { |
|
46 | + // Delete all shares expired 24 hours ago |
|
47 | + $this->mapper->deleteExpired($this->timeFactory->getTime() - 60*60*24); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | private $mapper; |
37 | 37 | |
38 | 38 | public function __construct(ITimeFactory $timeFactory, DirectMapper $mapper) { |
39 | - $this->setInterval(60*60*24); |
|
39 | + $this->setInterval(60 * 60 * 24); |
|
40 | 40 | |
41 | 41 | $this->timeFactory = $timeFactory; |
42 | 42 | $this->mapper = $mapper; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | protected function run($argument) { |
46 | 46 | // Delete all shares expired 24 hours ago |
47 | - $this->mapper->deleteExpired($this->timeFactory->getTime() - 60*60*24); |
|
47 | + $this->mapper->deleteExpired($this->timeFactory->getTime() - 60 * 60 * 24); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | // no php execution timeout for webdav |
26 | 26 | if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
27 | - @set_time_limit(0); |
|
27 | + @set_time_limit(0); |
|
28 | 28 | } |
29 | 29 | ignore_user_abort(true); |
30 | 30 | |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | |
36 | 36 | $serverFactory = new \OCA\DAV\Direct\ServerFactory(\OC::$server->getConfig()); |
37 | 37 | $server = $serverFactory->createServer( |
38 | - $baseuri, |
|
39 | - $requestUri, |
|
40 | - \OC::$server->getRootFolder(), |
|
41 | - \OC::$server->query(\OCA\DAV\Db\DirectMapper::class), |
|
42 | - \OC::$server->query(\OCP\AppFramework\Utility\ITimeFactory::class), |
|
43 | - \OC::$server->getBruteForceThrottler(), |
|
44 | - \OC::$server->getRequest() |
|
38 | + $baseuri, |
|
39 | + $requestUri, |
|
40 | + \OC::$server->getRootFolder(), |
|
41 | + \OC::$server->query(\OCA\DAV\Db\DirectMapper::class), |
|
42 | + \OC::$server->query(\OCP\AppFramework\Utility\ITimeFactory::class), |
|
43 | + \OC::$server->getBruteForceThrottler(), |
|
44 | + \OC::$server->getRequest() |
|
45 | 45 | ); |
46 | 46 | |
47 | 47 | $server->exec(); |
@@ -80,7 +80,7 @@ |
||
80 | 80 | */ |
81 | 81 | public function getCloudId(string $user, string $remote): ICloudId { |
82 | 82 | // TODO check what the correct url is for remote (asking the remote) |
83 | - return new CloudId($user. '@' . $remote, $user, $remote); |
|
83 | + return new CloudId($user.'@'.$remote, $user, $remote); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -32,87 +32,87 @@ |
||
32 | 32 | use OCP\Federation\ICloudIdManager; |
33 | 33 | |
34 | 34 | class CloudIdManager implements ICloudIdManager { |
35 | - /** |
|
36 | - * @param string $cloudId |
|
37 | - * @return ICloudId |
|
38 | - * @throws \InvalidArgumentException |
|
39 | - */ |
|
40 | - public function resolveCloudId(string $cloudId): ICloudId { |
|
41 | - // TODO magic here to get the url and user instead of just splitting on @ |
|
35 | + /** |
|
36 | + * @param string $cloudId |
|
37 | + * @return ICloudId |
|
38 | + * @throws \InvalidArgumentException |
|
39 | + */ |
|
40 | + public function resolveCloudId(string $cloudId): ICloudId { |
|
41 | + // TODO magic here to get the url and user instead of just splitting on @ |
|
42 | 42 | |
43 | - if (!$this->isValidCloudId($cloudId)) { |
|
44 | - throw new \InvalidArgumentException('Invalid cloud id'); |
|
45 | - } |
|
43 | + if (!$this->isValidCloudId($cloudId)) { |
|
44 | + throw new \InvalidArgumentException('Invalid cloud id'); |
|
45 | + } |
|
46 | 46 | |
47 | - // Find the first character that is not allowed in user names |
|
48 | - $id = $this->fixRemoteURL($cloudId); |
|
49 | - $posSlash = strpos($id, '/'); |
|
50 | - $posColon = strpos($id, ':'); |
|
47 | + // Find the first character that is not allowed in user names |
|
48 | + $id = $this->fixRemoteURL($cloudId); |
|
49 | + $posSlash = strpos($id, '/'); |
|
50 | + $posColon = strpos($id, ':'); |
|
51 | 51 | |
52 | - if ($posSlash === false && $posColon === false) { |
|
53 | - $invalidPos = \strlen($id); |
|
54 | - } elseif ($posSlash === false) { |
|
55 | - $invalidPos = $posColon; |
|
56 | - } elseif ($posColon === false) { |
|
57 | - $invalidPos = $posSlash; |
|
58 | - } else { |
|
59 | - $invalidPos = min($posSlash, $posColon); |
|
60 | - } |
|
52 | + if ($posSlash === false && $posColon === false) { |
|
53 | + $invalidPos = \strlen($id); |
|
54 | + } elseif ($posSlash === false) { |
|
55 | + $invalidPos = $posColon; |
|
56 | + } elseif ($posColon === false) { |
|
57 | + $invalidPos = $posSlash; |
|
58 | + } else { |
|
59 | + $invalidPos = min($posSlash, $posColon); |
|
60 | + } |
|
61 | 61 | |
62 | - // Find the last @ before $invalidPos |
|
63 | - $pos = $lastAtPos = 0; |
|
64 | - while ($lastAtPos !== false && $lastAtPos <= $invalidPos) { |
|
65 | - $pos = $lastAtPos; |
|
66 | - $lastAtPos = strpos($id, '@', $pos + 1); |
|
67 | - } |
|
62 | + // Find the last @ before $invalidPos |
|
63 | + $pos = $lastAtPos = 0; |
|
64 | + while ($lastAtPos !== false && $lastAtPos <= $invalidPos) { |
|
65 | + $pos = $lastAtPos; |
|
66 | + $lastAtPos = strpos($id, '@', $pos + 1); |
|
67 | + } |
|
68 | 68 | |
69 | - if ($pos !== false) { |
|
70 | - $user = substr($id, 0, $pos); |
|
71 | - $remote = substr($id, $pos + 1); |
|
72 | - if (!empty($user) && !empty($remote)) { |
|
73 | - return new CloudId($id, $user, $remote); |
|
74 | - } |
|
75 | - } |
|
76 | - throw new \InvalidArgumentException('Invalid cloud id'); |
|
77 | - } |
|
69 | + if ($pos !== false) { |
|
70 | + $user = substr($id, 0, $pos); |
|
71 | + $remote = substr($id, $pos + 1); |
|
72 | + if (!empty($user) && !empty($remote)) { |
|
73 | + return new CloudId($id, $user, $remote); |
|
74 | + } |
|
75 | + } |
|
76 | + throw new \InvalidArgumentException('Invalid cloud id'); |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * @param string $user |
|
81 | - * @param string $remote |
|
82 | - * @return CloudId |
|
83 | - */ |
|
84 | - public function getCloudId(string $user, string $remote): ICloudId { |
|
85 | - // TODO check what the correct url is for remote (asking the remote) |
|
86 | - return new CloudId($user. '@' . $remote, $user, $remote); |
|
87 | - } |
|
79 | + /** |
|
80 | + * @param string $user |
|
81 | + * @param string $remote |
|
82 | + * @return CloudId |
|
83 | + */ |
|
84 | + public function getCloudId(string $user, string $remote): ICloudId { |
|
85 | + // TODO check what the correct url is for remote (asking the remote) |
|
86 | + return new CloudId($user. '@' . $remote, $user, $remote); |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * Strips away a potential file names and trailing slashes: |
|
91 | - * - http://localhost |
|
92 | - * - http://localhost/ |
|
93 | - * - http://localhost/index.php |
|
94 | - * - http://localhost/index.php/s/{shareToken} |
|
95 | - * |
|
96 | - * all return: http://localhost |
|
97 | - * |
|
98 | - * @param string $remote |
|
99 | - * @return string |
|
100 | - */ |
|
101 | - protected function fixRemoteURL(string $remote): string { |
|
102 | - $remote = str_replace('\\', '/', $remote); |
|
103 | - if ($fileNamePosition = strpos($remote, '/index.php')) { |
|
104 | - $remote = substr($remote, 0, $fileNamePosition); |
|
105 | - } |
|
106 | - $remote = rtrim($remote, '/'); |
|
89 | + /** |
|
90 | + * Strips away a potential file names and trailing slashes: |
|
91 | + * - http://localhost |
|
92 | + * - http://localhost/ |
|
93 | + * - http://localhost/index.php |
|
94 | + * - http://localhost/index.php/s/{shareToken} |
|
95 | + * |
|
96 | + * all return: http://localhost |
|
97 | + * |
|
98 | + * @param string $remote |
|
99 | + * @return string |
|
100 | + */ |
|
101 | + protected function fixRemoteURL(string $remote): string { |
|
102 | + $remote = str_replace('\\', '/', $remote); |
|
103 | + if ($fileNamePosition = strpos($remote, '/index.php')) { |
|
104 | + $remote = substr($remote, 0, $fileNamePosition); |
|
105 | + } |
|
106 | + $remote = rtrim($remote, '/'); |
|
107 | 107 | |
108 | - return $remote; |
|
109 | - } |
|
108 | + return $remote; |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * @param string $cloudId |
|
113 | - * @return bool |
|
114 | - */ |
|
115 | - public function isValidCloudId(string $cloudId): bool { |
|
116 | - return strpos($cloudId, '@') !== false; |
|
117 | - } |
|
111 | + /** |
|
112 | + * @param string $cloudId |
|
113 | + * @return bool |
|
114 | + */ |
|
115 | + public function isValidCloudId(string $cloudId): bool { |
|
116 | + return strpos($cloudId, '@') !== false; |
|
117 | + } |
|
118 | 118 | } |