@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $this->recoveryKeyId = $this->config->getAppValue('encryption', |
141 | 141 | 'recoveryKeyId'); |
142 | 142 | if (empty($this->recoveryKeyId)) { |
143 | - $this->recoveryKeyId = 'recoveryKey_' . substr(md5(time()), 0, 8); |
|
143 | + $this->recoveryKeyId = 'recoveryKey_'.substr(md5(time()), 0, 8); |
|
144 | 144 | $this->config->setAppValue('encryption', |
145 | 145 | 'recoveryKeyId', |
146 | 146 | $this->recoveryKeyId); |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | $this->publicShareKeyId = $this->config->getAppValue('encryption', |
150 | 150 | 'publicShareKeyId'); |
151 | 151 | if (empty($this->publicShareKeyId)) { |
152 | - $this->publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8); |
|
152 | + $this->publicShareKeyId = 'pubShare_'.substr(md5(time()), 0, 8); |
|
153 | 153 | $this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId); |
154 | 154 | } |
155 | 155 | |
156 | 156 | $this->masterKeyId = $this->config->getAppValue('encryption', |
157 | 157 | 'masterKeyId'); |
158 | 158 | if (empty($this->masterKeyId)) { |
159 | - $this->masterKeyId = 'master_' . substr(md5(time()), 0, 8); |
|
159 | + $this->masterKeyId = 'master_'.substr(md5(time()), 0, 8); |
|
160 | 160 | $this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId); |
161 | 161 | } |
162 | 162 | |
@@ -176,13 +176,13 @@ discard block |
||
176 | 176 | |
177 | 177 | // Save public key |
178 | 178 | $this->keyStorage->setSystemUserKey( |
179 | - $this->publicShareKeyId . '.' . $this->publicKeyId, $keyPair['publicKey'], |
|
179 | + $this->publicShareKeyId.'.'.$this->publicKeyId, $keyPair['publicKey'], |
|
180 | 180 | Encryption::ID); |
181 | 181 | |
182 | 182 | // Encrypt private key empty passphrase |
183 | 183 | $encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], ''); |
184 | 184 | $header = $this->crypt->generateHeader(); |
185 | - $this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey); |
|
185 | + $this->setSystemPrivateKey($this->publicShareKeyId, $header.$encryptedKey); |
|
186 | 186 | } catch (\Throwable $e) { |
187 | 187 | $this->lockingProvider->releaseLock('encryption-generateSharedKey', ILockingProvider::LOCK_EXCLUSIVE); |
188 | 188 | throw $e; |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | |
213 | 213 | // Save public key |
214 | 214 | $this->keyStorage->setSystemUserKey( |
215 | - $this->masterKeyId . '.' . $this->publicKeyId, $keyPair['publicKey'], |
|
215 | + $this->masterKeyId.'.'.$this->publicKeyId, $keyPair['publicKey'], |
|
216 | 216 | Encryption::ID); |
217 | 217 | |
218 | 218 | // Encrypt private key with system password |
219 | 219 | $encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], $this->getMasterKeyPassword(), $this->masterKeyId); |
220 | 220 | $header = $this->crypt->generateHeader(); |
221 | - $this->setSystemPrivateKey($this->masterKeyId, $header . $encryptedKey); |
|
221 | + $this->setSystemPrivateKey($this->masterKeyId, $header.$encryptedKey); |
|
222 | 222 | } catch (\Throwable $e) { |
223 | 223 | $this->lockingProvider->releaseLock('encryption-generateMasterKey', ILockingProvider::LOCK_EXCLUSIVE); |
224 | 224 | throw $e; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return string |
257 | 257 | */ |
258 | 258 | public function getRecoveryKey() { |
259 | - return $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.' . $this->publicKeyId, Encryption::ID); |
|
259 | + return $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.'.$this->publicKeyId, Encryption::ID); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @return bool |
274 | 274 | */ |
275 | 275 | public function checkRecoveryPassword($password) { |
276 | - $recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.' . $this->privateKeyId, Encryption::ID); |
|
276 | + $recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.'.$this->privateKeyId, Encryption::ID); |
|
277 | 277 | $decryptedRecoveryKey = $this->crypt->decryptPrivateKey($recoveryKey, $password); |
278 | 278 | |
279 | 279 | if ($decryptedRecoveryKey) { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $header = $this->crypt->generateHeader(); |
298 | 298 | |
299 | 299 | if ($encryptedKey) { |
300 | - $this->setPrivateKey($uid, $header . $encryptedKey); |
|
300 | + $this->setPrivateKey($uid, $header.$encryptedKey); |
|
301 | 301 | return true; |
302 | 302 | } |
303 | 303 | return false; |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | public function setRecoveryKey($password, $keyPair) { |
312 | 312 | // Save Public Key |
313 | 313 | $this->keyStorage->setSystemUserKey($this->getRecoveryKeyId(). |
314 | - '.' . $this->publicKeyId, |
|
314 | + '.'.$this->publicKeyId, |
|
315 | 315 | $keyPair['publicKey'], |
316 | 316 | Encryption::ID); |
317 | 317 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | $header = $this->crypt->generateHeader(); |
320 | 320 | |
321 | 321 | if ($encryptedKey) { |
322 | - $this->setSystemPrivateKey($this->getRecoveryKeyId(), $header . $encryptedKey); |
|
322 | + $this->setSystemPrivateKey($this->getRecoveryKeyId(), $header.$encryptedKey); |
|
323 | 323 | return true; |
324 | 324 | } |
325 | 325 | return false; |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * @return boolean |
380 | 380 | */ |
381 | 381 | public function setShareKey($path, $uid, $key) { |
382 | - $keyId = $uid . '.' . $this->shareKeyId; |
|
382 | + $keyId = $uid.'.'.$this->shareKeyId; |
|
383 | 383 | return $this->keyStorage->setFileKey($path, $keyId, $key, Encryption::ID); |
384 | 384 | } |
385 | 385 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | return false; |
409 | 409 | } catch (\Exception $e) { |
410 | 410 | $this->log->logException($e, [ |
411 | - 'message' => 'Could not decrypt the private key from user "' . $uid . '"" during login. Assume password change on the user back-end.', |
|
411 | + 'message' => 'Could not decrypt the private key from user "'.$uid.'"" during login. Assume password change on the user back-end.', |
|
412 | 412 | 'level' => ILogger::WARN, |
413 | 413 | 'app' => 'encryption', |
414 | 414 | ]); |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | // use public share key for public links |
470 | 470 | $uid = $this->getPublicShareKeyId(); |
471 | 471 | $shareKey = $this->getShareKey($path, $uid); |
472 | - $privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.' . $this->privateKeyId, Encryption::ID); |
|
472 | + $privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.'.$this->privateKeyId, Encryption::ID); |
|
473 | 473 | $privateKey = $this->crypt->decryptPrivateKey($privateKey); |
474 | 474 | } else { |
475 | 475 | $shareKey = $this->getShareKey($path, $uid); |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | public function deleteShareKey($path, $keyId) { |
540 | 540 | return $this->keyStorage->deleteFileKey( |
541 | 541 | $path, |
542 | - $keyId . '.' . $this->shareKeyId, |
|
542 | + $keyId.'.'.$this->shareKeyId, |
|
543 | 543 | Encryption::ID); |
544 | 544 | } |
545 | 545 | |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | * @return mixed |
551 | 551 | */ |
552 | 552 | public function getShareKey($path, $uid) { |
553 | - $keyId = $uid . '.' . $this->shareKeyId; |
|
553 | + $keyId = $uid.'.'.$this->shareKeyId; |
|
554 | 554 | return $this->keyStorage->getFileKey($path, $keyId, Encryption::ID); |
555 | 555 | } |
556 | 556 | |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | * @return string |
613 | 613 | */ |
614 | 614 | public function getPublicShareKey() { |
615 | - return $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.' . $this->publicKeyId, Encryption::ID); |
|
615 | + return $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.'.$this->publicKeyId, Encryption::ID); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | /** |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * @return string returns openssl key |
682 | 682 | */ |
683 | 683 | public function getSystemPrivateKey($keyId) { |
684 | - return $this->keyStorage->getSystemUserKey($keyId . '.' . $this->privateKeyId, Encryption::ID); |
|
684 | + return $this->keyStorage->getSystemUserKey($keyId.'.'.$this->privateKeyId, Encryption::ID); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | /** |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | */ |
692 | 692 | public function setSystemPrivateKey($keyId, $key) { |
693 | 693 | return $this->keyStorage->setSystemUserKey( |
694 | - $keyId . '.' . $this->privateKeyId, |
|
694 | + $keyId.'.'.$this->privateKeyId, |
|
695 | 695 | $key, |
696 | 696 | Encryption::ID); |
697 | 697 | } |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | * @return string |
753 | 753 | */ |
754 | 754 | public function getPublicMasterKey() { |
755 | - return $this->keyStorage->getSystemUserKey($this->masterKeyId . '.' . $this->publicKeyId, Encryption::ID); |
|
755 | + return $this->keyStorage->getSystemUserKey($this->masterKeyId.'.'.$this->publicKeyId, Encryption::ID); |
|
756 | 756 | } |
757 | 757 | |
758 | 758 | /** |
@@ -761,6 +761,6 @@ discard block |
||
761 | 761 | * @return string |
762 | 762 | */ |
763 | 763 | public function getPrivateMasterKey() { |
764 | - return $this->keyStorage->getSystemUserKey($this->masterKeyId . '.' . $this->privateKeyId, Encryption::ID); |
|
764 | + return $this->keyStorage->getSystemUserKey($this->masterKeyId.'.'.$this->privateKeyId, Encryption::ID); |
|
765 | 765 | } |
766 | 766 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | /** @var bool */ |
49 | 49 | private $canPurgeToSaveSpace; |
50 | 50 | |
51 | - public function __construct(IConfig $config,ITimeFactory $timeFactory) { |
|
51 | + public function __construct(IConfig $config, ITimeFactory $timeFactory) { |
|
52 | 52 | $this->timeFactory = $timeFactory; |
53 | 53 | $this->retentionObligation = $config->getSystemValue('versions_retention_obligation', 'auto'); |
54 | 54 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | if (!ctype_digit($minValue) && $minValue !== 'auto') { |
153 | 153 | $isValid = false; |
154 | 154 | \OC::$server->getLogger()->warning( |
155 | - $minValue . ' is not a valid value for minimal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.', |
|
155 | + $minValue.' is not a valid value for minimal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.', |
|
156 | 156 | ['app' => 'files_versions'] |
157 | 157 | ); |
158 | 158 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | if (!ctype_digit($maxValue) && $maxValue !== 'auto') { |
161 | 161 | $isValid = false; |
162 | 162 | \OC::$server->getLogger()->warning( |
163 | - $maxValue . ' is not a valid value for maximal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.', |
|
163 | + $maxValue.' is not a valid value for maximal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.', |
|
164 | 164 | ['app' => 'files_versions'] |
165 | 165 | ); |
166 | 166 | } |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | $this->canPurgeToSaveSpace = true; |
179 | 179 | } elseif ($minValue !== 'auto' && $maxValue === 'auto') { |
180 | 180 | // Keep for X days but delete anytime if space needed |
181 | - $this->minAge = (int)$minValue; |
|
181 | + $this->minAge = (int) $minValue; |
|
182 | 182 | $this->maxAge = self::NO_OBLIGATION; |
183 | 183 | $this->canPurgeToSaveSpace = true; |
184 | 184 | } elseif ($minValue === 'auto' && $maxValue !== 'auto') { |
185 | 185 | // Delete anytime if space needed, Delete all older than max automatically |
186 | 186 | $this->minAge = self::NO_OBLIGATION; |
187 | - $this->maxAge = (int)$maxValue; |
|
187 | + $this->maxAge = (int) $maxValue; |
|
188 | 188 | $this->canPurgeToSaveSpace = true; |
189 | 189 | } elseif ($minValue !== 'auto' && $maxValue !== 'auto') { |
190 | 190 | // Delete all older than max OR older than min if space needed |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | $maxValue = $minValue; |
195 | 195 | } |
196 | 196 | |
197 | - $this->minAge = (int)$minValue; |
|
198 | - $this->maxAge = (int)$maxValue; |
|
197 | + $this->minAge = (int) $minValue; |
|
198 | + $this->maxAge = (int) $maxValue; |
|
199 | 199 | $this->canPurgeToSaveSpace = false; |
200 | 200 | } |
201 | 201 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $serverConnections = $helper->getServerConfigurationPrefixes(); |
34 | 34 | sort($serverConnections); |
35 | 35 | $lk = array_pop($serverConnections); |
36 | -$ln = (int)str_replace('s', '', $lk); |
|
36 | +$ln = (int) str_replace('s', '', $lk); |
|
37 | 37 | $nk = 's'.str_pad($ln + 1, 2, '0', STR_PAD_LEFT); |
38 | 38 | |
39 | 39 | $resultData = ['configPrefix' => $nk]; |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function connect($host, $port) { |
72 | 72 | if (strpos($host, '://') === false) { |
73 | - $host = 'ldap://' . $host; |
|
73 | + $host = 'ldap://'.$host; |
|
74 | 74 | } |
75 | 75 | if (strpos($host, ':', strpos($host, '://') + 1) === false) { |
76 | 76 | //ldap_connect ignores port parameter when URLs are passed |
77 | - $host .= ':' . $port; |
|
77 | + $host .= ':'.$port; |
|
78 | 78 | } |
79 | 79 | return $this->invokeLDAPMethod('connect', $host); |
80 | 80 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @throws \Exception |
223 | 223 | */ |
224 | 224 | public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0) { |
225 | - $oldHandler = set_error_handler(function ($no, $message, $file, $line) use (&$oldHandler) { |
|
225 | + $oldHandler = set_error_handler(function($no, $message, $file, $line) use (&$oldHandler) { |
|
226 | 226 | if (strpos($message, 'Partial search results returned: Sizelimit exceeded') !== false) { |
227 | 227 | return true; |
228 | 228 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | */ |
336 | 336 | protected function invokeLDAPMethod() { |
337 | 337 | $arguments = func_get_args(); |
338 | - $func = 'ldap_' . array_shift($arguments); |
|
338 | + $func = 'ldap_'.array_shift($arguments); |
|
339 | 339 | if (function_exists($func)) { |
340 | 340 | $this->preFunctionCall($func, $arguments); |
341 | 341 | $result = call_user_func_array($func, $arguments); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | throw new \Exception('LDAP Operations error', $errorCode); |
388 | 388 | } elseif ($errorCode === 19) { |
389 | 389 | ldap_get_option($this->curArgs[0], LDAP_OPT_ERROR_STRING, $extended_error); |
390 | - throw new ConstraintViolationException(!empty($extended_error)?$extended_error:$errorMsg, $errorCode); |
|
390 | + throw new ConstraintViolationException(!empty($extended_error) ? $extended_error : $errorMsg, $errorCode); |
|
391 | 391 | } else { |
392 | 392 | \OC::$server->getLogger()->debug('LDAP error {message} ({code}) after calling {func}', [ |
393 | 393 | 'app' => 'user_ldap', |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | return; |
162 | 162 | } |
163 | 163 | $this->config->setUserValue($this->getUsername(), 'user_ldap', 'isDeleted', '1'); |
164 | - $this->config->setUserValue($this->getUsername(), 'user_ldap', 'foundDeleted', (string)time()); |
|
164 | + $this->config->setUserValue($this->getUsername(), 'user_ldap', 'foundDeleted', (string) time()); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | $displayName = $displayName2 = ''; |
185 | 185 | $attr = strtolower($this->connection->ldapUserDisplayName); |
186 | 186 | if (isset($ldapEntry[$attr])) { |
187 | - $displayName = (string)$ldapEntry[$attr][0]; |
|
187 | + $displayName = (string) $ldapEntry[$attr][0]; |
|
188 | 188 | } |
189 | 189 | $attr = strtolower($this->connection->ldapUserDisplayName2); |
190 | 190 | if (isset($ldapEntry[$attr])) { |
191 | - $displayName2 = (string)$ldapEntry[$attr][0]; |
|
191 | + $displayName2 = (string) $ldapEntry[$attr][0]; |
|
192 | 192 | } |
193 | 193 | if ($displayName !== '') { |
194 | 194 | $this->composeAndStoreDisplayName($displayName, $displayName2); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @throws \Exception |
281 | 281 | */ |
282 | 282 | public function getHomePath($valueFromLDAP = null) { |
283 | - $path = (string)$valueFromLDAP; |
|
283 | + $path = (string) $valueFromLDAP; |
|
284 | 284 | $attr = null; |
285 | 285 | |
286 | 286 | if (is_null($valueFromLDAP) |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | && $path[1] === ':' && ('\\' === $path[2] || '/' === $path[2])) |
303 | 303 | ) { |
304 | 304 | $path = $this->config->getSystemValue('datadirectory', |
305 | - \OC::$SERVERROOT.'/data') . '/' . $path; |
|
305 | + \OC::$SERVERROOT.'/data').'/'.$path; |
|
306 | 306 | } |
307 | 307 | //we need it to store it in the DB as well in case a user gets |
308 | 308 | //deleted so we can clean up afterwards |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | && $this->config->getAppValue('user_ldap', 'enforce_home_folder_naming_rule', true) |
317 | 317 | ) { |
318 | 318 | // a naming rule attribute is defined, but it doesn't exist for that LDAP user |
319 | - throw new \Exception('Home dir attribute can\'t be read from LDAP for uid: ' . $this->getUsername()); |
|
319 | + throw new \Exception('Home dir attribute can\'t be read from LDAP for uid: '.$this->getUsername()); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | //false will apply default behaviour as defined and done by OC_User |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | * @return string the effective display name |
388 | 388 | */ |
389 | 389 | public function composeAndStoreDisplayName($displayName, $displayName2 = '') { |
390 | - $displayName2 = (string)$displayName2; |
|
390 | + $displayName2 = (string) $displayName2; |
|
391 | 391 | if ($displayName2 !== '') { |
392 | - $displayName .= ' (' . $displayName2 . ')'; |
|
392 | + $displayName .= ' ('.$displayName2.')'; |
|
393 | 393 | } |
394 | 394 | $oldName = $this->config->getUserValue($this->uid, 'user_ldap', 'displayName', null); |
395 | 395 | if ($oldName !== $displayName) { |
@@ -436,20 +436,20 @@ discard block |
||
436 | 436 | if ($this->wasRefreshed('email')) { |
437 | 437 | return; |
438 | 438 | } |
439 | - $email = (string)$valueFromLDAP; |
|
439 | + $email = (string) $valueFromLDAP; |
|
440 | 440 | if (is_null($valueFromLDAP)) { |
441 | 441 | $emailAttribute = $this->connection->ldapEmailAttribute; |
442 | 442 | if ($emailAttribute !== '') { |
443 | 443 | $aEmail = $this->access->readAttribute($this->dn, $emailAttribute); |
444 | 444 | if (is_array($aEmail) && (count($aEmail) > 0)) { |
445 | - $email = (string)$aEmail[0]; |
|
445 | + $email = (string) $aEmail[0]; |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | } |
449 | 449 | if ($email !== '') { |
450 | 450 | $user = $this->userManager->get($this->uid); |
451 | 451 | if (!is_null($user)) { |
452 | - $currentEmail = (string)$user->getEMailAddress(); |
|
452 | + $currentEmail = (string) $user->getEMailAddress(); |
|
453 | 453 | if ($currentEmail !== $email) { |
454 | 454 | $user->setEMailAddress($email); |
455 | 455 | } |
@@ -494,19 +494,19 @@ discard block |
||
494 | 494 | if ($aQuota && (count($aQuota) > 0) && $this->verifyQuotaValue($aQuota[0])) { |
495 | 495 | $quota = $aQuota[0]; |
496 | 496 | } elseif (is_array($aQuota) && isset($aQuota[0])) { |
497 | - $this->log->log('no suitable LDAP quota found for user ' . $this->uid . ': [' . $aQuota[0] . ']', ILogger::DEBUG); |
|
497 | + $this->log->log('no suitable LDAP quota found for user '.$this->uid.': ['.$aQuota[0].']', ILogger::DEBUG); |
|
498 | 498 | } |
499 | 499 | } elseif ($this->verifyQuotaValue($valueFromLDAP)) { |
500 | 500 | $quota = $valueFromLDAP; |
501 | 501 | } else { |
502 | - $this->log->log('no suitable LDAP quota found for user ' . $this->uid . ': [' . $valueFromLDAP . ']', ILogger::DEBUG); |
|
502 | + $this->log->log('no suitable LDAP quota found for user '.$this->uid.': ['.$valueFromLDAP.']', ILogger::DEBUG); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | if ($quota === false && $this->verifyQuotaValue($defaultQuota)) { |
506 | 506 | // quota not found using the LDAP attribute (or not parseable). Try the default quota |
507 | 507 | $quota = $defaultQuota; |
508 | 508 | } elseif ($quota === false) { |
509 | - $this->log->log('no suitable default quota found for user ' . $this->uid . ': [' . $defaultQuota . ']', ILogger::DEBUG); |
|
509 | + $this->log->log('no suitable default quota found for user '.$this->uid.': ['.$defaultQuota.']', ILogger::DEBUG); |
|
510 | 510 | return; |
511 | 511 | } |
512 | 512 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | if ($targetUser instanceof IUser) { |
515 | 515 | $targetUser->setQuota($quota); |
516 | 516 | } else { |
517 | - $this->log->log('trying to set a quota for user ' . $this->uid . ' but the user is missing', ILogger::INFO); |
|
517 | + $this->log->log('trying to set a quota for user '.$this->uid.' but the user is missing', ILogger::INFO); |
|
518 | 518 | } |
519 | 519 | } |
520 | 520 | |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | return true; |
597 | 597 | } catch (\Exception $e) { |
598 | 598 | \OC::$server->getLogger()->logException($e, [ |
599 | - 'message' => 'Could not set avatar for ' . $this->dn, |
|
599 | + 'message' => 'Could not set avatar for '.$this->dn, |
|
600 | 600 | 'level' => ILogger::INFO, |
601 | 601 | 'app' => 'user_ldap', |
602 | 602 | ]); |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | */ |
653 | 653 | public function handlePasswordExpiry($params) { |
654 | 654 | $ppolicyDN = $this->connection->ldapDefaultPPolicyDN; |
655 | - if (empty($ppolicyDN) || ((int)$this->connection->turnOnPasswordChange !== 1)) { |
|
656 | - return;//password expiry handling disabled |
|
655 | + if (empty($ppolicyDN) || ((int) $this->connection->turnOnPasswordChange !== 1)) { |
|
656 | + return; //password expiry handling disabled |
|
657 | 657 | } |
658 | 658 | $uid = $params['uid']; |
659 | 659 | if (isset($uid) && $uid === $this->getUsername()) { |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | if (array_key_exists('pwdpolicysubentry', $result[0])) { |
664 | 664 | $pwdPolicySubentry = $result[0]['pwdpolicysubentry']; |
665 | 665 | if ($pwdPolicySubentry && (count($pwdPolicySubentry) > 0)) { |
666 | - $ppolicyDN = $pwdPolicySubentry[0];//custom ppolicy DN |
|
666 | + $ppolicyDN = $pwdPolicySubentry[0]; //custom ppolicy DN |
|
667 | 667 | } |
668 | 668 | } |
669 | 669 | |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | $pwdChangedTime = array_key_exists('pwdchangedtime', $result[0]) ? $result[0]['pwdchangedtime'] : []; |
673 | 673 | |
674 | 674 | //retrieve relevant password policy attributes |
675 | - $cacheKey = 'ppolicyAttributes' . $ppolicyDN; |
|
675 | + $cacheKey = 'ppolicyAttributes'.$ppolicyDN; |
|
676 | 676 | $result = $this->connection->getFromCache($cacheKey); |
677 | 677 | if (is_null($result)) { |
678 | 678 | $result = $this->access->search('objectclass=*', $ppolicyDN, ['pwdgraceauthnlimit', 'pwdmaxage', 'pwdexpirewarning']); |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | //handle grace login |
687 | 687 | if (!empty($pwdGraceUseTime)) { //was this a grace login? |
688 | 688 | if (!empty($pwdGraceAuthNLimit) |
689 | - && count($pwdGraceUseTime) < (int)$pwdGraceAuthNLimit[0]) { //at least one more grace login available? |
|
689 | + && count($pwdGraceUseTime) < (int) $pwdGraceAuthNLimit[0]) { //at least one more grace login available? |
|
690 | 690 | $this->config->setUserValue($uid, 'user_ldap', 'needsPasswordReset', 'true'); |
691 | 691 | header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute( |
692 | 692 | 'user_ldap.renewPassword.showRenewPasswordForm', ['user' => $uid])); |
@@ -707,8 +707,8 @@ discard block |
||
707 | 707 | if (!empty($pwdChangedTime)) { |
708 | 708 | if (!empty($pwdMaxAge) |
709 | 709 | && !empty($pwdExpireWarning)) { |
710 | - $pwdMaxAgeInt = (int)$pwdMaxAge[0]; |
|
711 | - $pwdExpireWarningInt = (int)$pwdExpireWarning[0]; |
|
710 | + $pwdMaxAgeInt = (int) $pwdMaxAge[0]; |
|
711 | + $pwdExpireWarningInt = (int) $pwdExpireWarning[0]; |
|
712 | 712 | if ($pwdMaxAgeInt > 0 && $pwdExpireWarningInt > 0) { |
713 | 713 | $pwdChangedTimeDt = \DateTime::createFromFormat('YmdHisZ', $pwdChangedTime[0]); |
714 | 714 | $pwdChangedTimeDt->add(new \DateInterval('PT'.$pwdMaxAgeInt.'S')); |
@@ -550,7 +550,7 @@ |
||
550 | 550 | 'ldap_default_ppolicy_dn' => 'ldapDefaultPPolicyDN', |
551 | 551 | 'ldap_ext_storage_home_attribute' => 'ldapExtStorageHomeAttribute', |
552 | 552 | 'ldap_matching_rule_in_chain_state' => 'ldapMatchingRuleInChainState', |
553 | - 'ldapIgnoreNamingRules' => 'ldapIgnoreNamingRules', // sysconfig |
|
553 | + 'ldapIgnoreNamingRules' => 'ldapIgnoreNamingRules', // sysconfig |
|
554 | 554 | ]; |
555 | 555 | return $array; |
556 | 556 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | throw new \Exception('Internal error: Invalid object type', 500); |
116 | 116 | } |
117 | 117 | |
118 | - return (int)$result; |
|
118 | + return (int) $result; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | if ($count > 1000) { |
130 | 130 | return '> 1000'; |
131 | 131 | } |
132 | - return (string)$count; |
|
132 | + return (string) $count; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | public function countGroups() { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | |
212 | 212 | $filter = $this->access->combineFilterWithAnd([ |
213 | 213 | $this->configuration->ldapUserFilter, |
214 | - $attr . '=*' |
|
214 | + $attr.'=*' |
|
215 | 215 | ]); |
216 | 216 | |
217 | 217 | $limit = ($existsCheck === false) ? null : 1; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | if ($attr !== '' && $attr !== 'displayName') { |
239 | 239 | // most likely not the default value with upper case N, |
240 | 240 | // verify it still produces a result |
241 | - $count = (int)$this->countUsersWithAttribute($attr, true); |
|
241 | + $count = (int) $this->countUsersWithAttribute($attr, true); |
|
242 | 242 | if ($count > 0) { |
243 | 243 | //no change, but we sent it back to make sure the user interface |
244 | 244 | //is still correct, even if the ajax call was cancelled meanwhile |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | // first attribute that has at least one result wins |
251 | 251 | $displayNameAttrs = ['displayname', 'cn']; |
252 | 252 | foreach ($displayNameAttrs as $attr) { |
253 | - $count = (int)$this->countUsersWithAttribute($attr, true); |
|
253 | + $count = (int) $this->countUsersWithAttribute($attr, true); |
|
254 | 254 | |
255 | 255 | if ($count > 0) { |
256 | 256 | $this->applyFind('ldap_display_name', $attr); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | $attr = $this->configuration->ldapEmailAttribute; |
280 | 280 | if ($attr !== '') { |
281 | - $count = (int)$this->countUsersWithAttribute($attr, true); |
|
281 | + $count = (int) $this->countUsersWithAttribute($attr, true); |
|
282 | 282 | if ($count > 0) { |
283 | 283 | return false; |
284 | 284 | } |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | if ($winner !== '') { |
302 | 302 | $this->applyFind('ldap_email_attr', $winner); |
303 | 303 | if ($writeLog) { |
304 | - \OCP\Util::writeLog('user_ldap', 'The mail attribute has ' . |
|
305 | - 'automatically been reset, because the original value ' . |
|
304 | + \OCP\Util::writeLog('user_ldap', 'The mail attribute has '. |
|
305 | + 'automatically been reset, because the original value '. |
|
306 | 306 | 'did not return any results.', ILogger::INFO); |
307 | 307 | } |
308 | 308 | } |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | foreach ($portSettings as $setting) { |
682 | 682 | $p = $setting['port']; |
683 | 683 | $t = $setting['tls']; |
684 | - \OCP\Util::writeLog('user_ldap', 'Wiz: trying port '. $p . ', TLS '. $t, ILogger::DEBUG); |
|
684 | + \OCP\Util::writeLog('user_ldap', 'Wiz: trying port '.$p.', TLS '.$t, ILogger::DEBUG); |
|
685 | 685 | //connectAndBind may throw Exception, it needs to be catched by the |
686 | 686 | //callee of this method |
687 | 687 | |
@@ -701,10 +701,10 @@ discard block |
||
701 | 701 | if ($settingsFound === true) { |
702 | 702 | $config = [ |
703 | 703 | 'ldapPort' => $p, |
704 | - 'ldapTLS' => (int)$t |
|
704 | + 'ldapTLS' => (int) $t |
|
705 | 705 | ]; |
706 | 706 | $this->configuration->setConfiguration($config); |
707 | - \OCP\Util::writeLog('user_ldap', 'Wiz: detected Port ' . $p, ILogger::DEBUG); |
|
707 | + \OCP\Util::writeLog('user_ldap', 'Wiz: detected Port '.$p, ILogger::DEBUG); |
|
708 | 708 | $this->result->addChange('ldap_port', $p); |
709 | 709 | return $this->result; |
710 | 710 | } |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | |
748 | 748 | $dparts = explode('.', $domain); |
749 | 749 | while (count($dparts) > 0) { |
750 | - $base2 = 'dc=' . implode(',dc=', $dparts); |
|
750 | + $base2 = 'dc='.implode(',dc=', $dparts); |
|
751 | 751 | if ($base !== $base2 && $this->testBaseDN($base2)) { |
752 | 752 | $this->applyFind('ldap_base', $base2); |
753 | 753 | return $this->result; |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | if (is_array($objcs) && count($objcs) > 0) { |
897 | 897 | $filter .= '(|'; |
898 | 898 | foreach ($objcs as $objc) { |
899 | - $filter .= '(objectclass=' . $objc . ')'; |
|
899 | + $filter .= '(objectclass='.$objc.')'; |
|
900 | 900 | } |
901 | 901 | $filter .= ')'; |
902 | 902 | $parts++; |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | } |
913 | 913 | $base = $this->configuration->ldapBase[0]; |
914 | 914 | foreach ($cns as $cn) { |
915 | - $rr = $this->ldap->search($cr, $base, 'cn=' . $cn, ['dn', 'primaryGroupToken']); |
|
915 | + $rr = $this->ldap->search($cr, $base, 'cn='.$cn, ['dn', 'primaryGroupToken']); |
|
916 | 916 | if (!$this->ldap->isResource($rr)) { |
917 | 917 | continue; |
918 | 918 | } |
@@ -922,11 +922,11 @@ discard block |
||
922 | 922 | if ($dn === false || $dn === '') { |
923 | 923 | continue; |
924 | 924 | } |
925 | - $filterPart = '(memberof=' . $dn . ')'; |
|
925 | + $filterPart = '(memberof='.$dn.')'; |
|
926 | 926 | if (isset($attrs['primaryGroupToken'])) { |
927 | 927 | $pgt = $attrs['primaryGroupToken'][0]; |
928 | - $primaryFilterPart = '(primaryGroupID=' . $pgt .')'; |
|
929 | - $filterPart = '(|' . $filterPart . $primaryFilterPart . ')'; |
|
928 | + $primaryFilterPart = '(primaryGroupID='.$pgt.')'; |
|
929 | + $filterPart = '(|'.$filterPart.$primaryFilterPart.')'; |
|
930 | 930 | } |
931 | 931 | $filter .= $filterPart; |
932 | 932 | } |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | } |
937 | 937 | //wrap parts in AND condition |
938 | 938 | if ($parts > 1) { |
939 | - $filter = '(&' . $filter . ')'; |
|
939 | + $filter = '(&'.$filter.')'; |
|
940 | 940 | } |
941 | 941 | if ($filter === '') { |
942 | 942 | $filter = '(objectclass=*)'; |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | if (is_array($objcs) && count($objcs) > 0) { |
950 | 950 | $filter .= '(|'; |
951 | 951 | foreach ($objcs as $objc) { |
952 | - $filter .= '(objectclass=' . $objc . ')'; |
|
952 | + $filter .= '(objectclass='.$objc.')'; |
|
953 | 953 | } |
954 | 954 | $filter .= ')'; |
955 | 955 | $parts++; |
@@ -959,14 +959,14 @@ discard block |
||
959 | 959 | if (is_array($cns) && count($cns) > 0) { |
960 | 960 | $filter .= '(|'; |
961 | 961 | foreach ($cns as $cn) { |
962 | - $filter .= '(cn=' . $cn . ')'; |
|
962 | + $filter .= '(cn='.$cn.')'; |
|
963 | 963 | } |
964 | 964 | $filter .= ')'; |
965 | 965 | } |
966 | 966 | $parts++; |
967 | 967 | //wrap parts in AND condition |
968 | 968 | if ($parts > 1) { |
969 | - $filter = '(&' . $filter . ')'; |
|
969 | + $filter = '(&'.$filter.')'; |
|
970 | 970 | } |
971 | 971 | break; |
972 | 972 | |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | $attr = 'cn'; |
990 | 990 | } |
991 | 991 | if ($attr !== '') { |
992 | - $filterUsername = '(' . $attr . $loginpart . ')'; |
|
992 | + $filterUsername = '('.$attr.$loginpart.')'; |
|
993 | 993 | $parts++; |
994 | 994 | } |
995 | 995 | } |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | if (is_array($attrsToFilter) && count($attrsToFilter) > 0) { |
1006 | 1006 | $filterAttributes = '(|'; |
1007 | 1007 | foreach ($attrsToFilter as $attribute) { |
1008 | - $filterAttributes .= '(' . $attribute . $loginpart . ')'; |
|
1008 | + $filterAttributes .= '('.$attribute.$loginpart.')'; |
|
1009 | 1009 | } |
1010 | 1010 | $filterAttributes .= ')'; |
1011 | 1011 | $parts++; |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | |
1081 | 1081 | if ($login === true) { |
1082 | 1082 | $this->ldap->unbind($cr); |
1083 | - \OCP\Util::writeLog('user_ldap', 'Wiz: Bind successful to Port '. $port . ' TLS ' . (int)$tls, ILogger::DEBUG); |
|
1083 | + \OCP\Util::writeLog('user_ldap', 'Wiz: Bind successful to Port '.$port.' TLS '.(int) $tls, ILogger::DEBUG); |
|
1084 | 1084 | return true; |
1085 | 1085 | } |
1086 | 1086 | |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | //636 ← LDAPS / SSL |
1338 | 1338 | //7xxx ← UCS. need to be checked first, because both ports may be open |
1339 | 1339 | $host = $this->configuration->ldapHost; |
1340 | - $port = (int)$this->configuration->ldapPort; |
|
1340 | + $port = (int) $this->configuration->ldapPort; |
|
1341 | 1341 | $portSettings = []; |
1342 | 1342 | |
1343 | 1343 | //In case the port is already provided, we will check this first |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | $configPrefixes = $helper->getServerConfigurationPrefixes(true); |
113 | 113 | $ldapWrapper = new LDAP(); |
114 | 114 | |
115 | - $offset = (int)$input->getOption('offset'); |
|
116 | - $limit = (int)$input->getOption('limit'); |
|
115 | + $offset = (int) $input->getOption('offset'); |
|
116 | + $limit = (int) $input->getOption('limit'); |
|
117 | 117 | $this->validateOffsetAndLimit($offset, $limit); |
118 | 118 | |
119 | 119 | if ($input->getOption('group')) { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | $result = $proxy->$getMethod($input->getArgument('search'), $limit, $offset); |
142 | 142 | foreach ($result as $id => $name) { |
143 | - $line = $name . ($printID ? ' ('.$id.')' : ''); |
|
143 | + $line = $name.($printID ? ' ('.$id.')' : ''); |
|
144 | 144 | $output->writeln($line); |
145 | 145 | } |
146 | 146 | return 0; |
@@ -73,7 +73,7 @@ |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | $providers = $this->registry->getProviderStates($user); |
76 | - $state2fa = array_reduce($providers, function (bool $carry, bool $state) { |
|
76 | + $state2fa = array_reduce($providers, function(bool $carry, bool $state) { |
|
77 | 77 | return $carry || $state; |
78 | 78 | }, false); |
79 | 79 |