@@ -79,7 +79,7 @@ |
||
79 | 79 | * @param array $data |
80 | 80 | */ |
81 | 81 | public function populateJavaScriptVariables(array $data) { |
82 | - $data['array']['oc_updateState'] = json_encode([ |
|
82 | + $data['array']['oc_updateState'] = json_encode([ |
|
83 | 83 | 'updateAvailable' => true, |
84 | 84 | 'updateVersion' => $this->getUpdateState()['updateVersionString'], |
85 | 85 | 'updateLink' => $this->getUpdateState()['updateLink'] ?? '', |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // Server |
68 | 68 | $r = $this->updateChecker->getUpdateState(); |
69 | 69 | if (isset($r['updateAvailable']) && $r['updateAvailable']) { |
70 | - $output->writeln($r['updateVersionString'] . ' is available. Get more information on how to update at '. $r['updateLink'] . '.'); |
|
70 | + $output->writeln($r['updateVersionString'].' is available. Get more information on how to update at '.$r['updateLink'].'.'); |
|
71 | 71 | $updatesAvailableCount += 1; |
72 | 72 | } |
73 | 73 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | foreach ($apps as $app) { |
78 | 78 | $update = $this->installer->isUpdateAvailable($app); |
79 | 79 | if ($update !== false) { |
80 | - $output->writeln('Update for ' . $app . ' to version ' . $update . ' is available.'); |
|
80 | + $output->writeln('Update for '.$app.' to version '.$update.' is available.'); |
|
81 | 81 | $updatesAvailableCount += 1; |
82 | 82 | } |
83 | 83 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } else if ($updatesAvailableCount === 1) { |
89 | 89 | $output->writeln('<comment>1 update available</comment>'); |
90 | 90 | } else { |
91 | - $output->writeln('<comment>' . $updatesAvailableCount . ' updates available</comment>'); |
|
91 | + $output->writeln('<comment>'.$updatesAvailableCount.' updates available</comment>'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return 0; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $principals = []; |
77 | 77 | |
78 | 78 | if ($prefixPath === self::PRINCIPAL_PREFIX) { |
79 | - foreach($this->groupManager->search('') as $user) { |
|
79 | + foreach ($this->groupManager->search('') as $user) { |
|
80 | 80 | $principals[] = $this->groupToPrincipal($user); |
81 | 81 | } |
82 | 82 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public function getPrincipalByPath($path) { |
96 | - $elements = explode('/', $path, 3); |
|
96 | + $elements = explode('/', $path, 3); |
|
97 | 97 | if ($elements[0] !== 'principals') { |
98 | 98 | return null; |
99 | 99 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | - $carry[] = self::PRINCIPAL_PREFIX . '/' . $gid; |
|
220 | + $carry[] = self::PRINCIPAL_PREFIX.'/'.$gid; |
|
221 | 221 | return $carry; |
222 | 222 | }, []); |
223 | 223 | break; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $displayName = $group->getDisplayName(); |
291 | 291 | |
292 | 292 | return [ |
293 | - 'uri' => 'principals/groups/' . urlencode($groupId), |
|
293 | + 'uri' => 'principals/groups/'.urlencode($groupId), |
|
294 | 294 | '{DAV:}displayname' => $displayName, |
295 | 295 | '{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'GROUP', |
296 | 296 | ]; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $displayName = $user->getDisplayName(); |
307 | 307 | |
308 | 308 | $principal = [ |
309 | - 'uri' => 'principals/users/' . $userId, |
|
309 | + 'uri' => 'principals/users/'.$userId, |
|
310 | 310 | '{DAV:}displayname' => $displayName, |
311 | 311 | '{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL', |
312 | 312 | ]; |
@@ -170,7 +170,7 @@ |
||
170 | 170 | )) |
171 | 171 | ->andWhere($update->expr()->like( |
172 | 172 | $update->func()->lower('name'), |
173 | - $update->createNamedParameter('%' . $this->dbConnection->escapeLikeParameter('.' . $ext)) |
|
173 | + $update->createNamedParameter('%'.$this->dbConnection->escapeLikeParameter('.'.$ext)) |
|
174 | 174 | )); |
175 | 175 | return $update->execute(); |
176 | 176 | } |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | * @return array |
88 | 88 | */ |
89 | 89 | protected function normalizeDatabaseData(array $data) { |
90 | - $data['id'] = (string)$data['id']; |
|
91 | - $data['parent_id'] = (string)$data['parent_id']; |
|
92 | - $data['topmost_parent_id'] = (string)$data['topmost_parent_id']; |
|
90 | + $data['id'] = (string) $data['id']; |
|
91 | + $data['parent_id'] = (string) $data['parent_id']; |
|
92 | + $data['topmost_parent_id'] = (string) $data['topmost_parent_id']; |
|
93 | 93 | $data['creation_timestamp'] = new \DateTime($data['creation_timestamp']); |
94 | 94 | if (!is_null($data['latest_child_timestamp'])) { |
95 | 95 | $data['latest_child_timestamp'] = new \DateTime($data['latest_child_timestamp']); |
96 | 96 | } |
97 | - $data['children_count'] = (int)$data['children_count']; |
|
97 | + $data['children_count'] = (int) $data['children_count']; |
|
98 | 98 | return $data; |
99 | 99 | } |
100 | 100 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $resultStatement = $query->execute(); |
172 | 172 | $data = $resultStatement->fetch(\PDO::FETCH_NUM); |
173 | 173 | $resultStatement->closeCursor(); |
174 | - $children = (int)$data[0]; |
|
174 | + $children = (int) $data[0]; |
|
175 | 175 | |
176 | 176 | $comment = $this->get($id); |
177 | 177 | $comment->setChildrenCount($children); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | !is_string($type) || empty($type) |
194 | 194 | || !is_string($id) || empty($id) |
195 | 195 | ) { |
196 | - throw new \InvalidArgumentException($role . ' parameters must be string and not empty'); |
|
196 | + throw new \InvalidArgumentException($role.' parameters must be string and not empty'); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | if (empty($id)) { |
208 | 208 | return; |
209 | 209 | } |
210 | - $this->commentsCache[(string)$id] = $comment; |
|
210 | + $this->commentsCache[(string) $id] = $comment; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param mixed $id the comment's id |
217 | 217 | */ |
218 | 218 | protected function uncache($id) { |
219 | - $id = (string)$id; |
|
219 | + $id = (string) $id; |
|
220 | 220 | if (isset($this->commentsCache[$id])) { |
221 | 221 | unset($this->commentsCache[$id]); |
222 | 222 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @since 9.0.0 |
233 | 233 | */ |
234 | 234 | public function get($id) { |
235 | - if ((int)$id === 0) { |
|
235 | + if ((int) $id === 0) { |
|
236 | 236 | throw new \InvalidArgumentException('IDs must be translatable to a number in this implementation.'); |
237 | 237 | } |
238 | 238 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $query->select('*') |
511 | 511 | ->from('comments') |
512 | 512 | ->where($query->expr()->iLike('message', $query->createNamedParameter( |
513 | - '%' . $this->dbConn->escapeLikeParameter($search). '%' |
|
513 | + '%'.$this->dbConn->escapeLikeParameter($search).'%' |
|
514 | 514 | ))) |
515 | 515 | ->orderBy('creation_timestamp', 'DESC') |
516 | 516 | ->addOrderBy('id', 'DESC') |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $resultStatement = $query->execute(); |
573 | 573 | $data = $resultStatement->fetch(\PDO::FETCH_NUM); |
574 | 574 | $resultStatement->closeCursor(); |
575 | - return (int)$data[0]; |
|
575 | + return (int) $data[0]; |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | ->execute(); |
737 | 737 | |
738 | 738 | if ($affectedRows > 0) { |
739 | - $comment->setId((string)$qb->getLastInsertId()); |
|
739 | + $comment->setId((string) $qb->getLastInsertId()); |
|
740 | 740 | $this->sendEvent(CommentsEvent::EVENT_ADD, $comment); |
741 | 741 | } |
742 | 742 | |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | if (!isset($this->displayNameResolvers[$type])) { |
1017 | 1017 | throw new \OutOfBoundsException('No Displayname resolver for this type registered'); |
1018 | 1018 | } |
1019 | - return (string)$this->displayNameResolvers[$type]($id); |
|
1019 | + return (string) $this->displayNameResolvers[$type]($id); |
|
1020 | 1020 | } |
1021 | 1021 | |
1022 | 1022 | /** |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | * @return string Calculated HMAC |
70 | 70 | */ |
71 | 71 | public function calculateHMAC(string $message, string $password = ''): string { |
72 | - if($password === '') { |
|
72 | + if ($password === '') { |
|
73 | 73 | $password = $this->config->getSystemValue('secret'); |
74 | 74 | } |
75 | 75 | |
76 | 76 | // Append an "a" behind the password and hash it to prevent reusing the same password as for encryption |
77 | - $password = hash('sha512', $password . 'a'); |
|
77 | + $password = hash('sha512', $password.'a'); |
|
78 | 78 | |
79 | 79 | $hash = new Hash('sha512'); |
80 | 80 | $hash->setKey($password); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @return string Authenticated ciphertext |
89 | 89 | */ |
90 | 90 | public function encrypt(string $plaintext, string $password = ''): string { |
91 | - if($password === '') { |
|
91 | + if ($password === '') { |
|
92 | 92 | $password = $this->config->getSystemValue('secret'); |
93 | 93 | } |
94 | 94 | $this->cipher->setPassword($password); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | $this->cipher->setIV($iv); |
129 | 129 | |
130 | - if (!hash_equals($this->calculateHMAC($parts[0] . $parts[1], $password), $hmac)) { |
|
130 | + if (!hash_equals($this->calculateHMAC($parts[0].$parts[1], $password), $hmac)) { |
|
131 | 131 | throw new \Exception('HMAC does not match.'); |
132 | 132 | } |
133 | 133 |
@@ -167,7 +167,7 @@ |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | if (!$setting instanceof ISettings) { |
170 | - $this->log->logException(new \InvalidArgumentException('Invalid settings setting registered (' . $class . ')'), ['level' => ILogger::INFO]); |
|
170 | + $this->log->logException(new \InvalidArgumentException('Invalid settings setting registered ('.$class.')'), ['level' => ILogger::INFO]); |
|
171 | 171 | continue; |
172 | 172 | } |
173 | 173 |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | * @return mixed |
53 | 53 | */ |
54 | 54 | public function connect($host, $port) { |
55 | - if(strpos($host, '://') === false) { |
|
56 | - $host = 'ldap://' . $host; |
|
55 | + if (strpos($host, '://') === false) { |
|
56 | + $host = 'ldap://'.$host; |
|
57 | 57 | } |
58 | - if(strpos($host, ':', strpos($host, '://') + 1) === false) { |
|
58 | + if (strpos($host, ':', strpos($host, '://') + 1) === false) { |
|
59 | 59 | //ldap_connect ignores port parameter when URLs are passed |
60 | - $host .= ':' . $port; |
|
60 | + $host .= ':'.$port; |
|
61 | 61 | } |
62 | 62 | return $this->invokeLDAPMethod('connect', $host); |
63 | 63 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0) { |
195 | 195 | $oldHandler = set_error_handler(function($no, $message, $file, $line) use (&$oldHandler) { |
196 | - if(strpos($message, 'Partial search results returned: Sizelimit exceeded') !== false) { |
|
196 | + if (strpos($message, 'Partial search results returned: Sizelimit exceeded') !== false) { |
|
197 | 197 | return true; |
198 | 198 | } |
199 | 199 | $oldHandler($no, $message, $file, $line); |
@@ -272,13 +272,13 @@ discard block |
||
272 | 272 | * @return bool |
273 | 273 | */ |
274 | 274 | protected function isResultFalse($result) { |
275 | - if($result === false) { |
|
275 | + if ($result === false) { |
|
276 | 276 | return true; |
277 | 277 | } |
278 | 278 | |
279 | - if($this->curFunc === 'ldap_search' && is_array($result)) { |
|
279 | + if ($this->curFunc === 'ldap_search' && is_array($result)) { |
|
280 | 280 | foreach ($result as $singleResult) { |
281 | - if($singleResult === false) { |
|
281 | + if ($singleResult === false) { |
|
282 | 282 | return true; |
283 | 283 | } |
284 | 284 | } |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | */ |
293 | 293 | protected function invokeLDAPMethod() { |
294 | 294 | $arguments = func_get_args(); |
295 | - $func = 'ldap_' . array_shift($arguments); |
|
296 | - if(function_exists($func)) { |
|
295 | + $func = 'ldap_'.array_shift($arguments); |
|
296 | + if (function_exists($func)) { |
|
297 | 297 | $this->preFunctionCall($func, $arguments); |
298 | 298 | $result = call_user_func_array($func, $arguments); |
299 | 299 | if ($this->isResultFalse($result)) { |
@@ -323,12 +323,12 @@ discard block |
||
323 | 323 | */ |
324 | 324 | private function processLDAPError($resource) { |
325 | 325 | $errorCode = ldap_errno($resource); |
326 | - if($errorCode === 0) { |
|
326 | + if ($errorCode === 0) { |
|
327 | 327 | return; |
328 | 328 | } |
329 | - $errorMsg = ldap_error($resource); |
|
329 | + $errorMsg = ldap_error($resource); |
|
330 | 330 | |
331 | - if($this->curFunc === 'ldap_get_entries' |
|
331 | + if ($this->curFunc === 'ldap_get_entries' |
|
332 | 332 | && $errorCode === -4) { |
333 | 333 | } else if ($errorCode === 32) { |
334 | 334 | //for now |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | throw new \Exception('LDAP Operations error', $errorCode); |
345 | 345 | } else if ($errorCode === 19) { |
346 | 346 | ldap_get_option($this->curArgs[0], LDAP_OPT_ERROR_STRING, $extended_error); |
347 | - throw new ConstraintViolationException(!empty($extended_error)?$extended_error:$errorMsg, $errorCode); |
|
347 | + throw new ConstraintViolationException(!empty($extended_error) ? $extended_error : $errorMsg, $errorCode); |
|
348 | 348 | } else { |
349 | 349 | \OC::$server->getLogger()->debug('LDAP error {message} ({code}) after calling {func}', [ |
350 | 350 | 'app' => 'user_ldap', |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | * @throw \Exception |
361 | 361 | */ |
362 | 362 | private function postFunctionCall() { |
363 | - if($this->isResource($this->curArgs[0])) { |
|
363 | + if ($this->isResource($this->curArgs[0])) { |
|
364 | 364 | $resource = $this->curArgs[0]; |
365 | - } else if( |
|
365 | + } else if ( |
|
366 | 366 | $this->curFunc === 'ldap_search' |
367 | 367 | && is_array($this->curArgs[0]) |
368 | 368 | && $this->isResource($this->curArgs[0][0]) |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | public function getACL() { |
103 | - $acl = [ |
|
103 | + $acl = [ |
|
104 | 104 | [ |
105 | 105 | 'privilege' => '{DAV:}read', |
106 | 106 | 'principal' => $this->getOwner(), |
107 | 107 | 'protected' => true, |
108 | - ],[ |
|
108 | + ], [ |
|
109 | 109 | 'privilege' => '{DAV:}write', |
110 | 110 | 'principal' => $this->getOwner(), |
111 | 111 | 'protected' => true, |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | if ($this->getOwner() !== parent::getOwner()) { |
120 | - $acl[] = [ |
|
120 | + $acl[] = [ |
|
121 | 121 | 'privilege' => '{DAV:}read', |
122 | 122 | 'principal' => parent::getOwner(), |
123 | 123 | 'protected' => true, |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | public function delete() { |
178 | 178 | if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { |
179 | - $principal = 'principal:' . parent::getOwner(); |
|
179 | + $principal = 'principal:'.parent::getOwner(); |
|
180 | 180 | $shares = $this->carddavBackend->getShares($this->getResourceId()); |
181 | 181 | $shares = array_filter($shares, function($share) use ($principal){ |
182 | 182 | return $share['href'] === $principal; |