@@ -51,8 +51,8 @@ |
||
| 51 | 51 | } |
| 52 | 52 | if ($entry && $entry['mimetype'] === 'httpd/unix-directory') { |
| 53 | 53 | $id = $entry['fileid']; |
| 54 | - $sql = 'SELECT SUM(`size`) AS f1 ' . |
|
| 55 | - 'FROM `*PREFIX*filecache` ' . |
|
| 54 | + $sql = 'SELECT SUM(`size`) AS f1 '. |
|
| 55 | + 'FROM `*PREFIX*filecache` '. |
|
| 56 | 56 | 'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0'; |
| 57 | 57 | $result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId())); |
| 58 | 58 | if ($row = $result->fetchRow()) { |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) { |
| 68 | 68 | $folderContent = $sourceCache->getFolderContentsById($sourceEntry->getId()); |
| 69 | 69 | foreach ($folderContent as $subEntry) { |
| 70 | - $subTargetPath = $targetPath . '/' . $subEntry->getName(); |
|
| 70 | + $subTargetPath = $targetPath.'/'.$subEntry->getName(); |
|
| 71 | 71 | $this->copyFromCache($sourceCache, $subEntry, $subTargetPath); |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -51,19 +51,19 @@ |
||
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | // create audio result |
| 54 | - if($fileData['mimepart'] === 'audio'){ |
|
| 54 | + if ($fileData['mimepart'] === 'audio') { |
|
| 55 | 55 | $result = new \OC\Search\Result\Audio($fileData); |
| 56 | 56 | } |
| 57 | 57 | // create image result |
| 58 | - elseif($fileData['mimepart'] === 'image'){ |
|
| 58 | + elseif ($fileData['mimepart'] === 'image') { |
|
| 59 | 59 | $result = new \OC\Search\Result\Image($fileData); |
| 60 | 60 | } |
| 61 | 61 | // create folder result |
| 62 | - elseif($fileData['mimetype'] === 'httpd/unix-directory'){ |
|
| 62 | + elseif ($fileData['mimetype'] === 'httpd/unix-directory') { |
|
| 63 | 63 | $result = new \OC\Search\Result\Folder($fileData); |
| 64 | 64 | } |
| 65 | 65 | // or create file result |
| 66 | - else{ |
|
| 66 | + else { |
|
| 67 | 67 | $result = new \OC\Search\Result\File($fileData); |
| 68 | 68 | } |
| 69 | 69 | // add to results |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | * @param string $path |
| 106 | 106 | * @return string relative path |
| 107 | 107 | */ |
| 108 | - protected function getRelativePath ($path) { |
|
| 108 | + protected function getRelativePath($path) { |
|
| 109 | 109 | if (!isset(self::$userFolderCache)) { |
| 110 | 110 | $user = \OC::$server->getUserSession()->getUser()->getUID(); |
| 111 | 111 | self::$userFolderCache = \OC::$server->getUserFolder($user); |
@@ -89,17 +89,17 @@ discard block |
||
| 89 | 89 | * @throws QueryException if the class could not be found or instantiated |
| 90 | 90 | */ |
| 91 | 91 | public function resolve($name) { |
| 92 | - $baseMsg = 'Could not resolve ' . $name . '!'; |
|
| 92 | + $baseMsg = 'Could not resolve '.$name.'!'; |
|
| 93 | 93 | try { |
| 94 | 94 | $class = new ReflectionClass($name); |
| 95 | 95 | if ($class->isInstantiable()) { |
| 96 | 96 | return $this->buildClass($class); |
| 97 | 97 | } else { |
| 98 | - throw new QueryException($baseMsg . |
|
| 98 | + throw new QueryException($baseMsg. |
|
| 99 | 99 | ' Class can not be instantiated'); |
| 100 | 100 | } |
| 101 | - } catch(ReflectionException $e) { |
|
| 102 | - throw new QueryException($baseMsg . ' ' . $e->getMessage()); |
|
| 101 | + } catch (ReflectionException $e) { |
|
| 102 | + throw new QueryException($baseMsg.' '.$e->getMessage()); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | return $this->offsetGet($name); |
| 116 | 116 | } else { |
| 117 | 117 | $object = $this->resolve($name); |
| 118 | - $this->registerService($name, function () use ($object) { |
|
| 118 | + $this->registerService($name, function() use ($object) { |
|
| 119 | 119 | return $object; |
| 120 | 120 | }); |
| 121 | 121 | return $object; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public function registerService($name, Closure $closure, $shared = true) { |
| 143 | 143 | $name = $this->sanitizeName($name); |
| 144 | - if (isset($this[$name])) { |
|
| 144 | + if (isset($this[$name])) { |
|
| 145 | 145 | unset($this[$name]); |
| 146 | 146 | } |
| 147 | 147 | if ($shared) { |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param string $target the target that should be resolved instead |
| 160 | 160 | */ |
| 161 | 161 | public function registerAlias($alias, $target) { |
| 162 | - $this->registerService($alias, function (IContainer $container) use ($target) { |
|
| 162 | + $this->registerService($alias, function(IContainer $container) use ($target) { |
|
| 163 | 163 | return $container->query($target); |
| 164 | 164 | }, false); |
| 165 | 165 | } |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | * @param bool $httpOnly |
| 93 | 93 | */ |
| 94 | 94 | public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly) { |
| 95 | - $path = $this->webRoot ? : '/'; |
|
| 95 | + $path = $this->webRoot ?: '/'; |
|
| 96 | 96 | setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param array $server $_SERVER |
| 42 | 42 | * @param string $protocolVersion the http version to use defaults to HTTP/1.1 |
| 43 | 43 | */ |
| 44 | - public function __construct($server, $protocolVersion='HTTP/1.1') { |
|
| 44 | + public function __construct($server, $protocolVersion = 'HTTP/1.1') { |
|
| 45 | 45 | $this->server = $server; |
| 46 | 46 | $this->protocolVersion = $protocolVersion; |
| 47 | 47 | |
@@ -116,16 +116,16 @@ discard block |
||
| 116 | 116 | * @param string $ETag the etag |
| 117 | 117 | * @return string |
| 118 | 118 | */ |
| 119 | - public function getStatusHeader($status, \DateTime $lastModified=null, |
|
| 120 | - $ETag=null) { |
|
| 119 | + public function getStatusHeader($status, \DateTime $lastModified = null, |
|
| 120 | + $ETag = null) { |
|
| 121 | 121 | |
| 122 | - if(!is_null($lastModified)) { |
|
| 122 | + if (!is_null($lastModified)) { |
|
| 123 | 123 | $lastModified = $lastModified->format(\DateTime::RFC2822); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // if etag or lastmodified have not changed, return a not modified |
| 127 | 127 | if ((isset($this->server['HTTP_IF_NONE_MATCH']) |
| 128 | - && trim(trim($this->server['HTTP_IF_NONE_MATCH']), '"') === (string)$ETag) |
|
| 128 | + && trim(trim($this->server['HTTP_IF_NONE_MATCH']), '"') === (string) $ETag) |
|
| 129 | 129 | |
| 130 | 130 | || |
| 131 | 131 | |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | // we have one change currently for the http 1.0 header that differs |
| 140 | 140 | // from 1.1: STATUS_TEMPORARY_REDIRECT should be STATUS_FOUND |
| 141 | 141 | // if this differs any more, we want to create childclasses for this |
| 142 | - if($status === self::STATUS_TEMPORARY_REDIRECT |
|
| 142 | + if ($status === self::STATUS_TEMPORARY_REDIRECT |
|
| 143 | 143 | && $this->protocolVersion === 'HTTP/1.0') { |
| 144 | 144 | |
| 145 | 145 | $status = self::STATUS_FOUND; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - return $this->protocolVersion . ' ' . $status . ' ' . |
|
| 148 | + return $this->protocolVersion.' '.$status.' '. |
|
| 149 | 149 | $this->headers[$status]; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | * @throws SecurityException |
| 81 | 81 | * @since 6.0.0 |
| 82 | 82 | */ |
| 83 | - public function beforeController($controller, $methodName){ |
|
| 83 | + public function beforeController($controller, $methodName) { |
|
| 84 | 84 | // ensure that @CORS annotated API routes are not used in conjunction |
| 85 | 85 | // with session authentication since this enables CSRF attack vectors |
| 86 | 86 | if ($this->reflector->hasAnnotation('CORS') && |
| 87 | - !$this->reflector->hasAnnotation('PublicPage')) { |
|
| 87 | + !$this->reflector->hasAnnotation('PublicPage')) { |
|
| 88 | 88 | $user = $this->request->server['PHP_AUTH_USER']; |
| 89 | 89 | $pass = $this->request->server['PHP_AUTH_PW']; |
| 90 | 90 | |
@@ -110,16 +110,16 @@ discard block |
||
| 110 | 110 | * @return Response a Response object |
| 111 | 111 | * @throws SecurityException |
| 112 | 112 | */ |
| 113 | - public function afterController($controller, $methodName, Response $response){ |
|
| 113 | + public function afterController($controller, $methodName, Response $response) { |
|
| 114 | 114 | // only react if its a CORS request and if the request sends origin and |
| 115 | 115 | |
| 116 | - if(isset($this->request->server['HTTP_ORIGIN']) && |
|
| 116 | + if (isset($this->request->server['HTTP_ORIGIN']) && |
|
| 117 | 117 | $this->reflector->hasAnnotation('CORS')) { |
| 118 | 118 | |
| 119 | 119 | // allow credentials headers must not be true or CSRF is possible |
| 120 | 120 | // otherwise |
| 121 | - foreach($response->getHeaders() as $header => $value) { |
|
| 122 | - if(strtolower($header) === 'access-control-allow-credentials' && |
|
| 121 | + foreach ($response->getHeaders() as $header => $value) { |
|
| 122 | + if (strtolower($header) === 'access-control-allow-credentials' && |
|
| 123 | 123 | strtolower(trim($value)) === 'true') { |
| 124 | 124 | $msg = 'Access-Control-Allow-Credentials must not be '. |
| 125 | 125 | 'set to true in order to prevent CSRF'; |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | * @throws \Exception the passed in exception if it can't handle it |
| 144 | 144 | * @return Response a Response object or null in case that the exception could not be handled |
| 145 | 145 | */ |
| 146 | - public function afterException($controller, $methodName, \Exception $exception){ |
|
| 147 | - if($exception instanceof SecurityException){ |
|
| 148 | - $response = new JSONResponse(['message' => $exception->getMessage()]); |
|
| 149 | - if($exception->getCode() !== 0) { |
|
| 146 | + public function afterException($controller, $methodName, \Exception $exception) { |
|
| 147 | + if ($exception instanceof SecurityException) { |
|
| 148 | + $response = new JSONResponse(['message' => $exception->getMessage()]); |
|
| 149 | + if ($exception->getCode() !== 0) { |
|
| 150 | 150 | $response->setStatus($exception->getCode()); |
| 151 | 151 | } else { |
| 152 | 152 | $response->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR); |
@@ -143,7 +143,7 @@ |
||
| 143 | 143 | $format = $this->request->getParam('format'); |
| 144 | 144 | |
| 145 | 145 | // if none is given try the first Accept header |
| 146 | - if($format === null) { |
|
| 146 | + if ($format === null) { |
|
| 147 | 147 | $headers = $this->request->getHeader('Accept'); |
| 148 | 148 | $format = $controller->getResponderByHTTPHeader($headers, 'xml'); |
| 149 | 149 | } |