Completed
Pull Request — master (#10075)
by
unknown
27:10
created
lib/private/Group/Database.php 4 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -380,7 +380,6 @@
 block discarded – undo
380 380
 	/**
381 381
 	 * get the number of disabled users in a group
382 382
 	 *
383
-	 * @param string $search
384 383
 	 * @return int|bool
385 384
 	 */
386 385
 	public function countDisabledInGroup(string $gid): int {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * Checks whether the user is member of a group or not.
152 152
 	 */
153
-	public function inGroup( $uid, $gid ) {
153
+	public function inGroup($uid, $gid) {
154 154
 		$this->fixDI();
155 155
 
156 156
 		// check
@@ -179,14 +179,14 @@  discard block
 block discarded – undo
179 179
 		$this->fixDI();
180 180
 
181 181
 		// No duplicate entries!
182
-		if( !$this->inGroup( $uid, $gid )) {
182
+		if (!$this->inGroup($uid, $gid)) {
183 183
 			$qb = $this->dbConn->getQueryBuilder();
184 184
 			$qb->insert('group_user')
185 185
 				->setValue('uid', $qb->createNamedParameter($uid))
186 186
 				->setValue('gid', $qb->createNamedParameter($gid))
187 187
 				->execute();
188 188
 			return true;
189
-		}else{
189
+		} else {
190 190
 			return false;
191 191
 		}
192 192
 	}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	 * This function fetches all groups a user belongs to. It does not check
220 220
 	 * if the user exists at all.
221 221
 	 */
222
-	public function getUserGroups( $uid ) {
222
+	public function getUserGroups($uid) {
223 223
 		//guests has empty or null $uid
224 224
 		if ($uid === null || $uid === '') {
225 225
 			return [];
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 			->execute();
236 236
 
237 237
 		$groups = [];
238
-		while( $row = $cursor->fetch()) {
238
+		while ($row = $cursor->fetch()) {
239 239
 			$groups[] = $row['gid'];
240 240
 			$this->groupCache[$row['gid']] = $row['gid'];
241 241
 		}
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
 		if ($search !== '') {
265 265
 			$query->where($query->expr()->iLike('gid', $query->createNamedParameter(
266
-				'%' . $this->dbConn->escapeLikeParameter($search) . '%'
266
+				'%'.$this->dbConn->escapeLikeParameter($search).'%'
267 267
 			)));
268 268
 		}
269 269
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
 		if ($search !== '') {
329 329
 			$query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
330
-				'%' . $this->dbConn->escapeLikeParameter($search) . '%'
330
+				'%'.$this->dbConn->escapeLikeParameter($search).'%'
331 331
 			)));
332 332
 		}
333 333
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 
361 361
 		if ($search !== '') {
362 362
 			$query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
363
-				'%' . $this->dbConn->escapeLikeParameter($search) . '%'
363
+				'%'.$this->dbConn->escapeLikeParameter($search).'%'
364 364
 			)));
365 365
 		}
366 366
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		$result->closeCursor();
370 370
 
371 371
 		if ($count !== false) {
372
-			$count = (int)$count;
372
+			$count = (int) $count;
373 373
 		} else {
374 374
 			$count = 0;
375 375
 		}
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 		$result->closeCursor();
401 401
 		
402 402
 		if ($count !== false) {
403
-			$count = (int)$count;
403
+			$count = (int) $count;
404 404
 		} else {
405 405
 			$count = 0;
406 406
 		}
Please login to merge, or discard this patch.
Indentation   +349 added lines, -349 removed lines patch added patch discarded remove patch
@@ -55,357 +55,357 @@
 block discarded – undo
55 55
  * Class for group management in a SQL Database (e.g. MySQL, SQLite)
56 56
  */
57 57
 class Database extends ABackend
58
-	implements IAddToGroupBackend,
59
-	           ICountDisabledInGroup,
60
-	           ICountUsersBackend,
61
-	           ICreateGroupBackend,
62
-	           IDeleteGroupBackend,
63
-	           IRemoveFromGroupBackend {
64
-
65
-	/** @var string[] */
66
-	private $groupCache = [];
67
-
68
-	/** @var IDBConnection */
69
-	private $dbConn;
70
-
71
-	/**
72
-	 * \OC\Group\Database constructor.
73
-	 *
74
-	 * @param IDBConnection|null $dbConn
75
-	 */
76
-	public function __construct(IDBConnection $dbConn = null) {
77
-		$this->dbConn = $dbConn;
78
-	}
79
-
80
-	/**
81
-	 * FIXME: This function should not be required!
82
-	 */
83
-	private function fixDI() {
84
-		if ($this->dbConn === null) {
85
-			$this->dbConn = \OC::$server->getDatabaseConnection();
86
-		}
87
-	}
88
-
89
-	/**
90
-	 * Try to create a new group
91
-	 * @param string $gid The name of the group to create
92
-	 * @return bool
93
-	 *
94
-	 * Tries to create a new group. If the group name already exists, false will
95
-	 * be returned.
96
-	 */
97
-	public function createGroup(string $gid): bool {
98
-		$this->fixDI();
99
-
100
-		// Add group
101
-		$result = $this->dbConn->insertIfNotExist('*PREFIX*groups', [
102
-			'gid' => $gid,
103
-		]);
104
-
105
-		// Add to cache
106
-		$this->groupCache[$gid] = $gid;
107
-
108
-		return $result === 1;
109
-	}
110
-
111
-	/**
112
-	 * delete a group
113
-	 * @param string $gid gid of the group to delete
114
-	 * @return bool
115
-	 *
116
-	 * Deletes a group and removes it from the group_user-table
117
-	 */
118
-	public function deleteGroup(string $gid): bool {
119
-		$this->fixDI();
120
-
121
-		// Delete the group
122
-		$qb = $this->dbConn->getQueryBuilder();
123
-		$qb->delete('groups')
124
-			->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
125
-			->execute();
126
-
127
-		// Delete the group-user relation
128
-		$qb = $this->dbConn->getQueryBuilder();
129
-		$qb->delete('group_user')
130
-			->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
131
-			->execute();
132
-
133
-		// Delete the group-groupadmin relation
134
-		$qb = $this->dbConn->getQueryBuilder();
135
-		$qb->delete('group_admin')
136
-			->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
137
-			->execute();
138
-
139
-		// Delete from cache
140
-		unset($this->groupCache[$gid]);
141
-
142
-		return true;
143
-	}
144
-
145
-	/**
146
-	 * is user in group?
147
-	 * @param string $uid uid of the user
148
-	 * @param string $gid gid of the group
149
-	 * @return bool
150
-	 *
151
-	 * Checks whether the user is member of a group or not.
152
-	 */
153
-	public function inGroup( $uid, $gid ) {
154
-		$this->fixDI();
155
-
156
-		// check
157
-		$qb = $this->dbConn->getQueryBuilder();
158
-		$cursor = $qb->select('uid')
159
-			->from('group_user')
160
-			->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
161
-			->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
162
-			->execute();
163
-
164
-		$result = $cursor->fetch();
165
-		$cursor->closeCursor();
166
-
167
-		return $result ? true : false;
168
-	}
169
-
170
-	/**
171
-	 * Add a user to a group
172
-	 * @param string $uid Name of the user to add to group
173
-	 * @param string $gid Name of the group in which add the user
174
-	 * @return bool
175
-	 *
176
-	 * Adds a user to a group.
177
-	 */
178
-	public function addToGroup(string $uid, string $gid): bool {
179
-		$this->fixDI();
180
-
181
-		// No duplicate entries!
182
-		if( !$this->inGroup( $uid, $gid )) {
183
-			$qb = $this->dbConn->getQueryBuilder();
184
-			$qb->insert('group_user')
185
-				->setValue('uid', $qb->createNamedParameter($uid))
186
-				->setValue('gid', $qb->createNamedParameter($gid))
187
-				->execute();
188
-			return true;
189
-		}else{
190
-			return false;
191
-		}
192
-	}
193
-
194
-	/**
195
-	 * Removes a user from a group
196
-	 * @param string $uid Name of the user to remove from group
197
-	 * @param string $gid Name of the group from which remove the user
198
-	 * @return bool
199
-	 *
200
-	 * removes the user from a group.
201
-	 */
202
-	public function removeFromGroup(string $uid, string $gid): bool {
203
-		$this->fixDI();
204
-
205
-		$qb = $this->dbConn->getQueryBuilder();
206
-		$qb->delete('group_user')
207
-			->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
208
-			->andWhere($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
209
-			->execute();
210
-
211
-		return true;
212
-	}
213
-
214
-	/**
215
-	 * Get all groups a user belongs to
216
-	 * @param string $uid Name of the user
217
-	 * @return array an array of group names
218
-	 *
219
-	 * This function fetches all groups a user belongs to. It does not check
220
-	 * if the user exists at all.
221
-	 */
222
-	public function getUserGroups( $uid ) {
223
-		//guests has empty or null $uid
224
-		if ($uid === null || $uid === '') {
225
-			return [];
226
-		}
227
-
228
-		$this->fixDI();
229
-
230
-		// No magic!
231
-		$qb = $this->dbConn->getQueryBuilder();
232
-		$cursor = $qb->select('gid')
233
-			->from('group_user')
234
-			->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
235
-			->execute();
236
-
237
-		$groups = [];
238
-		while( $row = $cursor->fetch()) {
239
-			$groups[] = $row['gid'];
240
-			$this->groupCache[$row['gid']] = $row['gid'];
241
-		}
242
-		$cursor->closeCursor();
243
-
244
-		return $groups;
245
-	}
246
-
247
-	/**
248
-	 * get a list of all groups
249
-	 * @param string $search
250
-	 * @param int $limit
251
-	 * @param int $offset
252
-	 * @return array an array of group names
253
-	 *
254
-	 * Returns a list with all groups
255
-	 */
256
-	public function getGroups($search = '', $limit = null, $offset = null) {
257
-		$this->fixDI();
258
-
259
-		$query = $this->dbConn->getQueryBuilder();
260
-		$query->select('gid')
261
-			->from('groups')
262
-			->orderBy('gid', 'ASC');
263
-
264
-		if ($search !== '') {
265
-			$query->where($query->expr()->iLike('gid', $query->createNamedParameter(
266
-				'%' . $this->dbConn->escapeLikeParameter($search) . '%'
267
-			)));
268
-		}
269
-
270
-		$query->setMaxResults($limit)
271
-			->setFirstResult($offset);
272
-		$result = $query->execute();
273
-
274
-		$groups = [];
275
-		while ($row = $result->fetch()) {
276
-			$groups[] = $row['gid'];
277
-		}
278
-		$result->closeCursor();
279
-
280
-		return $groups;
281
-	}
282
-
283
-	/**
284
-	 * check if a group exists
285
-	 * @param string $gid
286
-	 * @return bool
287
-	 */
288
-	public function groupExists($gid) {
289
-		$this->fixDI();
290
-
291
-		// Check cache first
292
-		if (isset($this->groupCache[$gid])) {
293
-			return true;
294
-		}
295
-
296
-		$qb = $this->dbConn->getQueryBuilder();
297
-		$cursor = $qb->select('gid')
298
-			->from('groups')
299
-			->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
300
-			->execute();
301
-		$result = $cursor->fetch();
302
-		$cursor->closeCursor();
303
-
304
-		if ($result !== false) {
305
-			$this->groupCache[$gid] = $gid;
306
-			return true;
307
-		}
308
-		return false;
309
-	}
310
-
311
-	/**
312
-	 * get a list of all users in a group
313
-	 * @param string $gid
314
-	 * @param string $search
315
-	 * @param int $limit
316
-	 * @param int $offset
317
-	 * @return array an array of user ids
318
-	 */
319
-	public function usersInGroup($gid, $search = '', $limit = null, $offset = null) {
320
-		$this->fixDI();
321
-
322
-		$query = $this->dbConn->getQueryBuilder();
323
-		$query->select('uid')
324
-			->from('group_user')
325
-			->where($query->expr()->eq('gid', $query->createNamedParameter($gid)))
326
-			->orderBy('uid', 'ASC');
327
-
328
-		if ($search !== '') {
329
-			$query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
330
-				'%' . $this->dbConn->escapeLikeParameter($search) . '%'
331
-			)));
332
-		}
333
-
334
-		$query->setMaxResults($limit)
335
-			->setFirstResult($offset);
336
-		$result = $query->execute();
337
-
338
-		$users = [];
339
-		while ($row = $result->fetch()) {
340
-			$users[] = $row['uid'];
341
-		}
342
-		$result->closeCursor();
343
-
344
-		return $users;
345
-	}
346
-
347
-	/**
348
-	 * get the number of all users matching the search string in a group
349
-	 * @param string $gid
350
-	 * @param string $search
351
-	 * @return int
352
-	 */
353
-	public function countUsersInGroup(string $gid, string $search = ''): int {
354
-		$this->fixDI();
355
-
356
-		$query = $this->dbConn->getQueryBuilder();
357
-		$query->selectAlias($query->createFunction('COUNT(*)'), 'num_users')
358
-			->from('group_user')
359
-			->where($query->expr()->eq('gid', $query->createNamedParameter($gid)));
360
-
361
-		if ($search !== '') {
362
-			$query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
363
-				'%' . $this->dbConn->escapeLikeParameter($search) . '%'
364
-			)));
365
-		}
366
-
367
-		$result = $query->execute();
368
-		$count = $result->fetchColumn();
369
-		$result->closeCursor();
370
-
371
-		if ($count !== false) {
372
-			$count = (int)$count;
373
-		} else {
374
-			$count = 0;
375
-		}
376
-
377
-		return $count;
378
-	}
379
-
380
-	/**
381
-	 * get the number of disabled users in a group
382
-	 *
383
-	 * @param string $search
384
-	 * @return int|bool
385
-	 */
386
-	public function countDisabledInGroup(string $gid): int {
387
-		$this->fixDI();
58
+    implements IAddToGroupBackend,
59
+                ICountDisabledInGroup,
60
+                ICountUsersBackend,
61
+                ICreateGroupBackend,
62
+                IDeleteGroupBackend,
63
+                IRemoveFromGroupBackend {
64
+
65
+    /** @var string[] */
66
+    private $groupCache = [];
67
+
68
+    /** @var IDBConnection */
69
+    private $dbConn;
70
+
71
+    /**
72
+     * \OC\Group\Database constructor.
73
+     *
74
+     * @param IDBConnection|null $dbConn
75
+     */
76
+    public function __construct(IDBConnection $dbConn = null) {
77
+        $this->dbConn = $dbConn;
78
+    }
79
+
80
+    /**
81
+     * FIXME: This function should not be required!
82
+     */
83
+    private function fixDI() {
84
+        if ($this->dbConn === null) {
85
+            $this->dbConn = \OC::$server->getDatabaseConnection();
86
+        }
87
+    }
88
+
89
+    /**
90
+     * Try to create a new group
91
+     * @param string $gid The name of the group to create
92
+     * @return bool
93
+     *
94
+     * Tries to create a new group. If the group name already exists, false will
95
+     * be returned.
96
+     */
97
+    public function createGroup(string $gid): bool {
98
+        $this->fixDI();
99
+
100
+        // Add group
101
+        $result = $this->dbConn->insertIfNotExist('*PREFIX*groups', [
102
+            'gid' => $gid,
103
+        ]);
104
+
105
+        // Add to cache
106
+        $this->groupCache[$gid] = $gid;
107
+
108
+        return $result === 1;
109
+    }
110
+
111
+    /**
112
+     * delete a group
113
+     * @param string $gid gid of the group to delete
114
+     * @return bool
115
+     *
116
+     * Deletes a group and removes it from the group_user-table
117
+     */
118
+    public function deleteGroup(string $gid): bool {
119
+        $this->fixDI();
120
+
121
+        // Delete the group
122
+        $qb = $this->dbConn->getQueryBuilder();
123
+        $qb->delete('groups')
124
+            ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
125
+            ->execute();
126
+
127
+        // Delete the group-user relation
128
+        $qb = $this->dbConn->getQueryBuilder();
129
+        $qb->delete('group_user')
130
+            ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
131
+            ->execute();
132
+
133
+        // Delete the group-groupadmin relation
134
+        $qb = $this->dbConn->getQueryBuilder();
135
+        $qb->delete('group_admin')
136
+            ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
137
+            ->execute();
138
+
139
+        // Delete from cache
140
+        unset($this->groupCache[$gid]);
141
+
142
+        return true;
143
+    }
144
+
145
+    /**
146
+     * is user in group?
147
+     * @param string $uid uid of the user
148
+     * @param string $gid gid of the group
149
+     * @return bool
150
+     *
151
+     * Checks whether the user is member of a group or not.
152
+     */
153
+    public function inGroup( $uid, $gid ) {
154
+        $this->fixDI();
155
+
156
+        // check
157
+        $qb = $this->dbConn->getQueryBuilder();
158
+        $cursor = $qb->select('uid')
159
+            ->from('group_user')
160
+            ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
161
+            ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
162
+            ->execute();
163
+
164
+        $result = $cursor->fetch();
165
+        $cursor->closeCursor();
166
+
167
+        return $result ? true : false;
168
+    }
169
+
170
+    /**
171
+     * Add a user to a group
172
+     * @param string $uid Name of the user to add to group
173
+     * @param string $gid Name of the group in which add the user
174
+     * @return bool
175
+     *
176
+     * Adds a user to a group.
177
+     */
178
+    public function addToGroup(string $uid, string $gid): bool {
179
+        $this->fixDI();
180
+
181
+        // No duplicate entries!
182
+        if( !$this->inGroup( $uid, $gid )) {
183
+            $qb = $this->dbConn->getQueryBuilder();
184
+            $qb->insert('group_user')
185
+                ->setValue('uid', $qb->createNamedParameter($uid))
186
+                ->setValue('gid', $qb->createNamedParameter($gid))
187
+                ->execute();
188
+            return true;
189
+        }else{
190
+            return false;
191
+        }
192
+    }
193
+
194
+    /**
195
+     * Removes a user from a group
196
+     * @param string $uid Name of the user to remove from group
197
+     * @param string $gid Name of the group from which remove the user
198
+     * @return bool
199
+     *
200
+     * removes the user from a group.
201
+     */
202
+    public function removeFromGroup(string $uid, string $gid): bool {
203
+        $this->fixDI();
204
+
205
+        $qb = $this->dbConn->getQueryBuilder();
206
+        $qb->delete('group_user')
207
+            ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
208
+            ->andWhere($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
209
+            ->execute();
210
+
211
+        return true;
212
+    }
213
+
214
+    /**
215
+     * Get all groups a user belongs to
216
+     * @param string $uid Name of the user
217
+     * @return array an array of group names
218
+     *
219
+     * This function fetches all groups a user belongs to. It does not check
220
+     * if the user exists at all.
221
+     */
222
+    public function getUserGroups( $uid ) {
223
+        //guests has empty or null $uid
224
+        if ($uid === null || $uid === '') {
225
+            return [];
226
+        }
227
+
228
+        $this->fixDI();
229
+
230
+        // No magic!
231
+        $qb = $this->dbConn->getQueryBuilder();
232
+        $cursor = $qb->select('gid')
233
+            ->from('group_user')
234
+            ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
235
+            ->execute();
236
+
237
+        $groups = [];
238
+        while( $row = $cursor->fetch()) {
239
+            $groups[] = $row['gid'];
240
+            $this->groupCache[$row['gid']] = $row['gid'];
241
+        }
242
+        $cursor->closeCursor();
243
+
244
+        return $groups;
245
+    }
246
+
247
+    /**
248
+     * get a list of all groups
249
+     * @param string $search
250
+     * @param int $limit
251
+     * @param int $offset
252
+     * @return array an array of group names
253
+     *
254
+     * Returns a list with all groups
255
+     */
256
+    public function getGroups($search = '', $limit = null, $offset = null) {
257
+        $this->fixDI();
258
+
259
+        $query = $this->dbConn->getQueryBuilder();
260
+        $query->select('gid')
261
+            ->from('groups')
262
+            ->orderBy('gid', 'ASC');
263
+
264
+        if ($search !== '') {
265
+            $query->where($query->expr()->iLike('gid', $query->createNamedParameter(
266
+                '%' . $this->dbConn->escapeLikeParameter($search) . '%'
267
+            )));
268
+        }
269
+
270
+        $query->setMaxResults($limit)
271
+            ->setFirstResult($offset);
272
+        $result = $query->execute();
273
+
274
+        $groups = [];
275
+        while ($row = $result->fetch()) {
276
+            $groups[] = $row['gid'];
277
+        }
278
+        $result->closeCursor();
279
+
280
+        return $groups;
281
+    }
282
+
283
+    /**
284
+     * check if a group exists
285
+     * @param string $gid
286
+     * @return bool
287
+     */
288
+    public function groupExists($gid) {
289
+        $this->fixDI();
290
+
291
+        // Check cache first
292
+        if (isset($this->groupCache[$gid])) {
293
+            return true;
294
+        }
295
+
296
+        $qb = $this->dbConn->getQueryBuilder();
297
+        $cursor = $qb->select('gid')
298
+            ->from('groups')
299
+            ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
300
+            ->execute();
301
+        $result = $cursor->fetch();
302
+        $cursor->closeCursor();
303
+
304
+        if ($result !== false) {
305
+            $this->groupCache[$gid] = $gid;
306
+            return true;
307
+        }
308
+        return false;
309
+    }
310
+
311
+    /**
312
+     * get a list of all users in a group
313
+     * @param string $gid
314
+     * @param string $search
315
+     * @param int $limit
316
+     * @param int $offset
317
+     * @return array an array of user ids
318
+     */
319
+    public function usersInGroup($gid, $search = '', $limit = null, $offset = null) {
320
+        $this->fixDI();
321
+
322
+        $query = $this->dbConn->getQueryBuilder();
323
+        $query->select('uid')
324
+            ->from('group_user')
325
+            ->where($query->expr()->eq('gid', $query->createNamedParameter($gid)))
326
+            ->orderBy('uid', 'ASC');
327
+
328
+        if ($search !== '') {
329
+            $query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
330
+                '%' . $this->dbConn->escapeLikeParameter($search) . '%'
331
+            )));
332
+        }
333
+
334
+        $query->setMaxResults($limit)
335
+            ->setFirstResult($offset);
336
+        $result = $query->execute();
337
+
338
+        $users = [];
339
+        while ($row = $result->fetch()) {
340
+            $users[] = $row['uid'];
341
+        }
342
+        $result->closeCursor();
343
+
344
+        return $users;
345
+    }
346
+
347
+    /**
348
+     * get the number of all users matching the search string in a group
349
+     * @param string $gid
350
+     * @param string $search
351
+     * @return int
352
+     */
353
+    public function countUsersInGroup(string $gid, string $search = ''): int {
354
+        $this->fixDI();
355
+
356
+        $query = $this->dbConn->getQueryBuilder();
357
+        $query->selectAlias($query->createFunction('COUNT(*)'), 'num_users')
358
+            ->from('group_user')
359
+            ->where($query->expr()->eq('gid', $query->createNamedParameter($gid)));
360
+
361
+        if ($search !== '') {
362
+            $query->andWhere($query->expr()->like('uid', $query->createNamedParameter(
363
+                '%' . $this->dbConn->escapeLikeParameter($search) . '%'
364
+            )));
365
+        }
366
+
367
+        $result = $query->execute();
368
+        $count = $result->fetchColumn();
369
+        $result->closeCursor();
370
+
371
+        if ($count !== false) {
372
+            $count = (int)$count;
373
+        } else {
374
+            $count = 0;
375
+        }
376
+
377
+        return $count;
378
+    }
379
+
380
+    /**
381
+     * get the number of disabled users in a group
382
+     *
383
+     * @param string $search
384
+     * @return int|bool
385
+     */
386
+    public function countDisabledInGroup(string $gid): int {
387
+        $this->fixDI();
388 388
 		
389
-		$query = $this->dbConn->getQueryBuilder();
390
-		$query->select($query->createFunction('COUNT(Distinct uid)'))
391
-			->from('preferences', 'p')
392
-			->innerJoin('p', 'group_user', 'g', 'p.userid = g.uid')
393
-			->where($query->expr()->eq('appid', $query->createNamedParameter('core')))
394
-			->andWhere($query->expr()->eq('configkey', $query->createNamedParameter('enabled')))
395
-			->andWhere($query->expr()->eq('configvalue', $query->createNamedParameter('false'), IQueryBuilder::PARAM_STR))
396
-			->andWhere($query->expr()->eq('gid', $query->createNamedParameter($gid), IQueryBuilder::PARAM_STR));
389
+        $query = $this->dbConn->getQueryBuilder();
390
+        $query->select($query->createFunction('COUNT(Distinct uid)'))
391
+            ->from('preferences', 'p')
392
+            ->innerJoin('p', 'group_user', 'g', 'p.userid = g.uid')
393
+            ->where($query->expr()->eq('appid', $query->createNamedParameter('core')))
394
+            ->andWhere($query->expr()->eq('configkey', $query->createNamedParameter('enabled')))
395
+            ->andWhere($query->expr()->eq('configvalue', $query->createNamedParameter('false'), IQueryBuilder::PARAM_STR))
396
+            ->andWhere($query->expr()->eq('gid', $query->createNamedParameter($gid), IQueryBuilder::PARAM_STR));
397 397
 		
398
-		$result = $query->execute();
399
-		$count = $result->fetchColumn();
400
-		$result->closeCursor();
398
+        $result = $query->execute();
399
+        $count = $result->fetchColumn();
400
+        $result->closeCursor();
401 401
 		
402
-		if ($count !== false) {
403
-			$count = (int)$count;
404
-		} else {
405
-			$count = 0;
406
-		}
407
-
408
-		return $count;
409
-	}
402
+        if ($count !== false) {
403
+            $count = (int)$count;
404
+        } else {
405
+            $count = 0;
406
+        }
407
+
408
+        return $count;
409
+    }
410 410
 
411 411
 }
Please login to merge, or discard this patch.
lib/private/Group/Backend.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 	/**
Please login to merge, or discard this patch.
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -26,107 +26,107 @@
 block discarded – undo
26 26
  * Abstract base class for user management
27 27
  */
28 28
 abstract class Backend implements \OCP\GroupInterface {
29
-	/**
30
-	 * error code for functions not provided by the group backend
31
-	 */
32
-	const NOT_IMPLEMENTED = -501;
29
+    /**
30
+     * error code for functions not provided by the group backend
31
+     */
32
+    const NOT_IMPLEMENTED = -501;
33 33
 
34
-	protected $possibleActions = [
35
-		self::CREATE_GROUP => 'createGroup',
36
-		self::DELETE_GROUP => 'deleteGroup',
37
-		self::ADD_TO_GROUP => 'addToGroup',
38
-		self::REMOVE_FROM_GOUP => 'removeFromGroup',
39
-		self::COUNT_USERS => 'countUsersInGroup',
40
-		self::GROUP_DETAILS => 'getGroupDetails',
41
-		self::IS_ADMIN => 'isAdmin',
42
-	];
34
+    protected $possibleActions = [
35
+        self::CREATE_GROUP => 'createGroup',
36
+        self::DELETE_GROUP => 'deleteGroup',
37
+        self::ADD_TO_GROUP => 'addToGroup',
38
+        self::REMOVE_FROM_GOUP => 'removeFromGroup',
39
+        self::COUNT_USERS => 'countUsersInGroup',
40
+        self::GROUP_DETAILS => 'getGroupDetails',
41
+        self::IS_ADMIN => 'isAdmin',
42
+    ];
43 43
 
44
-	/**
45
-	* Get all supported actions
46
-	* @return int bitwise-or'ed actions
47
-	*
48
-	* Returns the supported actions as int to be
49
-	* compared with \OC\Group\Backend::CREATE_GROUP etc.
50
-	*/
51
-	public function getSupportedActions() {
52
-		$actions = 0;
53
-		foreach($this->possibleActions AS $action => $methodName) {
54
-			if(method_exists($this, $methodName)) {
55
-				$actions |= $action;
56
-			}
57
-		}
44
+    /**
45
+     * Get all supported actions
46
+     * @return int bitwise-or'ed actions
47
+     *
48
+     * Returns the supported actions as int to be
49
+     * compared with \OC\Group\Backend::CREATE_GROUP etc.
50
+     */
51
+    public function getSupportedActions() {
52
+        $actions = 0;
53
+        foreach($this->possibleActions AS $action => $methodName) {
54
+            if(method_exists($this, $methodName)) {
55
+                $actions |= $action;
56
+            }
57
+        }
58 58
 
59
-		return $actions;
60
-	}
59
+        return $actions;
60
+    }
61 61
 
62
-	/**
63
-	* Check if backend implements actions
64
-	* @param int $actions bitwise-or'ed actions
65
-	* @return bool
66
-	*
67
-	* Returns the supported actions as int to be
68
-	* compared with \OC\Group\Backend::CREATE_GROUP etc.
69
-	*/
70
-	public function implementsActions($actions) {
71
-		return (bool)($this->getSupportedActions() & $actions);
72
-	}
62
+    /**
63
+     * Check if backend implements actions
64
+     * @param int $actions bitwise-or'ed actions
65
+     * @return bool
66
+     *
67
+     * Returns the supported actions as int to be
68
+     * compared with \OC\Group\Backend::CREATE_GROUP etc.
69
+     */
70
+    public function implementsActions($actions) {
71
+        return (bool)($this->getSupportedActions() & $actions);
72
+    }
73 73
 
74
-	/**
75
-	 * is user in group?
76
-	 * @param string $uid uid of the user
77
-	 * @param string $gid gid of the group
78
-	 * @return bool
79
-	 *
80
-	 * Checks whether the user is member of a group or not.
81
-	 */
82
-	public function inGroup($uid, $gid) {
83
-		return in_array($gid, $this->getUserGroups($uid));
84
-	}
74
+    /**
75
+     * is user in group?
76
+     * @param string $uid uid of the user
77
+     * @param string $gid gid of the group
78
+     * @return bool
79
+     *
80
+     * Checks whether the user is member of a group or not.
81
+     */
82
+    public function inGroup($uid, $gid) {
83
+        return in_array($gid, $this->getUserGroups($uid));
84
+    }
85 85
 
86
-	/**
87
-	 * Get all groups a user belongs to
88
-	 * @param string $uid Name of the user
89
-	 * @return array an array of group names
90
-	 *
91
-	 * This function fetches all groups a user belongs to. It does not check
92
-	 * if the user exists at all.
93
-	 */
94
-	public function getUserGroups($uid) {
95
-		return array();
96
-	}
86
+    /**
87
+     * Get all groups a user belongs to
88
+     * @param string $uid Name of the user
89
+     * @return array an array of group names
90
+     *
91
+     * This function fetches all groups a user belongs to. It does not check
92
+     * if the user exists at all.
93
+     */
94
+    public function getUserGroups($uid) {
95
+        return array();
96
+    }
97 97
 
98
-	/**
99
-	 * get a list of all groups
100
-	 * @param string $search
101
-	 * @param int $limit
102
-	 * @param int $offset
103
-	 * @return array an array of group names
104
-	 *
105
-	 * Returns a list with all groups
106
-	 */
98
+    /**
99
+     * get a list of all groups
100
+     * @param string $search
101
+     * @param int $limit
102
+     * @param int $offset
103
+     * @return array an array of group names
104
+     *
105
+     * Returns a list with all groups
106
+     */
107 107
 
108
-	public function getGroups($search = '', $limit = -1, $offset = 0) {
109
-		return array();
110
-	}
108
+    public function getGroups($search = '', $limit = -1, $offset = 0) {
109
+        return array();
110
+    }
111 111
 
112
-	/**
113
-	 * check if a group exists
114
-	 * @param string $gid
115
-	 * @return bool
116
-	 */
117
-	public function groupExists($gid) {
118
-		return in_array($gid, $this->getGroups($gid, 1));
119
-	}
112
+    /**
113
+     * check if a group exists
114
+     * @param string $gid
115
+     * @return bool
116
+     */
117
+    public function groupExists($gid) {
118
+        return in_array($gid, $this->getGroups($gid, 1));
119
+    }
120 120
 
121
-	/**
122
-	 * get a list of all users in a group
123
-	 * @param string $gid
124
-	 * @param string $search
125
-	 * @param int $limit
126
-	 * @param int $offset
127
-	 * @return array an array of user ids
128
-	 */
129
-	public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
130
-		return array();
131
-	}
121
+    /**
122
+     * get a list of all users in a group
123
+     * @param string $gid
124
+     * @param string $search
125
+     * @param int $limit
126
+     * @param int $offset
127
+     * @return array an array of user ids
128
+     */
129
+    public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
130
+        return array();
131
+    }
132 132
 }
Please login to merge, or discard this patch.
ocs/v2.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,4 +20,4 @@
 block discarded – undo
20 20
  *
21 21
  */
22 22
 
23
-require_once __DIR__ . '/v1.php';
23
+require_once __DIR__.'/v1.php';
Please login to merge, or discard this patch.
ocs-provider/index.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@
 block discarded – undo
26 26
 $server = \OC::$server;
27 27
 
28 28
 $controller = new \OC\OCS\Provider(
29
-	'ocs_provider',
30
-	$server->getRequest(),
31
-	$server->getAppManager()
29
+    'ocs_provider',
30
+    $server->getRequest(),
31
+    $server->getAppManager()
32 32
 );
33 33
 echo $controller->buildProviderList()->render();
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
core/templates/update.admin.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 		<h2 class="title"><?php p($l->t('App update required')); ?></h2>
5 5
 		<?php } else { ?>
6 6
 		<h2 class="title"><?php p($l->t('%s will be updated to version %s',
7
-			array($_['productName'], $_['version']))); ?></h2>
7
+            array($_['productName'], $_['version']))); ?></h2>
8 8
 		<?php } ?>
9 9
 		<?php if (!empty($_['appsToUpgrade'])) { ?>
10 10
 		<div class="infogroup">
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 		<p id="update-progress-message-error" class="hidden"></p>
50 50
 		<ul id="update-progress-message-warnings" class="hidden"></ul>
51 51
 		<p id="update-progress-message"></p>
52
-		<a class="update-show-detailed"><?php p($l->t( 'Detailed logs' )); ?> <img src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a>
52
+		<a class="update-show-detailed"><?php p($l->t('Detailed logs')); ?> <img src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a>
53 53
 		<div id="update-progress-detailed" class="hidden"></div>
54 54
 	</div>
55 55
 </div>
Please login to merge, or discard this patch.
core/templates/installation.php 3 patches
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,8 +18,11 @@  discard block
 block discarded – undo
18 18
 			<?php if(is_array($err)):?>
19 19
 				<?php print_unescaped($err['error']); ?>
20 20
 				<span class='hint'><?php print_unescaped($err['hint']); ?></span>
21
-			<?php else: ?>
22
-				<?php print_unescaped($err); ?>
21
+			<?php else {
22
+    : ?>
23
+				<?php print_unescaped($err);
24
+}
25
+?>
23 26
 			<?php endif; ?>
24 27
 		</p>
25 28
 		<?php endforeach; ?>
@@ -75,8 +78,12 @@  discard block
 block discarded – undo
75 78
 
76 79
 	<?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
77 80
 	<fieldset id='databaseBackend'>
78
-		<?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle'])
79
-			$hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?>
81
+		<?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) {
82
+			$hasOtherDB = true;
83
+} else {
84
+			    $hasOtherDB =false;
85
+			}
86
+			//other than SQLite ?>
80 87
 		<legend><?php p($l->t( 'Configure the database' )); ?></legend>
81 88
 		<div id="selectDbType">
82 89
 		<?php foreach($_['databases'] as $type => $label): ?>
@@ -88,11 +95,14 @@  discard block
 block discarded – undo
88 95
 				<?php p($l->t( 'For more details check out the documentation.' )); ?> ↗</a>
89 96
 		</p>
90 97
 		<input type="hidden" id="dbtype" name="dbtype" value="<?php p($type) ?>">
91
-		<?php else: ?>
98
+		<?php else {
99
+    : ?>
92 100
 		<input type="radio" name="dbtype" value="<?php p($type) ?>" id="<?php p($type) ?>"
93 101
 			<?php print_unescaped($_['dbtype'] === $type ? 'checked="checked" ' : '') ?>/>
94 102
 		<label class="<?php p($type) ?>" for="<?php p($type) ?>"><?php p($label) ?></label>
95
-		<?php endif; ?>
103
+		<?php endif;
104
+}
105
+?>
96 106
 		<?php endforeach; ?>
97 107
 		</div>
98 108
 	</fieldset>
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 script('core', [
3
-	'jquery-showpassword',
4
-	'installation'
3
+    'jquery-showpassword',
4
+    'installation'
5 5
 ]);
6 6
 ?>
7 7
 <input type='hidden' id='hasMySQL' value='<?php p($_['hasMySQL']) ?>'>
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 		<legend><strong><?php p($l->t('Security warning'));?></strong></legend>
31 31
 		<p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br>
32 32
 		<?php print_unescaped($l->t(
33
-			'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer noopener">documentation</a>.',
34
-			[link_to_docs('admin-install')]
35
-		)); ?></p>
33
+            'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer noopener">documentation</a>.',
34
+            [link_to_docs('admin-install')]
35
+        )); ?></p>
36 36
 	</fieldset>
37 37
 	<?php endif; ?>
38 38
 	<fieldset id="adminaccount">
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	<?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
77 77
 	<fieldset id='databaseBackend'>
78 78
 		<?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle'])
79
-			$hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?>
79
+            $hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?>
80 80
 		<legend><?php p($l->t( 'Configure the database' )); ?></legend>
81 81
 		<div id="selectDbType">
82 82
 		<?php foreach($_['databases'] as $type => $label): ?>
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 <input type='hidden' id='hasOracle' value='<?php p($_['hasOracle']) ?>'>
11 11
 <form action="index.php" method="post">
12 12
 <input type="hidden" name="install" value="true">
13
-	<?php if(count($_['errors']) > 0): ?>
13
+	<?php if (count($_['errors']) > 0): ?>
14 14
 	<fieldset class="warning">
15
-		<legend><strong><?php p($l->t('Error'));?></strong></legend>
16
-		<?php foreach($_['errors'] as $err): ?>
15
+		<legend><strong><?php p($l->t('Error')); ?></strong></legend>
16
+		<?php foreach ($_['errors'] as $err): ?>
17 17
 		<p>
18
-			<?php if(is_array($err)):?>
18
+			<?php if (is_array($err)):?>
19 19
 				<?php print_unescaped($err['error']); ?>
20 20
 				<span class='hint'><?php print_unescaped($err['hint']); ?></span>
21 21
 			<?php else: ?>
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 		<?php endforeach; ?>
26 26
 	</fieldset>
27 27
 	<?php endif; ?>
28
-	<?php if(!$_['htaccessWorking']): ?>
28
+	<?php if (!$_['htaccessWorking']): ?>
29 29
 	<fieldset class="warning">
30
-		<legend><strong><?php p($l->t('Security warning'));?></strong></legend>
31
-		<p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br>
30
+		<legend><strong><?php p($l->t('Security warning')); ?></strong></legend>
31
+		<p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.')); ?><br>
32 32
 		<?php print_unescaped($l->t(
33 33
 			'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer noopener">documentation</a>.',
34 34
 			[link_to_docs('admin-install')]
@@ -36,35 +36,35 @@  discard block
 block discarded – undo
36 36
 	</fieldset>
37 37
 	<?php endif; ?>
38 38
 	<fieldset id="adminaccount">
39
-		<legend><?php print_unescaped($l->t( 'Create an <strong>admin account</strong>' )); ?></legend>
39
+		<legend><?php print_unescaped($l->t('Create an <strong>admin account</strong>')); ?></legend>
40 40
 		<p class="grouptop">
41 41
 			<input type="text" name="adminlogin" id="adminlogin"
42
-				placeholder="<?php p($l->t( 'Username' )); ?>"
42
+				placeholder="<?php p($l->t('Username')); ?>"
43 43
 				value="<?php p($_['adminlogin']); ?>"
44 44
 				autocomplete="off" autocapitalize="none" autocorrect="off" autofocus required>
45
-			<label for="adminlogin" class="infield"><?php p($l->t( 'Username' )); ?></label>
45
+			<label for="adminlogin" class="infield"><?php p($l->t('Username')); ?></label>
46 46
 		</p>
47 47
 		<p class="groupbottom">
48 48
 			<input type="password" name="adminpass" data-typetoggle="#show" id="adminpass"
49
-				placeholder="<?php p($l->t( 'Password' )); ?>"
49
+				placeholder="<?php p($l->t('Password')); ?>"
50 50
 				value="<?php p($_['adminpass']); ?>"
51 51
 				autocomplete="off" autocapitalize="none" autocorrect="off" required>
52
-			<label for="adminpass" class="infield"><?php p($l->t( 'Password' )); ?></label>
52
+			<label for="adminpass" class="infield"><?php p($l->t('Password')); ?></label>
53 53
 			<input type="checkbox" id="show" name="show">
54 54
 			<label for="show"></label>
55 55
 		</p>
56 56
 	</fieldset>
57 57
 
58
-	<?php if(!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?>
58
+	<?php if (!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?>
59 59
 	<fieldset id="advancedHeader">
60
-		<legend><a id="showAdvanced"><?php p($l->t( 'Storage & database' )); ?> <img src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a></legend>
60
+		<legend><a id="showAdvanced"><?php p($l->t('Storage & database')); ?> <img src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a></legend>
61 61
 	</fieldset>
62 62
 	<?php endif; ?>
63 63
 
64
-	<?php if(!$_['directoryIsSet'] OR count($_['errors']) > 0): ?>
64
+	<?php if (!$_['directoryIsSet'] OR count($_['errors']) > 0): ?>
65 65
 	<fieldset id="datadirField">
66 66
 		<div id="datadirContent">
67
-			<label for="directory"><?php p($l->t( 'Data folder' )); ?></label>
67
+			<label for="directory"><?php p($l->t('Data folder')); ?></label>
68 68
 			<input type="text" name="directory" id="directory"
69 69
 				placeholder="<?php p(OC::$SERVERROOT.'/data'); ?>"
70 70
 				value="<?php p($_['directory']); ?>"
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
 	</fieldset>
74 74
 	<?php endif; ?>
75 75
 
76
-	<?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
76
+	<?php if (!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
77 77
 	<fieldset id='databaseBackend'>
78
-		<?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle'])
79
-			$hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?>
80
-		<legend><?php p($l->t( 'Configure the database' )); ?></legend>
78
+		<?php if ($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle'])
79
+			$hasOtherDB = true; else $hasOtherDB = false; //other than SQLite ?>
80
+		<legend><?php p($l->t('Configure the database')); ?></legend>
81 81
 		<div id="selectDbType">
82
-		<?php foreach($_['databases'] as $type => $label): ?>
83
-		<?php if(count($_['databases']) === 1): ?>
82
+		<?php foreach ($_['databases'] as $type => $label): ?>
83
+		<?php if (count($_['databases']) === 1): ?>
84 84
 		<p class="info">
85
-			<?php p($l->t( 'Only %s is available.', array($label) )); ?>
86
-			<?php p($l->t( 'Install and activate additional PHP modules to choose other database types.' )); ?><br>
85
+			<?php p($l->t('Only %s is available.', array($label))); ?>
86
+			<?php p($l->t('Install and activate additional PHP modules to choose other database types.')); ?><br>
87 87
 			<a href="<?php print_unescaped(link_to_docs('admin-source_install')); ?>" target="_blank" rel="noreferrer noopener">
88
-				<?php p($l->t( 'For more details check out the documentation.' )); ?> ↗</a>
88
+				<?php p($l->t('For more details check out the documentation.')); ?> ↗</a>
89 89
 		</p>
90 90
 		<input type="hidden" id="dbtype" name="dbtype" value="<?php p($type) ?>">
91 91
 		<?php else: ?>
@@ -97,75 +97,75 @@  discard block
 block discarded – undo
97 97
 		</div>
98 98
 	</fieldset>
99 99
 
100
-		<?php if($hasOtherDB): ?>
100
+		<?php if ($hasOtherDB): ?>
101 101
 		<fieldset id='databaseField'>
102 102
 		<div id="use_other_db">
103 103
 			<p class="grouptop">
104
-				<label for="dbuser" class="infield"><?php p($l->t( 'Database user' )); ?></label>
104
+				<label for="dbuser" class="infield"><?php p($l->t('Database user')); ?></label>
105 105
 				<input type="text" name="dbuser" id="dbuser"
106
-					placeholder="<?php p($l->t( 'Database user' )); ?>"
106
+					placeholder="<?php p($l->t('Database user')); ?>"
107 107
 					value="<?php p($_['dbuser']); ?>"
108 108
 					autocomplete="off" autocapitalize="none" autocorrect="off">
109 109
 			</p>
110 110
 			<p class="groupmiddle">
111 111
 				<input type="password" name="dbpass" id="dbpass" data-typetoggle="#dbpassword-toggle"
112
-					placeholder="<?php p($l->t( 'Database password' )); ?>"
112
+					placeholder="<?php p($l->t('Database password')); ?>"
113 113
 					value="<?php p($_['dbpass']); ?>"
114 114
 					autocomplete="off" autocapitalize="none" autocorrect="off">
115
-				<label for="dbpass" class="infield"><?php p($l->t( 'Database password' )); ?></label>
115
+				<label for="dbpass" class="infield"><?php p($l->t('Database password')); ?></label>
116 116
 				<input type="checkbox" id="dbpassword-toggle" name="dbpassword-toggle">
117 117
 				<label for="dbpassword-toggle"></label>
118 118
 			</p>
119 119
 			<p class="groupmiddle">
120
-				<label for="dbname" class="infield"><?php p($l->t( 'Database name' )); ?></label>
120
+				<label for="dbname" class="infield"><?php p($l->t('Database name')); ?></label>
121 121
 				<input type="text" name="dbname" id="dbname"
122
-					placeholder="<?php p($l->t( 'Database name' )); ?>"
122
+					placeholder="<?php p($l->t('Database name')); ?>"
123 123
 					value="<?php p($_['dbname']); ?>"
124 124
 					autocomplete="off" autocapitalize="none" autocorrect="off"
125 125
 					pattern="[0-9a-zA-Z$_-]+">
126 126
 			</p>
127
-			<?php if($_['hasOracle']): ?>
127
+			<?php if ($_['hasOracle']): ?>
128 128
 			<div id="use_oracle_db">
129 129
 				<p class="groupmiddle">
130
-					<label for="dbtablespace" class="infield"><?php p($l->t( 'Database tablespace' )); ?></label>
130
+					<label for="dbtablespace" class="infield"><?php p($l->t('Database tablespace')); ?></label>
131 131
 					<input type="text" name="dbtablespace" id="dbtablespace"
132
-						placeholder="<?php p($l->t( 'Database tablespace' )); ?>"
132
+						placeholder="<?php p($l->t('Database tablespace')); ?>"
133 133
 						value="<?php p($_['dbtablespace']); ?>"
134 134
 						autocomplete="off" autocapitalize="none" autocorrect="off">
135 135
 				</p>
136 136
 			</div>
137 137
 			<?php endif; ?>
138 138
 			<p class="groupbottom">
139
-				<label for="dbhost" class="infield"><?php p($l->t( 'Database host' )); ?></label>
139
+				<label for="dbhost" class="infield"><?php p($l->t('Database host')); ?></label>
140 140
 				<input type="text" name="dbhost" id="dbhost"
141
-					placeholder="<?php p($l->t( 'Database host' )); ?>"
141
+					placeholder="<?php p($l->t('Database host')); ?>"
142 142
 					value="<?php p($_['dbhost']); ?>"
143 143
 					autocomplete="off" autocapitalize="none" autocorrect="off">
144 144
 			</p>
145 145
 			<p class="info">
146
-				<?php p($l->t( 'Please specify the port number along with the host name (e.g., localhost:5432).' )); ?>
146
+				<?php p($l->t('Please specify the port number along with the host name (e.g., localhost:5432).')); ?>
147 147
 			</p>
148 148
 		</div>
149 149
 		</fieldset>
150 150
 		<?php endif; ?>
151 151
 	<?php endif; ?>
152 152
 
153
-	<?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
153
+	<?php if (!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
154 154
 		<fieldset id="sqliteInformation" class="warning">
155
-			<legend><?php p($l->t('Performance warning'));?></legend>
156
-			<p><?php p($l->t('SQLite will be used as database.'));?></p>
157
-			<p><?php p($l->t('For larger installations we recommend to choose a different database backend.'));?></p>
155
+			<legend><?php p($l->t('Performance warning')); ?></legend>
156
+			<p><?php p($l->t('SQLite will be used as database.')); ?></p>
157
+			<p><?php p($l->t('For larger installations we recommend to choose a different database backend.')); ?></p>
158 158
 			<p><?php p($l->t('Especially when using the desktop client for file syncing the use of SQLite is discouraged.')); ?></p>
159 159
 		</fieldset>
160 160
 	<?php endif ?>
161 161
 
162 162
 	<div class="icon-loading-dark float-spinner">&nbsp;</div>
163 163
 
164
-	<div class="buttons"><input type="submit" class="primary" value="<?php p($l->t( 'Finish setup' )); ?>" data-finishing="<?php p($l->t( 'Finishing …' )); ?>"></div>
164
+	<div class="buttons"><input type="submit" class="primary" value="<?php p($l->t('Finish setup')); ?>" data-finishing="<?php p($l->t('Finishing …')); ?>"></div>
165 165
 
166 166
 	<p class="info">
167 167
 		<span class="icon-info-white"></span>
168
-		<?php p($l->t('Need help?'));?>
169
-		<a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation'));?> ↗</a>
168
+		<?php p($l->t('Need help?')); ?>
169
+		<a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation')); ?> ↗</a>
170 170
 	</p>
171 171
 </form>
Please login to merge, or discard this patch.
core/templates/exception.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2
-	/** @var array $_ */
3
-	/** @var \OCP\IL10N $l */
2
+    /** @var array $_ */
3
+    /** @var \OCP\IL10N $l */
4 4
 
5 5
 style('core', ['styles', 'header']);
6 6
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	<ul>
15 15
 		<li><?php p($l->t('Remote Address: %s', [$_['remoteAddr']])) ?></li>
16 16
 		<li><?php p($l->t('Request ID: %s', [$_['requestID']])) ?></li>
17
-		<?php if($_['debugMode']): ?>
17
+		<?php if ($_['debugMode']): ?>
18 18
 			<li><?php p($l->t('Type: %s', [$_['errorClass']])) ?></li>
19 19
 			<li><?php p($l->t('Code: %s', [$_['errorCode']])) ?></li>
20 20
 			<li><?php p($l->t('Message: %s', [$_['errorMsg']])) ?></li>
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 		<?php endif; ?>
24 24
 	</ul>
25 25
 
26
-	<?php if($_['debugMode']): ?>
26
+	<?php if ($_['debugMode']): ?>
27 27
 		<br />
28 28
 		<h3><?php p($l->t('Trace')) ?></h3>
29 29
 		<pre><?php p($_['trace']) ?></pre>
Please login to merge, or discard this patch.
core/templates/404.php 3 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,10 +14,13 @@
 block discarded – undo
14 14
 ?>
15 15
 <?php if (isset($_['content'])): ?>
16 16
 	<?php print_unescaped($_['content']) ?>
17
-<?php else: ?>
17
+<?php else {
18
+    : ?>
18 19
 	<ul>
19 20
 		<li class="error">
20
-			<?php p($l->t('File not found')); ?><br>
21
+			<?php p($l->t('File not found'));
22
+}
23
+?><br>
21 24
 			<p class="hint"><?php p($l->t('The specified document has not been found on the server.')); ?></p>
22 25
 			<p class="hint"><a href="<?php p(\OC::$server->getURLGenerator()->linkTo('', 'index.php')) ?>"><?php p($l->t('You can click here to return to %s.', array($theme->getName()))); ?></a></p>
23 26
 		</li>
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,11 +4,11 @@
 block discarded – undo
4 4
 /** @var $theme OCP\Defaults */
5 5
 // @codeCoverageIgnoreStart
6 6
 if(!isset($_)) {//standalone  page is not supported anymore - redirect to /
7
-	require_once '../../lib/base.php';
7
+    require_once '../../lib/base.php';
8 8
 
9
-	$urlGenerator = \OC::$server->getURLGenerator();
10
-	header('Location: ' . $urlGenerator->getAbsoluteURL('/'));
11
-	exit;
9
+    $urlGenerator = \OC::$server->getURLGenerator();
10
+    header('Location: ' . $urlGenerator->getAbsoluteURL('/'));
11
+    exit;
12 12
 }
13 13
 // @codeCoverageIgnoreEnd
14 14
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@
 block discarded – undo
3 3
 /** @var $l \OCP\IL10N */
4 4
 /** @var $theme OCP\Defaults */
5 5
 // @codeCoverageIgnoreStart
6
-if(!isset($_)) {//standalone  page is not supported anymore - redirect to /
6
+if (!isset($_)) {//standalone  page is not supported anymore - redirect to /
7 7
 	require_once '../../lib/base.php';
8 8
 
9 9
 	$urlGenerator = \OC::$server->getURLGenerator();
10
-	header('Location: ' . $urlGenerator->getAbsoluteURL('/'));
10
+	header('Location: '.$urlGenerator->getAbsoluteURL('/'));
11 11
 	exit;
12 12
 }
13 13
 // @codeCoverageIgnoreEnd
Please login to merge, or discard this patch.
core/Controller/UserController.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -29,46 +29,46 @@
 block discarded – undo
29 29
 use \OCP\IUserManager;
30 30
 
31 31
 class UserController extends Controller {
32
-	/**
33
-	 * @var IUserManager
34
-	 */
35
-	protected $userManager;
32
+    /**
33
+     * @var IUserManager
34
+     */
35
+    protected $userManager;
36 36
 
37
-	public function __construct($appName,
38
-								IRequest $request,
39
-								IUserManager $userManager
40
-	) {
41
-		parent::__construct($appName, $request);
42
-		$this->userManager = $userManager;
43
-	}
37
+    public function __construct($appName,
38
+                                IRequest $request,
39
+                                IUserManager $userManager
40
+    ) {
41
+        parent::__construct($appName, $request);
42
+        $this->userManager = $userManager;
43
+    }
44 44
 
45
-	/**
46
-	 * Lookup user display names
47
-	 *
48
-	 * @NoAdminRequired
49
-	 *
50
-	 * @param array $users
51
-	 *
52
-	 * @return JSONResponse
53
-	 */
54
-	public function getDisplayNames($users) {
55
-		$result = array();
45
+    /**
46
+     * Lookup user display names
47
+     *
48
+     * @NoAdminRequired
49
+     *
50
+     * @param array $users
51
+     *
52
+     * @return JSONResponse
53
+     */
54
+    public function getDisplayNames($users) {
55
+        $result = array();
56 56
 
57
-		foreach ($users as $user) {
58
-			$userObject = $this->userManager->get($user);
59
-			if (is_object($userObject)) {
60
-				$result[$user] = $userObject->getDisplayName();
61
-			} else {
62
-				$result[$user] = $user;
63
-			}
64
-		}
57
+        foreach ($users as $user) {
58
+            $userObject = $this->userManager->get($user);
59
+            if (is_object($userObject)) {
60
+                $result[$user] = $userObject->getDisplayName();
61
+            } else {
62
+                $result[$user] = $user;
63
+            }
64
+        }
65 65
 
66
-		$json = array(
67
-			'users' => $result,
68
-			'status' => 'success'
69
-		);
66
+        $json = array(
67
+            'users' => $result,
68
+            'status' => 'success'
69
+        );
70 70
 
71
-		return new JSONResponse($json);
71
+        return new JSONResponse($json);
72 72
 
73
-	}
73
+    }
74 74
 }
Please login to merge, or discard this patch.