@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @return boolean |
105 | 105 | */ |
106 | 106 | public function httpGet(RequestInterface $request, ResponseInterface $response):bool { |
107 | - if ($request->getPath() !== 'provisioning/' . AppleProvisioningNode::FILENAME) { |
|
107 | + if ($request->getPath() !== 'provisioning/'.AppleProvisioningNode::FILENAME) { |
|
108 | 108 | return true; |
109 | 109 | } |
110 | 110 | |
@@ -142,16 +142,16 @@ discard block |
||
142 | 142 | $carddavUUID = call_user_func($this->uuidClosure); |
143 | 143 | $profileUUID = call_user_func($this->uuidClosure); |
144 | 144 | |
145 | - $caldavIdentifier = $reverseDomain . '.' . $caldavUUID; |
|
146 | - $carddavIdentifier = $reverseDomain . '.' . $carddavUUID; |
|
147 | - $profileIdentifier = $reverseDomain . '.' . $profileUUID; |
|
145 | + $caldavIdentifier = $reverseDomain.'.'.$caldavUUID; |
|
146 | + $carddavIdentifier = $reverseDomain.'.'.$carddavUUID; |
|
147 | + $profileIdentifier = $reverseDomain.'.'.$profileUUID; |
|
148 | 148 | |
149 | 149 | $caldavDescription = $this->l10n->t('Configures a CalDAV account'); |
150 | - $caldavDisplayname = $description . ' CalDAV'; |
|
150 | + $caldavDisplayname = $description.' CalDAV'; |
|
151 | 151 | $carddavDescription = $this->l10n->t('Configures a CardDAV account'); |
152 | - $carddavDisplayname = $description . ' CardDAV'; |
|
152 | + $carddavDisplayname = $description.' CardDAV'; |
|
153 | 153 | |
154 | - $filename = $userId . '-' . AppleProvisioningNode::FILENAME; |
|
154 | + $filename = $userId.'-'.AppleProvisioningNode::FILENAME; |
|
155 | 155 | |
156 | 156 | $xmlSkeleton = $this->getTemplate(); |
157 | 157 | $body = vsprintf($xmlSkeleton, array_map(function($v) { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | )); |
181 | 181 | |
182 | 182 | $response->setStatus(200); |
183 | - $response->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '"'); |
|
183 | + $response->setHeader('Content-Disposition', 'attachment; filename="'.$filename.'"'); |
|
184 | 184 | $response->setHeader('Content-Type', 'application/xml; charset=utf-8'); |
185 | 185 | $response->setBody($body); |
186 | 186 |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @param string $stream |
133 | 133 | * @see http://www.php.net/manual/en/reserved.variables.php |
134 | 134 | */ |
135 | - public function __construct(array $vars= [], |
|
135 | + public function __construct(array $vars = [], |
|
136 | 136 | ISecureRandom $secureRandom = null, |
137 | 137 | IConfig $config, |
138 | 138 | CsrfTokenManager $csrfTokenManager = null, |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | $this->config = $config; |
144 | 144 | $this->csrfTokenManager = $csrfTokenManager; |
145 | 145 | |
146 | - if(!array_key_exists('method', $vars)) { |
|
146 | + if (!array_key_exists('method', $vars)) { |
|
147 | 147 | $vars['method'] = 'GET'; |
148 | 148 | } |
149 | 149 | |
150 | - foreach($this->allowedKeys as $name) { |
|
150 | + foreach ($this->allowedKeys as $name) { |
|
151 | 151 | $this->items[$name] = isset($vars[$name]) |
152 | 152 | ? $vars[$name] |
153 | 153 | : []; |
@@ -257,12 +257,12 @@ discard block |
||
257 | 257 | * @return mixed|null |
258 | 258 | */ |
259 | 259 | public function __get($name) { |
260 | - switch($name) { |
|
260 | + switch ($name) { |
|
261 | 261 | case 'put': |
262 | 262 | case 'patch': |
263 | 263 | case 'get': |
264 | 264 | case 'post': |
265 | - if($this->method !== strtoupper($name)) { |
|
265 | + if ($this->method !== strtoupper($name)) { |
|
266 | 266 | throw new \LogicException(sprintf('%s cannot be accessed in a %s request.', $name, $this->method)); |
267 | 267 | } |
268 | 268 | return $this->getContent(); |
@@ -313,9 +313,9 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function getHeader(string $name): string { |
315 | 315 | |
316 | - $name = strtoupper(str_replace('-', '_',$name)); |
|
317 | - if (isset($this->server['HTTP_' . $name])) { |
|
318 | - return $this->server['HTTP_' . $name]; |
|
316 | + $name = strtoupper(str_replace('-', '_', $name)); |
|
317 | + if (isset($this->server['HTTP_'.$name])) { |
|
318 | + return $this->server['HTTP_'.$name]; |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | // There's a few headers that seem to end up in the top-level |
@@ -445,21 +445,21 @@ discard block |
||
445 | 445 | // 'application/json' must be decoded manually. |
446 | 446 | if (strpos($this->getHeader('Content-Type'), 'application/json') !== false) { |
447 | 447 | $params = json_decode(file_get_contents($this->inputStream), true); |
448 | - if($params !== null && \count($params) > 0) { |
|
448 | + if ($params !== null && \count($params) > 0) { |
|
449 | 449 | $this->items['params'] = $params; |
450 | - if($this->method === 'POST') { |
|
450 | + if ($this->method === 'POST') { |
|
451 | 451 | $this->items['post'] = $params; |
452 | 452 | } |
453 | 453 | } |
454 | 454 | |
455 | 455 | // Handle application/x-www-form-urlencoded for methods other than GET |
456 | 456 | // or post correctly |
457 | - } elseif($this->method !== 'GET' |
|
457 | + } elseif ($this->method !== 'GET' |
|
458 | 458 | && $this->method !== 'POST' |
459 | 459 | && strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') !== false) { |
460 | 460 | |
461 | 461 | parse_str(file_get_contents($this->inputStream), $params); |
462 | - if(\is_array($params)) { |
|
462 | + if (\is_array($params)) { |
|
463 | 463 | $this->items['params'] = $params; |
464 | 464 | } |
465 | 465 | } |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | * @return bool true if CSRF check passed |
477 | 477 | */ |
478 | 478 | public function passesCSRFCheck(): bool { |
479 | - if($this->csrfTokenManager === null) { |
|
479 | + if ($this->csrfTokenManager === null) { |
|
480 | 480 | return false; |
481 | 481 | } |
482 | 482 | |
483 | - if(!$this->passesStrictCookieCheck()) { |
|
483 | + if (!$this->passesStrictCookieCheck()) { |
|
484 | 484 | return false; |
485 | 485 | } |
486 | 486 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | if ($this->getHeader('OCS-APIREQUEST')) { |
509 | 509 | return false; |
510 | 510 | } |
511 | - if($this->getCookie(session_name()) === null && $this->getCookie('nc_token') === null) { |
|
511 | + if ($this->getCookie(session_name()) === null && $this->getCookie('nc_token') === null) { |
|
512 | 512 | return false; |
513 | 513 | } |
514 | 514 | |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | protected function getProtectedCookieName(string $name): string { |
534 | 534 | $cookieParams = $this->getCookieParams(); |
535 | 535 | $prefix = ''; |
536 | - if($cookieParams['secure'] === true && $cookieParams['path'] === '/') { |
|
536 | + if ($cookieParams['secure'] === true && $cookieParams['path'] === '/') { |
|
537 | 537 | $prefix = '__Host-'; |
538 | 538 | } |
539 | 539 | |
@@ -548,12 +548,12 @@ discard block |
||
548 | 548 | * @since 9.1.0 |
549 | 549 | */ |
550 | 550 | public function passesStrictCookieCheck(): bool { |
551 | - if(!$this->cookieCheckRequired()) { |
|
551 | + if (!$this->cookieCheckRequired()) { |
|
552 | 552 | return true; |
553 | 553 | } |
554 | 554 | |
555 | 555 | $cookieName = $this->getProtectedCookieName('nc_sameSiteCookiestrict'); |
556 | - if($this->getCookie($cookieName) === 'true' |
|
556 | + if ($this->getCookie($cookieName) === 'true' |
|
557 | 557 | && $this->passesLaxCookieCheck()) { |
558 | 558 | return true; |
559 | 559 | } |
@@ -568,12 +568,12 @@ discard block |
||
568 | 568 | * @since 9.1.0 |
569 | 569 | */ |
570 | 570 | public function passesLaxCookieCheck(): bool { |
571 | - if(!$this->cookieCheckRequired()) { |
|
571 | + if (!$this->cookieCheckRequired()) { |
|
572 | 572 | return true; |
573 | 573 | } |
574 | 574 | |
575 | 575 | $cookieName = $this->getProtectedCookieName('nc_sameSiteCookielax'); |
576 | - if($this->getCookie($cookieName) === 'true') { |
|
576 | + if ($this->getCookie($cookieName) === 'true') { |
|
577 | 577 | return true; |
578 | 578 | } |
579 | 579 | return false; |
@@ -586,12 +586,12 @@ discard block |
||
586 | 586 | * @return string |
587 | 587 | */ |
588 | 588 | public function getId(): string { |
589 | - if(isset($this->server['UNIQUE_ID'])) { |
|
589 | + if (isset($this->server['UNIQUE_ID'])) { |
|
590 | 590 | return $this->server['UNIQUE_ID']; |
591 | 591 | } |
592 | 592 | |
593 | - if(empty($this->requestId)) { |
|
594 | - $validChars = ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS; |
|
593 | + if (empty($this->requestId)) { |
|
594 | + $validChars = ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS; |
|
595 | 595 | $this->requestId = $this->secureRandom->generate(20, $validChars); |
596 | 596 | } |
597 | 597 | |
@@ -647,15 +647,15 @@ discard block |
||
647 | 647 | $remoteAddress = isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : ''; |
648 | 648 | $trustedProxies = $this->config->getSystemValue('trusted_proxies', []); |
649 | 649 | |
650 | - if(\is_array($trustedProxies) && $this->isTrustedProxy($trustedProxies, $remoteAddress)) { |
|
650 | + if (\is_array($trustedProxies) && $this->isTrustedProxy($trustedProxies, $remoteAddress)) { |
|
651 | 651 | $forwardedForHeaders = $this->config->getSystemValue('forwarded_for_headers', [ |
652 | 652 | 'HTTP_X_FORWARDED_FOR' |
653 | 653 | // only have one default, so we cannot ship an insecure product out of the box |
654 | 654 | ]); |
655 | 655 | |
656 | - foreach($forwardedForHeaders as $header) { |
|
657 | - if(isset($this->server[$header])) { |
|
658 | - foreach(explode(',', $this->server[$header]) as $IP) { |
|
656 | + foreach ($forwardedForHeaders as $header) { |
|
657 | + if (isset($this->server[$header])) { |
|
658 | + foreach (explode(',', $this->server[$header]) as $IP) { |
|
659 | 659 | $IP = trim($IP); |
660 | 660 | if (filter_var($IP, FILTER_VALIDATE_IP) !== false) { |
661 | 661 | return $IP; |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * @return bool |
675 | 675 | */ |
676 | 676 | private function isOverwriteCondition(string $type = ''): bool { |
677 | - $regex = '/' . $this->config->getSystemValue('overwritecondaddr', '') . '/'; |
|
677 | + $regex = '/'.$this->config->getSystemValue('overwritecondaddr', '').'/'; |
|
678 | 678 | $remoteAddr = isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : ''; |
679 | 679 | return $regex === '//' || preg_match($regex, $remoteAddr) === 1 |
680 | 680 | || $type !== 'protocol'; |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | * @return string Server protocol (http or https) |
687 | 687 | */ |
688 | 688 | public function getServerProtocol(): string { |
689 | - if($this->config->getSystemValue('overwriteprotocol') !== '' |
|
689 | + if ($this->config->getSystemValue('overwriteprotocol') !== '' |
|
690 | 690 | && $this->isOverwriteCondition('protocol')) { |
691 | 691 | return $this->config->getSystemValue('overwriteprotocol'); |
692 | 692 | } |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | 'HTTP/2', |
733 | 733 | ]; |
734 | 734 | |
735 | - if(\in_array($claimedProtocol, $validProtocols, true)) { |
|
735 | + if (\in_array($claimedProtocol, $validProtocols, true)) { |
|
736 | 736 | return $claimedProtocol; |
737 | 737 | } |
738 | 738 | |
@@ -746,8 +746,8 @@ discard block |
||
746 | 746 | */ |
747 | 747 | public function getRequestUri(): string { |
748 | 748 | $uri = isset($this->server['REQUEST_URI']) ? $this->server['REQUEST_URI'] : ''; |
749 | - if($this->config->getSystemValue('overwritewebroot') !== '' && $this->isOverwriteCondition()) { |
|
750 | - $uri = $this->getScriptName() . substr($uri, \strlen($this->server['SCRIPT_NAME'])); |
|
749 | + if ($this->config->getSystemValue('overwritewebroot') !== '' && $this->isOverwriteCondition()) { |
|
750 | + $uri = $this->getScriptName().substr($uri, \strlen($this->server['SCRIPT_NAME'])); |
|
751 | 751 | } |
752 | 752 | return $uri; |
753 | 753 | } |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | // FIXME: Sabre does not really belong here |
775 | 775 | list($path, $name) = \Sabre\Uri\split($scriptName); |
776 | 776 | if (!empty($path)) { |
777 | - if($path === $pathInfo || strpos($pathInfo, $path.'/') === 0) { |
|
777 | + if ($path === $pathInfo || strpos($pathInfo, $path.'/') === 0) { |
|
778 | 778 | $pathInfo = substr($pathInfo, \strlen($path)); |
779 | 779 | } else { |
780 | 780 | throw new \Exception("The requested uri($requestUri) cannot be processed by the script '$scriptName')"); |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | if ($name !== '' && strpos($pathInfo, $name) === 0) { |
791 | 791 | $pathInfo = substr($pathInfo, \strlen($name)); |
792 | 792 | } |
793 | - if($pathInfo === false || $pathInfo === '/'){ |
|
793 | + if ($pathInfo === false || $pathInfo === '/') { |
|
794 | 794 | return ''; |
795 | 795 | } else { |
796 | 796 | return $pathInfo; |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | $pathInfo = rawurldecode($pathInfo); |
809 | 809 | $encoding = mb_detect_encoding($pathInfo, ['UTF-8', 'ISO-8859-1']); |
810 | 810 | |
811 | - switch($encoding) { |
|
811 | + switch ($encoding) { |
|
812 | 812 | case 'ISO-8859-1' : |
813 | 813 | $pathInfo = utf8_encode($pathInfo); |
814 | 814 | } |
@@ -824,12 +824,12 @@ discard block |
||
824 | 824 | */ |
825 | 825 | public function getScriptName(): string { |
826 | 826 | $name = $this->server['SCRIPT_NAME']; |
827 | - $overwriteWebRoot = $this->config->getSystemValue('overwritewebroot'); |
|
827 | + $overwriteWebRoot = $this->config->getSystemValue('overwritewebroot'); |
|
828 | 828 | if ($overwriteWebRoot !== '' && $this->isOverwriteCondition()) { |
829 | 829 | // FIXME: This code is untestable due to __DIR__, also that hardcoded path is really dangerous |
830 | 830 | $serverRoot = str_replace('\\', '/', substr(__DIR__, 0, -\strlen('lib/private/appframework/http/'))); |
831 | 831 | $suburi = str_replace('\\', '/', substr(realpath($this->server['SCRIPT_FILENAME']), \strlen($serverRoot))); |
832 | - $name = '/' . ltrim($overwriteWebRoot . $suburi, '/'); |
|
832 | + $name = '/'.ltrim($overwriteWebRoot.$suburi, '/'); |
|
833 | 833 | } |
834 | 834 | return $name; |
835 | 835 | } |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | return $host; |
900 | 900 | } else { |
901 | 901 | $trustedList = $this->config->getSystemValue('trusted_domains', []); |
902 | - if(!empty($trustedList)) { |
|
902 | + if (!empty($trustedList)) { |
|
903 | 903 | return $trustedList[0]; |
904 | 904 | } else { |
905 | 905 | return ''; |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | * isn't met |
915 | 915 | */ |
916 | 916 | private function getOverwriteHost() { |
917 | - if($this->config->getSystemValue('overwritehost') !== '' && $this->isOverwriteCondition()) { |
|
917 | + if ($this->config->getSystemValue('overwritehost') !== '' && $this->isOverwriteCondition()) { |
|
918 | 918 | return $this->config->getSystemValue('overwritehost'); |
919 | 919 | } |
920 | 920 | return null; |
@@ -39,7 +39,7 @@ |
||
39 | 39 | ], |
40 | 40 | [ |
41 | 41 | '<a target="_blank" href="../apps/office/calendar">', |
42 | - '<a target="_blank" href="' . link_to_docs('user-sync-calendars') . '" rel="noreferrer noopener">', |
|
42 | + '<a target="_blank" href="'.link_to_docs('user-sync-calendars').'" rel="noreferrer noopener">', |
|
43 | 43 | '</a>', |
44 | 44 | ], |
45 | 45 | $l->t('Also install the {calendarappstoreopen}Calendar app{linkclose}, or {calendardocopen}connect your desktop & mobile for syncing ↗{linkclose}.') |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | * @return string short footer |
91 | 91 | */ |
92 | 92 | public function getShortFooter() { |
93 | - $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
94 | - '<br/>' . $this->getSlogan(); |
|
93 | + $footer = '© '.date('Y').' <a href="'.$this->getBaseUrl().'" target="_blank">'.$this->getEntity().'</a>'. |
|
94 | + '<br/>'.$this->getSlogan(); |
|
95 | 95 | |
96 | 96 | return $footer; |
97 | 97 | } |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | * @return string long footer |
102 | 102 | */ |
103 | 103 | public function getLongFooter() { |
104 | - $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
105 | - '<br/>' . $this->getSlogan(); |
|
104 | + $footer = '© '.date('Y').' <a href="'.$this->getBaseUrl().'" target="_blank">'.$this->getEntity().'</a>'. |
|
105 | + '<br/>'.$this->getSlogan(); |
|
106 | 106 | |
107 | 107 | return $footer; |
108 | 108 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @return string documentation link |
113 | 113 | */ |
114 | 114 | public function buildDocLinkToKey($key) { |
115 | - return $this->getDocBaseUrl() . '/server/15/go.php?to=' . $key; |
|
115 | + return $this->getDocBaseUrl().'/server/15/go.php?to='.$key; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 |
@@ -110,7 +110,7 @@ |
||
110 | 110 | */ |
111 | 111 | public function clearCachedAvatars() { |
112 | 112 | $users = $this->config->getUsersForUserValue('avatar', 'generated', 'true'); |
113 | - foreach($users as $userId) { |
|
113 | + foreach ($users as $userId) { |
|
114 | 114 | try { |
115 | 115 | $folder = $this->appData->getFolder($userId); |
116 | 116 | $folder->delete(); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | - $folders = array_filter($folders, function (ISimpleFolder $folder) { |
|
70 | + $folders = array_filter($folders, function(ISimpleFolder $folder) { |
|
71 | 71 | return $folder->fileExists('photo.'); |
72 | 72 | }); |
73 | 73 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
78 | - $output->info('Delete ' . count($folders) . ' "photo." files'); |
|
78 | + $output->info('Delete '.count($folders).' "photo." files'); |
|
79 | 79 | |
80 | 80 | foreach ($folders as $folder) { |
81 | 81 | try { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $folder->getFile('photo.')->delete(); |
84 | 84 | } catch (\Exception $e) { |
85 | 85 | $this->logger->logException($e); |
86 | - $output->warning('Could not delete file "dav-photocache/' . $folder->getName() . '/photo."'); |
|
86 | + $output->warning('Could not delete file "dav-photocache/'.$folder->getName().'/photo."'); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | private function getCutoff($expire) { |
83 | 83 | $d1 = new \DateTime(); |
84 | 84 | $d2 = clone $d1; |
85 | - $d2->sub(new \DateInterval('PT' . $expire . 'S')); |
|
85 | + $d2->sub(new \DateInterval('PT'.$expire.'S')); |
|
86 | 86 | return $d2->diff($d1); |
87 | 87 | } |
88 | 88 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $ip, |
99 | 99 | array $metadata = []) { |
100 | 100 | // No need to log if the bruteforce protection is disabled |
101 | - if($this->config->getSystemValue('auth.bruteforce.protection.enabled', true) === false) { |
|
101 | + if ($this->config->getSystemValue('auth.bruteforce.protection.enabled', true) === false) { |
|
102 | 102 | return; |
103 | 103 | } |
104 | 104 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $values = [ |
107 | 107 | 'action' => $action, |
108 | 108 | 'occurred' => $this->timeFactory->getTime(), |
109 | - 'ip' => (string)$ipAddress, |
|
109 | + 'ip' => (string) $ipAddress, |
|
110 | 110 | 'subnet' => $ipAddress->getSubnet(), |
111 | 111 | 'metadata' => json_encode($metadata), |
112 | 112 | ]; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $qb = $this->db->getQueryBuilder(); |
126 | 126 | $qb->insert('bruteforce_attempts'); |
127 | - foreach($values as $column => $value) { |
|
127 | + foreach ($values as $column => $value) { |
|
128 | 128 | $qb->setValue($column, $qb->createNamedParameter($value)); |
129 | 129 | } |
130 | 130 | $qb->execute(); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return bool |
138 | 138 | */ |
139 | 139 | private function isIPWhitelisted($ip) { |
140 | - if($this->config->getSystemValue('auth.bruteforce.protection.enabled', true) === false) { |
|
140 | + if ($this->config->getSystemValue('auth.bruteforce.protection.enabled', true) === false) { |
|
141 | 141 | return true; |
142 | 142 | } |
143 | 143 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | $cx = explode('/', $cidr); |
164 | 164 | $addr = $cx[0]; |
165 | - $mask = (int)$cx[1]; |
|
165 | + $mask = (int) $cx[1]; |
|
166 | 166 | |
167 | 167 | // Do not compare ipv4 to ipv6 |
168 | 168 | if (($type === 4 && !filter_var($addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) || |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | $addr = inet_pton($addr); |
174 | 174 | |
175 | 175 | $valid = true; |
176 | - for($i = 0; $i < $mask; $i++) { |
|
177 | - $part = ord($addr[(int)($i/8)]); |
|
178 | - $orig = ord($ip[(int)($i/8)]); |
|
176 | + for ($i = 0; $i < $mask; $i++) { |
|
177 | + $part = ord($addr[(int) ($i / 8)]); |
|
178 | + $orig = ord($ip[(int) ($i / 8)]); |
|
179 | 179 | |
180 | 180 | $bitmask = 1 << (7 - ($i % 8)); |
181 | 181 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function getDelay($ip, $action = '') { |
208 | 208 | $ipAddress = new IpAddress($ip); |
209 | - if ($this->isIPWhitelisted((string)$ipAddress)) { |
|
209 | + if ($this->isIPWhitelisted((string) $ipAddress)) { |
|
210 | 210 | return 0; |
211 | 211 | } |
212 | 212 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | $maxDelay = 25; |
234 | 234 | $firstDelay = 0.1; |
235 | - if ($attempts > (8 * PHP_INT_SIZE - 1)) { |
|
235 | + if ($attempts > (8 * PHP_INT_SIZE - 1)) { |
|
236 | 236 | // Don't ever overflow. Just assume the maxDelay time:s |
237 | 237 | $firstDelay = $maxDelay; |
238 | 238 | } else { |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function resetDelay($ip, $action, $metadata) { |
255 | 255 | $ipAddress = new IpAddress($ip); |
256 | - if ($this->isIPWhitelisted((string)$ipAddress)) { |
|
256 | + if ($this->isIPWhitelisted((string) $ipAddress)) { |
|
257 | 257 | return; |
258 | 258 | } |
259 | 259 |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | */ ?> |
13 | 13 | <input type="hidden" name="permissions" value="" id="permissions"> |
14 | 14 | <input type="hidden" id="free_space" value="<?php isset($_['freeSpace']) ? p($_['freeSpace']) : '' ?>"> |
15 | - <?php if(isset($_['dirToken'])):?> |
|
15 | + <?php if (isset($_['dirToken'])):?> |
|
16 | 16 | <input type="hidden" id="publicUploadRequestToken" name="requesttoken" value="<?php p($_['requesttoken']) ?>" /> |
17 | 17 | <input type="hidden" id="dirToken" name="dirToken" value="<?php p($_['dirToken']) ?>" /> |
18 | - <?php endif;?> |
|
18 | + <?php endif; ?> |
|
19 | 19 | <input type="hidden" class="max_human_file_size" |
20 | 20 | value="(max <?php isset($_['uploadMaxHumanFilesize']) ? p($_['uploadMaxHumanFilesize']) : ''; ?>)"> |
21 | 21 | </div> |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | <th id='headerName' class="hidden column-name"> |
44 | 44 | <div id="headerName-container"> |
45 | 45 | <a class="name sort columntitle" data-sort="name"> |
46 | - <span><?php p($l->t( 'Name' )); ?></span> |
|
46 | + <span><?php p($l->t('Name')); ?></span> |
|
47 | 47 | <span class="sort-indicator"></span> |
48 | 48 | |
49 | 49 | </a> |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | <a class="size sort columntitle" data-sort="size"><span><?php p($l->t('Size')); ?></span><span class="sort-indicator"></span></a> |
60 | 60 | </th> |
61 | 61 | <th id="headerDate" class="hidden column-mtime"> |
62 | - <a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t( 'Modified' )); ?></span><span class="sort-indicator"></span></a> |
|
62 | + <a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t('Modified')); ?></span><span class="sort-indicator"></span></a> |
|
63 | 63 | </th> |
64 | 64 | </tr> |
65 | 65 | </thead> |
@@ -75,6 +75,6 @@ discard block |
||
75 | 75 | <div id="editor"></div><!-- FIXME Do not use this div in your app! It is deprecated and will be removed in the future! --> |
76 | 76 | <div id="uploadsize-message" title="<?php p($l->t('Upload too large'))?>"> |
77 | 77 | <p> |
78 | - <?php p($l->t('The files you are trying to upload exceed the maximum size for file uploads on this server.'));?> |
|
78 | + <?php p($l->t('The files you are trying to upload exceed the maximum size for file uploads on this server.')); ?> |
|
79 | 79 | </p> |
80 | 80 | </div> |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @param $uid |
142 | 142 | */ |
143 | 143 | public function invalidate($uid) { |
144 | - if(!isset($this->usersByUid[$uid])) { |
|
144 | + if (!isset($this->usersByUid[$uid])) { |
|
145 | 145 | return; |
146 | 146 | } |
147 | 147 | $dn = $this->usersByUid[$uid]->getDN(); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @return null |
156 | 156 | */ |
157 | 157 | private function checkAccess() { |
158 | - if(is_null($this->access)) { |
|
158 | + if (is_null($this->access)) { |
|
159 | 159 | throw new \Exception('LDAP Access instance must be set first'); |
160 | 160 | } |
161 | 161 | } |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | ]; |
180 | 180 | |
181 | 181 | $homeRule = $this->access->getConnection()->homeFolderNamingRule; |
182 | - if(strpos($homeRule, 'attr:') === 0) { |
|
182 | + if (strpos($homeRule, 'attr:') === 0) { |
|
183 | 183 | $attributes[] = substr($homeRule, strlen('attr:')); |
184 | 184 | } |
185 | 185 | |
186 | - if(!$minimal) { |
|
186 | + if (!$minimal) { |
|
187 | 187 | // attributes that are not really important but may come with big |
188 | 188 | // payload. |
189 | 189 | $attributes = array_merge( |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | |
195 | 195 | $attributes = array_reduce($attributes, |
196 | 196 | function($list, $attribute) { |
197 | - $attribute = strtolower(trim((string)$attribute)); |
|
198 | - if(!empty($attribute) && !in_array($attribute, $list)) { |
|
197 | + $attribute = strtolower(trim((string) $attribute)); |
|
198 | + if (!empty($attribute) && !in_array($attribute, $list)) { |
|
199 | 199 | $list[] = $attribute; |
200 | 200 | } |
201 | 201 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | public function isDeletedUser($id) { |
216 | 216 | $isDeleted = $this->ocConfig->getUserValue( |
217 | 217 | $id, 'user_ldap', 'isDeleted', 0); |
218 | - return (int)$isDeleted === 1; |
|
218 | + return (int) $isDeleted === 1; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | */ |
239 | 239 | protected function createInstancyByUserName($id) { |
240 | 240 | //most likely a uid. Check whether it is a deleted user |
241 | - if($this->isDeletedUser($id)) { |
|
241 | + if ($this->isDeletedUser($id)) { |
|
242 | 242 | return $this->getDeletedUser($id); |
243 | 243 | } |
244 | 244 | $dn = $this->access->username2dn($id); |
245 | - if($dn !== false) { |
|
245 | + if ($dn !== false) { |
|
246 | 246 | return $this->createAndCache($dn, $id); |
247 | 247 | } |
248 | 248 | return null; |
@@ -256,15 +256,15 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function get($id) { |
258 | 258 | $this->checkAccess(); |
259 | - if(isset($this->usersByDN[$id])) { |
|
259 | + if (isset($this->usersByDN[$id])) { |
|
260 | 260 | return $this->usersByDN[$id]; |
261 | - } else if(isset($this->usersByUid[$id])) { |
|
261 | + } else if (isset($this->usersByUid[$id])) { |
|
262 | 262 | return $this->usersByUid[$id]; |
263 | 263 | } |
264 | 264 | |
265 | - if($this->access->stringResemblesDN($id) ) { |
|
265 | + if ($this->access->stringResemblesDN($id)) { |
|
266 | 266 | $uid = $this->access->dn2username($id); |
267 | - if($uid !== false) { |
|
267 | + if ($uid !== false) { |
|
268 | 268 | return $this->createAndCache($id, $uid); |
269 | 269 | } |
270 | 270 | } |