@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $folder = $this->appData->getFolder($appName); |
67 | 67 | $gzip = false; |
68 | 68 | $file = $this->getFile($folder, $fileName, $gzip); |
69 | - } catch(NotFoundException $e) { |
|
69 | + } catch (NotFoundException $e) { |
|
70 | 70 | return new NotFoundResponse(); |
71 | 71 | } |
72 | 72 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | if ($encoding !== null && strpos($encoding, 'gzip') !== false) { |
96 | 96 | try { |
97 | 97 | $gzip = true; |
98 | - return $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz |
|
98 | + return $folder->getFile($fileName.'.gzip'); # Safari doesn't like .gz |
|
99 | 99 | } catch (NotFoundException $e) { |
100 | 100 | // continue |
101 | 101 | } |
@@ -163,21 +163,21 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) { |
165 | 165 | //fix types |
166 | - $data['fileid'] = (int)$data['fileid']; |
|
167 | - $data['parent'] = (int)$data['parent']; |
|
166 | + $data['fileid'] = (int) $data['fileid']; |
|
167 | + $data['parent'] = (int) $data['parent']; |
|
168 | 168 | $data['size'] = 0 + $data['size']; |
169 | - $data['mtime'] = (int)$data['mtime']; |
|
170 | - $data['storage_mtime'] = (int)$data['storage_mtime']; |
|
171 | - $data['encryptedVersion'] = (int)$data['encrypted']; |
|
172 | - $data['encrypted'] = (bool)$data['encrypted']; |
|
169 | + $data['mtime'] = (int) $data['mtime']; |
|
170 | + $data['storage_mtime'] = (int) $data['storage_mtime']; |
|
171 | + $data['encryptedVersion'] = (int) $data['encrypted']; |
|
172 | + $data['encrypted'] = (bool) $data['encrypted']; |
|
173 | 173 | $data['storage_id'] = $data['storage']; |
174 | - $data['storage'] = (int)$data['storage']; |
|
174 | + $data['storage'] = (int) $data['storage']; |
|
175 | 175 | $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']); |
176 | 176 | $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']); |
177 | 177 | if ($data['storage_mtime'] == 0) { |
178 | 178 | $data['storage_mtime'] = $data['mtime']; |
179 | 179 | } |
180 | - $data['permissions'] = (int)$data['permissions']; |
|
180 | + $data['permissions'] = (int) $data['permissions']; |
|
181 | 181 | return new CacheEntry($data); |
182 | 182 | } |
183 | 183 | |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | FROM `*PREFIX*filecache` WHERE `parent` = ? ORDER BY `name` ASC'; |
206 | 206 | $result = $this->connection->executeQuery($sql, [$fileId]); |
207 | 207 | $files = $result->fetchAll(); |
208 | - return array_map(function (array $data) { |
|
209 | - return self::cacheEntryFromData($data, $this->mimetypeLoader);; |
|
208 | + return array_map(function(array $data) { |
|
209 | + return self::cacheEntryFromData($data, $this->mimetypeLoader); ; |
|
210 | 210 | }, $files); |
211 | 211 | } else { |
212 | 212 | return array(); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $queryParts[] = '`storage`'; |
266 | 266 | $params[] = $this->getNumericStorageId(); |
267 | 267 | |
268 | - $queryParts = array_map(function ($item) { |
|
268 | + $queryParts = array_map(function($item) { |
|
269 | 269 | return trim($item, "`"); |
270 | 270 | }, $queryParts); |
271 | 271 | $values = array_combine($queryParts, $params); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | 'path_hash', |
275 | 275 | ]) |
276 | 276 | ) { |
277 | - return (int)$this->connection->lastInsertId('*PREFIX*filecache'); |
|
277 | + return (int) $this->connection->lastInsertId('*PREFIX*filecache'); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | // The file was created in the mean time |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | |
313 | 313 | // don't update if the data we try to set is the same as the one in the record |
314 | 314 | // some databases (Postgres) don't like superfluous updates |
315 | - $sql = 'UPDATE `*PREFIX*filecache` SET ' . implode(' = ?, ', $queryParts) . '=? ' . |
|
316 | - 'WHERE (' . |
|
317 | - implode(' <> ? OR ', $queryParts) . ' <> ? OR ' . |
|
318 | - implode(' IS NULL OR ', $queryParts) . ' IS NULL' . |
|
315 | + $sql = 'UPDATE `*PREFIX*filecache` SET '.implode(' = ?, ', $queryParts).'=? '. |
|
316 | + 'WHERE ('. |
|
317 | + implode(' <> ? OR ', $queryParts).' <> ? OR '. |
|
318 | + implode(' IS NULL OR ', $queryParts).' IS NULL'. |
|
319 | 319 | ') AND `fileid` = ? '; |
320 | 320 | $this->connection->executeQuery($sql, $params); |
321 | 321 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | } |
367 | 367 | } |
368 | 368 | $params[] = $value; |
369 | - $queryParts[] = '`' . $name . '`'; |
|
369 | + $queryParts[] = '`'.$name.'`'; |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | return array($queryParts, $params); |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | return -1; |
409 | 409 | } else { |
410 | 410 | $parent = $this->getParentPath($file); |
411 | - return (int)$this->getId($parent); |
|
411 | + return (int) $this->getId($parent); |
|
412 | 412 | } |
413 | 413 | } |
414 | 414 | |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | */ |
455 | 455 | private function getSubFolders($entry) { |
456 | 456 | $children = $this->getFolderContentsById($entry['fileid']); |
457 | - return array_filter($children, function ($child) { |
|
457 | + return array_filter($children, function($child) { |
|
458 | 458 | return $child['mimetype'] === 'httpd/unix-directory'; |
459 | 459 | }); |
460 | 460 | } |
@@ -517,10 +517,10 @@ discard block |
||
517 | 517 | list($targetStorageId, $targetPath) = $this->getMoveInfo($targetPath); |
518 | 518 | |
519 | 519 | if (is_null($sourceStorageId) || $sourceStorageId === false) { |
520 | - throw new \Exception('Invalid source storage id: ' . $sourceStorageId); |
|
520 | + throw new \Exception('Invalid source storage id: '.$sourceStorageId); |
|
521 | 521 | } |
522 | 522 | if (is_null($targetStorageId) || $targetStorageId === false) { |
523 | - throw new \Exception('Invalid target storage id: ' . $targetStorageId); |
|
523 | + throw new \Exception('Invalid target storage id: '.$targetStorageId); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | $this->connection->beginTransaction(); |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | ->set('path_hash', $fun->md5($newPathFunction)) |
540 | 540 | ->set('path', $newPathFunction) |
541 | 541 | ->where($query->expr()->eq('storage', $query->createNamedParameter($sourceStorageId, IQueryBuilder::PARAM_INT))) |
542 | - ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath) . '/%'))); |
|
542 | + ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath).'/%'))); |
|
543 | 543 | |
544 | 544 | try { |
545 | 545 | $query->execute(); |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | $sql = 'SELECT `size` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` = ?'; |
589 | 589 | $result = $this->connection->executeQuery($sql, array($this->getNumericStorageId(), $pathHash)); |
590 | 590 | if ($row = $result->fetch()) { |
591 | - if ((int)$row['size'] === -1) { |
|
591 | + if ((int) $row['size'] === -1) { |
|
592 | 592 | return self::SHALLOW; |
593 | 593 | } else { |
594 | 594 | return self::COMPLETE; |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | private function searchResultToCacheEntries(Statement $result) { |
638 | 638 | $files = $result->fetchAll(); |
639 | 639 | |
640 | - return array_map(function (array $data) { |
|
640 | + return array_map(function(array $data) { |
|
641 | 641 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
642 | 642 | }, $files); |
643 | 643 | } |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | $where = '`mimepart` = ?'; |
657 | 657 | } |
658 | 658 | $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `storage_mtime`, `mtime`, `encrypted`, `etag`, `permissions`, `checksum` |
659 | - FROM `*PREFIX*filecache` WHERE ' . $where . ' AND `storage` = ?'; |
|
659 | + FROM `*PREFIX*filecache` WHERE ' . $where.' AND `storage` = ?'; |
|
660 | 660 | $mimetype = $this->mimetypeLoader->getId($mimetype); |
661 | 661 | $result = $this->connection->executeQuery($sql, array($mimetype, $this->getNumericStorageId())); |
662 | 662 | |
@@ -707,20 +707,20 @@ discard block |
||
707 | 707 | * @return ICacheEntry[] file data |
708 | 708 | */ |
709 | 709 | public function searchByTag($tag, $userId) { |
710 | - $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, ' . |
|
711 | - '`mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, ' . |
|
712 | - '`encrypted`, `etag`, `permissions`, `checksum` ' . |
|
713 | - 'FROM `*PREFIX*filecache` `file`, ' . |
|
714 | - '`*PREFIX*vcategory_to_object` `tagmap`, ' . |
|
715 | - '`*PREFIX*vcategory` `tag` ' . |
|
710 | + $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, '. |
|
711 | + '`mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, '. |
|
712 | + '`encrypted`, `etag`, `permissions`, `checksum` '. |
|
713 | + 'FROM `*PREFIX*filecache` `file`, '. |
|
714 | + '`*PREFIX*vcategory_to_object` `tagmap`, '. |
|
715 | + '`*PREFIX*vcategory` `tag` '. |
|
716 | 716 | // JOIN filecache to vcategory_to_object |
717 | - 'WHERE `file`.`fileid` = `tagmap`.`objid` ' . |
|
717 | + 'WHERE `file`.`fileid` = `tagmap`.`objid` '. |
|
718 | 718 | // JOIN vcategory_to_object to vcategory |
719 | - 'AND `tagmap`.`type` = `tag`.`type` ' . |
|
720 | - 'AND `tagmap`.`categoryid` = `tag`.`id` ' . |
|
719 | + 'AND `tagmap`.`type` = `tag`.`type` '. |
|
720 | + 'AND `tagmap`.`categoryid` = `tag`.`id` '. |
|
721 | 721 | // conditions |
722 | - 'AND `file`.`storage` = ? ' . |
|
723 | - 'AND `tag`.`type` = \'files\' ' . |
|
722 | + 'AND `file`.`storage` = ? '. |
|
723 | + 'AND `tag`.`type` = \'files\' '. |
|
724 | 724 | 'AND `tag`.`uid` = ? '; |
725 | 725 | if (is_int($tag)) { |
726 | 726 | $sql .= 'AND `tag`.`id` = ? '; |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | |
739 | 739 | $files = $result->fetchAll(); |
740 | 740 | |
741 | - return array_map(function (array $data) { |
|
741 | + return array_map(function(array $data) { |
|
742 | 742 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
743 | 743 | }, $files); |
744 | 744 | } |
@@ -774,8 +774,8 @@ discard block |
||
774 | 774 | } |
775 | 775 | if (isset($entry['mimetype']) && $entry['mimetype'] === 'httpd/unix-directory') { |
776 | 776 | $id = $entry['fileid']; |
777 | - $sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 ' . |
|
778 | - 'FROM `*PREFIX*filecache` ' . |
|
777 | + $sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 '. |
|
778 | + 'FROM `*PREFIX*filecache` '. |
|
779 | 779 | 'WHERE `parent` = ? AND `storage` = ?'; |
780 | 780 | $result = $this->connection->executeQuery($sql, array($id, $this->getNumericStorageId())); |
781 | 781 | if ($row = $result->fetch()) { |
@@ -171,14 +171,14 @@ |
||
171 | 171 | protected function deleteOrphanEntries(IOutput $output, $repairInfo, $deleteTable, $deleteId, $sourceTable, $sourceId, $sourceNullColumn) { |
172 | 172 | $qb = $this->connection->getQueryBuilder(); |
173 | 173 | |
174 | - $qb->select('d.' . $deleteId) |
|
174 | + $qb->select('d.'.$deleteId) |
|
175 | 175 | ->from($deleteTable, 'd') |
176 | - ->leftJoin('d', $sourceTable, 's', $qb->expr()->eq('d.' . $deleteId, 's.' . $sourceId)) |
|
176 | + ->leftJoin('d', $sourceTable, 's', $qb->expr()->eq('d.'.$deleteId, 's.'.$sourceId)) |
|
177 | 177 | ->where( |
178 | 178 | $qb->expr()->eq('d.type', $qb->expr()->literal('files')) |
179 | 179 | ) |
180 | 180 | ->andWhere( |
181 | - $qb->expr()->isNull('s.' . $sourceNullColumn) |
|
181 | + $qb->expr()->isNull('s.'.$sourceNullColumn) |
|
182 | 182 | ); |
183 | 183 | $result = $qb->execute(); |
184 | 184 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return TemplateResponse|RedirectResponse |
86 | 86 | */ |
87 | 87 | public function showRenewPasswordForm($user) { |
88 | - if($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') { |
|
88 | + if ($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') { |
|
89 | 89 | return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm')); |
90 | 90 | } |
91 | 91 | $parameters = []; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return RedirectResponse |
130 | 130 | */ |
131 | 131 | public function tryRenewPassword($user, $oldPassword, $newPassword) { |
132 | - if($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') { |
|
132 | + if ($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') { |
|
133 | 133 | return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm')); |
134 | 134 | } |
135 | 135 | $args = !is_null($user) ? ['user' => $user] : []; |
@@ -102,13 +102,13 @@ |
||
102 | 102 | if ($generatePasswordResetToken) { |
103 | 103 | $token = $this->secureRandom->generate( |
104 | 104 | 21, |
105 | - ISecureRandom::CHAR_DIGITS . |
|
106 | - ISecureRandom::CHAR_LOWER . |
|
105 | + ISecureRandom::CHAR_DIGITS. |
|
106 | + ISecureRandom::CHAR_LOWER. |
|
107 | 107 | ISecureRandom::CHAR_UPPER |
108 | 108 | ); |
109 | - $tokenValue = $this->timeFactory->getTime() . ':' . $token; |
|
109 | + $tokenValue = $this->timeFactory->getTime().':'.$token; |
|
110 | 110 | $mailAddress = (null !== $user->getEMailAddress()) ? $user->getEMailAddress() : ''; |
111 | - $encryptedValue = $this->crypto->encrypt($tokenValue, $mailAddress . $this->config->getSystemValue('secret')); |
|
111 | + $encryptedValue = $this->crypto->encrypt($tokenValue, $mailAddress.$this->config->getSystemValue('secret')); |
|
112 | 112 | $this->config->setUserValue($user->getUID(), 'core', 'lostpassword', $encryptedValue); |
113 | 113 | $link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', ['userId' => $user->getUID(), 'token' => $token]); |
114 | 114 | } else { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param \OCP\IL10N $l10n |
47 | 47 | * @param Defaults $theme |
48 | 48 | */ |
49 | - public function __construct($template, $requestToken, $l10n, $theme ) { |
|
49 | + public function __construct($template, $requestToken, $l10n, $theme) { |
|
50 | 50 | $this->vars = array(); |
51 | 51 | $this->vars['requesttoken'] = $requestToken; |
52 | 52 | $this->l10n = $l10n; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected function getAppTemplateDirs($theme, $app, $serverRoot, $app_dir) { |
65 | 65 | // Check if the app is in the app folder or in the root |
66 | - if( file_exists($app_dir.'/templates/' )) { |
|
66 | + if (file_exists($app_dir.'/templates/')) { |
|
67 | 67 | return [ |
68 | 68 | $serverRoot.'/themes/'.$theme.'/apps/'.$app.'/templates/', |
69 | 69 | $app_dir.'/templates/', |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * |
99 | 99 | * If the key existed before, it will be overwritten |
100 | 100 | */ |
101 | - public function assign( $key, $value) { |
|
101 | + public function assign($key, $value) { |
|
102 | 102 | $this->vars[$key] = $value; |
103 | 103 | return true; |
104 | 104 | } |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | * exists, the value will be appended. It can be accessed via |
114 | 114 | * $_[$key][$position] in the template. |
115 | 115 | */ |
116 | - public function append( $key, $value ) { |
|
117 | - if( array_key_exists( $key, $this->vars )) { |
|
116 | + public function append($key, $value) { |
|
117 | + if (array_key_exists($key, $this->vars)) { |
|
118 | 118 | $this->vars[$key][] = $value; |
119 | 119 | } |
120 | - else{ |
|
121 | - $this->vars[$key] = array( $value ); |
|
120 | + else { |
|
121 | + $this->vars[$key] = array($value); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function printPage() { |
132 | 132 | $data = $this->fetchPage(); |
133 | - if( $data === false ) { |
|
133 | + if ($data === false) { |
|
134 | 134 | return false; |
135 | 135 | } |
136 | - else{ |
|
136 | + else { |
|
137 | 137 | print $data; |
138 | 138 | return true; |
139 | 139 | } |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | $l = $this->l10n; |
167 | 167 | $theme = $this->theme; |
168 | 168 | |
169 | - if( !is_null($additionalParams)) { |
|
170 | - $_ = array_merge( $additionalParams, $this->vars ); |
|
169 | + if (!is_null($additionalParams)) { |
|
170 | + $_ = array_merge($additionalParams, $this->vars); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // Include |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | if ($remoteShare) { |
183 | 183 | try { |
184 | 184 | $ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']); |
185 | - $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time()); |
|
185 | + $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_'.time()); |
|
186 | 186 | $share->setId($shareId); |
187 | 187 | list($token, $remoteId) = $this->askOwnerToReShare($shareWith, $share, $shareId); |
188 | 188 | // remote share was create successfully if we get a valid token as return |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | $failure = true; |
255 | 255 | } |
256 | 256 | } catch (\Exception $e) { |
257 | - $this->logger->error('Failed to notify remote server of federated share, removing share (' . $e->getMessage() . ')'); |
|
257 | + $this->logger->error('Failed to notify remote server of federated share, removing share ('.$e->getMessage().')'); |
|
258 | 258 | $failure = true; |
259 | 259 | } |
260 | 260 | |
261 | - if($failure) { |
|
261 | + if ($failure) { |
|
262 | 262 | $this->removeShareFromTableById($shareId); |
263 | 263 | $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable or uses a self-signed certificate.', |
264 | 264 | [$share->getNode()->getName(), $share->getSharedWith()]); |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | ->andWhere($query->expr()->eq('mountpoint', $query->createNamedParameter($share->getTarget()))); |
310 | 310 | $result = $query->execute()->fetchAll(); |
311 | 311 | |
312 | - if (isset($result[0]) && (int)$result[0]['remote_id'] > 0) { |
|
312 | + if (isset($result[0]) && (int) $result[0]['remote_id'] > 0) { |
|
313 | 313 | return $result[0]; |
314 | 314 | } |
315 | 315 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $qb->execute(); |
352 | 352 | $id = $qb->getLastInsertId(); |
353 | 353 | |
354 | - return (int)$id; |
|
354 | + return (int) $id; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -441,14 +441,14 @@ discard block |
||
441 | 441 | public function getRemoteId(IShare $share) { |
442 | 442 | $query = $this->dbConnection->getQueryBuilder(); |
443 | 443 | $query->select('remote_id')->from('federated_reshares') |
444 | - ->where($query->expr()->eq('share_id', $query->createNamedParameter((int)$share->getId()))); |
|
444 | + ->where($query->expr()->eq('share_id', $query->createNamedParameter((int) $share->getId()))); |
|
445 | 445 | $data = $query->execute()->fetch(); |
446 | 446 | |
447 | 447 | if (!is_array($data) || !isset($data['remote_id'])) { |
448 | 448 | throw new ShareNotFound(); |
449 | 449 | } |
450 | 450 | |
451 | - return (int)$data['remote_id']; |
|
451 | + return (int) $data['remote_id']; |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | /** |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | ->orderBy('id'); |
480 | 480 | |
481 | 481 | $cursor = $qb->execute(); |
482 | - while($data = $cursor->fetch()) { |
|
482 | + while ($data = $cursor->fetch()) { |
|
483 | 483 | $children[] = $this->createShareObject($data); |
484 | 484 | } |
485 | 485 | $cursor->closeCursor(); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | ); |
609 | 609 | } |
610 | 610 | |
611 | - $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
611 | + $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
612 | 612 | $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId()))); |
613 | 613 | |
614 | 614 | $qb->orderBy('id'); |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | |
672 | 672 | $cursor = $qb->execute(); |
673 | 673 | $shares = []; |
674 | - while($data = $cursor->fetch()) { |
|
674 | + while ($data = $cursor->fetch()) { |
|
675 | 675 | $shares[] = $this->createShareObject($data); |
676 | 676 | } |
677 | 677 | $cursor->closeCursor(); |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | ->execute(); |
724 | 724 | |
725 | 725 | $shares = []; |
726 | - while($data = $cursor->fetch()) { |
|
726 | + while ($data = $cursor->fetch()) { |
|
727 | 727 | $shares[] = $this->createShareObject($data); |
728 | 728 | } |
729 | 729 | $cursor->closeCursor(); |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | |
763 | 763 | $cursor = $qb->execute(); |
764 | 764 | |
765 | - while($data = $cursor->fetch()) { |
|
765 | + while ($data = $cursor->fetch()) { |
|
766 | 766 | $shares[] = $this->createShareObject($data); |
767 | 767 | } |
768 | 768 | $cursor->closeCursor(); |
@@ -839,15 +839,15 @@ discard block |
||
839 | 839 | private function createShareObject($data) { |
840 | 840 | |
841 | 841 | $share = new Share($this->rootFolder, $this->userManager); |
842 | - $share->setId((int)$data['id']) |
|
843 | - ->setShareType((int)$data['share_type']) |
|
844 | - ->setPermissions((int)$data['permissions']) |
|
842 | + $share->setId((int) $data['id']) |
|
843 | + ->setShareType((int) $data['share_type']) |
|
844 | + ->setPermissions((int) $data['permissions']) |
|
845 | 845 | ->setTarget($data['file_target']) |
846 | - ->setMailSend((bool)$data['mail_send']) |
|
846 | + ->setMailSend((bool) $data['mail_send']) |
|
847 | 847 | ->setToken($data['token']); |
848 | 848 | |
849 | 849 | $shareTime = new \DateTime(); |
850 | - $shareTime->setTimestamp((int)$data['stime']); |
|
850 | + $shareTime->setTimestamp((int) $data['stime']); |
|
851 | 851 | $share->setShareTime($shareTime); |
852 | 852 | $share->setSharedWith($data['share_with']); |
853 | 853 | |
@@ -857,13 +857,13 @@ discard block |
||
857 | 857 | } else { |
858 | 858 | //OLD SHARE |
859 | 859 | $share->setSharedBy($data['uid_owner']); |
860 | - $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); |
|
860 | + $path = $this->getNode($share->getSharedBy(), (int) $data['file_source']); |
|
861 | 861 | |
862 | 862 | $owner = $path->getOwner(); |
863 | 863 | $share->setShareOwner($owner->getUID()); |
864 | 864 | } |
865 | 865 | |
866 | - $share->setNodeId((int)$data['file_source']); |
|
866 | + $share->setNodeId((int) $data['file_source']); |
|
867 | 867 | $share->setNodeType($data['item_type']); |
868 | 868 | |
869 | 869 | $share->setProviderId($this->identifier()); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | $item = $node; |
117 | - $appendix = '/' . $node->getName(); |
|
117 | + $appendix = '/'.$node->getName(); |
|
118 | 118 | while (!empty($byId)) { |
119 | 119 | try { |
120 | 120 | /** @var Node $item */ |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | |
123 | 123 | if (!empty($byId[$item->getId()])) { |
124 | 124 | foreach ($byId[$item->getId()] as $uid => $path) { |
125 | - $results[$uid] = $path . $appendix; |
|
125 | + $results[$uid] = $path.$appendix; |
|
126 | 126 | } |
127 | 127 | unset($byId[$item->getId()]); |
128 | 128 | } |
129 | 129 | |
130 | - $appendix = '/' . $item->getName() . $appendix; |
|
130 | + $appendix = '/'.$item->getName().$appendix; |
|
131 | 131 | } catch (NotFoundException $e) { |
132 | 132 | return $results; |
133 | 133 | } catch (InvalidPathException $e) { |
@@ -212,6 +212,6 @@ discard block |
||
212 | 212 | protected function getMountedPath(Node $node) { |
213 | 213 | $path = $node->getPath(); |
214 | 214 | $sections = explode('/', $path, 4); |
215 | - return '/' . $sections[3]; |
|
215 | + return '/'.$sections[3]; |
|
216 | 216 | } |
217 | 217 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | static public function enableCaching($cache_time = null) { |
49 | 49 | if (is_numeric($cache_time)) { |
50 | - header('Pragma: public');// enable caching in IE |
|
50 | + header('Pragma: public'); // enable caching in IE |
|
51 | 51 | if ($cache_time > 0) { |
52 | 52 | self::setExpiresHeader('PT'.$cache_time.'S'); |
53 | 53 | header('Cache-Control: max-age='.$cache_time.', must-revalidate'); |
@@ -78,29 +78,29 @@ discard block |
||
78 | 78 | */ |
79 | 79 | static public function setStatus($status) { |
80 | 80 | $protocol = \OC::$server->getRequest()->getHttpProtocol(); |
81 | - switch($status) { |
|
81 | + switch ($status) { |
|
82 | 82 | case self::STATUS_NOT_MODIFIED: |
83 | - $status = $status . ' Not Modified'; |
|
83 | + $status = $status.' Not Modified'; |
|
84 | 84 | break; |
85 | 85 | case self::STATUS_TEMPORARY_REDIRECT: |
86 | 86 | if ($protocol == 'HTTP/1.1') { |
87 | - $status = $status . ' Temporary Redirect'; |
|
87 | + $status = $status.' Temporary Redirect'; |
|
88 | 88 | break; |
89 | 89 | } else { |
90 | 90 | $status = self::STATUS_FOUND; |
91 | 91 | // fallthrough |
92 | 92 | } |
93 | 93 | case self::STATUS_FOUND; |
94 | - $status = $status . ' Found'; |
|
94 | + $status = $status.' Found'; |
|
95 | 95 | break; |
96 | 96 | case self::STATUS_NOT_FOUND; |
97 | - $status = $status . ' Not Found'; |
|
97 | + $status = $status.' Not Found'; |
|
98 | 98 | break; |
99 | 99 | case self::STATUS_INTERNAL_SERVER_ERROR; |
100 | - $status = $status . ' Internal Server Error'; |
|
100 | + $status = $status.' Internal Server Error'; |
|
101 | 101 | break; |
102 | 102 | case self::STATUS_SERVICE_UNAVAILABLE; |
103 | - $status = $status . ' Service Unavailable'; |
|
103 | + $status = $status.' Service Unavailable'; |
|
104 | 104 | break; |
105 | 105 | } |
106 | 106 | header($protocol.' '.$status); |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | * @param string $filename file name |
181 | 181 | * @param string $type disposition type, either 'attachment' or 'inline' |
182 | 182 | */ |
183 | - static public function setContentDispositionHeader( $filename, $type = 'attachment' ) { |
|
183 | + static public function setContentDispositionHeader($filename, $type = 'attachment') { |
|
184 | 184 | if (\OC::$server->getRequest()->isUserAgent( |
185 | 185 | [ |
186 | 186 | \OC\AppFramework\Http\Request::USER_AGENT_IE, |
187 | 187 | \OC\AppFramework\Http\Request::USER_AGENT_ANDROID_MOBILE_CHROME, |
188 | 188 | \OC\AppFramework\Http\Request::USER_AGENT_FREEBOX, |
189 | 189 | ])) { |
190 | - header( 'Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode( $filename ) . '"' ); |
|
190 | + header('Content-Disposition: '.rawurlencode($type).'; filename="'.rawurlencode($filename).'"'); |
|
191 | 191 | } else { |
192 | - header( 'Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode( $filename ) |
|
193 | - . '; filename="' . rawurlencode( $filename ) . '"' ); |
|
192 | + header('Content-Disposition: '.rawurlencode($type).'; filename*=UTF-8\'\''.rawurlencode($filename) |
|
193 | + . '; filename="'.rawurlencode($filename).'"'); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | . 'connect-src *; ' |
257 | 257 | . 'object-src \'none\'; ' |
258 | 258 | . 'base-uri \'self\'; '; |
259 | - header('Content-Security-Policy:' . $policy); |
|
259 | + header('Content-Security-Policy:'.$policy); |
|
260 | 260 | header('X-Frame-Options: SAMEORIGIN'); // Disallow iFraming from other domains |
261 | 261 | |
262 | 262 | // Send fallback headers for installations that don't have the possibility to send |
263 | 263 | // custom headers on the webserver side |
264 | - if(getenv('modHeadersAvailable') !== 'true') { |
|
264 | + if (getenv('modHeadersAvailable') !== 'true') { |
|
265 | 265 | header('X-XSS-Protection: 1; mode=block'); // Enforce browser based XSS filters |
266 | 266 | header('X-Content-Type-Options: nosniff'); // Disable sniffing the content type for IE |
267 | 267 | header('X-Robots-Tag: none'); // https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag |