@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $owner = isset($_POST['owner']) ? $_POST['owner'] : null; |
146 | 146 | $sharedBy = isset($_POST['sharedBy']) ? $_POST['sharedBy'] : null; |
147 | 147 | $shareWith = isset($_POST['shareWith']) ? $_POST['shareWith'] : null; |
148 | - $remoteId = isset($_POST['remoteId']) ? (int)$_POST['remoteId'] : null; |
|
148 | + $remoteId = isset($_POST['remoteId']) ? (int) $_POST['remoteId'] : null; |
|
149 | 149 | $sharedByFederatedId = isset($_POST['sharedByFederatedId']) ? $_POST['sharedByFederatedId'] : null; |
150 | 150 | $ownerFederatedId = isset($_POST['ownerFederatedId']) ? $_POST['ownerFederatedId'] : null; |
151 | 151 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } catch (ProviderCouldNotAddShareException $e) { |
181 | 181 | throw new OCSException($e->getMessage(), 400); |
182 | 182 | } catch (\Exception $e) { |
183 | - throw new OCSException('internal server error, was not able to add share from ' . $remote, 500); |
|
183 | + throw new OCSException('internal server error, was not able to add share from '.$remote, 500); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | return new Http\DataResponse(); |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | |
203 | 203 | $token = $this->request->getParam('token', null); |
204 | 204 | $shareWith = $this->request->getParam('shareWith', null); |
205 | - $permission = (int)$this->request->getParam('permission', null); |
|
206 | - $remoteId = (int)$this->request->getParam('remoteId', null); |
|
205 | + $permission = (int) $this->request->getParam('permission', null); |
|
206 | + $remoteId = (int) $this->request->getParam('remoteId', null); |
|
207 | 207 | |
208 | 208 | if ($id === null || |
209 | 209 | $token === null || |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | } catch (ProviderDoesNotExistsException $e) { |
232 | 232 | throw new OCSException('Server does not support federated cloud sharing', 503); |
233 | 233 | } catch (ShareNotFound $e) { |
234 | - $this->logger->debug('Share not found: ' . $e->getMessage()); |
|
234 | + $this->logger->debug('Share not found: '.$e->getMessage()); |
|
235 | 235 | } catch (\Exception $e) { |
236 | - $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage()); |
|
236 | + $this->logger->debug('internal server error, can not process notification: '.$e->getMessage()); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | throw new OCSBadRequestException(); |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | } catch (ProviderDoesNotExistsException $e) { |
268 | 268 | throw new OCSException('Server does not support federated cloud sharing', 503); |
269 | 269 | } catch (ShareNotFound $e) { |
270 | - $this->logger->debug('Share not found: ' . $e->getMessage()); |
|
270 | + $this->logger->debug('Share not found: '.$e->getMessage()); |
|
271 | 271 | } catch (\Exception $e) { |
272 | - $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage()); |
|
272 | + $this->logger->debug('internal server error, can not process notification: '.$e->getMessage()); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | return new Http\DataResponse(); |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | } catch (ProviderDoesNotExistsException $e) { |
301 | 301 | throw new OCSException('Server does not support federated cloud sharing', 503); |
302 | 302 | } catch (ShareNotFound $e) { |
303 | - $this->logger->debug('Share not found: ' . $e->getMessage()); |
|
303 | + $this->logger->debug('Share not found: '.$e->getMessage()); |
|
304 | 304 | } catch (\Exception $e) { |
305 | - $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage()); |
|
305 | + $this->logger->debug('internal server error, can not process notification: '.$e->getMessage()); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | return new Http\DataResponse(); |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $notification = ['sharedSecret' => $token]; |
332 | 332 | $provider->notificationReceived('SHARE_UNSHARED', $id, $notification); |
333 | 333 | } catch (\Exception $e) { |
334 | - $this->logger->debug('processing unshare notification failed: ' . $e->getMessage()); |
|
334 | + $this->logger->debug('processing unshare notification failed: '.$e->getMessage()); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | return new Http\DataResponse(); |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | |
405 | 405 | try { |
406 | 406 | $provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file'); |
407 | - $ocmPermissions = $this->ncPermissions2ocmPermissions((int)$ncPermissions); |
|
407 | + $ocmPermissions = $this->ncPermissions2ocmPermissions((int) $ncPermissions); |
|
408 | 408 | $notification = ['sharedSecret' => $token, 'permission' => $ocmPermissions]; |
409 | 409 | $provider->notificationReceived('RESHARE_CHANGE_PERMISSION', $id, $notification); |
410 | 410 | } catch (\Exception $e) { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $secure = $protocol === 'https'; |
80 | 80 | $federatedSharingEndpoints = $discoveryService->discover($this->cloudId->getRemote(), 'FEDERATED_SHARING'); |
81 | 81 | $webDavEndpoint = isset($federatedSharingEndpoints['webdav']) ? $federatedSharingEndpoints['webdav'] : '/public.php/webdav'; |
82 | - $root = rtrim($root, '/') . $webDavEndpoint; |
|
82 | + $root = rtrim($root, '/').$webDavEndpoint; |
|
83 | 83 | $this->mountPoint = $options['mountpoint']; |
84 | 84 | $this->token = $options['token']; |
85 | 85 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | 'host' => $host, |
89 | 89 | 'root' => $root, |
90 | 90 | 'user' => $options['token'], |
91 | - 'password' => (string)$options['password'] |
|
91 | + 'password' => (string) $options['password'] |
|
92 | 92 | )); |
93 | 93 | } |
94 | 94 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return string |
129 | 129 | */ |
130 | 130 | public function getId() { |
131 | - return 'shared::' . md5($this->token . '@' . $this->getRemote()); |
|
131 | + return 'shared::'.md5($this->token.'@'.$this->getRemote()); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | public function getCache($path = '', $storage = null) { |
@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | */ |
250 | 250 | protected function testRemote() { |
251 | 251 | try { |
252 | - return $this->testRemoteUrl($this->getRemote() . '/ocs-provider/index.php') |
|
253 | - || $this->testRemoteUrl($this->getRemote() . '/ocs-provider/') |
|
254 | - || $this->testRemoteUrl($this->getRemote() . '/status.php'); |
|
252 | + return $this->testRemoteUrl($this->getRemote().'/ocs-provider/index.php') |
|
253 | + || $this->testRemoteUrl($this->getRemote().'/ocs-provider/') |
|
254 | + || $this->testRemoteUrl($this->getRemote().'/status.php'); |
|
255 | 255 | } catch (\Exception $e) { |
256 | 256 | return false; |
257 | 257 | } |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | */ |
264 | 264 | private function testRemoteUrl($url) { |
265 | 265 | $cache = $this->memcacheFactory->createDistributed('files_sharing_remote_url'); |
266 | - if($cache->hasKey($url)) { |
|
267 | - return (bool)$cache->get($url); |
|
266 | + if ($cache->hasKey($url)) { |
|
267 | + return (bool) $cache->get($url); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | $client = $this->httpClient->newClient(); |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $returnValue = false; |
282 | 282 | } |
283 | 283 | |
284 | - $cache->set($url, $returnValue, 60*60*24); |
|
284 | + $cache->set($url, $returnValue, 60 * 60 * 24); |
|
285 | 285 | return $returnValue; |
286 | 286 | } |
287 | 287 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @return bool |
293 | 293 | */ |
294 | 294 | public function remoteIsOwnCloud() { |
295 | - if(defined('PHPUNIT_RUN') || !$this->testRemoteUrl($this->getRemote() . '/status.php')) { |
|
295 | + if (defined('PHPUNIT_RUN') || !$this->testRemoteUrl($this->getRemote().'/status.php')) { |
|
296 | 296 | return false; |
297 | 297 | } |
298 | 298 | return true; |
@@ -310,11 +310,11 @@ discard block |
||
310 | 310 | $password = $this->getPassword(); |
311 | 311 | |
312 | 312 | // If remote is not an ownCloud do not try to get any share info |
313 | - if(!$this->remoteIsOwnCloud()) { |
|
313 | + if (!$this->remoteIsOwnCloud()) { |
|
314 | 314 | return ['status' => 'unsupported']; |
315 | 315 | } |
316 | 316 | |
317 | - $url = rtrim($remote, '/') . '/index.php/apps/files_sharing/shareinfo?t=' . $token; |
|
317 | + $url = rtrim($remote, '/').'/index.php/apps/files_sharing/shareinfo?t='.$token; |
|
318 | 318 | |
319 | 319 | // TODO: DI |
320 | 320 | $client = \OC::$server->getHTTPClientService()->newClient(); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | try { |
383 | 383 | $ocmPermissions = json_decode($ocmPermissions); |
384 | 384 | $ncPermissions = 0; |
385 | - foreach($ocmPermissions as $permission) { |
|
385 | + foreach ($ocmPermissions as $permission) { |
|
386 | 386 | switch (strtolower($permission)) { |
387 | 387 | case 'read': |
388 | 388 | $ncPermissions += Constants::PERMISSION_READ; |
@@ -4,13 +4,13 @@ discard block |
||
4 | 4 | script('federatedfilesharing', 'settings-admin'); |
5 | 5 | ?> |
6 | 6 | |
7 | -<?php if($_['internalOnly'] === false): ?> |
|
7 | +<?php if ($_['internalOnly'] === false): ?> |
|
8 | 8 | |
9 | 9 | <div id="fileSharingSettings" class="section"> |
10 | 10 | <h2> |
11 | - <?php p($l->t('Federated Cloud Sharing'));?> |
|
11 | + <?php p($l->t('Federated Cloud Sharing')); ?> |
|
12 | 12 | <a target="_blank" rel="noreferrer noopener" class="icon-info svg" |
13 | - title="<?php p($l->t('Open documentation'));?>" |
|
13 | + title="<?php p($l->t('Open documentation')); ?>" |
|
14 | 14 | href="<?php p(link_to_docs('admin-sharing-federated')); ?>"></a> |
15 | 15 | </h2> |
16 | 16 | |
@@ -20,29 +20,29 @@ discard block |
||
20 | 20 | <input type="checkbox" name="outgoing_server2server_share_enabled" id="outgoingServer2serverShareEnabled" class="checkbox" |
21 | 21 | value="1" <?php if ($_['outgoingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
22 | 22 | <label for="outgoingServer2serverShareEnabled"> |
23 | - <?php p($l->t('Allow users on this server to send shares to other servers'));?> |
|
23 | + <?php p($l->t('Allow users on this server to send shares to other servers')); ?> |
|
24 | 24 | </label> |
25 | 25 | </p> |
26 | 26 | <p> |
27 | 27 | <input type="checkbox" name="incoming_server2server_share_enabled" id="incomingServer2serverShareEnabled" class="checkbox" |
28 | 28 | value="1" <?php if ($_['incomingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
29 | 29 | <label for="incomingServer2serverShareEnabled"> |
30 | - <?php p($l->t('Allow users on this server to receive shares from other servers'));?> |
|
30 | + <?php p($l->t('Allow users on this server to receive shares from other servers')); ?> |
|
31 | 31 | </label><br/> |
32 | 32 | </p> |
33 | - <?php if($_['federatedGroupSharingSupported']): ?> |
|
33 | + <?php if ($_['federatedGroupSharingSupported']): ?> |
|
34 | 34 | <p> |
35 | 35 | <input type="checkbox" name="outgoing_server2server_group_share_enabled" id="outgoingServer2serverGroupShareEnabled" class="checkbox" |
36 | 36 | value="1" <?php if ($_['outgoingServer2serverGroupShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
37 | 37 | <label for="outgoingServer2serverGroupShareEnabled"> |
38 | - <?php p($l->t('Allow users on this server to send shares to groups on other servers'));?> |
|
38 | + <?php p($l->t('Allow users on this server to send shares to groups on other servers')); ?> |
|
39 | 39 | </label> |
40 | 40 | </p> |
41 | 41 | <p> |
42 | 42 | <input type="checkbox" name="incoming_server2server_group_share_enabled" id="incomingServer2serverGroupShareEnabled" class="checkbox" |
43 | 43 | value="1" <?php if ($_['incomingServer2serverGroupShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
44 | 44 | <label for="incomingServer2serverGroupShareEnabled"> |
45 | - <?php p($l->t('Allow users on this server to receive group shares from other servers'));?> |
|
45 | + <?php p($l->t('Allow users on this server to receive group shares from other servers')); ?> |
|
46 | 46 | </label><br/> |
47 | 47 | </p> |
48 | 48 | <?php endif; ?> |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | <input type="checkbox" name="lookupServerEnabled" id="lookupServerEnabled" class="checkbox" |
51 | 51 | value="1" <?php if ($_['lookupServerEnabled']) print_unescaped('checked="checked"'); ?> /> |
52 | 52 | <label for="lookupServerEnabled"> |
53 | - <?php p($l->t('Search global and public address book for users'));?> |
|
53 | + <?php p($l->t('Search global and public address book for users')); ?> |
|
54 | 54 | </label><br/> |
55 | 55 | </p> |
56 | 56 | <p> |
57 | 57 | <input type="checkbox" name="lookupServerUploadEnabled" id="lookupServerUploadEnabled" class="checkbox" |
58 | 58 | value="1" <?php if ($_['lookupServerUploadEnabled']) print_unescaped('checked="checked"'); ?> /> |
59 | 59 | <label for="lookupServerUploadEnabled"> |
60 | - <?php p($l->t('Allow users to publish their data to a global and public address book'));?> |
|
60 | + <?php p($l->t('Allow users to publish their data to a global and public address book')); ?> |
|
61 | 61 | </label><br/> |
62 | 62 | </p> |
63 | 63 |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | // To find out if we are running from CLI or not |
173 | 173 | $this->registerParameter('isCLI', \OC::$CLI); |
174 | 174 | |
175 | - $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) { |
|
175 | + $this->registerService(\OCP\IServerContainer::class, function(IServerContainer $c) { |
|
176 | 176 | return $c; |
177 | 177 | }); |
178 | 178 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $this->registerAlias(IActionFactory::class, ActionFactory::class); |
186 | 186 | |
187 | 187 | |
188 | - $this->registerService(\OCP\IPreview::class, function (Server $c) { |
|
188 | + $this->registerService(\OCP\IPreview::class, function(Server $c) { |
|
189 | 189 | return new PreviewManager( |
190 | 190 | $c->getConfig(), |
191 | 191 | $c->getRootFolder(), |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | }); |
197 | 197 | $this->registerAlias('PreviewManager', \OCP\IPreview::class); |
198 | 198 | |
199 | - $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { |
|
199 | + $this->registerService(\OC\Preview\Watcher::class, function(Server $c) { |
|
200 | 200 | return new \OC\Preview\Watcher( |
201 | 201 | $c->getAppDataDir('preview') |
202 | 202 | ); |
203 | 203 | }); |
204 | 204 | |
205 | - $this->registerService('EncryptionManager', function (Server $c) { |
|
205 | + $this->registerService('EncryptionManager', function(Server $c) { |
|
206 | 206 | $view = new View(); |
207 | 207 | $util = new Encryption\Util( |
208 | 208 | $view, |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | ); |
221 | 221 | }); |
222 | 222 | |
223 | - $this->registerService('EncryptionFileHelper', function (Server $c) { |
|
223 | + $this->registerService('EncryptionFileHelper', function(Server $c) { |
|
224 | 224 | $util = new Encryption\Util( |
225 | 225 | new View(), |
226 | 226 | $c->getUserManager(), |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | ); |
235 | 235 | }); |
236 | 236 | |
237 | - $this->registerService('EncryptionKeyStorage', function (Server $c) { |
|
237 | + $this->registerService('EncryptionKeyStorage', function(Server $c) { |
|
238 | 238 | $view = new View(); |
239 | 239 | $util = new Encryption\Util( |
240 | 240 | $view, |
@@ -245,30 +245,30 @@ discard block |
||
245 | 245 | |
246 | 246 | return new Encryption\Keys\Storage($view, $util); |
247 | 247 | }); |
248 | - $this->registerService('TagMapper', function (Server $c) { |
|
248 | + $this->registerService('TagMapper', function(Server $c) { |
|
249 | 249 | return new TagMapper($c->getDatabaseConnection()); |
250 | 250 | }); |
251 | 251 | |
252 | - $this->registerService(\OCP\ITagManager::class, function (Server $c) { |
|
252 | + $this->registerService(\OCP\ITagManager::class, function(Server $c) { |
|
253 | 253 | $tagMapper = $c->query('TagMapper'); |
254 | 254 | return new TagManager($tagMapper, $c->getUserSession()); |
255 | 255 | }); |
256 | 256 | $this->registerAlias('TagManager', \OCP\ITagManager::class); |
257 | 257 | |
258 | - $this->registerService('SystemTagManagerFactory', function (Server $c) { |
|
258 | + $this->registerService('SystemTagManagerFactory', function(Server $c) { |
|
259 | 259 | $config = $c->getConfig(); |
260 | 260 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class); |
261 | 261 | return new $factoryClass($this); |
262 | 262 | }); |
263 | - $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) { |
|
263 | + $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function(Server $c) { |
|
264 | 264 | return $c->query('SystemTagManagerFactory')->getManager(); |
265 | 265 | }); |
266 | 266 | $this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class); |
267 | 267 | |
268 | - $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) { |
|
268 | + $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function(Server $c) { |
|
269 | 269 | return $c->query('SystemTagManagerFactory')->getObjectMapper(); |
270 | 270 | }); |
271 | - $this->registerService('RootFolder', function (Server $c) { |
|
271 | + $this->registerService('RootFolder', function(Server $c) { |
|
272 | 272 | $manager = \OC\Files\Filesystem::getMountManager(null); |
273 | 273 | $view = new View(); |
274 | 274 | $root = new Root( |
@@ -289,38 +289,38 @@ discard block |
||
289 | 289 | }); |
290 | 290 | $this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class); |
291 | 291 | |
292 | - $this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) { |
|
293 | - return new LazyRoot(function () use ($c) { |
|
292 | + $this->registerService(\OCP\Files\IRootFolder::class, function(Server $c) { |
|
293 | + return new LazyRoot(function() use ($c) { |
|
294 | 294 | return $c->query('RootFolder'); |
295 | 295 | }); |
296 | 296 | }); |
297 | 297 | $this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class); |
298 | 298 | |
299 | - $this->registerService(\OC\User\Manager::class, function (Server $c) { |
|
299 | + $this->registerService(\OC\User\Manager::class, function(Server $c) { |
|
300 | 300 | $config = $c->getConfig(); |
301 | 301 | return new \OC\User\Manager($config); |
302 | 302 | }); |
303 | 303 | $this->registerAlias('UserManager', \OC\User\Manager::class); |
304 | 304 | $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class); |
305 | 305 | |
306 | - $this->registerService(\OCP\IGroupManager::class, function (Server $c) { |
|
306 | + $this->registerService(\OCP\IGroupManager::class, function(Server $c) { |
|
307 | 307 | $groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger()); |
308 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
308 | + $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
309 | 309 | \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid)); |
310 | 310 | }); |
311 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) { |
|
311 | + $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $gid) { |
|
312 | 312 | \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID())); |
313 | 313 | }); |
314 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
314 | + $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
315 | 315 | \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID())); |
316 | 316 | }); |
317 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
317 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
318 | 318 | \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID())); |
319 | 319 | }); |
320 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
320 | + $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
321 | 321 | \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID())); |
322 | 322 | }); |
323 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
323 | + $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
324 | 324 | \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
325 | 325 | //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks |
326 | 326 | \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | }); |
330 | 330 | $this->registerAlias('GroupManager', \OCP\IGroupManager::class); |
331 | 331 | |
332 | - $this->registerService(Store::class, function (Server $c) { |
|
332 | + $this->registerService(Store::class, function(Server $c) { |
|
333 | 333 | $session = $c->getSession(); |
334 | 334 | if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
335 | 335 | $tokenProvider = $c->query(IProvider::class); |
@@ -340,13 +340,13 @@ discard block |
||
340 | 340 | return new Store($session, $logger, $tokenProvider); |
341 | 341 | }); |
342 | 342 | $this->registerAlias(IStore::class, Store::class); |
343 | - $this->registerService(Authentication\Token\DefaultTokenMapper::class, function (Server $c) { |
|
343 | + $this->registerService(Authentication\Token\DefaultTokenMapper::class, function(Server $c) { |
|
344 | 344 | $dbConnection = $c->getDatabaseConnection(); |
345 | 345 | return new Authentication\Token\DefaultTokenMapper($dbConnection); |
346 | 346 | }); |
347 | 347 | $this->registerAlias(IProvider::class, Authentication\Token\Manager::class); |
348 | 348 | |
349 | - $this->registerService(\OCP\IUserSession::class, function (Server $c) { |
|
349 | + $this->registerService(\OCP\IUserSession::class, function(Server $c) { |
|
350 | 350 | $manager = $c->getUserManager(); |
351 | 351 | $session = new \OC\Session\Memory(''); |
352 | 352 | $timeFactory = new TimeFactory(); |
@@ -370,45 +370,45 @@ discard block |
||
370 | 370 | $c->getLockdownManager(), |
371 | 371 | $c->getLogger() |
372 | 372 | ); |
373 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
373 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
374 | 374 | \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); |
375 | 375 | }); |
376 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
376 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
377 | 377 | /** @var $user \OC\User\User */ |
378 | 378 | \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password)); |
379 | 379 | }); |
380 | - $userSession->listen('\OC\User', 'preDelete', function ($user) use ($dispatcher) { |
|
380 | + $userSession->listen('\OC\User', 'preDelete', function($user) use ($dispatcher) { |
|
381 | 381 | /** @var $user \OC\User\User */ |
382 | 382 | \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID())); |
383 | 383 | $dispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user)); |
384 | 384 | }); |
385 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
385 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
386 | 386 | /** @var $user \OC\User\User */ |
387 | 387 | \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID())); |
388 | 388 | }); |
389 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
389 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
390 | 390 | /** @var $user \OC\User\User */ |
391 | 391 | \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
392 | 392 | }); |
393 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
393 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
394 | 394 | /** @var $user \OC\User\User */ |
395 | 395 | \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
396 | 396 | }); |
397 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
397 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
398 | 398 | \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password)); |
399 | 399 | }); |
400 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $password) { |
|
400 | + $userSession->listen('\OC\User', 'postLogin', function($user, $password) { |
|
401 | 401 | /** @var $user \OC\User\User */ |
402 | 402 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
403 | 403 | }); |
404 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
404 | + $userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) { |
|
405 | 405 | /** @var $user \OC\User\User */ |
406 | 406 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
407 | 407 | }); |
408 | - $userSession->listen('\OC\User', 'logout', function () { |
|
408 | + $userSession->listen('\OC\User', 'logout', function() { |
|
409 | 409 | \OC_Hook::emit('OC_User', 'logout', array()); |
410 | 410 | }); |
411 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) use ($dispatcher) { |
|
411 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) use ($dispatcher) { |
|
412 | 412 | /** @var $user \OC\User\User */ |
413 | 413 | \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue)); |
414 | 414 | $dispatcher->dispatch('OCP\IUser::changeUser', new GenericEvent($user, ['feature' => $feature, 'oldValue' => $oldValue, 'value' => $value])); |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class); |
423 | 423 | $this->registerAlias('NavigationManager', \OCP\INavigationManager::class); |
424 | 424 | |
425 | - $this->registerService(\OC\AllConfig::class, function (Server $c) { |
|
425 | + $this->registerService(\OC\AllConfig::class, function(Server $c) { |
|
426 | 426 | return new \OC\AllConfig( |
427 | 427 | $c->getSystemConfig() |
428 | 428 | ); |
@@ -430,17 +430,17 @@ discard block |
||
430 | 430 | $this->registerAlias('AllConfig', \OC\AllConfig::class); |
431 | 431 | $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
432 | 432 | |
433 | - $this->registerService('SystemConfig', function ($c) use ($config) { |
|
433 | + $this->registerService('SystemConfig', function($c) use ($config) { |
|
434 | 434 | return new \OC\SystemConfig($config); |
435 | 435 | }); |
436 | 436 | |
437 | - $this->registerService(\OC\AppConfig::class, function (Server $c) { |
|
437 | + $this->registerService(\OC\AppConfig::class, function(Server $c) { |
|
438 | 438 | return new \OC\AppConfig($c->getDatabaseConnection()); |
439 | 439 | }); |
440 | 440 | $this->registerAlias('AppConfig', \OC\AppConfig::class); |
441 | 441 | $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class); |
442 | 442 | |
443 | - $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) { |
|
443 | + $this->registerService(\OCP\L10N\IFactory::class, function(Server $c) { |
|
444 | 444 | return new \OC\L10N\Factory( |
445 | 445 | $c->getConfig(), |
446 | 446 | $c->getRequest(), |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | }); |
451 | 451 | $this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class); |
452 | 452 | |
453 | - $this->registerService(\OCP\IURLGenerator::class, function (Server $c) { |
|
453 | + $this->registerService(\OCP\IURLGenerator::class, function(Server $c) { |
|
454 | 454 | $config = $c->getConfig(); |
455 | 455 | $cacheFactory = $c->getMemCacheFactory(); |
456 | 456 | $request = $c->getRequest(); |
@@ -465,12 +465,12 @@ discard block |
||
465 | 465 | $this->registerAlias('AppFetcher', AppFetcher::class); |
466 | 466 | $this->registerAlias('CategoryFetcher', CategoryFetcher::class); |
467 | 467 | |
468 | - $this->registerService(\OCP\ICache::class, function ($c) { |
|
468 | + $this->registerService(\OCP\ICache::class, function($c) { |
|
469 | 469 | return new Cache\File(); |
470 | 470 | }); |
471 | 471 | $this->registerAlias('UserCache', \OCP\ICache::class); |
472 | 472 | |
473 | - $this->registerService(Factory::class, function (Server $c) { |
|
473 | + $this->registerService(Factory::class, function(Server $c) { |
|
474 | 474 | |
475 | 475 | $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(), |
476 | 476 | ArrayCache::class, |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | $version = implode(',', $v); |
488 | 488 | $instanceId = \OC_Util::getInstanceId(); |
489 | 489 | $path = \OC::$SERVERROOT; |
490 | - $prefix = md5($instanceId . '-' . $version . '-' . $path); |
|
490 | + $prefix = md5($instanceId.'-'.$version.'-'.$path); |
|
491 | 491 | return new \OC\Memcache\Factory($prefix, $c->getLogger(), |
492 | 492 | $config->getSystemValue('memcache.local', null), |
493 | 493 | $config->getSystemValue('memcache.distributed', null), |
@@ -500,12 +500,12 @@ discard block |
||
500 | 500 | $this->registerAlias('MemCacheFactory', Factory::class); |
501 | 501 | $this->registerAlias(ICacheFactory::class, Factory::class); |
502 | 502 | |
503 | - $this->registerService('RedisFactory', function (Server $c) { |
|
503 | + $this->registerService('RedisFactory', function(Server $c) { |
|
504 | 504 | $systemConfig = $c->getSystemConfig(); |
505 | 505 | return new RedisFactory($systemConfig); |
506 | 506 | }); |
507 | 507 | |
508 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
508 | + $this->registerService(\OCP\Activity\IManager::class, function(Server $c) { |
|
509 | 509 | return new \OC\Activity\Manager( |
510 | 510 | $c->getRequest(), |
511 | 511 | $c->getUserSession(), |
@@ -515,14 +515,14 @@ discard block |
||
515 | 515 | }); |
516 | 516 | $this->registerAlias('ActivityManager', \OCP\Activity\IManager::class); |
517 | 517 | |
518 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
518 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
519 | 519 | return new \OC\Activity\EventMerger( |
520 | 520 | $c->getL10N('lib') |
521 | 521 | ); |
522 | 522 | }); |
523 | 523 | $this->registerAlias(IValidator::class, Validator::class); |
524 | 524 | |
525 | - $this->registerService(\OCP\IAvatarManager::class, function (Server $c) { |
|
525 | + $this->registerService(\OCP\IAvatarManager::class, function(Server $c) { |
|
526 | 526 | return new AvatarManager( |
527 | 527 | $c->query(\OC\User\Manager::class), |
528 | 528 | $c->getAppDataDir('avatar'), |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | |
536 | 536 | $this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class); |
537 | 537 | |
538 | - $this->registerService(\OCP\ILogger::class, function (Server $c) { |
|
538 | + $this->registerService(\OCP\ILogger::class, function(Server $c) { |
|
539 | 539 | $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file'); |
540 | 540 | $factory = new LogFactory($c, $this->getSystemConfig()); |
541 | 541 | $logger = $factory->get($logType); |
@@ -545,11 +545,11 @@ discard block |
||
545 | 545 | }); |
546 | 546 | $this->registerAlias('Logger', \OCP\ILogger::class); |
547 | 547 | |
548 | - $this->registerService(ILogFactory::class, function (Server $c) { |
|
548 | + $this->registerService(ILogFactory::class, function(Server $c) { |
|
549 | 549 | return new LogFactory($c, $this->getSystemConfig()); |
550 | 550 | }); |
551 | 551 | |
552 | - $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) { |
|
552 | + $this->registerService(\OCP\BackgroundJob\IJobList::class, function(Server $c) { |
|
553 | 553 | $config = $c->getConfig(); |
554 | 554 | return new \OC\BackgroundJob\JobList( |
555 | 555 | $c->getDatabaseConnection(), |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | }); |
560 | 560 | $this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class); |
561 | 561 | |
562 | - $this->registerService(\OCP\Route\IRouter::class, function (Server $c) { |
|
562 | + $this->registerService(\OCP\Route\IRouter::class, function(Server $c) { |
|
563 | 563 | $cacheFactory = $c->getMemCacheFactory(); |
564 | 564 | $logger = $c->getLogger(); |
565 | 565 | if ($cacheFactory->isLocalCacheAvailable()) { |
@@ -571,12 +571,12 @@ discard block |
||
571 | 571 | }); |
572 | 572 | $this->registerAlias('Router', \OCP\Route\IRouter::class); |
573 | 573 | |
574 | - $this->registerService(\OCP\ISearch::class, function ($c) { |
|
574 | + $this->registerService(\OCP\ISearch::class, function($c) { |
|
575 | 575 | return new Search(); |
576 | 576 | }); |
577 | 577 | $this->registerAlias('Search', \OCP\ISearch::class); |
578 | 578 | |
579 | - $this->registerService(\OC\Security\RateLimiting\Limiter::class, function (Server $c) { |
|
579 | + $this->registerService(\OC\Security\RateLimiting\Limiter::class, function(Server $c) { |
|
580 | 580 | return new \OC\Security\RateLimiting\Limiter( |
581 | 581 | $this->getUserSession(), |
582 | 582 | $this->getRequest(), |
@@ -584,34 +584,34 @@ discard block |
||
584 | 584 | $c->query(\OC\Security\RateLimiting\Backend\IBackend::class) |
585 | 585 | ); |
586 | 586 | }); |
587 | - $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
587 | + $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) { |
|
588 | 588 | return new \OC\Security\RateLimiting\Backend\MemoryCache( |
589 | 589 | $this->getMemCacheFactory(), |
590 | 590 | new \OC\AppFramework\Utility\TimeFactory() |
591 | 591 | ); |
592 | 592 | }); |
593 | 593 | |
594 | - $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) { |
|
594 | + $this->registerService(\OCP\Security\ISecureRandom::class, function($c) { |
|
595 | 595 | return new SecureRandom(); |
596 | 596 | }); |
597 | 597 | $this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class); |
598 | 598 | |
599 | - $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) { |
|
599 | + $this->registerService(\OCP\Security\ICrypto::class, function(Server $c) { |
|
600 | 600 | return new Crypto($c->getConfig(), $c->getSecureRandom()); |
601 | 601 | }); |
602 | 602 | $this->registerAlias('Crypto', \OCP\Security\ICrypto::class); |
603 | 603 | |
604 | - $this->registerService(\OCP\Security\IHasher::class, function (Server $c) { |
|
604 | + $this->registerService(\OCP\Security\IHasher::class, function(Server $c) { |
|
605 | 605 | return new Hasher($c->getConfig()); |
606 | 606 | }); |
607 | 607 | $this->registerAlias('Hasher', \OCP\Security\IHasher::class); |
608 | 608 | |
609 | - $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) { |
|
609 | + $this->registerService(\OCP\Security\ICredentialsManager::class, function(Server $c) { |
|
610 | 610 | return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); |
611 | 611 | }); |
612 | 612 | $this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class); |
613 | 613 | |
614 | - $this->registerService(IDBConnection::class, function (Server $c) { |
|
614 | + $this->registerService(IDBConnection::class, function(Server $c) { |
|
615 | 615 | $systemConfig = $c->getSystemConfig(); |
616 | 616 | $factory = new \OC\DB\ConnectionFactory($systemConfig); |
617 | 617 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $this->registerAlias('DatabaseConnection', IDBConnection::class); |
627 | 627 | |
628 | 628 | |
629 | - $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) { |
|
629 | + $this->registerService(\OCP\Http\Client\IClientService::class, function(Server $c) { |
|
630 | 630 | $user = \OC_User::getUser(); |
631 | 631 | $uid = $user ? $user : null; |
632 | 632 | return new ClientService( |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | ); |
642 | 642 | }); |
643 | 643 | $this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class); |
644 | - $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) { |
|
644 | + $this->registerService(\OCP\Diagnostics\IEventLogger::class, function(Server $c) { |
|
645 | 645 | $eventLogger = new EventLogger(); |
646 | 646 | if ($c->getSystemConfig()->getValue('debug', false)) { |
647 | 647 | // In debug mode, module is being activated by default |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | }); |
652 | 652 | $this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class); |
653 | 653 | |
654 | - $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) { |
|
654 | + $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function(Server $c) { |
|
655 | 655 | $queryLogger = new QueryLogger(); |
656 | 656 | if ($c->getSystemConfig()->getValue('debug', false)) { |
657 | 657 | // In debug mode, module is being activated by default |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | }); |
662 | 662 | $this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class); |
663 | 663 | |
664 | - $this->registerService(TempManager::class, function (Server $c) { |
|
664 | + $this->registerService(TempManager::class, function(Server $c) { |
|
665 | 665 | return new TempManager( |
666 | 666 | $c->getLogger(), |
667 | 667 | $c->getConfig() |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | $this->registerAlias('TempManager', TempManager::class); |
671 | 671 | $this->registerAlias(ITempManager::class, TempManager::class); |
672 | 672 | |
673 | - $this->registerService(AppManager::class, function (Server $c) { |
|
673 | + $this->registerService(AppManager::class, function(Server $c) { |
|
674 | 674 | return new \OC\App\AppManager( |
675 | 675 | $c->getUserSession(), |
676 | 676 | $c->query(\OC\AppConfig::class), |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | $this->registerAlias('AppManager', AppManager::class); |
683 | 683 | $this->registerAlias(IAppManager::class, AppManager::class); |
684 | 684 | |
685 | - $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) { |
|
685 | + $this->registerService(\OCP\IDateTimeZone::class, function(Server $c) { |
|
686 | 686 | return new DateTimeZone( |
687 | 687 | $c->getConfig(), |
688 | 688 | $c->getSession() |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | }); |
691 | 691 | $this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class); |
692 | 692 | |
693 | - $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) { |
|
693 | + $this->registerService(\OCP\IDateTimeFormatter::class, function(Server $c) { |
|
694 | 694 | $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); |
695 | 695 | |
696 | 696 | return new DateTimeFormatter( |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | }); |
701 | 701 | $this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class); |
702 | 702 | |
703 | - $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) { |
|
703 | + $this->registerService(\OCP\Files\Config\IUserMountCache::class, function(Server $c) { |
|
704 | 704 | $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); |
705 | 705 | $listener = new UserMountCacheListener($mountCache); |
706 | 706 | $listener->listen($c->getUserManager()); |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | }); |
709 | 709 | $this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class); |
710 | 710 | |
711 | - $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) { |
|
711 | + $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function(Server $c) { |
|
712 | 712 | $loader = \OC\Files\Filesystem::getLoader(); |
713 | 713 | $mountCache = $c->query('UserMountCache'); |
714 | 714 | $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
@@ -724,10 +724,10 @@ discard block |
||
724 | 724 | }); |
725 | 725 | $this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class); |
726 | 726 | |
727 | - $this->registerService('IniWrapper', function ($c) { |
|
727 | + $this->registerService('IniWrapper', function($c) { |
|
728 | 728 | return new IniGetWrapper(); |
729 | 729 | }); |
730 | - $this->registerService('AsyncCommandBus', function (Server $c) { |
|
730 | + $this->registerService('AsyncCommandBus', function(Server $c) { |
|
731 | 731 | $busClass = $c->getConfig()->getSystemValue('commandbus'); |
732 | 732 | if ($busClass) { |
733 | 733 | list($app, $class) = explode('::', $busClass, 2); |
@@ -742,10 +742,10 @@ discard block |
||
742 | 742 | return new CronBus($jobList); |
743 | 743 | } |
744 | 744 | }); |
745 | - $this->registerService('TrustedDomainHelper', function ($c) { |
|
745 | + $this->registerService('TrustedDomainHelper', function($c) { |
|
746 | 746 | return new TrustedDomainHelper($this->getConfig()); |
747 | 747 | }); |
748 | - $this->registerService('Throttler', function (Server $c) { |
|
748 | + $this->registerService('Throttler', function(Server $c) { |
|
749 | 749 | return new Throttler( |
750 | 750 | $c->getDatabaseConnection(), |
751 | 751 | new TimeFactory(), |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $c->getConfig() |
754 | 754 | ); |
755 | 755 | }); |
756 | - $this->registerService('IntegrityCodeChecker', function (Server $c) { |
|
756 | + $this->registerService('IntegrityCodeChecker', function(Server $c) { |
|
757 | 757 | // IConfig and IAppManager requires a working database. This code |
758 | 758 | // might however be called when ownCloud is not yet setup. |
759 | 759 | if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | $c->getTempManager() |
775 | 775 | ); |
776 | 776 | }); |
777 | - $this->registerService(\OCP\IRequest::class, function ($c) { |
|
777 | + $this->registerService(\OCP\IRequest::class, function($c) { |
|
778 | 778 | if (isset($this['urlParams'])) { |
779 | 779 | $urlParams = $this['urlParams']; |
780 | 780 | } else { |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | }); |
811 | 811 | $this->registerAlias('Request', \OCP\IRequest::class); |
812 | 812 | |
813 | - $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) { |
|
813 | + $this->registerService(\OCP\Mail\IMailer::class, function(Server $c) { |
|
814 | 814 | return new Mailer( |
815 | 815 | $c->getConfig(), |
816 | 816 | $c->getLogger(), |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | }); |
822 | 822 | $this->registerAlias('Mailer', \OCP\Mail\IMailer::class); |
823 | 823 | |
824 | - $this->registerService('LDAPProvider', function (Server $c) { |
|
824 | + $this->registerService('LDAPProvider', function(Server $c) { |
|
825 | 825 | $config = $c->getConfig(); |
826 | 826 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
827 | 827 | if (is_null($factoryClass)) { |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | $factory = new $factoryClass($this); |
832 | 832 | return $factory->getLDAPProvider(); |
833 | 833 | }); |
834 | - $this->registerService(ILockingProvider::class, function (Server $c) { |
|
834 | + $this->registerService(ILockingProvider::class, function(Server $c) { |
|
835 | 835 | $ini = $c->getIniWrapper(); |
836 | 836 | $config = $c->getConfig(); |
837 | 837 | $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -854,49 +854,49 @@ discard block |
||
854 | 854 | }); |
855 | 855 | $this->registerAlias('LockingProvider', ILockingProvider::class); |
856 | 856 | |
857 | - $this->registerService(\OCP\Files\Mount\IMountManager::class, function () { |
|
857 | + $this->registerService(\OCP\Files\Mount\IMountManager::class, function() { |
|
858 | 858 | return new \OC\Files\Mount\Manager(); |
859 | 859 | }); |
860 | 860 | $this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class); |
861 | 861 | |
862 | - $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) { |
|
862 | + $this->registerService(\OCP\Files\IMimeTypeDetector::class, function(Server $c) { |
|
863 | 863 | return new \OC\Files\Type\Detection( |
864 | 864 | $c->getURLGenerator(), |
865 | 865 | \OC::$configDir, |
866 | - \OC::$SERVERROOT . '/resources/config/' |
|
866 | + \OC::$SERVERROOT.'/resources/config/' |
|
867 | 867 | ); |
868 | 868 | }); |
869 | 869 | $this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class); |
870 | 870 | |
871 | - $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) { |
|
871 | + $this->registerService(\OCP\Files\IMimeTypeLoader::class, function(Server $c) { |
|
872 | 872 | return new \OC\Files\Type\Loader( |
873 | 873 | $c->getDatabaseConnection() |
874 | 874 | ); |
875 | 875 | }); |
876 | 876 | $this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class); |
877 | - $this->registerService(BundleFetcher::class, function () { |
|
877 | + $this->registerService(BundleFetcher::class, function() { |
|
878 | 878 | return new BundleFetcher($this->getL10N('lib')); |
879 | 879 | }); |
880 | - $this->registerService(\OCP\Notification\IManager::class, function (Server $c) { |
|
880 | + $this->registerService(\OCP\Notification\IManager::class, function(Server $c) { |
|
881 | 881 | return new Manager( |
882 | 882 | $c->query(IValidator::class) |
883 | 883 | ); |
884 | 884 | }); |
885 | 885 | $this->registerAlias('NotificationManager', \OCP\Notification\IManager::class); |
886 | 886 | |
887 | - $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) { |
|
887 | + $this->registerService(\OC\CapabilitiesManager::class, function(Server $c) { |
|
888 | 888 | $manager = new \OC\CapabilitiesManager($c->getLogger()); |
889 | - $manager->registerCapability(function () use ($c) { |
|
889 | + $manager->registerCapability(function() use ($c) { |
|
890 | 890 | return new \OC\OCS\CoreCapabilities($c->getConfig()); |
891 | 891 | }); |
892 | - $manager->registerCapability(function () use ($c) { |
|
892 | + $manager->registerCapability(function() use ($c) { |
|
893 | 893 | return $c->query(\OC\Security\Bruteforce\Capabilities::class); |
894 | 894 | }); |
895 | 895 | return $manager; |
896 | 896 | }); |
897 | 897 | $this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class); |
898 | 898 | |
899 | - $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) { |
|
899 | + $this->registerService(\OCP\Comments\ICommentsManager::class, function(Server $c) { |
|
900 | 900 | $config = $c->getConfig(); |
901 | 901 | $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class); |
902 | 902 | /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | $manager->registerDisplayNameResolver('user', function($id) use ($c) { |
907 | 907 | $manager = $c->getUserManager(); |
908 | 908 | $user = $manager->get($id); |
909 | - if(is_null($user)) { |
|
909 | + if (is_null($user)) { |
|
910 | 910 | $l = $c->getL10N('core'); |
911 | 911 | $displayName = $l->t('Unknown user'); |
912 | 912 | } else { |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | }); |
920 | 920 | $this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class); |
921 | 921 | |
922 | - $this->registerService('ThemingDefaults', function (Server $c) { |
|
922 | + $this->registerService('ThemingDefaults', function(Server $c) { |
|
923 | 923 | /* |
924 | 924 | * Dark magic for autoloader. |
925 | 925 | * If we do a class_exists it will try to load the class which will |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | } |
947 | 947 | return new \OC_Defaults(); |
948 | 948 | }); |
949 | - $this->registerService(SCSSCacher::class, function (Server $c) { |
|
949 | + $this->registerService(SCSSCacher::class, function(Server $c) { |
|
950 | 950 | /** @var Factory $cacheFactory */ |
951 | 951 | $cacheFactory = $c->query(Factory::class); |
952 | 952 | return new SCSSCacher( |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | $this->getMemCacheFactory() |
960 | 960 | ); |
961 | 961 | }); |
962 | - $this->registerService(JSCombiner::class, function (Server $c) { |
|
962 | + $this->registerService(JSCombiner::class, function(Server $c) { |
|
963 | 963 | /** @var Factory $cacheFactory */ |
964 | 964 | $cacheFactory = $c->query(Factory::class); |
965 | 965 | return new JSCombiner( |
@@ -970,13 +970,13 @@ discard block |
||
970 | 970 | $c->getLogger() |
971 | 971 | ); |
972 | 972 | }); |
973 | - $this->registerService(EventDispatcher::class, function () { |
|
973 | + $this->registerService(EventDispatcher::class, function() { |
|
974 | 974 | return new EventDispatcher(); |
975 | 975 | }); |
976 | 976 | $this->registerAlias('EventDispatcher', EventDispatcher::class); |
977 | 977 | $this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class); |
978 | 978 | |
979 | - $this->registerService('CryptoWrapper', function (Server $c) { |
|
979 | + $this->registerService('CryptoWrapper', function(Server $c) { |
|
980 | 980 | // FIXME: Instantiiated here due to cyclic dependency |
981 | 981 | $request = new Request( |
982 | 982 | [ |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | $request |
1002 | 1002 | ); |
1003 | 1003 | }); |
1004 | - $this->registerService('CsrfTokenManager', function (Server $c) { |
|
1004 | + $this->registerService('CsrfTokenManager', function(Server $c) { |
|
1005 | 1005 | $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom()); |
1006 | 1006 | |
1007 | 1007 | return new CsrfTokenManager( |
@@ -1009,22 +1009,22 @@ discard block |
||
1009 | 1009 | $c->query(SessionStorage::class) |
1010 | 1010 | ); |
1011 | 1011 | }); |
1012 | - $this->registerService(SessionStorage::class, function (Server $c) { |
|
1012 | + $this->registerService(SessionStorage::class, function(Server $c) { |
|
1013 | 1013 | return new SessionStorage($c->getSession()); |
1014 | 1014 | }); |
1015 | - $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) { |
|
1015 | + $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function(Server $c) { |
|
1016 | 1016 | return new ContentSecurityPolicyManager(); |
1017 | 1017 | }); |
1018 | 1018 | $this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class); |
1019 | 1019 | |
1020 | - $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) { |
|
1020 | + $this->registerService('ContentSecurityPolicyNonceManager', function(Server $c) { |
|
1021 | 1021 | return new ContentSecurityPolicyNonceManager( |
1022 | 1022 | $c->getCsrfTokenManager(), |
1023 | 1023 | $c->getRequest() |
1024 | 1024 | ); |
1025 | 1025 | }); |
1026 | 1026 | |
1027 | - $this->registerService(\OCP\Share\IManager::class, function (Server $c) { |
|
1027 | + $this->registerService(\OCP\Share\IManager::class, function(Server $c) { |
|
1028 | 1028 | $config = $c->getConfig(); |
1029 | 1029 | $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class); |
1030 | 1030 | /** @var \OCP\Share\IProviderFactory $factory */ |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | |
1068 | 1068 | $this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class); |
1069 | 1069 | |
1070 | - $this->registerService('SettingsManager', function (Server $c) { |
|
1070 | + $this->registerService('SettingsManager', function(Server $c) { |
|
1071 | 1071 | $manager = new \OC\Settings\Manager( |
1072 | 1072 | $c->getLogger(), |
1073 | 1073 | $c->getDatabaseConnection(), |
@@ -1085,36 +1085,36 @@ discard block |
||
1085 | 1085 | ); |
1086 | 1086 | return $manager; |
1087 | 1087 | }); |
1088 | - $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) { |
|
1088 | + $this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) { |
|
1089 | 1089 | return new \OC\Files\AppData\Factory( |
1090 | 1090 | $c->getRootFolder(), |
1091 | 1091 | $c->getSystemConfig() |
1092 | 1092 | ); |
1093 | 1093 | }); |
1094 | 1094 | |
1095 | - $this->registerService('LockdownManager', function (Server $c) { |
|
1096 | - return new LockdownManager(function () use ($c) { |
|
1095 | + $this->registerService('LockdownManager', function(Server $c) { |
|
1096 | + return new LockdownManager(function() use ($c) { |
|
1097 | 1097 | return $c->getSession(); |
1098 | 1098 | }); |
1099 | 1099 | }); |
1100 | 1100 | |
1101 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) { |
|
1101 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function(Server $c) { |
|
1102 | 1102 | return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService()); |
1103 | 1103 | }); |
1104 | 1104 | |
1105 | - $this->registerService(ICloudIdManager::class, function (Server $c) { |
|
1105 | + $this->registerService(ICloudIdManager::class, function(Server $c) { |
|
1106 | 1106 | return new CloudIdManager(); |
1107 | 1107 | }); |
1108 | 1108 | |
1109 | - $this->registerService(IConfig::class, function (Server $c) { |
|
1109 | + $this->registerService(IConfig::class, function(Server $c) { |
|
1110 | 1110 | return new GlobalScale\Config($c->getConfig()); |
1111 | 1111 | }); |
1112 | 1112 | |
1113 | - $this->registerService(ICloudFederationProviderManager::class, function (Server $c) { |
|
1113 | + $this->registerService(ICloudFederationProviderManager::class, function(Server $c) { |
|
1114 | 1114 | return new CloudFederationProviderManager($c->getAppManager(), $c->getHTTPClientService(), $c->getCloudIdManager(), $c->getLogger()); |
1115 | 1115 | }); |
1116 | 1116 | |
1117 | - $this->registerService(ICloudFederationFactory::class, function (Server $c) { |
|
1117 | + $this->registerService(ICloudFederationFactory::class, function(Server $c) { |
|
1118 | 1118 | return new CloudFederationFactory(); |
1119 | 1119 | }); |
1120 | 1120 | |
@@ -1124,18 +1124,18 @@ discard block |
||
1124 | 1124 | $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
1125 | 1125 | $this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
1126 | 1126 | |
1127 | - $this->registerService(Defaults::class, function (Server $c) { |
|
1127 | + $this->registerService(Defaults::class, function(Server $c) { |
|
1128 | 1128 | return new Defaults( |
1129 | 1129 | $c->getThemingDefaults() |
1130 | 1130 | ); |
1131 | 1131 | }); |
1132 | 1132 | $this->registerAlias('Defaults', \OCP\Defaults::class); |
1133 | 1133 | |
1134 | - $this->registerService(\OCP\ISession::class, function (SimpleContainer $c) { |
|
1134 | + $this->registerService(\OCP\ISession::class, function(SimpleContainer $c) { |
|
1135 | 1135 | return $c->query(\OCP\IUserSession::class)->getSession(); |
1136 | 1136 | }); |
1137 | 1137 | |
1138 | - $this->registerService(IShareHelper::class, function (Server $c) { |
|
1138 | + $this->registerService(IShareHelper::class, function(Server $c) { |
|
1139 | 1139 | return new ShareHelper( |
1140 | 1140 | $c->query(\OCP\Share\IManager::class) |
1141 | 1141 | ); |
@@ -1197,11 +1197,11 @@ discard block |
||
1197 | 1197 | // no avatar to remove |
1198 | 1198 | } catch (\Exception $e) { |
1199 | 1199 | // Ignore exceptions |
1200 | - $logger->info('Could not cleanup avatar of ' . $user->getUID()); |
|
1200 | + $logger->info('Could not cleanup avatar of '.$user->getUID()); |
|
1201 | 1201 | } |
1202 | 1202 | }); |
1203 | 1203 | |
1204 | - $dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) { |
|
1204 | + $dispatcher->addListener('OCP\IUser::changeUser', function(GenericEvent $e) { |
|
1205 | 1205 | $manager = $this->getAvatarManager(); |
1206 | 1206 | /** @var IUser $user */ |
1207 | 1207 | $user = $e->getSubject(); |
@@ -1352,7 +1352,7 @@ discard block |
||
1352 | 1352 | * @deprecated since 9.2.0 use IAppData |
1353 | 1353 | */ |
1354 | 1354 | public function getAppFolder() { |
1355 | - $dir = '/' . \OC_App::getCurrentApp(); |
|
1355 | + $dir = '/'.\OC_App::getCurrentApp(); |
|
1356 | 1356 | $root = $this->getRootFolder(); |
1357 | 1357 | if (!$root->nodeExists($dir)) { |
1358 | 1358 | $folder = $root->newFolder($dir); |
@@ -1927,7 +1927,7 @@ discard block |
||
1927 | 1927 | /** |
1928 | 1928 | * @return \OCP\Collaboration\AutoComplete\IManager |
1929 | 1929 | */ |
1930 | - public function getAutoCompleteManager(){ |
|
1930 | + public function getAutoCompleteManager() { |
|
1931 | 1931 | return $this->query(IManager::class); |
1932 | 1932 | } |
1933 | 1933 |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $supportedShareTypes = $this->config->getSupportedShareTypes($resourceType); |
146 | 146 | if (!in_array($shareType, $supportedShareTypes)) { |
147 | 147 | return new JSONResponse( |
148 | - ['message' => 'Share type "' . $shareType . '" not implemented'], |
|
148 | + ['message' => 'Share type "'.$shareType.'" not implemented'], |
|
149 | 149 | Http::STATUS_NOT_IMPLEMENTED |
150 | 150 | ); |
151 | 151 | } |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | |
159 | 159 | if (!$this->userManager->userExists($shareWith)) { |
160 | 160 | return new JSONResponse( |
161 | - ['message' => 'User "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()], |
|
161 | + ['message' => 'User "'.$shareWith.'" does not exists at '.$this->urlGenerator->getBaseUrl()], |
|
162 | 162 | Http::STATUS_BAD_REQUEST |
163 | 163 | ); |
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | 167 | if ($shareType === 'group') { |
168 | - if(!$this->groupManager->groupExists($shareWith)) { |
|
168 | + if (!$this->groupManager->groupExists($shareWith)) { |
|
169 | 169 | return new JSONResponse( |
170 | - ['message' => 'Group "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()], |
|
170 | + ['message' => 'Group "'.$shareWith.'" does not exists at '.$this->urlGenerator->getBaseUrl()], |
|
171 | 171 | Http::STATUS_BAD_REQUEST |
172 | 172 | ); |
173 | 173 | } |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | ); |
201 | 201 | } catch (\Exception $e) { |
202 | 202 | return new JSONResponse( |
203 | - ['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()], |
|
203 | + ['message' => 'Internal error at '.$this->urlGenerator->getBaseUrl()], |
|
204 | 204 | Http::STATUS_BAD_REQUEST |
205 | 205 | ); |
206 | 206 | } |
207 | 207 | |
208 | 208 | $user = $this->userManager->get($shareWith); |
209 | 209 | $recipientDisplayName = ''; |
210 | - if($user) { |
|
210 | + if ($user) { |
|
211 | 211 | $recipientDisplayName = $user->getDisplayName(); |
212 | 212 | } |
213 | 213 | |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | } |
270 | 270 | catch (\Exception $e) { |
271 | 271 | return new JSONResponse( |
272 | - ['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()], |
|
272 | + ['message' => 'Internal error at '.$this->urlGenerator->getBaseUrl()], |
|
273 | 273 | Http::STATUS_BAD_REQUEST |
274 | 274 | ); |
275 | 275 | } |
276 | 276 | |
277 | - return new JSONResponse($result,Http::STATUS_CREATED); |
|
277 | + return new JSONResponse($result, Http::STATUS_CREATED); |
|
278 | 278 | |
279 | 279 | } |
280 | 280 | |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | */ |
287 | 287 | private function mapUid($uid) { |
288 | 288 | // FIXME this should be a method in the user management instead |
289 | - $this->logger->debug('shareWith before, ' . $uid, ['app' => $this->appName]); |
|
289 | + $this->logger->debug('shareWith before, '.$uid, ['app' => $this->appName]); |
|
290 | 290 | \OCP\Util::emitHook( |
291 | 291 | '\OCA\Files_Sharing\API\Server2Server', |
292 | 292 | 'preLoginNameUsedAsUserName', |
293 | 293 | array('uid' => &$uid) |
294 | 294 | ); |
295 | - $this->logger->debug('shareWith after, ' . $uid, ['app' => $this->appName]); |
|
295 | + $this->logger->debug('shareWith after, '.$uid, ['app' => $this->appName]); |
|
296 | 296 | |
297 | 297 | return $uid; |
298 | 298 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | // for backward compatibility make sure that the remote url stored in the |
173 | 173 | // database ends with a trailing slash |
174 | 174 | if (substr($remote, -1) !== '/') { |
175 | - $remote = $remote . '/'; |
|
175 | + $remote = $remote.'/'; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | $token = $share->getShareSecret(); |
@@ -200,23 +200,23 @@ discard block |
||
200 | 200 | |
201 | 201 | // FIXME this should be a method in the user management instead |
202 | 202 | if ($shareType === Share::SHARE_TYPE_USER) { |
203 | - $this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']); |
|
203 | + $this->logger->debug('shareWith before, '.$shareWith, ['app' => 'files_sharing']); |
|
204 | 204 | Util::emitHook( |
205 | 205 | '\OCA\Files_Sharing\API\Server2Server', |
206 | 206 | 'preLoginNameUsedAsUserName', |
207 | 207 | array('uid' => &$shareWith) |
208 | 208 | ); |
209 | - $this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']); |
|
209 | + $this->logger->debug('shareWith after, '.$shareWith, ['app' => 'files_sharing']); |
|
210 | 210 | |
211 | 211 | if (!$this->userManager->userExists($shareWith)) { |
212 | - throw new ProviderCouldNotAddShareException('User does not exists', '',Http::STATUS_BAD_REQUEST); |
|
212 | + throw new ProviderCouldNotAddShareException('User does not exists', '', Http::STATUS_BAD_REQUEST); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | \OC_Util::setupFS($shareWith); |
216 | 216 | } |
217 | 217 | |
218 | 218 | if ($shareType === Share::SHARE_TYPE_GROUP && !$this->groupManager->groupExists($shareWith)) { |
219 | - throw new ProviderCouldNotAddShareException('Group does not exists', '',Http::STATUS_BAD_REQUEST); |
|
219 | + throw new ProviderCouldNotAddShareException('Group does not exists', '', Http::STATUS_BAD_REQUEST); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | $externalManager = new \OCA\Files_Sharing\External\Manager( |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | ); |
233 | 233 | |
234 | 234 | try { |
235 | - $externalManager->addShare($remote, $token, '', $name, $owner, $shareType,false, $shareWith, $remoteId); |
|
235 | + $externalManager->addShare($remote, $token, '', $name, $owner, $shareType, false, $shareWith, $remoteId); |
|
236 | 236 | $shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external'); |
237 | 237 | |
238 | 238 | if ($shareType === Share::SHARE_TYPE_USER) { |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | ->setType('remote_share') |
242 | 242 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')]) |
243 | 243 | ->setAffectedUser($shareWith) |
244 | - ->setObject('remote_share', (int)$shareId, $name); |
|
244 | + ->setObject('remote_share', (int) $shareId, $name); |
|
245 | 245 | \OC::$server->getActivityManager()->publish($event); |
246 | 246 | $this->notifyAboutNewShare($shareWith, $shareId, $ownerFederatedId, $sharedByFederatedId, $name); |
247 | 247 | } else { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | ->setType('remote_share') |
253 | 253 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')]) |
254 | 254 | ->setAffectedUser($user->getUID()) |
255 | - ->setObject('remote_share', (int)$shareId, $name); |
|
255 | + ->setObject('remote_share', (int) $shareId, $name); |
|
256 | 256 | \OC::$server->getActivityManager()->publish($event); |
257 | 257 | $this->notifyAboutNewShare($user->getUID(), $shareId, $ownerFederatedId, $sharedByFederatedId, $name); |
258 | 258 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | 'level' => ILogger::ERROR, |
265 | 265 | 'app' => 'files_sharing' |
266 | 266 | ]); |
267 | - throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
267 | + throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from '.$remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | |
342 | 342 | $declineAction = $notification->createAction(); |
343 | 343 | $declineAction->setLabel('decline') |
344 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); |
|
344 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'DELETE'); |
|
345 | 345 | $notification->addAction($declineAction); |
346 | 346 | |
347 | 347 | $acceptAction = $notification->createAction(); |
348 | 348 | $acceptAction->setLabel('accept') |
349 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); |
|
349 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'POST'); |
|
350 | 350 | $notification->addAction($acceptAction); |
351 | 351 | |
352 | 352 | $this->notificationManager->notify($notification); |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | */ |
407 | 407 | protected function executeAcceptShare(IShare $share) { |
408 | 408 | try { |
409 | - $fileId = (int)$share->getNode()->getId(); |
|
409 | + $fileId = (int) $share->getNode()->getId(); |
|
410 | 410 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
411 | 411 | } catch (\Exception $e) { |
412 | 412 | throw new ShareNotFound(); |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | $this->federatedShareProvider->removeShareFromTable($share); |
485 | 485 | |
486 | 486 | try { |
487 | - $fileId = (int)$share->getNode()->getId(); |
|
487 | + $fileId = (int) $share->getNode()->getId(); |
|
488 | 488 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
489 | 489 | } catch (\Exception $e) { |
490 | 490 | throw new ShareNotFound(); |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | $notification = $this->notificationManager->createNotification(); |
586 | 586 | $notification->setApp('files_sharing') |
587 | 587 | ->setUser($share['user']) |
588 | - ->setObject('remote_share', (int)$share['id']); |
|
588 | + ->setObject('remote_share', (int) $share['id']); |
|
589 | 589 | $this->notificationManager->markProcessed($notification); |
590 | 590 | |
591 | 591 | $event = $this->activityManager->generateEvent(); |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | ->setType('remote_share') |
594 | 594 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path]) |
595 | 595 | ->setAffectedUser($user) |
596 | - ->setObject('remote_share', (int)$share['id'], $path); |
|
596 | + ->setObject('remote_share', (int) $share['id'], $path); |
|
597 | 597 | \OC::$server->getActivityManager()->publish($event); |
598 | 598 | } |
599 | 599 | |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | $owner = $share->getShareOwner(); |
642 | 642 | $currentServer = $this->addressHandler->generateRemoteURL(); |
643 | 643 | if ($this->addressHandler->compareAddresses($user, $remote, $owner, $currentServer)) { |
644 | - throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: ' . $id); |
|
644 | + throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: '.$id); |
|
645 | 645 | } |
646 | 646 | } catch (\Exception $e) { |
647 | 647 | throw new ProviderCouldNotAddShareException($e->getMessage()); |
@@ -655,10 +655,10 @@ discard block |
||
655 | 655 | $share->setSharedBy($share->getSharedWith()); |
656 | 656 | $share->setSharedWith($shareWith); |
657 | 657 | $result = $this->federatedShareProvider->create($share); |
658 | - $this->federatedShareProvider->storeRemoteId((int)$result->getId(), $senderId); |
|
658 | + $this->federatedShareProvider->storeRemoteId((int) $result->getId(), $senderId); |
|
659 | 659 | return ['token' => $result->getToken(), 'providerId' => $result->getId()]; |
660 | 660 | } else { |
661 | - throw new ProviderCouldNotAddShareException('resharing not allowed for share: ' . $id); |
|
661 | + throw new ProviderCouldNotAddShareException('resharing not allowed for share: '.$id); |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | */ |
705 | 705 | protected function ocmPermissions2ncPermissions(array $ocmPermissions) { |
706 | 706 | $ncPermissions = 0; |
707 | - foreach($ocmPermissions as $permission) { |
|
707 | + foreach ($ocmPermissions as $permission) { |
|
708 | 708 | switch (strtolower($permission)) { |
709 | 709 | case 'read': |
710 | 710 | $ncPermissions += Constants::PERMISSION_READ; |
@@ -148,18 +148,18 @@ discard block |
||
148 | 148 | * @return Mount|null |
149 | 149 | * @throws \Doctrine\DBAL\DBALException |
150 | 150 | */ |
151 | - public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted=false, $user = null, $remoteId = -1, $parent = -1) { |
|
151 | + public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted = false, $user = null, $remoteId = -1, $parent = -1) { |
|
152 | 152 | |
153 | 153 | $user = $user ? $user : $this->uid; |
154 | 154 | $accepted = $accepted ? 1 : 0; |
155 | - $name = Filesystem::normalizePath('/' . $name); |
|
155 | + $name = Filesystem::normalizePath('/'.$name); |
|
156 | 156 | |
157 | 157 | if (!$accepted) { |
158 | 158 | // To avoid conflicts with the mount point generation later, |
159 | 159 | // we only use a temporary mount point name here. The real |
160 | 160 | // mount point name will be generated when accepting the share, |
161 | 161 | // using the original share item name. |
162 | - $tmpMountPointName = '{{TemporaryMountPointName#' . $name . '}}'; |
|
162 | + $tmpMountPointName = '{{TemporaryMountPointName#'.$name.'}}'; |
|
163 | 163 | $mountPoint = $tmpMountPointName; |
164 | 164 | $hash = md5($tmpMountPointName); |
165 | 165 | $data = [ |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $i = 1; |
180 | 180 | while (!$this->connection->insertIfNotExist('*PREFIX*share_external', $data, ['user', 'mountpoint_hash'])) { |
181 | 181 | // The external share already exists for the user |
182 | - $data['mountpoint'] = $tmpMountPointName . '-' . $i; |
|
182 | + $data['mountpoint'] = $tmpMountPointName.'-'.$i; |
|
183 | 183 | $data['mountpoint_hash'] = md5($data['mountpoint']); |
184 | 184 | $i++; |
185 | 185 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | $mountPoint = Files::buildNotExistingFileName('/', $name); |
190 | - $mountPoint = Filesystem::normalizePath('/' . $mountPoint); |
|
190 | + $mountPoint = Filesystem::normalizePath('/'.$mountPoint); |
|
191 | 191 | $hash = md5($mountPoint); |
192 | 192 | |
193 | 193 | $this->writeShareToDb($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType); |
@@ -245,9 +245,9 @@ discard block |
||
245 | 245 | $validShare = is_array($share) && isset($share['share_type']) && isset($share['user']); |
246 | 246 | |
247 | 247 | // check if the user is allowed to access it |
248 | - if ($validShare && (int)$share['share_type'] === Share::SHARE_TYPE_USER && $share['user'] === $this->uid) { |
|
248 | + if ($validShare && (int) $share['share_type'] === Share::SHARE_TYPE_USER && $share['user'] === $this->uid) { |
|
249 | 249 | return $share; |
250 | - } else if ($validShare && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { |
|
250 | + } else if ($validShare && (int) $share['share_type'] === Share::SHARE_TYPE_GROUP) { |
|
251 | 251 | $user = $this->userManager->get($this->uid); |
252 | 252 | if ($this->groupManager->get($share['user'])->inGroup($user)) { |
253 | 253 | return $share; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $mountPoint = Filesystem::normalizePath($mountPoint); |
277 | 277 | $hash = md5($mountPoint); |
278 | 278 | |
279 | - if($share['share_type'] === Share::SHARE_TYPE_USER) { |
|
279 | + if ($share['share_type'] === Share::SHARE_TYPE_USER) { |
|
280 | 280 | $acceptShare = $this->connection->prepare(' |
281 | 281 | UPDATE `*PREFIX*share_external` |
282 | 282 | SET `accepted` = ?, |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | $share = $this->getShare($id); |
323 | 323 | |
324 | - if ($share && (int)$share['share_type'] === Share::SHARE_TYPE_USER) { |
|
324 | + if ($share && (int) $share['share_type'] === Share::SHARE_TYPE_USER) { |
|
325 | 325 | $removeShare = $this->connection->prepare(' |
326 | 326 | DELETE FROM `*PREFIX*share_external` WHERE `id` = ? AND `user` = ?'); |
327 | 327 | $removeShare->execute(array($id, $this->uid)); |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | $this->processNotification($id); |
331 | 331 | return true; |
332 | - } else if ($share && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { |
|
332 | + } else if ($share && (int) $share['share_type'] === Share::SHARE_TYPE_GROUP) { |
|
333 | 333 | $this->writeShareToDb( |
334 | 334 | $share['remote'], |
335 | 335 | $share['share_token'], |
@@ -374,14 +374,14 @@ discard block |
||
374 | 374 | |
375 | 375 | $result = $this->tryOCMEndPoint($remote, $token, $remoteId, $feedback); |
376 | 376 | |
377 | - if($result === true) { |
|
377 | + if ($result === true) { |
|
378 | 378 | return true; |
379 | 379 | } |
380 | 380 | |
381 | 381 | $federationEndpoints = $this->discoveryService->discover($remote, 'FEDERATED_SHARING'); |
382 | 382 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
383 | 383 | |
384 | - $url = rtrim($remote, '/') . $endpoint . '/' . $remoteId . '/' . $feedback . '?format=' . Share::RESPONSE_FORMAT; |
|
384 | + $url = rtrim($remote, '/').$endpoint.'/'.$remoteId.'/'.$feedback.'?format='.Share::RESPONSE_FORMAT; |
|
385 | 385 | $fields = array('token' => $token); |
386 | 386 | |
387 | 387 | $client = $this->clientService->newClient(); |
@@ -454,13 +454,13 @@ discard block |
||
454 | 454 | * @return string |
455 | 455 | */ |
456 | 456 | protected function stripPath($path) { |
457 | - $prefix = '/' . $this->uid . '/files'; |
|
457 | + $prefix = '/'.$this->uid.'/files'; |
|
458 | 458 | return rtrim(substr($path, strlen($prefix)), '/'); |
459 | 459 | } |
460 | 460 | |
461 | 461 | public function getMount($data) { |
462 | 462 | $data['manager'] = $this; |
463 | - $mountPoint = '/' . $this->uid . '/files' . $data['mountpoint']; |
|
463 | + $mountPoint = '/'.$this->uid.'/files'.$data['mountpoint']; |
|
464 | 464 | $data['mountpoint'] = $mountPoint; |
465 | 465 | $data['certificateManager'] = \OC::$server->getCertificateManager($this->uid); |
466 | 466 | return new Mount(self::STORAGE, $mountPoint, $data, $this, $this->storageLoader); |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | WHERE `mountpoint_hash` = ? |
501 | 501 | AND `user` = ? |
502 | 502 | '); |
503 | - $result = (bool)$query->execute(array($target, $targetHash, $sourceHash, $this->uid)); |
|
503 | + $result = (bool) $query->execute(array($target, $targetHash, $sourceHash, $this->uid)); |
|
504 | 504 | |
505 | 505 | return $result; |
506 | 506 | } |
@@ -535,9 +535,9 @@ discard block |
||
535 | 535 | WHERE `mountpoint_hash` = ? |
536 | 536 | AND `user` = ? |
537 | 537 | '); |
538 | - $result = (bool)$query->execute(array($hash, $this->uid)); |
|
538 | + $result = (bool) $query->execute(array($hash, $this->uid)); |
|
539 | 539 | |
540 | - if($result) { |
|
540 | + if ($result) { |
|
541 | 541 | $this->removeReShares($id); |
542 | 542 | } |
543 | 543 | |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | |
559 | 559 | |
560 | 560 | $query->delete('federated_reshares') |
561 | - ->where($query->expr()->in('share_id', $query->createFunction('(' . $select . ')'))); |
|
561 | + ->where($query->expr()->in('share_id', $query->createFunction('('.$select.')'))); |
|
562 | 562 | $query->execute(); |
563 | 563 | |
564 | 564 | $deleteReShares = $this->connection->getQueryBuilder(); |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | |
583 | 583 | if ($result) { |
584 | 584 | $shares = $getShare->fetchAll(); |
585 | - foreach($shares as $share) { |
|
585 | + foreach ($shares as $share) { |
|
586 | 586 | $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); |
587 | 587 | } |
588 | 588 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | DELETE FROM `*PREFIX*share_external` |
592 | 592 | WHERE `user` = ? |
593 | 593 | '); |
594 | - return (bool)$query->execute(array($uid)); |
|
594 | + return (bool) $query->execute(array($uid)); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | /** |