@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $token = $argument['token']; |
106 | 106 | $action = $argument['action']; |
107 | 107 | $data = json_decode($argument['data'], true); |
108 | - $try = (int)$argument['try'] + 1; |
|
108 | + $try = (int) $argument['try'] + 1; |
|
109 | 109 | |
110 | 110 | $result = $this->notifications->sendUpdateToRemote($remote, $remoteId, $token, $action, $data, $try); |
111 | 111 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | 'token' => $argument['token'], |
129 | 129 | 'data' => $argument['data'], |
130 | 130 | 'action' => $argument['action'], |
131 | - 'try' => (int)$argument['try'] + 1, |
|
131 | + 'try' => (int) $argument['try'] + 1, |
|
132 | 132 | 'lastRun' => time() |
133 | 133 | ] |
134 | 134 | ); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @return bool |
142 | 142 | */ |
143 | 143 | protected function shouldRun(array $argument) { |
144 | - $lastRun = (int)$argument['lastRun']; |
|
144 | + $lastRun = (int) $argument['lastRun']; |
|
145 | 145 | return ((time() - $lastRun) > $this->interval); |
146 | 146 | } |
147 | 147 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | public function generateToken() { |
56 | 56 | $token = $this->secureRandom->generate( |
57 | 57 | self::TOKEN_LENGTH, |
58 | - ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS); |
|
58 | + ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS); |
|
59 | 59 | return $token; |
60 | 60 | } |
61 | 61 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @package OCA\Federation\Controller |
46 | 46 | */ |
47 | -class OCSAuthAPIController extends OCSController{ |
|
47 | +class OCSAuthAPIController extends OCSController { |
|
48 | 48 | |
49 | 49 | /** @var ISecureRandom */ |
50 | 50 | private $secureRandom; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function requestSharedSecret($url, $token) { |
105 | 105 | if ($this->trustedServers->isTrustedServer($url) === false) { |
106 | - $this->logger->error('remote server not trusted (' . $url . ') while requesting shared secret', ['app' => 'federation']); |
|
106 | + $this->logger->error('remote server not trusted ('.$url.') while requesting shared secret', ['app' => 'federation']); |
|
107 | 107 | throw new OCSForbiddenException(); |
108 | 108 | } |
109 | 109 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $localToken = $this->dbHandler->getToken($url); |
113 | 113 | if (strcmp($localToken, $token) > 0) { |
114 | 114 | $this->logger->info( |
115 | - 'remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.', |
|
115 | + 'remote server ('.$url.') presented lower token. We will initiate the exchange of the shared secret.', |
|
116 | 116 | ['app' => 'federation'] |
117 | 117 | ); |
118 | 118 | throw new OCSForbiddenException(); |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function getSharedSecret($url, $token) { |
153 | 153 | if ($this->trustedServers->isTrustedServer($url) === false) { |
154 | - $this->logger->error('remote server not trusted (' . $url . ') while getting shared secret', ['app' => 'federation']); |
|
154 | + $this->logger->error('remote server not trusted ('.$url.') while getting shared secret', ['app' => 'federation']); |
|
155 | 155 | throw new OCSForbiddenException(); |
156 | 156 | } |
157 | 157 | |
158 | 158 | if ($this->isValidToken($url, $token) === false) { |
159 | 159 | $expectedToken = $this->dbHandler->getToken($url); |
160 | 160 | $this->logger->error( |
161 | - 'remote server (' . $url . ') didn\'t send a valid token (got "' . $token . '" but expected "'. $expectedToken . '") while getting shared secret', |
|
161 | + 'remote server ('.$url.') didn\'t send a valid token (got "'.$token.'" but expected "'.$expectedToken.'") while getting shared secret', |
|
162 | 162 | ['app' => 'federation'] |
163 | 163 | ); |
164 | 164 | throw new OCSForbiddenException(); |
@@ -82,7 +82,7 @@ |
||
82 | 82 | ); |
83 | 83 | }); |
84 | 84 | |
85 | - $container->registerService('SettingsController', function (IAppContainer $c) { |
|
85 | + $container->registerService('SettingsController', function(IAppContainer $c) { |
|
86 | 86 | $server = $c->getServer(); |
87 | 87 | return new SettingsController( |
88 | 88 | $c->getAppName(), |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $progress->start(); |
61 | 61 | $this->syncService->syncThemAll(function($url, $ex) use ($progress, $output) { |
62 | 62 | if ($ex instanceof \Exception) { |
63 | - $output->writeln("Error while syncing $url : " . $ex->getMessage()); |
|
63 | + $output->writeln("Error while syncing $url : ".$ex->getMessage()); |
|
64 | 64 | |
65 | 65 | } else { |
66 | 66 | $progress->advance(); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $client = $this->httpClientService->newClient(); |
222 | 222 | try { |
223 | 223 | $result = $client->get( |
224 | - $url . '/status.php', |
|
224 | + $url.'/status.php', |
|
225 | 225 | [ |
226 | 226 | 'timeout' => 3, |
227 | 227 | 'connect_timeout' => 3, |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | } |
234 | 234 | } catch (\Exception $e) { |
235 | - $this->logger->debug('No Nextcloud server: ' . $e->getMessage()); |
|
235 | + $this->logger->debug('No Nextcloud server: '.$e->getMessage()); |
|
236 | 236 | return false; |
237 | 237 | } |
238 | 238 | |
@@ -273,6 +273,6 @@ discard block |
||
273 | 273 | |
274 | 274 | } |
275 | 275 | |
276 | - return 'https://' . $url; |
|
276 | + return 'https://'.$url; |
|
277 | 277 | } |
278 | 278 | } |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | $result = $query->execute(); |
88 | 88 | |
89 | 89 | if ($result) { |
90 | - return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable); |
|
90 | + return (int) $this->connection->lastInsertId('*PREFIX*'.$this->dbTable); |
|
91 | 91 | } else { |
92 | - $message = 'Internal failure, Could not add trusted server: ' . $url; |
|
92 | + $message = 'Internal failure, Could not add trusted server: '.$url; |
|
93 | 93 | $message_t = $this->IL10N->t('Could not add server'); |
94 | 94 | throw new HintException($message, $message_t); |
95 | 95 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $result = $query->execute()->fetchAll(); |
125 | 125 | |
126 | 126 | if (empty($result)) { |
127 | - throw new \Exception('No Server found with ID: ' . $id); |
|
127 | + throw new \Exception('No Server found with ID: '.$id); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | return $result[0]; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $result = $query->execute()->fetch(); |
194 | 194 | |
195 | 195 | if (!isset($result['token'])) { |
196 | - throw new \Exception('No token found for: ' . $url); |
|
196 | + throw new \Exception('No token found for: '.$url); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | return $result['token']; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | ->setParameter('url_hash', $hash); |
267 | 267 | |
268 | 268 | $result = $query->execute()->fetch(); |
269 | - return (int)$result['status']; |
|
269 | + return (int) $result['status']; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $ss = $app->getSyncService(); |
38 | 38 | $ss->syncThemAll(function($url, $ex) { |
39 | 39 | if ($ex instanceof \Exception) { |
40 | - \OC::$server->getLogger()->error("Error while syncing $url : " . $ex->getMessage(), ['app' => 'fed-sync']); |
|
40 | + \OC::$server->getLogger()->error("Error while syncing $url : ".$ex->getMessage(), ['app' => 'fed-sync']); |
|
41 | 41 | } |
42 | 42 | }); |
43 | 43 | } |
@@ -84,7 +84,7 @@ |
||
84 | 84 | */ |
85 | 85 | private function isRequestPublic(RequestInterface $request) { |
86 | 86 | $url = $request->getPath(); |
87 | - $matchingUrls = array_filter($this->publicURLs, function ($publicUrl) use ($url) { |
|
87 | + $matchingUrls = array_filter($this->publicURLs, function($publicUrl) use ($url) { |
|
88 | 88 | return strpos($url, $publicUrl, 0) === 0; |
89 | 89 | }); |
90 | 90 | return !empty($matchingUrls); |