@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @package OCA\DAV\Comments |
| 42 | 42 | */ |
| 43 | 43 | class EntityCollection extends RootCollection implements IProperties { |
| 44 | - const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker'; |
|
| 44 | + const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker'; |
|
| 45 | 45 | |
| 46 | 46 | /** @var string */ |
| 47 | 47 | protected $id; |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | IUserSession $userSession, |
| 66 | 66 | ILogger $logger |
| 67 | 67 | ) { |
| 68 | - foreach(['id', 'name'] as $property) { |
|
| 68 | + foreach (['id', 'name'] as $property) { |
|
| 69 | 69 | $$property = trim($$property); |
| 70 | - if(empty($$property) || !is_string($$property)) { |
|
| 71 | - throw new \InvalidArgumentException('"' . $property . '" parameter must be non-empty string'); |
|
| 70 | + if (empty($$property) || !is_string($$property)) { |
|
| 71 | + throw new \InvalidArgumentException('"'.$property.'" parameter must be non-empty string'); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | $this->id = $id; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | function findChildren($limit = 0, $offset = 0, \DateTime $datetime = null) { |
| 135 | 135 | $comments = $this->commentsManager->getForObject($this->name, $this->id, $limit, $offset, $datetime); |
| 136 | 136 | $result = []; |
| 137 | - foreach($comments as $comment) { |
|
| 137 | + foreach ($comments as $comment) { |
|
| 138 | 138 | $result[] = new CommentNode( |
| 139 | 139 | $this->commentsManager, |
| 140 | 140 | $comment, |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | function getProperties($properties) { |
| 188 | 188 | $marker = null; |
| 189 | 189 | $user = $this->userSession->getUser(); |
| 190 | - if(!is_null($user)) { |
|
| 190 | + if (!is_null($user)) { |
|
| 191 | 191 | $marker = $this->commentsManager->getReadMark($this->name, $this->id, $user); |
| 192 | 192 | } |
| 193 | 193 | return [self::PROPERTY_NAME_READ_MARKER => $marker]; |
@@ -100,13 +100,13 @@ |
||
| 100 | 100 | if ($this->shareManager->checkPassword($share, $password)) { |
| 101 | 101 | return true; |
| 102 | 102 | } else if ($this->session->exists('public_link_authenticated') |
| 103 | - && $this->session->get('public_link_authenticated') === (string)$share->getId()) { |
|
| 103 | + && $this->session->get('public_link_authenticated') === (string) $share->getId()) { |
|
| 104 | 104 | return true; |
| 105 | 105 | } else { |
| 106 | 106 | if (in_array('XMLHttpRequest', explode(',', $this->request->getHeader('X-Requested-With')))) { |
| 107 | 107 | // do not re-authenticate over ajax, use dummy auth name to prevent browser popup |
| 108 | 108 | http_response_code(401); |
| 109 | - header('WWW-Authenticate','DummyBasic realm="' . $this->realm . '"'); |
|
| 109 | + header('WWW-Authenticate', 'DummyBasic realm="'.$this->realm.'"'); |
|
| 110 | 110 | throw new \Sabre\DAV\Exception\NotAuthenticated('Cannot authenticate over ajax calls'); |
| 111 | 111 | } |
| 112 | 112 | return false; |
@@ -102,11 +102,11 @@ |
||
| 102 | 102 | * @param array $conditions |
| 103 | 103 | */ |
| 104 | 104 | public function validateTokens(RequestInterface $request, &$conditions) { |
| 105 | - foreach($conditions as &$fileCondition) { |
|
| 106 | - if(isset($fileCondition['tokens'])) { |
|
| 107 | - foreach($fileCondition['tokens'] as &$token) { |
|
| 108 | - if(isset($token['token'])) { |
|
| 109 | - if(substr($token['token'], 0, 16) === 'opaquelocktoken:') { |
|
| 105 | + foreach ($conditions as &$fileCondition) { |
|
| 106 | + if (isset($fileCondition['tokens'])) { |
|
| 107 | + foreach ($fileCondition['tokens'] as &$token) { |
|
| 108 | + if (isset($token['token'])) { |
|
| 109 | + if (substr($token['token'], 0, 16) === 'opaquelocktoken:') { |
|
| 110 | 110 | $token['validToken'] = true; |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -172,14 +172,14 @@ discard block |
||
| 172 | 172 | return; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - $ns = '{' . $this::NS_OWNCLOUD . '}'; |
|
| 175 | + $ns = '{'.$this::NS_OWNCLOUD.'}'; |
|
| 176 | 176 | $requestedProps = []; |
| 177 | 177 | $filterRules = []; |
| 178 | 178 | |
| 179 | 179 | // parse report properties and gather filter info |
| 180 | 180 | foreach ($report as $reportProps) { |
| 181 | 181 | $name = $reportProps['name']; |
| 182 | - if ($name === $ns . 'filter-rules') { |
|
| 182 | + if ($name === $ns.'filter-rules') { |
|
| 183 | 183 | $filterRules = $reportProps['value']; |
| 184 | 184 | } else if ($name === '{DAV:}prop') { |
| 185 | 185 | // propfind properties |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | if (empty($filesUri)) { |
| 241 | 241 | return ''; |
| 242 | 242 | } |
| 243 | - return '/' . $filesUri; |
|
| 243 | + return '/'.$filesUri; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -252,15 +252,15 @@ discard block |
||
| 252 | 252 | * @throws TagNotFoundException whenever a tag was not found |
| 253 | 253 | */ |
| 254 | 254 | protected function processFilterRules($filterRules) { |
| 255 | - $ns = '{' . $this::NS_OWNCLOUD . '}'; |
|
| 255 | + $ns = '{'.$this::NS_OWNCLOUD.'}'; |
|
| 256 | 256 | $resultFileIds = null; |
| 257 | 257 | $systemTagIds = []; |
| 258 | 258 | $favoriteFilter = null; |
| 259 | 259 | foreach ($filterRules as $filterRule) { |
| 260 | - if ($filterRule['name'] === $ns . 'systemtag') { |
|
| 260 | + if ($filterRule['name'] === $ns.'systemtag') { |
|
| 261 | 261 | $systemTagIds[] = $filterRule['value']; |
| 262 | 262 | } |
| 263 | - if ($filterRule['name'] === $ns . 'favorite') { |
|
| 263 | + if ($filterRule['name'] === $ns.'favorite') { |
|
| 264 | 264 | $favoriteFilter = true; |
| 265 | 265 | } |
| 266 | 266 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | if (!empty($unknownTagIds)) { |
| 302 | - throw new TagNotFoundException('Tag with ids ' . implode(', ', $unknownTagIds) . ' not found'); |
|
| 302 | + throw new TagNotFoundException('Tag with ids '.implode(', ', $unknownTagIds).' not found'); |
|
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | public function prepareResponses($filesUri, $requestedProps, $nodes) { |
| 340 | 340 | $responses = []; |
| 341 | 341 | foreach ($nodes as $node) { |
| 342 | - $propFind = new PropFind($filesUri . $node->getPath(), $requestedProps); |
|
| 342 | + $propFind = new PropFind($filesUri.$node->getPath(), $requestedProps); |
|
| 343 | 343 | |
| 344 | 344 | $this->server->getPropertiesByNode($propFind, $node); |
| 345 | 345 | // copied from Sabre Server's getPropertiesForPath |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | $responses[] = new Response( |
| 355 | - rtrim($this->server->getBaseUri(), '/') . $filesUri . $node->getPath(), |
|
| 355 | + rtrim($this->server->getBaseUri(), '/').$filesUri.$node->getPath(), |
|
| 356 | 356 | $result, |
| 357 | 357 | 200 |
| 358 | 358 | ); |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | function xmlSerialize(Writer $writer) { |
| 67 | 67 | |
| 68 | 68 | foreach ($this->checksums as $checksum) { |
| 69 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum); |
|
| 69 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}checksum', $checksum); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function beforeHandler(RequestInterface $request) { |
| 66 | 66 | $userAgent = $request->getHeader('User-Agent'); |
| 67 | - if($userAgent === null) { |
|
| 67 | + if ($userAgent === null) { |
|
| 68 | 68 | return; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | // Match on the mirall version which is in scheme "Mozilla/5.0 (%1) mirall/%2" or |
| 74 | 74 | // "mirall/%1" for older releases |
| 75 | 75 | preg_match("/(?:mirall\\/)([\d.]+)/i", $userAgent, $versionMatches); |
| 76 | - if(isset($versionMatches[1]) && |
|
| 76 | + if (isset($versionMatches[1]) && |
|
| 77 | 77 | version_compare($versionMatches[1], $minimumSupportedDesktopVersion) === -1) { |
| 78 | 78 | throw new \Sabre\DAV\Exception\Forbidden('Unsupported client version.'); |
| 79 | 79 | } |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | return null; |
| 72 | 72 | } |
| 73 | 73 | foreach ($tree as $elem) { |
| 74 | - if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}share-type') { |
|
| 75 | - $shareTypes[] = (int)$elem['value']; |
|
| 74 | + if ($elem['name'] === '{'.self::NS_OWNCLOUD.'}share-type') { |
|
| 75 | + $shareTypes[] = (int) $elem['value']; |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | return new self($shareTypes); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function xmlSerialize(Writer $writer) { |
| 88 | 88 | foreach ($this->shareTypes as $shareType) { |
| 89 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}share-type', $shareType); |
|
| 89 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}share-type', $shareType); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -49,17 +49,17 @@ |
||
| 49 | 49 | * @param \DOMElement $errorNode |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) { |
|
| 52 | + public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) { |
|
| 53 | 53 | |
| 54 | 54 | // set ownCloud namespace |
| 55 | 55 | $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); |
| 56 | 56 | |
| 57 | 57 | // adding the retry node |
| 58 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true)); |
|
| 58 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true)); |
|
| 59 | 59 | $errorNode->appendChild($error); |
| 60 | 60 | |
| 61 | 61 | // adding the message node |
| 62 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage()); |
|
| 62 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage()); |
|
| 63 | 63 | $errorNode->appendChild($error); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -61,17 +61,17 @@ |
||
| 61 | 61 | * @param \DOMElement $errorNode |
| 62 | 62 | * @return void |
| 63 | 63 | */ |
| 64 | - public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) { |
|
| 64 | + public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) { |
|
| 65 | 65 | |
| 66 | 66 | // set ownCloud namespace |
| 67 | 67 | $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); |
| 68 | 68 | |
| 69 | 69 | // adding the retry node |
| 70 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true)); |
|
| 70 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true)); |
|
| 71 | 71 | $errorNode->appendChild($error); |
| 72 | 72 | |
| 73 | 73 | // adding the message node |
| 74 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage()); |
|
| 74 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage()); |
|
| 75 | 75 | $errorNode->appendChild($error); |
| 76 | 76 | } |
| 77 | 77 | |