@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | 'remoteId' => $shareId |
135 | 135 | ); |
136 | 136 | |
137 | - $result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/' . $id . '/reshare', $fields); |
|
137 | + $result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/'.$id.'/reshare', $fields); |
|
138 | 138 | $status = json_decode($result['result'], true); |
139 | 139 | |
140 | 140 | $httpRequestSuccessful = $result['success']; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if ($httpRequestSuccessful && $ocsCallSuccessful && $validToken && $validRemoteId) { |
146 | 146 | return [ |
147 | 147 | $status['ocs']['data']['token'], |
148 | - (int)$status['ocs']['data']['remoteId'] |
|
148 | + (int) $status['ocs']['data']['remoteId'] |
|
149 | 149 | ]; |
150 | 150 | } |
151 | 151 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $fields[$key] = $value; |
230 | 230 | } |
231 | 231 | |
232 | - $result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/' . $remoteId . '/' . $action, $fields); |
|
232 | + $result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/'.$remoteId.'/'.$action, $fields); |
|
233 | 233 | $status = json_decode($result['result'], true); |
234 | 234 | |
235 | 235 | if ($result['success'] && |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $client = $this->httpClientService->newClient(); |
281 | 281 | |
282 | 282 | if ($this->addressHandler->urlContainProtocol($remoteDomain) === false) { |
283 | - $remoteDomain = 'https://' . $remoteDomain; |
|
283 | + $remoteDomain = 'https://'.$remoteDomain; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | $result = [ |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $federationEndpoints = $this->discoveryService->discover($remoteDomain, 'FEDERATED_SHARING'); |
292 | 292 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
293 | 293 | try { |
294 | - $response = $client->post($remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, [ |
|
294 | + $response = $client->post($remoteDomain.$endpoint.$urlSuffix.'?format='.self::RESPONSE_FORMAT, [ |
|
295 | 295 | 'body' => $fields, |
296 | 296 | 'timeout' => 10, |
297 | 297 | 'connect_timeout' => 10, |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $secure = $protocol === 'https'; |
78 | 78 | $federatedSharingEndpoints = $discoveryService->discover($this->cloudId->getRemote(), 'FEDERATED_SHARING'); |
79 | 79 | $webDavEndpoint = isset($federatedSharingEndpoints['webdav']) ? $federatedSharingEndpoints['webdav'] : '/public.php/webdav'; |
80 | - $root = rtrim($root, '/') . $webDavEndpoint; |
|
80 | + $root = rtrim($root, '/').$webDavEndpoint; |
|
81 | 81 | $this->mountPoint = $options['mountpoint']; |
82 | 82 | $this->token = $options['token']; |
83 | 83 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | 'host' => $host, |
87 | 87 | 'root' => $root, |
88 | 88 | 'user' => $options['token'], |
89 | - 'password' => (string)$options['password'] |
|
89 | + 'password' => (string) $options['password'] |
|
90 | 90 | )); |
91 | 91 | } |
92 | 92 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @return string |
127 | 127 | */ |
128 | 128 | public function getId() { |
129 | - return 'shared::' . md5($this->token . '@' . $this->getRemote()); |
|
129 | + return 'shared::'.md5($this->token.'@'.$this->getRemote()); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | public function getCache($path = '', $storage = null) { |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | */ |
248 | 248 | protected function testRemote() { |
249 | 249 | try { |
250 | - return $this->testRemoteUrl($this->getRemote() . '/ocs-provider/index.php') |
|
251 | - || $this->testRemoteUrl($this->getRemote() . '/ocs-provider/') |
|
252 | - || $this->testRemoteUrl($this->getRemote() . '/status.php'); |
|
250 | + return $this->testRemoteUrl($this->getRemote().'/ocs-provider/index.php') |
|
251 | + || $this->testRemoteUrl($this->getRemote().'/ocs-provider/') |
|
252 | + || $this->testRemoteUrl($this->getRemote().'/status.php'); |
|
253 | 253 | } catch (\Exception $e) { |
254 | 254 | return false; |
255 | 255 | } |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | */ |
262 | 262 | private function testRemoteUrl($url) { |
263 | 263 | $cache = $this->memcacheFactory->create('files_sharing_remote_url'); |
264 | - if($cache->hasKey($url)) { |
|
265 | - return (bool)$cache->get($url); |
|
264 | + if ($cache->hasKey($url)) { |
|
265 | + return (bool) $cache->get($url); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | $client = $this->httpClient->newClient(); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * @return bool |
291 | 291 | */ |
292 | 292 | public function remoteIsOwnCloud() { |
293 | - if(defined('PHPUNIT_RUN') || !$this->testRemoteUrl($this->getRemote() . '/status.php')) { |
|
293 | + if (defined('PHPUNIT_RUN') || !$this->testRemoteUrl($this->getRemote().'/status.php')) { |
|
294 | 294 | return false; |
295 | 295 | } |
296 | 296 | return true; |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | $password = $this->getPassword(); |
309 | 309 | |
310 | 310 | // If remote is not an ownCloud do not try to get any share info |
311 | - if(!$this->remoteIsOwnCloud()) { |
|
311 | + if (!$this->remoteIsOwnCloud()) { |
|
312 | 312 | return ['status' => 'unsupported']; |
313 | 313 | } |
314 | 314 | |
315 | - $url = rtrim($remote, '/') . '/index.php/apps/files_sharing/shareinfo?t=' . $token; |
|
315 | + $url = rtrim($remote, '/').'/index.php/apps/files_sharing/shareinfo?t='.$token; |
|
316 | 316 | |
317 | 317 | // TODO: DI |
318 | 318 | $client = \OC::$server->getHTTPClientService()->newClient(); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | } |
215 | 215 | |
216 | 216 | if ($provider === null) { |
217 | - throw new ProviderException('No provider with id .' . $id . ' found.'); |
|
217 | + throw new ProviderException('No provider with id .'.$id.' found.'); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | return $provider; |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | |
243 | 243 | if ($provider === null) { |
244 | - throw new ProviderException('No share provider for share type ' . $shareType); |
|
244 | + throw new ProviderException('No share provider for share type '.$shareType); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | return $provider; |
@@ -65,7 +65,7 @@ |
||
65 | 65 | $eventDispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener); |
66 | 66 | $eventDispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener); |
67 | 67 | |
68 | -\OCA\Files\App::getNavigationManager()->add(function () { |
|
68 | +\OCA\Files\App::getNavigationManager()->add(function() { |
|
69 | 69 | $l = \OC::$server->getL10N('systemtags'); |
70 | 70 | return [ |
71 | 71 | 'id' => 'systemtagsfilter', |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $config = \OC::$server->getConfig(); |
52 | 52 | if ($config->getAppValue('core', 'shareapi_enabled', 'yes') === 'yes') { |
53 | - \OCA\Files\App::getNavigationManager()->add(function () { |
|
53 | + \OCA\Files\App::getNavigationManager()->add(function() { |
|
54 | 54 | $l = \OC::$server->getL10N('files_sharing'); |
55 | 55 | return [ |
56 | 56 | 'id' => 'sharingin', |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | }); |
63 | 63 | |
64 | 64 | if (\OCP\Util::isSharingDisabledForUser() === false) { |
65 | - \OCA\Files\App::getNavigationManager()->add(function () { |
|
65 | + \OCA\Files\App::getNavigationManager()->add(function() { |
|
66 | 66 | $l = \OC::$server->getL10N('files_sharing'); |
67 | 67 | return [ |
68 | 68 | 'id' => 'sharingout', |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | // Check if sharing by link is enabled |
77 | 77 | if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') { |
78 | - \OCA\Files\App::getNavigationManager()->add(function () { |
|
78 | + \OCA\Files\App::getNavigationManager()->add(function() { |
|
79 | 79 | $l = \OC::$server->getL10N('files_sharing'); |
80 | 80 | return [ |
81 | 81 | 'id' => 'sharinglinks', |
@@ -28,7 +28,7 @@ |
||
28 | 28 | // register hooks |
29 | 29 | \OCA\Files_Trashbin\Trashbin::registerHooks(); |
30 | 30 | |
31 | -\OCA\Files\App::getNavigationManager()->add(function () { |
|
31 | +\OCA\Files\App::getNavigationManager()->add(function() { |
|
32 | 32 | $l = \OC::$server->getL10N('files_trashbin'); |
33 | 33 | return [ |
34 | 34 | 'id' => 'trashbin', |
@@ -119,9 +119,9 @@ |
||
119 | 119 | $elements = explode(' ', $fullName); |
120 | 120 | $result = ['', '', '', '', '']; |
121 | 121 | if (count($elements) > 2) { |
122 | - $result[0] = implode(' ', array_slice($elements, count($elements)-1)); |
|
122 | + $result[0] = implode(' ', array_slice($elements, count($elements) - 1)); |
|
123 | 123 | $result[1] = $elements[0]; |
124 | - $result[2] = implode(' ', array_slice($elements, 1, count($elements)-2)); |
|
124 | + $result[2] = implode(' ', array_slice($elements, 1, count($elements) - 2)); |
|
125 | 125 | } elseif (count($elements) === 2) { |
126 | 126 | $result[0] = $elements[1]; |
127 | 127 | $result[1] = $elements[0]; |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function discover($remote, $service) { |
62 | 62 | // Check the cache first |
63 | - $cacheData = $this->cache->get($remote . '#' . $service); |
|
64 | - if($cacheData) { |
|
63 | + $cacheData = $this->cache->get($remote.'#'.$service); |
|
64 | + if ($cacheData) { |
|
65 | 65 | return json_decode($cacheData, true); |
66 | 66 | } |
67 | 67 | |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | |
70 | 70 | // query the remote server for available services |
71 | 71 | try { |
72 | - $response = $this->client->get($remote . '/ocs-provider/', [ |
|
72 | + $response = $this->client->get($remote.'/ocs-provider/', [ |
|
73 | 73 | 'timeout' => 10, |
74 | 74 | 'connect_timeout' => 10, |
75 | 75 | ]); |
76 | - if($response->getStatusCode() === Http::STATUS_OK) { |
|
76 | + if ($response->getStatusCode() === Http::STATUS_OK) { |
|
77 | 77 | $decodedServices = json_decode($response->getBody(), true); |
78 | 78 | $discoveredServices = $this->getEndpoints($decodedServices, $service); |
79 | 79 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | // Write into cache |
86 | - $this->cache->set($remote . '#' . $service, json_encode($discoveredServices)); |
|
86 | + $this->cache->set($remote.'#'.$service, json_encode($discoveredServices)); |
|
87 | 87 | return $discoveredServices; |
88 | 88 | } |
89 | 89 | |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | |
99 | 99 | $discoveredServices = []; |
100 | 100 | |
101 | - if(is_array($decodedServices) && |
|
101 | + if (is_array($decodedServices) && |
|
102 | 102 | isset($decodedServices['services'][$service]['endpoints']) |
103 | 103 | ) { |
104 | 104 | foreach ($decodedServices['services'][$service]['endpoints'] as $endpoint => $url) { |
105 | - if($this->isSafeUrl($url)) { |
|
105 | + if ($this->isSafeUrl($url)) { |
|
106 | 106 | $discoveredServices[$endpoint] = $url; |
107 | 107 | } |
108 | 108 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return bool |
120 | 120 | */ |
121 | 121 | protected function isSafeUrl($url) { |
122 | - return (bool)preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url); |
|
122 | + return (bool) preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function check() { |
57 | 57 | // Look up the cache - it is invalidated all 30 minutes |
58 | - if (((int)$this->config->getAppValue('core', 'lastupdatedat') + 1800) > time()) { |
|
58 | + if (((int) $this->config->getAppValue('core', 'lastupdatedat') + 1800) > time()) { |
|
59 | 59 | return json_decode($this->config->getAppValue('core', 'lastupdateResult'), true); |
60 | 60 | } |
61 | 61 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $versionString = implode('x', $version); |
80 | 80 | |
81 | 81 | //fetch xml data from updater |
82 | - $url = $updaterUrl . '?version=' . $versionString; |
|
82 | + $url = $updaterUrl.'?version='.$versionString; |
|
83 | 83 | |
84 | 84 | $tmp = []; |
85 | 85 | try { |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | $data = @simplexml_load_string($xml); |
94 | 94 | libxml_disable_entity_loader($loadEntities); |
95 | 95 | if ($data !== false) { |
96 | - $tmp['version'] = (string)$data->version; |
|
97 | - $tmp['versionstring'] = (string)$data->versionstring; |
|
98 | - $tmp['url'] = (string)$data->url; |
|
99 | - $tmp['web'] = (string)$data->web; |
|
100 | - $tmp['autoupdater'] = (string)$data->autoupdater; |
|
96 | + $tmp['version'] = (string) $data->version; |
|
97 | + $tmp['versionstring'] = (string) $data->versionstring; |
|
98 | + $tmp['url'] = (string) $data->url; |
|
99 | + $tmp['web'] = (string) $data->web; |
|
100 | + $tmp['autoupdater'] = (string) $data->autoupdater; |
|
101 | 101 | } else { |
102 | 102 | libxml_clear_errors(); |
103 | 103 | } |