@@ -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(); |
@@ -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 | } |
@@ -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); |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | static function xmlDeserialize(Reader $reader) { |
48 | 48 | |
49 | 49 | $elements = $reader->parseInnerTree([ |
50 | - '{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue', |
|
51 | - '{' . Plugin::NS_OWNCLOUD . '}remove' => 'Sabre\\Xml\\Element\\KeyValue', |
|
50 | + '{'.Plugin::NS_OWNCLOUD.'}set' => 'Sabre\\Xml\\Element\\KeyValue', |
|
51 | + '{'.Plugin::NS_OWNCLOUD.'}remove' => 'Sabre\\Xml\\Element\\KeyValue', |
|
52 | 52 | ]); |
53 | 53 | |
54 | 54 | $set = []; |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | foreach ($elements as $elem) { |
58 | 58 | switch ($elem['name']) { |
59 | 59 | |
60 | - case '{' . Plugin::NS_OWNCLOUD . '}set' : |
|
60 | + case '{'.Plugin::NS_OWNCLOUD.'}set' : |
|
61 | 61 | $sharee = $elem['value']; |
62 | 62 | |
63 | - $sumElem = '{' . Plugin::NS_OWNCLOUD . '}summary'; |
|
64 | - $commonName = '{' . Plugin::NS_OWNCLOUD . '}common-name'; |
|
63 | + $sumElem = '{'.Plugin::NS_OWNCLOUD.'}summary'; |
|
64 | + $commonName = '{'.Plugin::NS_OWNCLOUD.'}common-name'; |
|
65 | 65 | |
66 | 66 | $set[] = [ |
67 | 67 | 'href' => $sharee['{DAV:}href'], |
68 | 68 | 'commonName' => isset($sharee[$commonName]) ? $sharee[$commonName] : null, |
69 | 69 | 'summary' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null, |
70 | - 'readOnly' => !array_key_exists('{' . Plugin::NS_OWNCLOUD . '}read-write', $sharee), |
|
70 | + 'readOnly' => !array_key_exists('{'.Plugin::NS_OWNCLOUD.'}read-write', $sharee), |
|
71 | 71 | ]; |
72 | 72 | break; |
73 | 73 | |
74 | - case '{' . Plugin::NS_OWNCLOUD . '}remove' : |
|
74 | + case '{'.Plugin::NS_OWNCLOUD.'}remove' : |
|
75 | 75 | $remove[] = $elem['value']['{DAV:}href']; |
76 | 76 | break; |
77 | 77 |
@@ -121,21 +121,21 @@ discard block |
||
121 | 121 | */ |
122 | 122 | function xmlSerialize(Writer $writer) { |
123 | 123 | |
124 | - $cs = '{' . Plugin::NS_OWNCLOUD . '}'; |
|
124 | + $cs = '{'.Plugin::NS_OWNCLOUD.'}'; |
|
125 | 125 | |
126 | 126 | if (!is_null($this->organizer)) { |
127 | 127 | |
128 | - $writer->startElement($cs . 'organizer'); |
|
128 | + $writer->startElement($cs.'organizer'); |
|
129 | 129 | $writer->writeElement('{DAV:}href', $this->organizer['href']); |
130 | 130 | |
131 | 131 | if (isset($this->organizer['commonName']) && $this->organizer['commonName']) { |
132 | - $writer->writeElement($cs . 'common-name', $this->organizer['commonName']); |
|
132 | + $writer->writeElement($cs.'common-name', $this->organizer['commonName']); |
|
133 | 133 | } |
134 | 134 | if (isset($this->organizer['firstName']) && $this->organizer['firstName']) { |
135 | - $writer->writeElement($cs . 'first-name', $this->organizer['firstName']); |
|
135 | + $writer->writeElement($cs.'first-name', $this->organizer['firstName']); |
|
136 | 136 | } |
137 | 137 | if (isset($this->organizer['lastName']) && $this->organizer['lastName']) { |
138 | - $writer->writeElement($cs . 'last-name', $this->organizer['lastName']); |
|
138 | + $writer->writeElement($cs.'last-name', $this->organizer['lastName']); |
|
139 | 139 | } |
140 | 140 | $writer->endElement(); // organizer |
141 | 141 | |
@@ -143,23 +143,23 @@ discard block |
||
143 | 143 | |
144 | 144 | foreach ($this->users as $user) { |
145 | 145 | |
146 | - $writer->startElement($cs . 'user'); |
|
146 | + $writer->startElement($cs.'user'); |
|
147 | 147 | $writer->writeElement('{DAV:}href', $user['href']); |
148 | 148 | if (isset($user['commonName']) && $user['commonName']) { |
149 | - $writer->writeElement($cs . 'common-name', $user['commonName']); |
|
149 | + $writer->writeElement($cs.'common-name', $user['commonName']); |
|
150 | 150 | } |
151 | - $writer->writeElement($cs . 'invite-accepted'); |
|
151 | + $writer->writeElement($cs.'invite-accepted'); |
|
152 | 152 | |
153 | - $writer->startElement($cs . 'access'); |
|
153 | + $writer->startElement($cs.'access'); |
|
154 | 154 | if ($user['readOnly']) { |
155 | - $writer->writeElement($cs . 'read'); |
|
155 | + $writer->writeElement($cs.'read'); |
|
156 | 156 | } else { |
157 | - $writer->writeElement($cs . 'read-write'); |
|
157 | + $writer->writeElement($cs.'read-write'); |
|
158 | 158 | } |
159 | 159 | $writer->endElement(); // access |
160 | 160 | |
161 | 161 | if (isset($user['summary']) && $user['summary']) { |
162 | - $writer->writeElement($cs . 'summary', $user['summary']); |
|
162 | + $writer->writeElement($cs.'summary', $user['summary']); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | $writer->endElement(); //user |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | */ |
100 | 100 | function initialize(Server $server) { |
101 | 101 | $this->server = $server; |
102 | - $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest'; |
|
103 | - $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite'; |
|
102 | + $this->server->xml->elementMap['{'.Plugin::NS_OWNCLOUD.'}share'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest'; |
|
103 | + $this->server->xml->elementMap['{'.Plugin::NS_OWNCLOUD.'}invite'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite'; |
|
104 | 104 | |
105 | 105 | $this->server->on('method:POST', [$this, 'httpPost']); |
106 | - $this->server->on('propFind', [$this, 'propFind']); |
|
106 | + $this->server->on('propFind', [$this, 'propFind']); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | // Dealing with the 'share' document, which modified invitees on a |
148 | 148 | // calendar. |
149 | - case '{' . self::NS_OWNCLOUD . '}share' : |
|
149 | + case '{'.self::NS_OWNCLOUD.'}share' : |
|
150 | 150 | |
151 | 151 | // We can only deal with IShareableCalendar objects |
152 | 152 | if (!$node instanceof IShareable) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | function propFind(PropFind $propFind, INode $node) { |
190 | 190 | if ($node instanceof IShareable) { |
191 | 191 | |
192 | - $propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function() use ($node) { |
|
192 | + $propFind->handle('{'.Plugin::NS_OWNCLOUD.'}invite', function() use ($node) { |
|
193 | 193 | return new Invite( |
194 | 194 | $node->getShares() |
195 | 195 | ); |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | * @param string[] $remove |
58 | 58 | */ |
59 | 59 | public function updateShares($shareable, $add, $remove) { |
60 | - foreach($add as $element) { |
|
60 | + foreach ($add as $element) { |
|
61 | 61 | $this->shareWith($shareable, $element); |
62 | 62 | } |
63 | - foreach($remove as $element) { |
|
63 | + foreach ($remove as $element) { |
|
64 | 64 | $this->unshare($shareable, $element); |
65 | 65 | } |
66 | 66 | } |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | ->execute(); |
165 | 165 | |
166 | 166 | $shares = []; |
167 | - while($row = $result->fetch()) { |
|
167 | + while ($row = $result->fetch()) { |
|
168 | 168 | $p = $this->principalBackend->getPrincipalByPath($row['principaluri']); |
169 | - $shares[]= [ |
|
169 | + $shares[] = [ |
|
170 | 170 | 'href' => "principal:${row['principaluri']}", |
171 | 171 | 'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '', |
172 | 172 | 'status' => 1, |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | foreach ($shares as $share) { |
193 | 193 | $acl[] = [ |
194 | 194 | 'privilege' => '{DAV:}read', |
195 | - 'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'], |
|
195 | + 'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'], |
|
196 | 196 | 'protected' => true, |
197 | 197 | ]; |
198 | 198 | if (!$share['readOnly']) { |
199 | 199 | $acl[] = [ |
200 | 200 | 'privilege' => '{DAV:}write', |
201 | - 'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'], |
|
201 | + 'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'], |
|
202 | 202 | 'protected' => true, |
203 | 203 | ]; |
204 | 204 | } else if ($this->resourceType === 'calendar') { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | // so users can change the visibility. |
207 | 207 | $acl[] = [ |
208 | 208 | 'privilege' => '{DAV:}write-properties', |
209 | - 'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'], |
|
209 | + 'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'], |
|
210 | 210 | 'protected' => true, |
211 | 211 | ]; |
212 | 212 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | \Closure $childExistsFunction |
70 | 70 | ) { |
71 | 71 | $name = trim($name); |
72 | - if(empty($name) || !is_string($name)) { |
|
72 | + if (empty($name) || !is_string($name)) { |
|
73 | 73 | throw new \InvalidArgumentException('"name" parameter must be non-empty string'); |
74 | 74 | } |
75 | 75 | $this->name = $name; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @throws NotFound |
92 | 92 | */ |
93 | 93 | function getChild($name) { |
94 | - if(!$this->childExists($name)) { |
|
94 | + if (!$this->childExists($name)) { |
|
95 | 95 | throw new NotFound('Entity does not exist or is not available'); |
96 | 96 | } |
97 | 97 | return new EntityCollection( |