@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function __construct($serverConfigPrefixes, ILDAPWrapper $ldap, GroupPluginManager $groupPluginManager) { |
39 | 39 | parent::__construct($ldap); |
40 | - foreach($serverConfigPrefixes as $configPrefix) { |
|
40 | + foreach ($serverConfigPrefixes as $configPrefix) { |
|
41 | 41 | $this->backends[$configPrefix] = |
42 | 42 | new \OCA\User_LDAP\Group_LDAP($this->getAccess($configPrefix), $groupPluginManager); |
43 | - if(is_null($this->refBackend)) { |
|
43 | + if (is_null($this->refBackend)) { |
|
44 | 44 | $this->refBackend = &$this->backends[$configPrefix]; |
45 | 45 | } |
46 | 46 | } |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function walkBackends($gid, $method, $parameters) { |
57 | 57 | $cacheKey = $this->getGroupCacheKey($gid); |
58 | - foreach($this->backends as $configPrefix => $backend) { |
|
59 | - if($result = call_user_func_array(array($backend, $method), $parameters)) { |
|
58 | + foreach ($this->backends as $configPrefix => $backend) { |
|
59 | + if ($result = call_user_func_array(array($backend, $method), $parameters)) { |
|
60 | 60 | $this->writeToCache($cacheKey, $configPrefix); |
61 | 61 | return $result; |
62 | 62 | } |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | $cacheKey = $this->getGroupCacheKey($gid); |
77 | 77 | $prefix = $this->getFromCache($cacheKey); |
78 | 78 | //in case the uid has been found in the past, try this stored connection first |
79 | - if(!is_null($prefix)) { |
|
80 | - if(isset($this->backends[$prefix])) { |
|
79 | + if (!is_null($prefix)) { |
|
80 | + if (isset($this->backends[$prefix])) { |
|
81 | 81 | $result = call_user_func_array(array($this->backends[$prefix], $method), $parameters); |
82 | - if($result === $passOnWhen) { |
|
82 | + if ($result === $passOnWhen) { |
|
83 | 83 | //not found here, reset cache to null if group vanished |
84 | 84 | //because sometimes methods return false with a reason |
85 | 85 | $groupExists = call_user_func_array( |
86 | 86 | array($this->backends[$prefix], 'groupExists'), |
87 | 87 | array($gid) |
88 | 88 | ); |
89 | - if(!$groupExists) { |
|
89 | + if (!$groupExists) { |
|
90 | 90 | $this->writeToCache($cacheKey, null); |
91 | 91 | } |
92 | 92 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function getUserGroups($uid) { |
120 | 120 | $groups = array(); |
121 | 121 | |
122 | - foreach($this->backends as $backend) { |
|
122 | + foreach ($this->backends as $backend) { |
|
123 | 123 | $backendGroups = $backend->getUserGroups($uid); |
124 | 124 | if (is_array($backendGroups)) { |
125 | 125 | $groups = array_merge($groups, $backendGroups); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { |
137 | 137 | $users = array(); |
138 | 138 | |
139 | - foreach($this->backends as $backend) { |
|
139 | + foreach ($this->backends as $backend) { |
|
140 | 140 | $backendUsers = $backend->usersInGroup($gid, $search, $limit, $offset); |
141 | 141 | if (is_array($backendUsers)) { |
142 | 142 | $users = array_merge($users, $backendUsers); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | public function getGroups($search = '', $limit = -1, $offset = 0) { |
222 | 222 | $groups = array(); |
223 | 223 | |
224 | - foreach($this->backends as $backend) { |
|
224 | + foreach ($this->backends as $backend) { |
|
225 | 225 | $backendGroups = $backend->getGroups($search, $limit, $offset); |
226 | 226 | if (is_array($backendGroups)) { |
227 | 227 | $groups = array_merge($groups, $backendGroups); |
@@ -56,8 +56,8 @@ |
||
56 | 56 | */ |
57 | 57 | public function postConnect(ConnectionEventArgs $args) { |
58 | 58 | $sensitive = $this->caseSensitiveLike ? 'true' : 'false'; |
59 | - $args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = ' . $sensitive); |
|
60 | - $args->getConnection()->executeUpdate('PRAGMA journal_mode = ' . $this->journalMode); |
|
59 | + $args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = '.$sensitive); |
|
60 | + $args->getConnection()->executeUpdate('PRAGMA journal_mode = '.$this->journalMode); |
|
61 | 61 | /** @var \PDO $pdo */ |
62 | 62 | $pdo = $args->getConnection()->getWrappedConnection(); |
63 | 63 | $pdo->sqliteCreateFunction('md5', 'md5', 1); |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | $params = array(); |
94 | 94 | if (count($ids) == 1 && isset($uidOwner)) { |
95 | 95 | // FIXME: don't concat $parents, use Docrine's PARAM_INT_ARRAY approach |
96 | - $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' . |
|
97 | - '`item_target`, `file_target`, `parent` ' . |
|
98 | - 'FROM `*PREFIX*share` ' . |
|
96 | + $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, '. |
|
97 | + '`item_target`, `file_target`, `parent` '. |
|
98 | + 'FROM `*PREFIX*share` '. |
|
99 | 99 | 'WHERE `parent` IN ('.$parents.') AND `uid_owner` = ? '; |
100 | 100 | $params[] = $uidOwner; |
101 | 101 | } else { |
102 | - $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' . |
|
103 | - '`item_target`, `file_target`, `parent`, `uid_owner` ' . |
|
102 | + $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, '. |
|
103 | + '`item_target`, `file_target`, `parent`, `uid_owner` '. |
|
104 | 104 | 'FROM `*PREFIX*share` WHERE `parent` IN ('.$parents.') '; |
105 | 105 | } |
106 | 106 | if ($excludeGroupChildren) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 'shareWith' => $item['share_with'], |
118 | 118 | 'itemTarget' => $item['item_target'], |
119 | 119 | 'itemType' => $item['item_type'], |
120 | - 'shareType' => (int)$item['share_type'], |
|
120 | + 'shareType' => (int) $item['share_type'], |
|
121 | 121 | ); |
122 | 122 | if (isset($item['file_target'])) { |
123 | 123 | $tmpItem['fileTarget'] = $item['file_target']; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | if ($defaultExpireDate === 'yes') { |
169 | 169 | $enforceExpireDate = $config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'); |
170 | 170 | $defaultExpireSettings['defaultExpireDateSet'] = true; |
171 | - $defaultExpireSettings['expireAfterDays'] = (int)$config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
171 | + $defaultExpireSettings['expireAfterDays'] = (int) $config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
172 | 172 | $defaultExpireSettings['enforceExpireDate'] = $enforceExpireDate === 'yes'; |
173 | 173 | } |
174 | 174 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * @since 9.1.0 |
38 | 38 | */ |
39 | - const KEY_ADMIN_SECTION = 'admin-section'; |
|
39 | + const KEY_ADMIN_SECTION = 'admin-section'; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * @since 13.0.0 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * @since 13.0.0 |
48 | 48 | */ |
49 | - const KEY_PERSONAL_SECTION = 'personal-section'; |
|
49 | + const KEY_PERSONAL_SECTION = 'personal-section'; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @param string $type 'admin' or 'personal' |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | class Streamer { |
32 | 32 | // array of regexp. Matching user agents will get tar instead of zip |
33 | - private $preferTarFor = [ '/macintosh|mac os x/i' ]; |
|
33 | + private $preferTarFor = ['/macintosh|mac os x/i']; |
|
34 | 34 | |
35 | 35 | // streamer instance |
36 | 36 | private $streamerInstance; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param int $numberOfFiles The number of files (and directories) that will |
44 | 44 | * be included in the streamed file |
45 | 45 | */ |
46 | - public function __construct(IRequest $request, int $size, int $numberOfFiles){ |
|
46 | + public function __construct(IRequest $request, int $size, int $numberOfFiles) { |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * zip32 constraints for a basic (without compression, volumes nor |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * Send HTTP headers |
81 | 81 | * @param string $name |
82 | 82 | */ |
83 | - public function sendHeaders($name){ |
|
83 | + public function sendHeaders($name) { |
|
84 | 84 | $extension = $this->streamerInstance instanceof ZipStreamer ? '.zip' : '.tar'; |
85 | - $fullName = $name . $extension; |
|
85 | + $fullName = $name.$extension; |
|
86 | 86 | $this->streamerInstance->sendHeaders($fullName); |
87 | 87 | } |
88 | 88 | |
@@ -91,27 +91,27 @@ discard block |
||
91 | 91 | * @param string $dir |
92 | 92 | * @param string $internalDir |
93 | 93 | */ |
94 | - public function addDirRecursive($dir, $internalDir='') { |
|
94 | + public function addDirRecursive($dir, $internalDir = '') { |
|
95 | 95 | $dirname = basename($dir); |
96 | - $rootDir = $internalDir . $dirname; |
|
96 | + $rootDir = $internalDir.$dirname; |
|
97 | 97 | if (!empty($rootDir)) { |
98 | 98 | $this->streamerInstance->addEmptyDir($rootDir); |
99 | 99 | } |
100 | - $internalDir .= $dirname . '/'; |
|
100 | + $internalDir .= $dirname.'/'; |
|
101 | 101 | // prevent absolute dirs |
102 | 102 | $internalDir = ltrim($internalDir, '/'); |
103 | 103 | |
104 | - $files= \OC\Files\Filesystem::getDirectoryContent($dir); |
|
105 | - foreach($files as $file) { |
|
104 | + $files = \OC\Files\Filesystem::getDirectoryContent($dir); |
|
105 | + foreach ($files as $file) { |
|
106 | 106 | $filename = $file['name']; |
107 | - $file = $dir . '/' . $filename; |
|
108 | - if(\OC\Files\Filesystem::is_file($file)) { |
|
107 | + $file = $dir.'/'.$filename; |
|
108 | + if (\OC\Files\Filesystem::is_file($file)) { |
|
109 | 109 | $filesize = \OC\Files\Filesystem::filesize($file); |
110 | 110 | $fileTime = \OC\Files\Filesystem::filemtime($file); |
111 | 111 | $fh = \OC\Files\Filesystem::fopen($file, 'r'); |
112 | - $this->addFileFromStream($fh, $internalDir . $filename, $filesize, $fileTime); |
|
112 | + $this->addFileFromStream($fh, $internalDir.$filename, $filesize, $fileTime); |
|
113 | 113 | fclose($fh); |
114 | - }elseif(\OC\Files\Filesystem::is_dir($file)) { |
|
114 | + }elseif (\OC\Files\Filesystem::is_dir($file)) { |
|
115 | 115 | $this->addDirRecursive($file, $internalDir); |
116 | 116 | } |
117 | 117 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param string $dirName Directory Path and name to be added to the archive. |
148 | 148 | * @return bool $success |
149 | 149 | */ |
150 | - public function addEmptyDir($dirName){ |
|
150 | + public function addEmptyDir($dirName) { |
|
151 | 151 | return $this->streamerInstance->addEmptyDir($dirName); |
152 | 152 | } |
153 | 153 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * closing, the file is completely written to the output stream. |
158 | 158 | * @return bool $success |
159 | 159 | */ |
160 | - public function finalize(){ |
|
160 | + public function finalize() { |
|
161 | 161 | return $this->streamerInstance->finalize(); |
162 | 162 | } |
163 | 163 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $results = $folder->search($query); |
159 | 159 | |
160 | 160 | /** @var SearchResult[] $nodes */ |
161 | - $nodes = array_map(function (Node $node) { |
|
161 | + $nodes = array_map(function(Node $node) { |
|
162 | 162 | if ($node instanceof Folder) { |
163 | 163 | $davNode = new \OCA\DAV\Connector\Sabre\Directory($this->view, $node, $this->tree, $this->shareManager); |
164 | 164 | } else { |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | }, $results); |
171 | 171 | |
172 | 172 | // Sort again, since the result from multiple storages is appended and not sorted |
173 | - usort($nodes, function (SearchResult $a, SearchResult $b) use ($search) { |
|
173 | + usort($nodes, function(SearchResult $a, SearchResult $b) use ($search) { |
|
174 | 174 | return $this->sort($a, $b, $search->orderBy); |
175 | 175 | }); |
176 | 176 | |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | * @return string |
260 | 260 | */ |
261 | 261 | private function getHrefForNode(Node $node) { |
262 | - $base = '/files/' . $this->user->getUID(); |
|
263 | - return $base . $this->view->getRelativePath($node->getPath()); |
|
262 | + $base = '/files/'.$this->user->getUID(); |
|
263 | + return $base.$this->view->getRelativePath($node->getPath()); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | // TODO offset |
272 | 272 | $limit = $query->limit; |
273 | 273 | $orders = array_map([$this, 'mapSearchOrder'], $query->orderBy); |
274 | - return new SearchQuery($this->transformSearchOperation($query->where), (int)$limit->maxResults, 0, $orders, $this->user); |
|
274 | + return new SearchQuery($this->transformSearchOperation($query->where), (int) $limit->maxResults, 0, $orders, $this->user); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -301,19 +301,19 @@ discard block |
||
301 | 301 | case Operator::OPERATION_LESS_THAN: |
302 | 302 | case Operator::OPERATION_IS_LIKE: |
303 | 303 | if (count($operator->arguments) !== 2) { |
304 | - throw new \InvalidArgumentException('Invalid number of arguments for ' . $trimmedType . ' operation'); |
|
304 | + throw new \InvalidArgumentException('Invalid number of arguments for '.$trimmedType.' operation'); |
|
305 | 305 | } |
306 | 306 | if (!($operator->arguments[0] instanceof SearchPropertyDefinition)) { |
307 | - throw new \InvalidArgumentException('Invalid argument 1 for ' . $trimmedType . ' operation, expected property'); |
|
307 | + throw new \InvalidArgumentException('Invalid argument 1 for '.$trimmedType.' operation, expected property'); |
|
308 | 308 | } |
309 | 309 | if (!($operator->arguments[1] instanceof Literal)) { |
310 | - throw new \InvalidArgumentException('Invalid argument 2 for ' . $trimmedType . ' operation, expected literal'); |
|
310 | + throw new \InvalidArgumentException('Invalid argument 2 for '.$trimmedType.' operation, expected literal'); |
|
311 | 311 | } |
312 | 312 | return new SearchComparison($trimmedType, $this->mapPropertyNameToColumn($operator->arguments[0]), $this->castValue($operator->arguments[0], $operator->arguments[1]->value)); |
313 | 313 | case Operator::OPERATION_IS_COLLECTION: |
314 | 314 | return new SearchComparison('eq', 'mimetype', ICacheEntry::DIRECTORY_MIMETYPE); |
315 | 315 | default: |
316 | - throw new \InvalidArgumentException('Unsupported operation ' . $trimmedType . ' (' . $operator->type . ')'); |
|
316 | + throw new \InvalidArgumentException('Unsupported operation '.$trimmedType.' ('.$operator->type.')'); |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | case FilesPlugin::INTERNAL_FILEID_PROPERTYNAME: |
339 | 339 | return 'fileid'; |
340 | 340 | default: |
341 | - throw new \InvalidArgumentException('Unsupported property for search or order: ' . $property->name); |
|
341 | + throw new \InvalidArgumentException('Unsupported property for search or order: '.$property->name); |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 |
@@ -164,7 +164,7 @@ |
||
164 | 164 | * @since 14.0.0 |
165 | 165 | */ |
166 | 166 | public function render(): string { |
167 | - $detailContent = ($this->detail !== '') ? ' <span class="download-size">(' . Util::sanitizeHTML($this->detail) . ')</span>' : ''; |
|
167 | + $detailContent = ($this->detail !== '') ? ' <span class="download-size">('.Util::sanitizeHTML($this->detail).')</span>' : ''; |
|
168 | 168 | return sprintf( |
169 | 169 | '<li id="%s"><a href="%s"><span class="icon %s"></span>%s %s</a></li>', |
170 | 170 | Util::sanitizeHTML($this->id), Util::sanitizeHTML($this->link), Util::sanitizeHTML($this->icon), Util::sanitizeHTML($this->label), $detailContent |
@@ -57,17 +57,17 @@ |
||
57 | 57 | $result = ['wide' => [], 'exact' => []]; |
58 | 58 | |
59 | 59 | $groups = $this->groupManager->search($search, $limit, $offset); |
60 | - $groupIds = array_map(function (IGroup $group) { return $group->getGID(); }, $groups); |
|
60 | + $groupIds = array_map(function(IGroup $group) { return $group->getGID(); }, $groups); |
|
61 | 61 | |
62 | 62 | if (!$this->shareeEnumeration || count($groups) < $limit) { |
63 | 63 | $hasMoreResults = true; |
64 | 64 | } |
65 | 65 | |
66 | - $userGroups = []; |
|
66 | + $userGroups = []; |
|
67 | 67 | if (!empty($groups) && $this->shareWithGroupOnly) { |
68 | 68 | // Intersect all the groups that match with the groups this user is a member of |
69 | 69 | $userGroups = $this->groupManager->getUserGroups($this->userSession->getUser()); |
70 | - $userGroups = array_map(function (IGroup $group) { return $group->getGID(); }, $userGroups); |
|
70 | + $userGroups = array_map(function(IGroup $group) { return $group->getGID(); }, $userGroups); |
|
71 | 71 | $groupIds = array_intersect($groupIds, $userGroups); |
72 | 72 | } |
73 | 73 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | if (count($configNames) > 1) { |
68 | 68 | if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->systemConfig->getKeys())) { |
69 | - $output->writeln('<error>System config ' . implode(' => ', $configNames) . ' could not be deleted because it did not exist</error>'); |
|
69 | + $output->writeln('<error>System config '.implode(' => ', $configNames).' could not be deleted because it did not exist</error>'); |
|
70 | 70 | return 1; |
71 | 71 | } |
72 | 72 | |
@@ -76,21 +76,21 @@ discard block |
||
76 | 76 | $value = $this->removeSubValue(array_slice($configNames, 1), $value, $input->hasParameterOption('--error-if-not-exists')); |
77 | 77 | } |
78 | 78 | catch (\UnexpectedValueException $e) { |
79 | - $output->writeln('<error>System config ' . implode(' => ', $configNames) . ' could not be deleted because it did not exist</error>'); |
|
79 | + $output->writeln('<error>System config '.implode(' => ', $configNames).' could not be deleted because it did not exist</error>'); |
|
80 | 80 | return 1; |
81 | 81 | } |
82 | 82 | |
83 | 83 | $this->systemConfig->setValue($configName, $value); |
84 | - $output->writeln('<info>System config value ' . implode(' => ', $configNames) . ' deleted</info>'); |
|
84 | + $output->writeln('<info>System config value '.implode(' => ', $configNames).' deleted</info>'); |
|
85 | 85 | return 0; |
86 | 86 | } else { |
87 | 87 | if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->systemConfig->getKeys())) { |
88 | - $output->writeln('<error>System config ' . $configName . ' could not be deleted because it did not exist</error>'); |
|
88 | + $output->writeln('<error>System config '.$configName.' could not be deleted because it did not exist</error>'); |
|
89 | 89 | return 1; |
90 | 90 | } |
91 | 91 | |
92 | 92 | $this->systemConfig->deleteValue($configName); |
93 | - $output->writeln('<info>System config value ' . $configName . ' deleted</info>'); |
|
93 | + $output->writeln('<info>System config value '.$configName.' deleted</info>'); |
|
94 | 94 | return 0; |
95 | 95 | } |
96 | 96 | } |