@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'privilege' => '{DAV:}read', |
111 | 111 | 'principal' => $this->getOwner(), |
112 | 112 | 'protected' => true, |
113 | - ],[ |
|
113 | + ], [ |
|
114 | 114 | 'privilege' => '{DAV:}write', |
115 | 115 | 'principal' => $this->getOwner(), |
116 | 116 | 'protected' => true, |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | $acl = $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl); |
148 | 148 | $allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/system']; |
149 | - return array_filter($acl, function ($rule) use ($allowedPrincipals) { |
|
149 | + return array_filter($acl, function($rule) use ($allowedPrincipals) { |
|
150 | 150 | return \in_array($rule['principal'], $allowedPrincipals, true); |
151 | 151 | }); |
152 | 152 | } |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | |
181 | 181 | public function delete() { |
182 | 182 | if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { |
183 | - $principal = 'principal:' . parent::getOwner(); |
|
183 | + $principal = 'principal:'.parent::getOwner(); |
|
184 | 184 | $shares = $this->carddavBackend->getShares($this->getResourceId()); |
185 | - $shares = array_filter($shares, function ($share) use ($principal) { |
|
185 | + $shares = array_filter($shares, function($share) use ($principal) { |
|
186 | 186 | return $share['href'] === $principal; |
187 | 187 | }); |
188 | 188 | if (empty($shares)) { |
@@ -103,7 +103,7 @@ |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | // $calendarHomePath will look like: calendars/username |
106 | - $calendarHomePath = $pathParts[0] . '/' . $pathParts[1]; |
|
106 | + $calendarHomePath = $pathParts[0].'/'.$pathParts[1]; |
|
107 | 107 | try { |
108 | 108 | $calendarHome = $this->server->tree->getNodeForPath($calendarHomePath); |
109 | 109 | if (!($calendarHome instanceof CalendarHome)) { |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | */ |
597 | 597 | private function getVEventByRecurrenceId(VObject\Component\VCalendar $vcalendar, |
598 | 598 | int $recurrenceId, |
599 | - bool $isRecurrenceException):?VEvent { |
|
599 | + bool $isRecurrenceException): ?VEvent { |
|
600 | 600 | $vevents = $this->getAllVEventsFromVCalendar($vcalendar); |
601 | 601 | if (count($vevents) === 0) { |
602 | 602 | return null; |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * @param string $calendarData |
675 | 675 | * @return VObject\Component\VCalendar|null |
676 | 676 | */ |
677 | - private function parseCalendarData(string $calendarData):?VObject\Component\VCalendar { |
|
677 | + private function parseCalendarData(string $calendarData): ?VObject\Component\VCalendar { |
|
678 | 678 | try { |
679 | 679 | return VObject\Reader::read($calendarData, |
680 | 680 | VObject\Reader::OPTION_FORGIVING); |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * @param string $principalUri |
688 | 688 | * @return IUser|null |
689 | 689 | */ |
690 | - private function getUserFromPrincipalURI(string $principalUri):?IUser { |
|
690 | + private function getUserFromPrincipalURI(string $principalUri): ?IUser { |
|
691 | 691 | if (!$principalUri) { |
692 | 692 | return null; |
693 | 693 | } |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | * @return VObject\Component\VEvent[] |
728 | 728 | */ |
729 | 729 | private function getRecurrenceExceptionFromListOfVEvents(array $vevents):array { |
730 | - return array_values(array_filter($vevents, function (VEvent $vevent) { |
|
730 | + return array_values(array_filter($vevents, function(VEvent $vevent) { |
|
731 | 731 | return $vevent->{'RECURRENCE-ID'} !== null; |
732 | 732 | })); |
733 | 733 | } |
@@ -736,8 +736,8 @@ discard block |
||
736 | 736 | * @param array $vevents |
737 | 737 | * @return VEvent|null |
738 | 738 | */ |
739 | - private function getMasterItemFromListOfVEvents(array $vevents):?VEvent { |
|
740 | - $elements = array_values(array_filter($vevents, function (VEvent $vevent) { |
|
739 | + private function getMasterItemFromListOfVEvents(array $vevents): ?VEvent { |
|
740 | + $elements = array_values(array_filter($vevents, function(VEvent $vevent) { |
|
741 | 741 | return $vevent->{'RECURRENCE-ID'} === null; |
742 | 742 | })); |
743 | 743 |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function getGroups(string $search = '', int $limit = null, int $offset = 0): DataResponse { |
90 | 90 | $groups = $this->groupManager->search($search, $limit, $offset); |
91 | - $groups = array_map(function ($group) { |
|
91 | + $groups = array_map(function($group) { |
|
92 | 92 | /** @var IGroup $group */ |
93 | 93 | return $group->getGID(); |
94 | 94 | }, $groups); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function getGroupsDetails(string $search = '', int $limit = null, int $offset = 0): DataResponse { |
110 | 110 | $groups = $this->groupManager->search($search, $limit, $offset); |
111 | - $groups = array_map(function ($group) { |
|
111 | + $groups = array_map(function($group) { |
|
112 | 112 | /** @var IGroup $group */ |
113 | 113 | return [ |
114 | 114 | 'id' => $group->getGID(), |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | if ($this->groupManager->isAdmin($user->getUID()) |
164 | 164 | || $isSubadminOfGroup) { |
165 | 165 | $users = $this->groupManager->get($groupId)->getUsers(); |
166 | - $users = array_map(function ($user) { |
|
166 | + $users = array_map(function($user) { |
|
167 | 167 | /** @var IUser $user */ |
168 | 168 | return $user->getUID(); |
169 | 169 | }, $users); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | foreach ($users as $user) { |
208 | 208 | try { |
209 | 209 | /** @var IUser $user */ |
210 | - $userId = (string)$user->getUID(); |
|
210 | + $userId = (string) $user->getUID(); |
|
211 | 211 | $userData = $this->getUserData($userId); |
212 | 212 | // Do not insert empty entry |
213 | 213 | if (!empty($userData)) { |
@@ -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 | } |