@@ -31,20 +31,20 @@ |
||
31 | 31 | |
32 | 32 | require '../3rdparty/autoload.php'; |
33 | 33 | |
34 | -$locales = array_map(static function (string $localeCode) { |
|
34 | +$locales = array_map(static function(string $localeCode) { |
|
35 | 35 | return [ |
36 | 36 | 'code' => $localeCode, |
37 | 37 | 'name' => Locale::getDisplayName($localeCode, 'en') |
38 | 38 | ]; |
39 | 39 | }, ResourceBundle::getLocales('')); |
40 | 40 | |
41 | -$locales = array_filter($locales, static function (array $locale) { |
|
41 | +$locales = array_filter($locales, static function(array $locale) { |
|
42 | 42 | return is_array(Punic\Data::explodeLocale($locale['code'])); |
43 | 43 | }); |
44 | 44 | |
45 | 45 | $locales = array_values($locales); |
46 | 46 | |
47 | -if (file_put_contents(__DIR__ . '/locales.json', json_encode($locales, JSON_PRETTY_PRINT)) === false) { |
|
47 | +if (file_put_contents(__DIR__.'/locales.json', json_encode($locales, JSON_PRETTY_PRINT)) === false) { |
|
48 | 48 | echo 'Failed to update locales.json'; |
49 | 49 | exit(1); |
50 | 50 | } |
@@ -97,20 +97,20 @@ discard block |
||
97 | 97 | |
98 | 98 | $cachedGroups = &$this->cachedGroups; |
99 | 99 | $cachedUserGroups = &$this->cachedUserGroups; |
100 | - $this->listen('\OC\Group', 'postDelete', function ($group) use (&$cachedGroups, &$cachedUserGroups) { |
|
100 | + $this->listen('\OC\Group', 'postDelete', function($group) use (&$cachedGroups, &$cachedUserGroups) { |
|
101 | 101 | /** |
102 | 102 | * @var \OC\Group\Group $group |
103 | 103 | */ |
104 | 104 | unset($cachedGroups[$group->getGID()]); |
105 | 105 | $cachedUserGroups = []; |
106 | 106 | }); |
107 | - $this->listen('\OC\Group', 'postAddUser', function ($group) use (&$cachedUserGroups) { |
|
107 | + $this->listen('\OC\Group', 'postAddUser', function($group) use (&$cachedUserGroups) { |
|
108 | 108 | /** |
109 | 109 | * @var \OC\Group\Group $group |
110 | 110 | */ |
111 | 111 | $cachedUserGroups = []; |
112 | 112 | }); |
113 | - $this->listen('\OC\Group', 'postRemoveUser', function ($group) use (&$cachedUserGroups) { |
|
113 | + $this->listen('\OC\Group', 'postRemoveUser', function($group) use (&$cachedUserGroups) { |
|
114 | 114 | /** |
115 | 115 | * @var \OC\Group\Group $group |
116 | 116 | */ |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | if ($aGroup instanceof IGroup) { |
251 | 251 | $groups[$groupId] = $aGroup; |
252 | 252 | } else { |
253 | - $this->logger->debug('Group "' . $groupId . '" was returned by search but not found through direct access', ['app' => 'core']); |
|
253 | + $this->logger->debug('Group "'.$groupId.'" was returned by search but not found through direct access', ['app' => 'core']); |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | if (!is_null($limit) and $limit <= 0) { |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | if ($aGroup instanceof IGroup) { |
284 | 284 | $groups[$groupId] = $aGroup; |
285 | 285 | } else { |
286 | - $this->logger->debug('User "' . $uid . '" belongs to deleted group: "' . $groupId . '"', ['app' => 'core']); |
|
286 | + $this->logger->debug('User "'.$uid.'" belongs to deleted group: "'.$groupId.'"', ['app' => 'core']); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * @return array ['displayName' => displayname] |
352 | 352 | */ |
353 | 353 | public function getUserGroupNames(IUser $user) { |
354 | - return array_map(function ($group) { |
|
354 | + return array_map(function($group) { |
|
355 | 355 | return ['displayName' => $group->getDisplayName()]; |
356 | 356 | }, $this->getUserGroups($user)); |
357 | 357 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $ip = $input->getArgument('ipaddress'); |
54 | 54 | |
55 | 55 | if (!filter_var($ip, FILTER_VALIDATE_IP)) { |
56 | - $output->writeln('<error>"' . $ip . '" is not a valid IP address</error>'); |
|
56 | + $output->writeln('<error>"'.$ip.'" is not a valid IP address</error>'); |
|
57 | 57 | return 1; |
58 | 58 | } |
59 | 59 |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | throw new InvalidTokenException("Token does not exist", 0, $ex); |
161 | 161 | } |
162 | 162 | |
163 | - if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { |
|
163 | + if ((int) $token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { |
|
164 | 164 | throw new ExpiredTokenException($token); |
165 | 165 | } |
166 | 166 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | throw new InvalidTokenException("Token with ID $tokenId does not exist", 0, $ex); |
183 | 183 | } |
184 | 184 | |
185 | - if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { |
|
185 | + if ((int) $token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { |
|
186 | 186 | throw new ExpiredTokenException($token); |
187 | 187 | } |
188 | 188 | |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public function invalidateOldTokens() { |
268 | 268 | $olderThan = $this->time->getTime() - (int) $this->config->getSystemValue('session_lifetime', 60 * 60 * 24); |
269 | - $this->logger->debug('Invalidating session tokens older than ' . date('c', $olderThan), ['app' => 'cron']); |
|
269 | + $this->logger->debug('Invalidating session tokens older than '.date('c', $olderThan), ['app' => 'cron']); |
|
270 | 270 | $this->mapper->invalidateOld($olderThan, IToken::DO_NOT_REMEMBER); |
271 | 271 | $rememberThreshold = $this->time->getTime() - (int) $this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15); |
272 | - $this->logger->debug('Invalidating remembered session tokens older than ' . date('c', $rememberThreshold), ['app' => 'cron']); |
|
272 | + $this->logger->debug('Invalidating remembered session tokens older than '.date('c', $rememberThreshold), ['app' => 'cron']); |
|
273 | 273 | $this->mapper->invalidateOld($rememberThreshold, IToken::REMEMBER); |
274 | 274 | } |
275 | 275 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | private function hashToken(string $token): string { |
302 | 302 | $secret = $this->config->getSystemValue('secret'); |
303 | - return hash('sha512', $token . $secret); |
|
303 | + return hash('sha512', $token.$secret); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | */ |
315 | 315 | private function encryptPassword(string $password, string $token): string { |
316 | 316 | $secret = $this->config->getSystemValue('secret'); |
317 | - return $this->crypto->encrypt($password, $token . $secret); |
|
317 | + return $this->crypto->encrypt($password, $token.$secret); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
@@ -330,11 +330,11 @@ discard block |
||
330 | 330 | private function decryptPassword(string $password, string $token): string { |
331 | 331 | $secret = $this->config->getSystemValue('secret'); |
332 | 332 | try { |
333 | - return $this->crypto->decrypt($password, $token . $secret); |
|
333 | + return $this->crypto->decrypt($password, $token.$secret); |
|
334 | 334 | } catch (Exception $ex) { |
335 | 335 | // Delete the invalid token |
336 | 336 | $this->invalidateToken($token); |
337 | - throw new InvalidTokenException("Can not decrypt token password: " . $ex->getMessage(), 0, $ex); |
|
337 | + throw new InvalidTokenException("Can not decrypt token password: ".$ex->getMessage(), 0, $ex); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | $token = $this->mapper->getToken($this->hashToken($tokenId)); |
104 | 104 | $this->cache[$token->getToken()] = $token; |
105 | 105 | } catch (DoesNotExistException $ex) { |
106 | - throw new InvalidTokenException("Token does not exist: " . $ex->getMessage(), 0, $ex); |
|
106 | + throw new InvalidTokenException("Token does not exist: ".$ex->getMessage(), 0, $ex); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | - if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { |
|
110 | + if ((int) $token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { |
|
111 | 111 | throw new ExpiredTokenException($token); |
112 | 112 | } |
113 | 113 | |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | try { |
128 | 128 | $token = $this->mapper->getTokenById($tokenId); |
129 | 129 | } catch (DoesNotExistException $ex) { |
130 | - throw new InvalidTokenException("Token with ID $tokenId does not exist: " . $ex->getMessage(), 0, $ex); |
|
130 | + throw new InvalidTokenException("Token with ID $tokenId does not exist: ".$ex->getMessage(), 0, $ex); |
|
131 | 131 | } |
132 | 132 | |
133 | - if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { |
|
133 | + if ((int) $token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { |
|
134 | 134 | throw new ExpiredTokenException($token); |
135 | 135 | } |
136 | 136 | |
@@ -192,10 +192,10 @@ discard block |
||
192 | 192 | $this->cache->clear(); |
193 | 193 | |
194 | 194 | $olderThan = $this->time->getTime() - (int) $this->config->getSystemValue('session_lifetime', 60 * 60 * 24); |
195 | - $this->logger->debug('Invalidating session tokens older than ' . date('c', $olderThan), ['app' => 'cron']); |
|
195 | + $this->logger->debug('Invalidating session tokens older than '.date('c', $olderThan), ['app' => 'cron']); |
|
196 | 196 | $this->mapper->invalidateOld($olderThan, IToken::DO_NOT_REMEMBER); |
197 | 197 | $rememberThreshold = $this->time->getTime() - (int) $this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15); |
198 | - $this->logger->debug('Invalidating remembered session tokens older than ' . date('c', $rememberThreshold), ['app' => 'cron']); |
|
198 | + $this->logger->debug('Invalidating remembered session tokens older than '.date('c', $rememberThreshold), ['app' => 'cron']); |
|
199 | 199 | $this->mapper->invalidateOld($rememberThreshold, IToken::REMEMBER); |
200 | 200 | } |
201 | 201 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | private function encrypt(string $plaintext, string $token): string { |
284 | 284 | $secret = $this->config->getSystemValue('secret'); |
285 | - return $this->crypto->encrypt($plaintext, $token . $secret); |
|
285 | + return $this->crypto->encrypt($plaintext, $token.$secret); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | private function decrypt(string $cipherText, string $token): string { |
292 | 292 | $secret = $this->config->getSystemValue('secret'); |
293 | 293 | try { |
294 | - return $this->crypto->decrypt($cipherText, $token . $secret); |
|
294 | + return $this->crypto->decrypt($cipherText, $token.$secret); |
|
295 | 295 | } catch (\Exception $ex) { |
296 | 296 | // Delete the invalid token |
297 | 297 | $this->invalidateToken($token); |
298 | - throw new InvalidTokenException("Could not decrypt token password: " . $ex->getMessage(), 0, $ex); |
|
298 | + throw new InvalidTokenException("Could not decrypt token password: ".$ex->getMessage(), 0, $ex); |
|
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | private function hashToken(string $token): string { |
317 | 317 | $secret = $this->config->getSystemValue('secret'); |
318 | - return hash('sha512', $token . $secret); |
|
318 | + return hash('sha512', $token.$secret); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
@@ -428,6 +428,6 @@ discard block |
||
428 | 428 | while ($error = openssl_error_string()) { |
429 | 429 | $errors[] = $error; |
430 | 430 | } |
431 | - $this->logger->critical('Something is wrong with your openssl setup: ' . implode(', ', $errors)); |
|
431 | + $this->logger->critical('Something is wrong with your openssl setup: '.implode(', ', $errors)); |
|
432 | 432 | } |
433 | 433 | } |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | // Failed, maybe the user used their email address |
462 | 462 | $users = $this->manager->getByEmail($user); |
463 | 463 | if (!(\count($users) === 1 && $this->login($users[0]->getUID(), $password))) { |
464 | - $this->logger->warning('Login failed: \'' . $user . '\' (Remote IP: \'' . \OC::$server->getRequest()->getRemoteAddress() . '\')', ['app' => 'core']); |
|
464 | + $this->logger->warning('Login failed: \''.$user.'\' (Remote IP: \''.\OC::$server->getRequest()->getRemoteAddress().'\')', ['app' => 'core']); |
|
465 | 465 | |
466 | 466 | $throttler->registerAttempt('login', $request->getRemoteAddress(), ['user' => $user]); |
467 | 467 | |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } catch (InvalidTokenException $ex) { |
534 | 534 | $this->logger->logException($ex, [ |
535 | 535 | 'level' => ILogger::DEBUG, |
536 | - 'message' => 'Token is not valid: ' . $ex->getMessage(), |
|
536 | + 'message' => 'Token is not valid: '.$ex->getMessage(), |
|
537 | 537 | ]); |
538 | 538 | return false; |
539 | 539 | } |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | } |
564 | 564 | |
565 | 565 | // trigger any other initialization |
566 | - \OC::$server->getEventDispatcher()->dispatch(IUser::class . '::firstLogin', new GenericEvent($this->getUser())); |
|
566 | + \OC::$server->getEventDispatcher()->dispatch(IUser::class.'::firstLogin', new GenericEvent($this->getUser())); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | private function checkTokenCredentials(IToken $dbToken, $token) { |
726 | 726 | // Check whether login credentials are still valid and the user was not disabled |
727 | 727 | // This check is performed each 5 minutes |
728 | - $lastCheck = $dbToken->getLastCheck() ? : 0; |
|
728 | + $lastCheck = $dbToken->getLastCheck() ?: 0; |
|
729 | 729 | $now = $this->timeFactory->getTime(); |
730 | 730 | if ($lastCheck > ($now - 60 * 5)) { |
731 | 731 | // Checked performed recently, nothing to do now |
@@ -985,9 +985,9 @@ discard block |
||
985 | 985 | setcookie('nc_session_id', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT, '', $secureCookie, true); |
986 | 986 | // old cookies might be stored under /webroot/ instead of /webroot |
987 | 987 | // and Firefox doesn't like it! |
988 | - setcookie('nc_username', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT . '/', '', $secureCookie, true); |
|
989 | - setcookie('nc_token', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT . '/', '', $secureCookie, true); |
|
990 | - setcookie('nc_session_id', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT . '/', '', $secureCookie, true); |
|
988 | + setcookie('nc_username', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT.'/', '', $secureCookie, true); |
|
989 | + setcookie('nc_token', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT.'/', '', $secureCookie, true); |
|
990 | + setcookie('nc_session_id', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT.'/', '', $secureCookie, true); |
|
991 | 991 | } |
992 | 992 | |
993 | 993 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if (isset($context[$name])) { |
71 | 71 | $context = $context[$name]; |
72 | 72 | } else { |
73 | - throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set'); |
|
73 | + throw new \BadMethodCallException('Invalid context, "'.$name.'" options not set'); |
|
74 | 74 | } |
75 | 75 | if (isset($context['session']) and $context['session'] instanceof \phpseclib\Net\SFTP) { |
76 | 76 | $this->sftp = $context['session']; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | public function stream_open($path, $mode, $options, &$opened_path) { |
84 | 84 | [, $path] = explode('://', $path); |
85 | - $path = '/' . ltrim($path); |
|
85 | + $path = '/'.ltrim($path); |
|
86 | 86 | $path = str_replace('//', '/', $path); |
87 | 87 | |
88 | 88 | $this->loadContext('sftp'); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if (isset($context[$name])) { |
71 | 71 | $context = $context[$name]; |
72 | 72 | } else { |
73 | - throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set'); |
|
73 | + throw new \BadMethodCallException('Invalid context, "'.$name.'" options not set'); |
|
74 | 74 | } |
75 | 75 | if (isset($context['session']) and $context['session'] instanceof \phpseclib\Net\SFTP) { |
76 | 76 | $this->sftp = $context['session']; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | public function stream_open($path, $mode, $options, &$opened_path) { |
84 | 84 | [, $path] = explode('://', $path); |
85 | - $path = '/' . ltrim($path); |
|
85 | + $path = '/'.ltrim($path); |
|
86 | 86 | $path = str_replace('//', '/', $path); |
87 | 87 | |
88 | 88 | $this->loadContext('sftp'); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | |
24 | 24 | style('settings', 'settings'); |
25 | -script('settings', [ 'settings', 'admin', 'log']); |
|
25 | +script('settings', ['settings', 'admin', 'log']); |
|
26 | 26 | script('core', 'setupchecks'); |
27 | 27 | script('files', 'jquery.fileupload'); |
28 | 28 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | foreach ($_['forms']['personal'] as $form) { |
38 | 38 | if (isset($form['anchor'])) { |
39 | 39 | $anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.PersonalSettings.index', ['section' => $form['anchor']]); |
40 | - $class = 'nav-icon-' . $form['anchor']; |
|
40 | + $class = 'nav-icon-'.$form['anchor']; |
|
41 | 41 | $sectionName = $form['section-name']; |
42 | 42 | $active = $form['active'] ? ' class="active"' : ''; ?> |
43 | 43 | <li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?>> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | foreach ($_['forms']['admin'] as $form) { |
65 | 65 | if (isset($form['anchor'])) { |
66 | 66 | $anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]); |
67 | - $class = 'nav-icon-' . $form['anchor']; |
|
67 | + $class = 'nav-icon-'.$form['anchor']; |
|
68 | 68 | $sectionName = $form['section-name']; |
69 | 69 | $active = $form['active'] ? ' class="active"' : ''; ?> |
70 | 70 | <li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?>> |