Completed
Pull Request — master (#4890)
by Blizzz
14:37
created
lib/private/Group/Group.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -222,8 +222,8 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
lib/private/Group/Database.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
lib/private/Group/MetaData.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 = [];
Please login to merge, or discard this patch.
lib/private/Group/Backend.php 1 patch
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.
public.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  */
30 30
 try {
31 31
 
32
-	require_once __DIR__ . '/lib/base.php';
32
+	require_once __DIR__.'/lib/base.php';
33 33
 	if (\OCP\Util::needUpgrade()) {
34 34
 		// since the behavior of apps or remotes are unpredictable during
35 35
 		// an upgrade, return a 503 directly
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		$pathInfo = trim($pathInfo, '/');
53 53
 		list($service) = explode('/', $pathInfo);
54 54
 	}
55
-	$file = OCP\Config::getAppValue('core', 'public_' . strip_tags($service));
55
+	$file = OCP\Config::getAppValue('core', 'public_'.strip_tags($service));
56 56
 	if (is_null($file)) {
57 57
 		header('HTTP/1.0 404 Not Found');
58 58
 		exit;
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
 	OC_App::loadApps(array('filesystem', 'logging'));
68 68
 
69 69
 	if (!\OC::$server->getAppManager()->isInstalled($app)) {
70
-		throw new Exception('App not installed: ' . $app);
70
+		throw new Exception('App not installed: '.$app);
71 71
 	}
72 72
 	OC_App::loadApp($app);
73 73
 	OC_User::setIncognitoMode(true);
74 74
 
75
-	$baseuri = OC::$WEBROOT . '/public.php/' . $service . '/';
75
+	$baseuri = OC::$WEBROOT.'/public.php/'.$service.'/';
76 76
 
77
-	require_once OC_App::getAppPath($app) . '/' . $parts[1];
77
+	require_once OC_App::getAppPath($app).'/'.$parts[1];
78 78
 
79 79
 } catch (Exception $ex) {
80 80
 	if ($ex instanceof \OC\ServiceUnavailableException) {
Please login to merge, or discard this patch.
ocs/providers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,17 +23,17 @@
 block discarded – undo
23 23
  *
24 24
  */
25 25
 
26
-require_once __DIR__ . '/../lib/base.php';
26
+require_once __DIR__.'/../lib/base.php';
27 27
 
28 28
 header('Content-type: application/xml');
29 29
 
30 30
 $request = \OC::$server->getRequest();
31 31
 
32
-$url = $request->getServerProtocol() . '://' . substr($request->getServerHost() . $request->getRequestUri(), 0, -17).'ocs/v1.php/';
32
+$url = $request->getServerProtocol().'://'.substr($request->getServerHost().$request->getRequestUri(), 0, -17).'ocs/v1.php/';
33 33
 
34 34
 $writer = new XMLWriter();
35 35
 $writer->openURI('php://output');
36
-$writer->startDocument('1.0','UTF-8');
36
+$writer->startDocument('1.0', 'UTF-8');
37 37
 $writer->setIndent(4);
38 38
 $writer->startElement('providers');
39 39
 $writer->startElement('provider');
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 1 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.
status.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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(),
Please login to merge, or discard this patch.