@@ -36,8 +36,8 @@ |
||
36 | 36 | |
37 | 37 | protected function run($argument) { |
38 | 38 | $config = \OC::$server->getConfig(); |
39 | - $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/flow.log'; |
|
40 | - $this->filePath = trim((string)$config->getAppValue(Application::APP_ID, 'logfile', $default)); |
|
39 | + $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/flow.log'; |
|
40 | + $this->filePath = trim((string) $config->getAppValue(Application::APP_ID, 'logfile', $default)); |
|
41 | 41 | |
42 | 42 | if ($this->filePath === '') { |
43 | 43 | // disabled, nothing to do |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function discover(string $remote, string $service, bool $skipCache = false): array { |
70 | 70 | // Check the cache first |
71 | 71 | if ($skipCache === false) { |
72 | - $cacheData = $this->cache->get($remote . '#' . $service); |
|
72 | + $cacheData = $this->cache->get($remote.'#'.$service); |
|
73 | 73 | if ($cacheData) { |
74 | 74 | $data = json_decode($cacheData, true); |
75 | 75 | if (\is_array($data)) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | // query the remote server for available services |
84 | 84 | try { |
85 | - $response = $this->client->get($remote . '/ocs-provider/', [ |
|
85 | + $response = $this->client->get($remote.'/ocs-provider/', [ |
|
86 | 86 | 'timeout' => 10, |
87 | 87 | 'connect_timeout' => 10, |
88 | 88 | ]); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | // Write into cache |
100 | - $this->cache->set($remote . '#' . $service, json_encode($discoveredServices), 60 * 60 * 24); |
|
100 | + $this->cache->set($remote.'#'.$service, json_encode($discoveredServices), 60 * 60 * 24); |
|
101 | 101 | return $discoveredServices; |
102 | 102 | } |
103 | 103 | |
@@ -130,6 +130,6 @@ discard block |
||
130 | 130 | * @return bool |
131 | 131 | */ |
132 | 132 | protected function isSafeUrl(string $url): bool { |
133 | - return (bool)preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url); |
|
133 | + return (bool) preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url); |
|
134 | 134 | } |
135 | 135 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | private function getCutoff(int $expire): \DateInterval { |
94 | 94 | $d1 = new \DateTime(); |
95 | 95 | $d2 = clone $d1; |
96 | - $d2->sub(new \DateInterval('PT' . $expire . 'S')); |
|
96 | + $d2->sub(new \DateInterval('PT'.$expire.'S')); |
|
97 | 97 | return $d2->diff($d1); |
98 | 98 | } |
99 | 99 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $values = [ |
129 | 129 | 'action' => $action, |
130 | 130 | 'occurred' => $this->timeFactory->getTime(), |
131 | - 'ip' => (string)$ipAddress, |
|
131 | + 'ip' => (string) $ipAddress, |
|
132 | 132 | 'subnet' => $ipAddress->getSubnet(), |
133 | 133 | 'metadata' => json_encode($metadata), |
134 | 134 | ]; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | $keys = $this->config->getAppKeys('bruteForce'); |
167 | - $keys = array_filter($keys, function ($key) { |
|
167 | + $keys = array_filter($keys, function($key) { |
|
168 | 168 | return 0 === strpos($key, 'whitelist_'); |
169 | 169 | }); |
170 | 170 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $cx = explode('/', $cidr); |
185 | 185 | $addr = $cx[0]; |
186 | - $mask = (int)$cx[1]; |
|
186 | + $mask = (int) $cx[1]; |
|
187 | 187 | |
188 | 188 | // Do not compare ipv4 to ipv6 |
189 | 189 | if (($type === 4 && !filter_var($addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) || |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | |
196 | 196 | $valid = true; |
197 | 197 | for ($i = 0; $i < $mask; $i++) { |
198 | - $part = ord($addr[(int)($i / 8)]); |
|
199 | - $orig = ord($ip[(int)($i / 8)]); |
|
198 | + $part = ord($addr[(int) ($i / 8)]); |
|
199 | + $orig = ord($ip[(int) ($i / 8)]); |
|
200 | 200 | |
201 | 201 | $bitmask = 1 << (7 - ($i % 8)); |
202 | 202 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | $ipAddress = new IpAddress($ip); |
234 | - if ($this->isIPWhitelisted((string)$ipAddress)) { |
|
234 | + if ($this->isIPWhitelisted((string) $ipAddress)) { |
|
235 | 235 | return 0; |
236 | 236 | } |
237 | 237 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function resetDelay(string $ip, string $action, array $metadata): void { |
291 | 291 | $ipAddress = new IpAddress($ip); |
292 | - if ($this->isIPWhitelisted((string)$ipAddress)) { |
|
292 | + if ($this->isIPWhitelisted((string) $ipAddress)) { |
|
293 | 293 | return; |
294 | 294 | } |
295 | 295 |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * actions that user backends can define |
41 | 41 | */ |
42 | - public const CREATE_USER = 1; // 1 << 0 |
|
43 | - public const SET_PASSWORD = 16; // 1 << 4 |
|
44 | - public const CHECK_PASSWORD = 256; // 1 << 8 |
|
45 | - public const GET_HOME = 4096; // 1 << 12 |
|
46 | - public const GET_DISPLAYNAME = 65536; // 1 << 16 |
|
47 | - public const SET_DISPLAYNAME = 1048576; // 1 << 20 |
|
48 | - public const PROVIDE_AVATAR = 16777216; // 1 << 24 |
|
49 | - public const COUNT_USERS = 268435456; // 1 << 28 |
|
42 | + public const CREATE_USER = 1; // 1 << 0 |
|
43 | + public const SET_PASSWORD = 16; // 1 << 4 |
|
44 | + public const CHECK_PASSWORD = 256; // 1 << 8 |
|
45 | + public const GET_HOME = 4096; // 1 << 12 |
|
46 | + public const GET_DISPLAYNAME = 65536; // 1 << 16 |
|
47 | + public const SET_DISPLAYNAME = 1048576; // 1 << 20 |
|
48 | + public const PROVIDE_AVATAR = 16777216; // 1 << 24 |
|
49 | + public const COUNT_USERS = 268435456; // 1 << 28 |
|
50 | 50 | |
51 | 51 | protected $possibleActions = [ |
52 | 52 | self::CREATE_USER => 'createUser', |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * compared with self::CREATE_USER etc. |
87 | 87 | */ |
88 | 88 | public function implementsActions($actions) { |
89 | - return (bool)($this->getSupportedActions() & $actions); |
|
89 | + return (bool) ($this->getSupportedActions() & $actions); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | $this->util = $util; |
81 | 81 | |
82 | 82 | $this->encryption_base_dir = '/files_encryption'; |
83 | - $this->keys_base_dir = $this->encryption_base_dir .'/keys'; |
|
84 | - $this->backup_base_dir = $this->encryption_base_dir .'/backup'; |
|
83 | + $this->keys_base_dir = $this->encryption_base_dir.'/keys'; |
|
84 | + $this->backup_base_dir = $this->encryption_base_dir.'/backup'; |
|
85 | 85 | $this->root_dir = $this->util->getKeyStorageRoot(); |
86 | 86 | $this->crypto = $crypto; |
87 | 87 | $this->config = $config; |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | public function getFileKey($path, $keyId, $encryptionModuleId) { |
102 | 102 | $realFile = $this->util->stripPartialFileExtension($path); |
103 | 103 | $keyDir = $this->getFileKeyDir($encryptionModuleId, $realFile); |
104 | - $key = $this->getKey($keyDir . $keyId)['key']; |
|
104 | + $key = $this->getKey($keyDir.$keyId)['key']; |
|
105 | 105 | |
106 | 106 | if ($key === '' && $realFile !== $path) { |
107 | 107 | // Check if the part file has keys and use them, if no normal keys |
108 | 108 | // exist. This is required to fix copyBetweenStorage() when we |
109 | 109 | // rename a .part file over storage borders. |
110 | 110 | $keyDir = $this->getFileKeyDir($encryptionModuleId, $path); |
111 | - $key = $this->getKey($keyDir . $keyId)['key']; |
|
111 | + $key = $this->getKey($keyDir.$keyId)['key']; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return base64_decode($key); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function setFileKey($path, $keyId, $key, $encryptionModuleId) { |
140 | 140 | $keyDir = $this->getFileKeyDir($encryptionModuleId, $path); |
141 | - return $this->setKey($keyDir . $keyId, [ |
|
141 | + return $this->setKey($keyDir.$keyId, [ |
|
142 | 142 | 'key' => base64_encode($key), |
143 | 143 | ]); |
144 | 144 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function deleteFileKey($path, $keyId, $encryptionModuleId) { |
182 | 182 | $keyDir = $this->getFileKeyDir($encryptionModuleId, $path); |
183 | - return !$this->view->file_exists($keyDir . $keyId) || $this->view->unlink($keyDir . $keyId); |
|
183 | + return !$this->view->file_exists($keyDir.$keyId) || $this->view->unlink($keyDir.$keyId); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | */ |
210 | 210 | protected function constructUserKeyPath($encryptionModuleId, $keyId, $uid) { |
211 | 211 | if ($uid === null) { |
212 | - $path = $this->root_dir . '/' . $this->encryption_base_dir . '/' . $encryptionModuleId . '/' . $keyId; |
|
212 | + $path = $this->root_dir.'/'.$this->encryption_base_dir.'/'.$encryptionModuleId.'/'.$keyId; |
|
213 | 213 | } else { |
214 | - $path = $this->root_dir . '/' . $uid . $this->encryption_base_dir . '/' |
|
215 | - . $encryptionModuleId . '/' . $uid . '.' . $keyId; |
|
214 | + $path = $this->root_dir.'/'.$uid.$this->encryption_base_dir.'/' |
|
215 | + . $encryptionModuleId.'/'.$uid.'.'.$keyId; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | return \OC\Files\Filesystem::normalizePath($path); |
@@ -369,12 +369,12 @@ discard block |
||
369 | 369 | |
370 | 370 | // in case of system wide mount points the keys are stored directly in the data directory |
371 | 371 | if ($this->util->isSystemWideMountPoint($filename, $owner)) { |
372 | - $keyPath = $this->root_dir . '/' . $this->keys_base_dir . $filename . '/'; |
|
372 | + $keyPath = $this->root_dir.'/'.$this->keys_base_dir.$filename.'/'; |
|
373 | 373 | } else { |
374 | - $keyPath = $this->root_dir . '/' . $owner . $this->keys_base_dir . $filename . '/'; |
|
374 | + $keyPath = $this->root_dir.'/'.$owner.$this->keys_base_dir.$filename.'/'; |
|
375 | 375 | } |
376 | 376 | |
377 | - return Filesystem::normalizePath($keyPath . $encryptionModuleId . '/', false); |
|
377 | + return Filesystem::normalizePath($keyPath.$encryptionModuleId.'/', false); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | /** |
@@ -429,13 +429,13 @@ discard block |
||
429 | 429 | * @since 12.0.0 |
430 | 430 | */ |
431 | 431 | public function backupUserKeys($encryptionModuleId, $purpose, $uid) { |
432 | - $source = $uid . $this->encryption_base_dir . '/' . $encryptionModuleId; |
|
433 | - $backupDir = $uid . $this->backup_base_dir; |
|
432 | + $source = $uid.$this->encryption_base_dir.'/'.$encryptionModuleId; |
|
433 | + $backupDir = $uid.$this->backup_base_dir; |
|
434 | 434 | if (!$this->view->file_exists($backupDir)) { |
435 | 435 | $this->view->mkdir($backupDir); |
436 | 436 | } |
437 | 437 | |
438 | - $backupDir = $backupDir . '/' . $purpose . '.' . $encryptionModuleId . '.' . $this->getTimestamp(); |
|
438 | + $backupDir = $backupDir.'/'.$purpose.'.'.$encryptionModuleId.'.'.$this->getTimestamp(); |
|
439 | 439 | $this->view->mkdir($backupDir); |
440 | 440 | |
441 | 441 | return $this->view->copy($source, $backupDir); |
@@ -461,9 +461,9 @@ discard block |
||
461 | 461 | $systemWideMountPoint = $this->util->isSystemWideMountPoint($relativePath, $owner); |
462 | 462 | |
463 | 463 | if ($systemWideMountPoint) { |
464 | - $systemPath = $this->root_dir . '/' . $this->keys_base_dir . $relativePath . '/'; |
|
464 | + $systemPath = $this->root_dir.'/'.$this->keys_base_dir.$relativePath.'/'; |
|
465 | 465 | } else { |
466 | - $systemPath = $this->root_dir . '/' . $owner . $this->keys_base_dir . $relativePath . '/'; |
|
466 | + $systemPath = $this->root_dir.'/'.$owner.$this->keys_base_dir.$relativePath.'/'; |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | return Filesystem::normalizePath($systemPath, false); |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | $sub_dirs = explode('/', ltrim($path, '/')); |
481 | 481 | $dir = ''; |
482 | 482 | foreach ($sub_dirs as $sub_dir) { |
483 | - $dir .= '/' . $sub_dir; |
|
483 | + $dir .= '/'.$sub_dir; |
|
484 | 484 | if (!$this->view->is_dir($dir)) { |
485 | 485 | $this->view->mkdir($dir); |
486 | 486 | } |
@@ -375,7 +375,7 @@ |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | foreach ($result->getHeaders() as $name => $value) { |
378 | - header($name . ': ' . $value); |
|
378 | + header($name.': '.$value); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | $meta = $result->getMeta(); |
@@ -85,7 +85,7 @@ |
||
85 | 85 | public function isComplete() { |
86 | 86 | $prefix = $this->getPrefix(); |
87 | 87 | $cache = $this->getCache(); |
88 | - $chunkcount = (int)$this->info['chunkcount']; |
|
88 | + $chunkcount = (int) $this->info['chunkcount']; |
|
89 | 89 | |
90 | 90 | for ($i = ($chunkcount - 1); $i >= 0; $i--) { |
91 | 91 | if (!$cache->hasKey($prefix.$i)) { |
@@ -103,7 +103,7 @@ |
||
103 | 103 | // Call all slots |
104 | 104 | foreach (self::$registered[$signalClass][$signalName] as $i) { |
105 | 105 | try { |
106 | - call_user_func([ $i["class"], $i["name"] ], $params); |
|
106 | + call_user_func([$i["class"], $i["name"]], $params); |
|
107 | 107 | } catch (Exception $e) { |
108 | 108 | self::$thrownExceptions[] = $e; |
109 | 109 | \OC::$server->getLogger()->logException($e); |
@@ -149,7 +149,7 @@ |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public function actionInclude($file) { |
152 | - $function = function ($param) use ($file) { |
|
152 | + $function = function($param) use ($file) { |
|
153 | 153 | unset($param["_route"]); |
154 | 154 | $_GET = array_merge($_GET, $param); |
155 | 155 | unset($param); |