@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return array enriched share info with data from the filecache |
110 | 110 | */ |
111 | 111 | private static function extendShareInfo($share) { |
112 | - $view = new \OC\Files\View('/' . \OC_User::getUser() . '/files/'); |
|
112 | + $view = new \OC\Files\View('/'.\OC_User::getUser().'/files/'); |
|
113 | 113 | $info = $view->getFileInfo($share['mountpoint']); |
114 | 114 | |
115 | 115 | $share['mimetype'] = $info->getMimetype(); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | throw new OCSNotFoundException('Share does not exist'); |
173 | 173 | } |
174 | 174 | |
175 | - $mountPoint = '/' . \OC_User::getUser() . '/files' . $shareInfo['mountpoint']; |
|
175 | + $mountPoint = '/'.\OC_User::getUser().'/files'.$shareInfo['mountpoint']; |
|
176 | 176 | |
177 | 177 | if ($this->externalManager->removeShare($mountPoint) === true) { |
178 | 178 | return new DataResponse(); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | public function showAuthenticate($token) { |
151 | 151 | $share = $this->shareManager->getShareByToken($token); |
152 | 152 | |
153 | - if($this->linkShareAuth($share)) { |
|
153 | + if ($this->linkShareAuth($share)) { |
|
154 | 154 | return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.showShare', array('token' => $token))); |
155 | 155 | } |
156 | 156 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | $authenticate = $this->linkShareAuth($share, $password); |
180 | 180 | |
181 | - if($authenticate === true) { |
|
181 | + if ($authenticate === true) { |
|
182 | 182 | return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.showShare', array('token' => $token))); |
183 | 183 | } |
184 | 184 | |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | private function linkShareAuth(\OCP\Share\IShare $share, $password = null) { |
200 | 200 | if ($password !== null) { |
201 | 201 | if ($this->shareManager->checkPassword($share, $password)) { |
202 | - $this->session->set('public_link_authenticated', (string)$share->getId()); |
|
202 | + $this->session->set('public_link_authenticated', (string) $share->getId()); |
|
203 | 203 | } else { |
204 | 204 | $this->emitAccessShareHook($share, 403, 'Wrong password'); |
205 | 205 | return false; |
206 | 206 | } |
207 | 207 | } else { |
208 | 208 | // not authenticated ? |
209 | - if ( ! $this->session->exists('public_link_authenticated') |
|
210 | - || $this->session->get('public_link_authenticated') !== (string)$share->getId()) { |
|
209 | + if (!$this->session->exists('public_link_authenticated') |
|
210 | + || $this->session->get('public_link_authenticated') !== (string) $share->getId()) { |
|
211 | 211 | return false; |
212 | 212 | } |
213 | 213 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $itemType = $itemSource = $uidOwner = ''; |
229 | 229 | $token = $share; |
230 | 230 | $exception = null; |
231 | - if($share instanceof \OCP\Share\IShare) { |
|
231 | + if ($share instanceof \OCP\Share\IShare) { |
|
232 | 232 | try { |
233 | 233 | $token = $share->getToken(); |
234 | 234 | $uidOwner = $share->getSharedBy(); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | 'errorCode' => $errorCode, |
248 | 248 | 'errorMessage' => $errorMessage, |
249 | 249 | ]); |
250 | - if(!is_null($exception)) { |
|
250 | + if (!is_null($exception)) { |
|
251 | 251 | throw $exception; |
252 | 252 | } |
253 | 253 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | if ($freeSpace < \OCP\Files\FileInfo::SPACE_UNLIMITED) { |
341 | 341 | $freeSpace = max($freeSpace, 0); |
342 | 342 | } else { |
343 | - $freeSpace = (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188 |
|
343 | + $freeSpace = (INF > 0) ? INF : PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188 |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | $hideFileList = $share->getPermissions() & \OCP\Constants::PERMISSION_READ ? false : true; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | $shareTmpl['previewMaxY'] = $this->config->getSystemValue('preview_max_y', 1024); |
372 | 372 | $shareTmpl['disclaimer'] = $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null); |
373 | 373 | if ($shareTmpl['previewSupported']) { |
374 | - $shareTmpl['previewImage'] = $this->urlGenerator->linkToRouteAbsolute( 'files_sharing.PublicPreview.getPreview', |
|
374 | + $shareTmpl['previewImage'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.PublicPreview.getPreview', |
|
375 | 375 | ['x' => 200, 'y' => 200, 'file' => $shareTmpl['directory_path'], 't' => $shareTmpl['dirToken']]); |
376 | 376 | } else { |
377 | 377 | $shareTmpl['previewImage'] = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'favicon-fb.png')); |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | } |
402 | 402 | |
403 | 403 | // OpenGraph Support: http://ogp.me/ |
404 | - \OCP\Util::addHeader('meta', ['property' => "og:title", 'content' => $this->defaults->getName() . ' - ' . $this->defaults->getSlogan()]); |
|
404 | + \OCP\Util::addHeader('meta', ['property' => "og:title", 'content' => $this->defaults->getName().' - '.$this->defaults->getSlogan()]); |
|
405 | 405 | \OCP\Util::addHeader('meta', ['property' => "og:description", 'content' => $this->l10n->t('%s is publicly shared', [$shareTmpl['filename']])]); |
406 | 406 | \OCP\Util::addHeader('meta', ['property' => "og:site_name", 'content' => $this->defaults->getName()]); |
407 | 407 | \OCP\Util::addHeader('meta', ['property' => "og:url", 'content' => $shareTmpl['shareUrl']]); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | |
437 | 437 | $share = $this->shareManager->getShareByToken($token); |
438 | 438 | |
439 | - if(!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
439 | + if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
440 | 440 | return new \OCP\AppFramework\Http\DataResponse('Share is read-only'); |
441 | 441 | } |
442 | 442 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | |
515 | 515 | $this->emitAccessShareHook($share); |
516 | 516 | |
517 | - $server_params = array( 'head' => $this->request->getMethod() == 'HEAD' ); |
|
517 | + $server_params = array('head' => $this->request->getMethod() == 'HEAD'); |
|
518 | 518 | |
519 | 519 | /** |
520 | 520 | * Http range requests support |
@@ -23,6 +23,6 @@ |
||
23 | 23 | |
24 | 24 | namespace OCA\Files_Sharing; |
25 | 25 | |
26 | -interface ISharedStorage{ |
|
26 | +interface ISharedStorage { |
|
27 | 27 | |
28 | 28 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | /** {@inheritDoc} */ |
39 | 39 | public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) { |
40 | - if(!$this->storage->remoteIsOwnCloud()) { |
|
40 | + if (!$this->storage->remoteIsOwnCloud()) { |
|
41 | 41 | return parent::scan($path, $recursive, $recursive, $lock); |
42 | 42 | } |
43 | 43 | |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | } catch (\Exception $e) { |
89 | 89 | $this->storage->checkStorageAvailability(); |
90 | 90 | throw new \Exception( |
91 | - 'Error while scanning remote share: "' . |
|
92 | - $this->storage->getRemote() . '" ' . |
|
91 | + 'Error while scanning remote share: "'. |
|
92 | + $this->storage->getRemote().'" '. |
|
93 | 93 | $e->getMessage() |
94 | 94 | ); |
95 | 95 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | $this->addResult($data['data'], ''); |
98 | 98 | } else { |
99 | 99 | throw new \Exception( |
100 | - 'Error while scanning remote share: "' . |
|
101 | - $this->storage->getRemote() . '"' |
|
100 | + 'Error while scanning remote share: "'. |
|
101 | + $this->storage->getRemote().'"' |
|
102 | 102 | ); |
103 | 103 | } |
104 | 104 | } |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | $children = []; |
114 | 114 | foreach ($data['children'] as $child) { |
115 | 115 | $children[$child['name']] = true; |
116 | - $this->addResult($child, ltrim($path . '/' . $child['name'], '/')); |
|
116 | + $this->addResult($child, ltrim($path.'/'.$child['name'], '/')); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | $existingCache = $this->cache->getFolderContentsById($id); |
120 | 120 | foreach ($existingCache as $existingChild) { |
121 | 121 | // if an existing child is not in the new data, remove it |
122 | 122 | if (!isset($children[$existingChild['name']])) { |
123 | - $this->cache->remove(ltrim($path . '/' . $existingChild['name'], '/')); |
|
123 | + $this->cache->remove(ltrim($path.'/'.$existingChild['name'], '/')); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | $managerProvider = $this->managerProvider; |
62 | 62 | $manager = $managerProvider(); |
63 | 63 | $data['manager'] = $manager; |
64 | - $mountPoint = '/' . $user->getUID() . '/files/' . ltrim($data['mountpoint'], '/'); |
|
64 | + $mountPoint = '/'.$user->getUID().'/files/'.ltrim($data['mountpoint'], '/'); |
|
65 | 65 | $data['mountpoint'] = $mountPoint; |
66 | 66 | $data['cloudId'] = $this->cloudIdManager->getCloudId($data['owner'], $data['remote']); |
67 | 67 | $data['certificateManager'] = \OC::$server->getCertificateManager($user->getUID()); |
@@ -90,11 +90,11 @@ |
||
90 | 90 | */ |
91 | 91 | static private function renameChildren($oldPath, $newPath) { |
92 | 92 | |
93 | - $absNewPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $newPath); |
|
94 | - $absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $oldPath); |
|
93 | + $absNewPath = \OC\Files\Filesystem::normalizePath('/'.\OCP\User::getUser().'/files/'.$newPath); |
|
94 | + $absOldPath = \OC\Files\Filesystem::normalizePath('/'.\OCP\User::getUser().'/files/'.$oldPath); |
|
95 | 95 | |
96 | 96 | $mountManager = \OC\Files\Filesystem::getMountManager(); |
97 | - $mountedShares = $mountManager->findIn('/' . \OCP\User::getUser() . '/files/' . $oldPath); |
|
97 | + $mountedShares = $mountManager->findIn('/'.\OCP\User::getUser().'/files/'.$oldPath); |
|
98 | 98 | foreach ($mountedShares as $mount) { |
99 | 99 | if ($mount->getStorage()->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')) { |
100 | 100 | $mountPoint = $mount->getMountPoint(); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $basePath = $path; |
89 | 89 | |
90 | - if ($relativePath !== null && Filesystem::isReadable($basePath . $relativePath)) { |
|
90 | + if ($relativePath !== null && Filesystem::isReadable($basePath.$relativePath)) { |
|
91 | 91 | $path .= Filesystem::normalizePath($relativePath); |
92 | 92 | } |
93 | 93 | |
@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | if ($password !== null) { |
113 | 113 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { |
114 | 114 | if ($shareManager->checkPassword($share, $password)) { |
115 | - \OC::$server->getSession()->set('public_link_authenticated', (string)$share->getId()); |
|
115 | + \OC::$server->getSession()->set('public_link_authenticated', (string) $share->getId()); |
|
116 | 116 | return true; |
117 | 117 | } |
118 | 118 | } |
119 | 119 | } else { |
120 | 120 | // not authenticated ? |
121 | 121 | if (\OC::$server->getSession()->exists('public_link_authenticated') |
122 | - && \OC::$server->getSession()->get('public_link_authenticated') !== (string)$share->getId()) { |
|
122 | + && \OC::$server->getSession()->get('public_link_authenticated') !== (string) $share->getId()) { |
|
123 | 123 | return true; |
124 | 124 | } |
125 | 125 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | Filesystem::initMountPoints($owner); |
133 | 133 | $info = Filesystem::getFileInfo($target); |
134 | 134 | $ownerView = new View('/'.$owner.'/files'); |
135 | - if ( $owner != User::getUser() ) { |
|
135 | + if ($owner != User::getUser()) { |
|
136 | 136 | $path = $ownerView->getPath($info['fileid']); |
137 | 137 | } else { |
138 | 138 | $path = $target; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if ($info instanceof \OC\Files\FileInfo) { |
146 | 146 | $ids[] = $info['fileid']; |
147 | 147 | } else { |
148 | - \OCP\Util::writeLog('sharing', 'No fileinfo available for: ' . $path, \OCP\Util::WARN); |
|
148 | + \OCP\Util::writeLog('sharing', 'No fileinfo available for: '.$path, \OCP\Util::WARN); |
|
149 | 149 | } |
150 | 150 | $path = dirname($path); |
151 | 151 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $idList = array_chunk($ids, 99, true); |
156 | 156 | |
157 | 157 | foreach ($idList as $subList) { |
158 | - $statement = "SELECT `share_with`, `share_type`, `file_target` FROM `*PREFIX*share` WHERE `file_source` IN (" . implode(',', $subList) . ") AND `share_type` IN (0, 1, 2)"; |
|
158 | + $statement = "SELECT `share_with`, `share_type`, `file_target` FROM `*PREFIX*share` WHERE `file_source` IN (".implode(',', $subList).") AND `share_type` IN (0, 1, 2)"; |
|
159 | 159 | $query = \OCP\DB::prepare($statement); |
160 | 160 | $r = $query->execute(); |
161 | 161 | $result = array_merge($result, $r->fetchAll()); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $uid = User::getUser(); |
184 | 184 | } |
185 | 185 | Filesystem::initMountPoints($uid); |
186 | - if ( $uid != User::getUser() ) { |
|
186 | + if ($uid != User::getUser()) { |
|
187 | 187 | $info = Filesystem::getFileInfo($filename); |
188 | 188 | $ownerView = new View('/'.$uid.'/files'); |
189 | 189 | try { |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $dir = $pathinfo['dirname']; |
231 | 231 | $i = 2; |
232 | 232 | while ($view->file_exists($path) || in_array($path, $excludeList)) { |
233 | - $path = Filesystem::normalizePath($dir . '/' . $name . ' ('.$i.')' . $ext); |
|
233 | + $path = Filesystem::normalizePath($dir.'/'.$name.' ('.$i.')'.$ext); |
|
234 | 234 | $i++; |
235 | 235 | } |
236 | 236 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $dir = ''; |
255 | 255 | $subdirs = explode('/', $shareFolder); |
256 | 256 | foreach ($subdirs as $subdir) { |
257 | - $dir = $dir . '/' . $subdir; |
|
257 | + $dir = $dir.'/'.$subdir; |
|
258 | 258 | if (!$view->is_dir($dir)) { |
259 | 259 | $view->mkdir($dir); |
260 | 260 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * sets the correct interval for this timed job |
43 | 43 | */ |
44 | - public function __construct(){ |
|
44 | + public function __construct() { |
|
45 | 45 | $this->interval = $this->defaultIntervalMin * 60; |
46 | 46 | } |
47 | 47 | |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | $logger = \OC::$server->getLogger(); |
56 | 56 | |
57 | 57 | $sql = |
58 | - 'DELETE FROM `*PREFIX*share` ' . |
|
59 | - 'WHERE `item_type` in (\'file\', \'folder\') ' . |
|
58 | + 'DELETE FROM `*PREFIX*share` '. |
|
59 | + 'WHERE `item_type` in (\'file\', \'folder\') '. |
|
60 | 60 | 'AND NOT EXISTS (SELECT `fileid` FROM `*PREFIX*filecache` WHERE `file_source` = `fileid`)'; |
61 | 61 | |
62 | 62 | $deletedEntries = $connection->executeUpdate($sql); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @throws S2SException |
91 | 91 | */ |
92 | 92 | public function beforeController($controller, $methodName) { |
93 | - if(!$this->isSharingEnabled()) { |
|
93 | + if (!$this->isSharingEnabled()) { |
|
94 | 94 | throw new NotFoundException('Sharing is disabled.'); |
95 | 95 | } |
96 | 96 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @throws \Exception |
118 | 118 | */ |
119 | 119 | public function afterException($controller, $methodName, \Exception $exception) { |
120 | - if(is_a($exception, '\OCP\Files\NotFoundException')) { |
|
120 | + if (is_a($exception, '\OCP\Files\NotFoundException')) { |
|
121 | 121 | return new NotFoundResponse(); |
122 | 122 | } |
123 | 123 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | private function isSharingEnabled() { |
155 | 155 | // FIXME: This check is done here since the route is globally defined and not inside the files_sharing app |
156 | 156 | // Check whether the sharing application is enabled |
157 | - if(!$this->appManager->isEnabledForUser($this->appName)) { |
|
157 | + if (!$this->appManager->isEnabledForUser($this->appName)) { |
|
158 | 158 | return false; |
159 | 159 | } |
160 | 160 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | // Check whether public sharing is enabled |
175 | - if($this->config->getAppValue('core', 'shareapi_allow_links', 'yes') !== 'yes') { |
|
175 | + if ($this->config->getAppValue('core', 'shareapi_allow_links', 'yes') !== 'yes') { |
|
176 | 176 | return false; |
177 | 177 | } |
178 | 178 |