@@ -231,7 +231,7 @@ |
||
231 | 231 | $result->closeCursor(); |
232 | 232 | |
233 | 233 | if ($all) { |
234 | - return ((int)$row[0] === count($objIds)); |
|
234 | + return ((int) $row[0] === count($objIds)); |
|
235 | 235 | } else { |
236 | 236 | return (bool) $row; |
237 | 237 | } |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | ->from(self::TAG_TABLE); |
137 | 137 | |
138 | 138 | if (!is_null($visibilityFilter)) { |
139 | - $query->andWhere($query->expr()->eq('visibility', $query->createNamedParameter((int)$visibilityFilter))); |
|
139 | + $query->andWhere($query->expr()->eq('visibility', $query->createNamedParameter((int) $visibilityFilter))); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | if (!empty($nameSearchPattern)) { |
143 | 143 | $query->andWhere( |
144 | 144 | $query->expr()->like( |
145 | 145 | 'name', |
146 | - $query->createNamedParameter('%' . $this->connection->escapeLikeParameter($nameSearchPattern). '%') |
|
146 | + $query->createNamedParameter('%'.$this->connection->escapeLikeParameter($nameSearchPattern).'%') |
|
147 | 147 | ) |
148 | 148 | ); |
149 | 149 | } |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * {@inheritdoc} |
168 | 168 | */ |
169 | 169 | public function getTag($tagName, $userVisible, $userAssignable) { |
170 | - $userVisible = (int)$userVisible; |
|
171 | - $userAssignable = (int)$userAssignable; |
|
170 | + $userVisible = (int) $userVisible; |
|
171 | + $userAssignable = (int) $userAssignable; |
|
172 | 172 | |
173 | 173 | $result = $this->selectTagQuery |
174 | 174 | ->setParameter('name', $tagName) |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $result->closeCursor(); |
181 | 181 | if (!$row) { |
182 | 182 | throw new TagNotFoundException( |
183 | - 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') does not exist' |
|
183 | + 'Tag ("'.$tagName.'", '.$userVisible.', '.$userAssignable.') does not exist' |
|
184 | 184 | ); |
185 | 185 | } |
186 | 186 | |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | * {@inheritdoc} |
192 | 192 | */ |
193 | 193 | public function createTag($tagName, $userVisible, $userAssignable) { |
194 | - $userVisible = (int)$userVisible; |
|
195 | - $userAssignable = (int)$userAssignable; |
|
194 | + $userVisible = (int) $userVisible; |
|
195 | + $userAssignable = (int) $userAssignable; |
|
196 | 196 | |
197 | 197 | $query = $this->connection->getQueryBuilder(); |
198 | 198 | $query->insert(self::TAG_TABLE) |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $query->execute(); |
207 | 207 | } catch (UniqueConstraintViolationException $e) { |
208 | 208 | throw new TagAlreadyExistsException( |
209 | - 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') already exists', |
|
209 | + 'Tag ("'.$tagName.'", '.$userVisible.', '.$userAssignable.') already exists', |
|
210 | 210 | 0, |
211 | 211 | $e |
212 | 212 | ); |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | $tagId = $query->getLastInsertId(); |
216 | 216 | |
217 | 217 | $tag = new SystemTag( |
218 | - (int)$tagId, |
|
218 | + (int) $tagId, |
|
219 | 219 | $tagName, |
220 | - (bool)$userVisible, |
|
221 | - (bool)$userAssignable |
|
220 | + (bool) $userVisible, |
|
221 | + (bool) $userAssignable |
|
222 | 222 | ); |
223 | 223 | |
224 | 224 | $this->dispatcher->dispatch(ManagerEvent::EVENT_CREATE, new ManagerEvent( |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | * {@inheritdoc} |
233 | 233 | */ |
234 | 234 | public function updateTag($tagId, $tagName, $userVisible, $userAssignable) { |
235 | - $userVisible = (int)$userVisible; |
|
236 | - $userAssignable = (int)$userAssignable; |
|
235 | + $userVisible = (int) $userVisible; |
|
236 | + $userAssignable = (int) $userAssignable; |
|
237 | 237 | |
238 | 238 | try { |
239 | 239 | $tags = $this->getTagsByIds($tagId); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | } |
271 | 271 | } catch (UniqueConstraintViolationException $e) { |
272 | 272 | throw new TagAlreadyExistsException( |
273 | - 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') already exists', |
|
273 | + 'Tag ("'.$tagName.'", '.$userVisible.', '.$userAssignable.') already exists', |
|
274 | 274 | 0, |
275 | 275 | $e |
276 | 276 | ); |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | } |
378 | 378 | |
379 | 379 | private function createSystemTagFromRow($row) { |
380 | - return new SystemTag((int)$row['id'], $row['name'], (bool)$row['visibility'], (bool)$row['editable']); |
|
380 | + return new SystemTag((int) $row['id'], $row['name'], (bool) $row['visibility'], (bool) $row['editable']); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |
@@ -222,8 +222,8 @@ |
||
222 | 222 | public function count($search = '') { |
223 | 223 | $users = false; |
224 | 224 | foreach ($this->backends as $backend) { |
225 | - if($backend->implementsActions(\OC\Group\Backend::COUNT_USERS)) { |
|
226 | - if($users === false) { |
|
225 | + if ($backend->implementsActions(\OC\Group\Backend::COUNT_USERS)) { |
|
226 | + if ($users === false) { |
|
227 | 227 | //we could directly add to a bool variable, but this would |
228 | 228 | //be ugly |
229 | 229 | $users = 0; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * Tries to create a new group. If the group name already exists, false will |
77 | 77 | * be returned. |
78 | 78 | */ |
79 | - public function createGroup( $gid ) { |
|
79 | + public function createGroup($gid) { |
|
80 | 80 | $this->fixDI(); |
81 | 81 | |
82 | 82 | // Add group |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * Deletes a group and removes it from the group_user-table |
99 | 99 | */ |
100 | - public function deleteGroup( $gid ) { |
|
100 | + public function deleteGroup($gid) { |
|
101 | 101 | $this->fixDI(); |
102 | 102 | |
103 | 103 | // Delete the group |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * |
133 | 133 | * Checks whether the user is member of a group or not. |
134 | 134 | */ |
135 | - public function inGroup( $uid, $gid ) { |
|
135 | + public function inGroup($uid, $gid) { |
|
136 | 136 | $this->fixDI(); |
137 | 137 | |
138 | 138 | // check |
@@ -157,18 +157,18 @@ discard block |
||
157 | 157 | * |
158 | 158 | * Adds a user to a group. |
159 | 159 | */ |
160 | - public function addToGroup( $uid, $gid ) { |
|
160 | + public function addToGroup($uid, $gid) { |
|
161 | 161 | $this->fixDI(); |
162 | 162 | |
163 | 163 | // No duplicate entries! |
164 | - if( !$this->inGroup( $uid, $gid )) { |
|
164 | + if (!$this->inGroup($uid, $gid)) { |
|
165 | 165 | $qb = $this->dbConn->getQueryBuilder(); |
166 | 166 | $qb->insert('group_user') |
167 | 167 | ->setValue('uid', $qb->createNamedParameter($uid)) |
168 | 168 | ->setValue('gid', $qb->createNamedParameter($gid)) |
169 | 169 | ->execute(); |
170 | 170 | return true; |
171 | - }else{ |
|
171 | + } else { |
|
172 | 172 | return false; |
173 | 173 | } |
174 | 174 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * |
182 | 182 | * removes the user from a group. |
183 | 183 | */ |
184 | - public function removeFromGroup( $uid, $gid ) { |
|
184 | + public function removeFromGroup($uid, $gid) { |
|
185 | 185 | $this->fixDI(); |
186 | 186 | |
187 | 187 | $qb = $this->dbConn->getQueryBuilder(); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * This function fetches all groups a user belongs to. It does not check |
202 | 202 | * if the user exists at all. |
203 | 203 | */ |
204 | - public function getUserGroups( $uid ) { |
|
204 | + public function getUserGroups($uid) { |
|
205 | 205 | //guests has empty or null $uid |
206 | 206 | if ($uid === null || $uid === '') { |
207 | 207 | return []; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | ->execute(); |
218 | 218 | |
219 | 219 | $groups = []; |
220 | - while( $row = $cursor->fetch()) { |
|
220 | + while ($row = $cursor->fetch()) { |
|
221 | 221 | $groups[] = $row["gid"]; |
222 | 222 | $this->groupCache[$row['gid']] = $row['gid']; |
223 | 223 | } |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | $parameters = []; |
240 | 240 | $searchLike = ''; |
241 | 241 | if ($search !== '') { |
242 | - $parameters[] = '%' . $search . '%'; |
|
242 | + $parameters[] = '%'.$search.'%'; |
|
243 | 243 | $searchLike = ' WHERE LOWER(`gid`) LIKE LOWER(?)'; |
244 | 244 | } |
245 | 245 | |
246 | - $stmt = \OC_DB::prepare('SELECT `gid` FROM `*PREFIX*groups`' . $searchLike . ' ORDER BY `gid` ASC', $limit, $offset); |
|
246 | + $stmt = \OC_DB::prepare('SELECT `gid` FROM `*PREFIX*groups`'.$searchLike.' ORDER BY `gid` ASC', $limit, $offset); |
|
247 | 247 | $result = $stmt->execute($parameters); |
248 | 248 | $groups = array(); |
249 | 249 | while ($row = $result->fetchRow()) { |
@@ -292,11 +292,11 @@ discard block |
||
292 | 292 | $parameters = [$gid]; |
293 | 293 | $searchLike = ''; |
294 | 294 | if ($search !== '') { |
295 | - $parameters[] = '%' . $this->dbConn->escapeLikeParameter($search) . '%'; |
|
295 | + $parameters[] = '%'.$this->dbConn->escapeLikeParameter($search).'%'; |
|
296 | 296 | $searchLike = ' AND `uid` LIKE ?'; |
297 | 297 | } |
298 | 298 | |
299 | - $stmt = \OC_DB::prepare('SELECT `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?' . $searchLike . ' ORDER BY `uid` ASC', |
|
299 | + $stmt = \OC_DB::prepare('SELECT `uid` FROM `*PREFIX*group_user` WHERE `gid` = ?'.$searchLike.' ORDER BY `uid` ASC', |
|
300 | 300 | $limit, |
301 | 301 | $offset); |
302 | 302 | $result = $stmt->execute($parameters); |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | $parameters = [$gid]; |
319 | 319 | $searchLike = ''; |
320 | 320 | if ($search !== '') { |
321 | - $parameters[] = '%' . $this->dbConn->escapeLikeParameter($search) . '%'; |
|
321 | + $parameters[] = '%'.$this->dbConn->escapeLikeParameter($search).'%'; |
|
322 | 322 | $searchLike = ' AND `uid` LIKE ?'; |
323 | 323 | } |
324 | 324 | |
325 | - $stmt = \OC_DB::prepare('SELECT COUNT(`uid`) AS `count` FROM `*PREFIX*group_user` WHERE `gid` = ?' . $searchLike); |
|
325 | + $stmt = \OC_DB::prepare('SELECT COUNT(`uid`) AS `count` FROM `*PREFIX*group_user` WHERE `gid` = ?'.$searchLike); |
|
326 | 326 | $result = $stmt->execute($parameters); |
327 | 327 | $count = $result->fetchOne(); |
328 | - if($count !== false) { |
|
328 | + if ($count !== false) { |
|
329 | 329 | $count = intval($count); |
330 | 330 | } |
331 | 331 | return $count; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | IUserSession $userSession |
61 | 61 | ) { |
62 | 62 | $this->user = $user; |
63 | - $this->isAdmin = (bool)$isAdmin; |
|
63 | + $this->isAdmin = (bool) $isAdmin; |
|
64 | 64 | $this->groupManager = $groupManager; |
65 | 65 | $this->userSession = $userSession; |
66 | 66 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @return array |
77 | 77 | */ |
78 | 78 | public function get($groupSearch = '', $userSearch = '') { |
79 | - $key = $groupSearch . '::' . $userSearch; |
|
80 | - if(isset($this->metaData[$key])) { |
|
79 | + $key = $groupSearch.'::'.$userSearch; |
|
80 | + if (isset($this->metaData[$key])) { |
|
81 | 81 | return $this->metaData[$key]; |
82 | 82 | } |
83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $sortAdminGroupsIndex = 0; |
89 | 89 | $sortAdminGroupsKeys = array(); |
90 | 90 | |
91 | - foreach($this->getGroups($groupSearch) as $group) { |
|
91 | + foreach ($this->getGroups($groupSearch) as $group) { |
|
92 | 92 | $groupMetaData = $this->generateGroupMetaData($group, $userSearch); |
93 | 93 | if (strtolower($group->getGID()) !== 'admin') { |
94 | 94 | $this->addEntry( |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | * @return \OCP\IGroup[] |
186 | 186 | */ |
187 | 187 | protected function getGroups($search = '') { |
188 | - if($this->isAdmin) { |
|
188 | + if ($this->isAdmin) { |
|
189 | 189 | return $this->groupManager->search($search); |
190 | 190 | } else { |
191 | 191 | $userObject = $this->userSession->getUser(); |
192 | - if($userObject !== null) { |
|
192 | + if ($userObject !== null) { |
|
193 | 193 | $groups = $this->groupManager->getSubAdmin()->getSubAdminsGroups($userObject); |
194 | 194 | } else { |
195 | 195 | $groups = []; |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function getSupportedActions() { |
51 | 51 | $actions = 0; |
52 | - foreach($this->possibleActions AS $action => $methodName) { |
|
53 | - if(method_exists($this, $methodName)) { |
|
52 | + foreach ($this->possibleActions AS $action => $methodName) { |
|
53 | + if (method_exists($this, $methodName)) { |
|
54 | 54 | $actions |= $action; |
55 | 55 | } |
56 | 56 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * compared with \OC\Group\Backend::CREATE_GROUP etc. |
68 | 68 | */ |
69 | 69 | public function implementsActions($actions) { |
70 | - return (bool)($this->getSupportedActions() & $actions); |
|
70 | + return (bool) ($this->getSupportedActions() & $actions); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -20,4 +20,4 @@ |
||
20 | 20 | * |
21 | 21 | */ |
22 | 22 | |
23 | -require_once __DIR__ . '/v1.php'; |
|
23 | +require_once __DIR__.'/v1.php'; |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * |
20 | 20 | */ |
21 | 21 | |
22 | -require_once __DIR__ . '/../lib/base.php'; |
|
22 | +require_once __DIR__.'/../lib/base.php'; |
|
23 | 23 | |
24 | 24 | header('Content-Type: application/json'); |
25 | 25 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | try { |
31 | 31 | |
32 | - require_once __DIR__ . '/lib/base.php'; |
|
32 | + require_once __DIR__.'/lib/base.php'; |
|
33 | 33 | |
34 | 34 | $systemConfig = \OC::$server->getSystemConfig(); |
35 | 35 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | # see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php |
39 | 39 | # for description and defaults |
40 | 40 | $defaults = new \OCP\Defaults(); |
41 | - $values=array( |
|
41 | + $values = array( |
|
42 | 42 | 'installed'=>$installed, |
43 | 43 | 'maintenance' => $maintenance, |
44 | 44 | 'needsDbUpgrade' => \OCP\Util::needUpgrade(), |