@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function getThemedIcon($app, $image) { |
99 | 99 | try { |
100 | - $iconFile = $this->imageManager->getCachedImage("icon-" . $app . '-' . str_replace("/","_",$image)); |
|
100 | + $iconFile = $this->imageManager->getCachedImage("icon-".$app.'-'.str_replace("/", "_", $image)); |
|
101 | 101 | } catch (NotFoundException $exception) { |
102 | 102 | $icon = $this->iconBuilder->colorSvg($app, $image); |
103 | 103 | if ($icon === false || $icon === "") { |
104 | 104 | return new NotFoundResponse(); |
105 | 105 | } |
106 | - $iconFile = $this->imageManager->setCachedImage("icon-" . $app . '-' . str_replace("/","_",$image), $icon); |
|
106 | + $iconFile = $this->imageManager->setCachedImage("icon-".$app.'-'.str_replace("/", "_", $image), $icon); |
|
107 | 107 | } |
108 | 108 | if ($iconFile !== false) { |
109 | 109 | $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); |
@@ -132,17 +132,17 @@ discard block |
||
132 | 132 | $response = null; |
133 | 133 | if ($this->themingDefaults->shouldReplaceIcons()) { |
134 | 134 | try { |
135 | - $iconFile = $this->imageManager->getCachedImage('favIcon-' . $app); |
|
135 | + $iconFile = $this->imageManager->getCachedImage('favIcon-'.$app); |
|
136 | 136 | } catch (NotFoundException $exception) { |
137 | 137 | $icon = $this->iconBuilder->getFavicon($app); |
138 | - $iconFile = $this->imageManager->setCachedImage('favIcon-' . $app, $icon); |
|
138 | + $iconFile = $this->imageManager->setCachedImage('favIcon-'.$app, $icon); |
|
139 | 139 | } |
140 | 140 | if ($iconFile !== false) { |
141 | 141 | $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); |
142 | 142 | } |
143 | 143 | } |
144 | - if($response === null) { |
|
145 | - $fallbackLogo = \OC::$SERVERROOT . '/core/img/favicon.png'; |
|
144 | + if ($response === null) { |
|
145 | + $fallbackLogo = \OC::$SERVERROOT.'/core/img/favicon.png'; |
|
146 | 146 | $response = new DataDisplayResponse($this->fileAccessHelper->file_get_contents($fallbackLogo), Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); |
147 | 147 | } |
148 | 148 | $response->cacheFor(86400); |
@@ -167,17 +167,17 @@ discard block |
||
167 | 167 | $response = null; |
168 | 168 | if ($this->themingDefaults->shouldReplaceIcons()) { |
169 | 169 | try { |
170 | - $iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app); |
|
170 | + $iconFile = $this->imageManager->getCachedImage('touchIcon-'.$app); |
|
171 | 171 | } catch (NotFoundException $exception) { |
172 | 172 | $icon = $this->iconBuilder->getTouchIcon($app); |
173 | - $iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app, $icon); |
|
173 | + $iconFile = $this->imageManager->setCachedImage('touchIcon-'.$app, $icon); |
|
174 | 174 | } |
175 | 175 | if ($iconFile !== false) { |
176 | 176 | $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']); |
177 | 177 | } |
178 | 178 | } |
179 | - if($response === null) { |
|
180 | - $fallbackLogo = \OC::$SERVERROOT . '/core/img/favicon-touch.png'; |
|
179 | + if ($response === null) { |
|
180 | + $fallbackLogo = \OC::$SERVERROOT.'/core/img/favicon-touch.png'; |
|
181 | 181 | $response = new DataDisplayResponse($this->fileAccessHelper->file_get_contents($fallbackLogo), Http::STATUS_OK, ['Content-Type' => 'image/png']); |
182 | 182 | } |
183 | 183 | $response->cacheFor(86400); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $result = $qb->execute(); |
50 | 50 | $row = $result->fetch(); |
51 | 51 | $result->closeCursor(); |
52 | - if($row === false) { |
|
52 | + if ($row === false) { |
|
53 | 53 | throw new ClientNotFoundException(); |
54 | 54 | } |
55 | 55 | return Client::fromRow($row); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $result = $qb->execute(); |
70 | 70 | $row = $result->fetch(); |
71 | 71 | $result->closeCursor(); |
72 | - if($row === false) { |
|
72 | + if ($row === false) { |
|
73 | 73 | throw new ClientNotFoundException(); |
74 | 74 | } |
75 | 75 | return Client::fromRow($row); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $result = $qb->execute(); |
50 | 50 | $row = $result->fetch(); |
51 | 51 | $result->closeCursor(); |
52 | - if($row === false) { |
|
52 | + if ($row === false) { |
|
53 | 53 | throw new AccessTokenNotFoundException(); |
54 | 54 | } |
55 | 55 | return AccessToken::fromRow($row); |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | */ |
171 | 171 | private function requiresCSRFCheck() { |
172 | 172 | // GET requires no check at all |
173 | - if($this->request->getMethod() === 'GET') { |
|
173 | + if ($this->request->getMethod() === 'GET') { |
|
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | |
177 | 177 | // Official Nextcloud clients require no checks |
178 | - if($this->request->isUserAgent([ |
|
178 | + if ($this->request->isUserAgent([ |
|
179 | 179 | IRequest::USER_AGENT_CLIENT_DESKTOP, |
180 | 180 | IRequest::USER_AGENT_CLIENT_ANDROID, |
181 | 181 | IRequest::USER_AGENT_CLIENT_IOS, |
@@ -184,17 +184,17 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | // If not logged-in no check is required |
187 | - if(!$this->userSession->isLoggedIn()) { |
|
187 | + if (!$this->userSession->isLoggedIn()) { |
|
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | |
191 | 191 | // POST always requires a check |
192 | - if($this->request->getMethod() === 'POST') { |
|
192 | + if ($this->request->getMethod() === 'POST') { |
|
193 | 193 | return true; |
194 | 194 | } |
195 | 195 | |
196 | 196 | // If logged-in AND DAV authenticated no check is required |
197 | - if($this->userSession->isLoggedIn() && |
|
197 | + if ($this->userSession->isLoggedIn() && |
|
198 | 198 | $this->isDavAuthenticated($this->userSession->getUser()->getUID())) { |
199 | 199 | return false; |
200 | 200 | } |
@@ -211,10 +211,10 @@ discard block |
||
211 | 211 | private function auth(RequestInterface $request, ResponseInterface $response) { |
212 | 212 | $forcedLogout = false; |
213 | 213 | |
214 | - if(!$this->request->passesCSRFCheck() && |
|
214 | + if (!$this->request->passesCSRFCheck() && |
|
215 | 215 | $this->requiresCSRFCheck()) { |
216 | 216 | // In case of a fail with POST we need to recheck the credentials |
217 | - if($this->request->getMethod() === 'POST') { |
|
217 | + if ($this->request->getMethod() === 'POST') { |
|
218 | 218 | $forcedLogout = true; |
219 | 219 | } else { |
220 | 220 | $response->setStatus(401); |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - if($forcedLogout) { |
|
225 | + if ($forcedLogout) { |
|
226 | 226 | $this->userSession->logout(); |
227 | 227 | } else { |
228 | - if($this->twoFactorManager->needsSecondFactor($this->userSession->getUser())) { |
|
228 | + if ($this->twoFactorManager->needsSecondFactor($this->userSession->getUser())) { |
|
229 | 229 | throw new \Sabre\DAV\Exception\NotAuthenticated('2FA challenge not passed.'); |
230 | 230 | } |
231 | 231 | if (\OC_User::handleApacheAuth() || |
@@ -238,19 +238,19 @@ discard block |
||
238 | 238 | \OC_Util::setupFS($user); |
239 | 239 | $this->currentUser = $user; |
240 | 240 | $this->session->close(); |
241 | - return [true, $this->principalPrefix . $user]; |
|
241 | + return [true, $this->principalPrefix.$user]; |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | 245 | if (!$this->userSession->isLoggedIn() && in_array('XMLHttpRequest', explode(',', $request->getHeader('X-Requested-With')))) { |
246 | 246 | // do not re-authenticate over ajax, use dummy auth name to prevent browser popup |
247 | - $response->addHeader('WWW-Authenticate','DummyBasic realm="' . $this->realm . '"'); |
|
247 | + $response->addHeader('WWW-Authenticate', 'DummyBasic realm="'.$this->realm.'"'); |
|
248 | 248 | $response->setStatus(401); |
249 | 249 | throw new \Sabre\DAV\Exception\NotAuthenticated('Cannot authenticate over ajax calls'); |
250 | 250 | } |
251 | 251 | |
252 | 252 | $data = parent::check($request, $response); |
253 | - if($data[0] === true) { |
|
253 | + if ($data[0] === true) { |
|
254 | 254 | $startPos = strrpos($data[1], '/') + 1; |
255 | 255 | $user = $this->userSession->getUser()->getUID(); |
256 | 256 | $data[1] = substr_replace($data[1], $user, $startPos); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | private function setupUserFs($userId) { |
56 | 56 | \OC_Util::setupFS($userId); |
57 | 57 | $this->session->close(); |
58 | - return $this->principalPrefix . $userId; |
|
58 | + return $this->principalPrefix.$userId; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | public function validateBearerToken($bearerToken) { |
65 | 65 | \OC_Util::setupFS(); |
66 | 66 | |
67 | - if(!$this->userSession->isLoggedIn()) { |
|
67 | + if (!$this->userSession->isLoggedIn()) { |
|
68 | 68 | $this->userSession->tryTokenLogin($this->request); |
69 | 69 | } |
70 | - if($this->userSession->isLoggedIn()) { |
|
70 | + if ($this->userSession->isLoggedIn()) { |
|
71 | 71 | return $this->setupUserFs($this->userSession->getUser()->getUID()); |
72 | 72 | } |
73 | 73 |
@@ -71,26 +71,26 @@ |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | $app = substr($script, 0, strpos($script, '/')); |
74 | - $script = substr($script, strpos($script, '/')+1); |
|
74 | + $script = substr($script, strpos($script, '/') + 1); |
|
75 | 75 | $app_path = \OC_App::getAppPath($app); |
76 | 76 | $app_url = \OC_App::getAppWebPath($app); |
77 | 77 | |
78 | 78 | // missing translations files fill be ignored |
79 | 79 | if (strpos($script, 'l10n/') === 0) { |
80 | - $this->appendIfExist($app_path, $script . '.js', $app_url); |
|
80 | + $this->appendIfExist($app_path, $script.'.js', $app_url); |
|
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
84 | 84 | if ($app_path === false && $app_url === false) { |
85 | 85 | $this->logger->error('Could not find resource {resource} to load', [ |
86 | - 'resource' => $app . '/' . $script . '.js', |
|
86 | + 'resource' => $app.'/'.$script.'.js', |
|
87 | 87 | 'app' => 'jsresourceloader', |
88 | 88 | ]); |
89 | 89 | return; |
90 | 90 | } |
91 | 91 | |
92 | 92 | if (!$this->cacheAndAppendCombineJsonIfExist($app_path, $script.'.json', $app)) { |
93 | - $this->append($app_path, $script . '.js', $app_url); |
|
93 | + $this->append($app_path, $script.'.js', $app_url); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $app = new \OCP\AppFramework\App('theming'); |
27 | 27 | /** @var \OCA\Theming\Util $util */ |
28 | 28 | $util = $app->getContainer()->query(\OCA\Theming\Util::class); |
29 | -if(!$util->isAlreadyThemed()) { |
|
29 | +if (!$util->isAlreadyThemed()) { |
|
30 | 30 | |
31 | 31 | $app->getContainer()->registerCapability(\OCA\Theming\Capabilities::class); |
32 | 32 |
@@ -70,34 +70,34 @@ |
||
70 | 70 | |
71 | 71 | $status = 'error'; |
72 | 72 | $message = 'no valid init status'; |
73 | - switch( $this->session->getStatus()) { |
|
73 | + switch ($this->session->getStatus()) { |
|
74 | 74 | case Session::RUN_MIGRATION: |
75 | 75 | $status = 'interactionNeeded'; |
76 | - $message = (string)$this->l->t( |
|
76 | + $message = (string) $this->l->t( |
|
77 | 77 | 'You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please run \'occ encryption:migrate\' or contact your administrator' |
78 | 78 | ); |
79 | 79 | break; |
80 | 80 | case Session::INIT_EXECUTED: |
81 | 81 | $status = 'interactionNeeded'; |
82 | - $message = (string)$this->l->t( |
|
82 | + $message = (string) $this->l->t( |
|
83 | 83 | 'Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files.' |
84 | 84 | ); |
85 | 85 | break; |
86 | 86 | case Session::NOT_INITIALIZED: |
87 | 87 | $status = 'interactionNeeded'; |
88 | 88 | if ($this->encryptionManager->isEnabled()) { |
89 | - $message = (string)$this->l->t( |
|
89 | + $message = (string) $this->l->t( |
|
90 | 90 | 'Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again.' |
91 | 91 | ); |
92 | 92 | } else { |
93 | - $message = (string)$this->l->t( |
|
93 | + $message = (string) $this->l->t( |
|
94 | 94 | 'Please enable server side encryption in the admin settings in order to use the encryption module.' |
95 | 95 | ); |
96 | 96 | } |
97 | 97 | break; |
98 | 98 | case Session::INIT_SUCCESSFUL: |
99 | 99 | $status = 'success'; |
100 | - $message = (string)$this->l->t('Encryption app is enabled and ready'); |
|
100 | + $message = (string) $this->l->t('Encryption app is enabled and ready'); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | return new DataResponse( |
@@ -67,7 +67,7 @@ |
||
67 | 67 | |
68 | 68 | $isMasterKeyEnabled = $this->util->isMasterKeyEnabled(); |
69 | 69 | |
70 | - if(!$isMasterKeyEnabled) { |
|
70 | + if (!$isMasterKeyEnabled) { |
|
71 | 71 | $output->writeln('Master key already disabled'); |
72 | 72 | } else { |
73 | 73 | $question = new ConfirmationQuestion( |