Completed
Push — stable12 ( b91394...cede17 )
by
unknown
30:59 queued 20:45
created
apps/user_ldap/ajax/getConfiguration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 OCP\JSON::checkAppEnabled('user_ldap');
30 30
 OCP\JSON::callCheck();
31 31
 
32
-$prefix = (string)$_POST['ldap_serverconfig_chooser'];
32
+$prefix = (string) $_POST['ldap_serverconfig_chooser'];
33 33
 $ldapWrapper = new OCA\User_LDAP\LDAP();
34 34
 $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix);
35 35
 $configuration = $connection->getConfiguration();
Please login to merge, or discard this patch.
apps/user_ldap/ajax/setConfiguration.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@
 block discarded – undo
30 30
 OCP\JSON::checkAppEnabled('user_ldap');
31 31
 OCP\JSON::callCheck();
32 32
 
33
-$prefix = (string)$_POST['ldap_serverconfig_chooser'];
33
+$prefix = (string) $_POST['ldap_serverconfig_chooser'];
34 34
 
35 35
 // Checkboxes are not submitted, when they are unchecked. Set them manually.
36 36
 // only legacy checkboxes (Advanced and Expert tab) need to be handled here,
37 37
 // the Wizard-like tabs handle it on their own
38 38
 $chkboxes = array('ldap_configuration_active', 'ldap_override_main_server',
39 39
 				  'ldap_turn_off_cert_check');
40
-foreach($chkboxes as $boxid) {
41
-	if(!isset($_POST[$boxid])) {
40
+foreach ($chkboxes as $boxid) {
41
+	if (!isset($_POST[$boxid])) {
42 42
 		$_POST[$boxid] = 0;
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.
apps/user_ldap/ajax/deleteConfiguration.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
 OCP\JSON::checkAppEnabled('user_ldap');
32 32
 OCP\JSON::callCheck();
33 33
 
34
-$prefix = (string)$_POST['ldap_serverconfig_chooser'];
34
+$prefix = (string) $_POST['ldap_serverconfig_chooser'];
35 35
 $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
36
-if($helper->deleteServerConfiguration($prefix)) {
36
+if ($helper->deleteServerConfiguration($prefix)) {
37 37
 	OCP\JSON::success();
38 38
 } else {
39 39
 	$l = \OC::$server->getL10N('user_ldap');
Please login to merge, or discard this patch.
apps/user_ldap/ajax/wizard.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,16 +32,16 @@  discard block
 block discarded – undo
32 32
 
33 33
 $l = \OC::$server->getL10N('user_ldap');
34 34
 
35
-if(!isset($_POST['action'])) {
35
+if (!isset($_POST['action'])) {
36 36
 	\OCP\JSON::error(array('message' => $l->t('No action specified')));
37 37
 }
38
-$action = (string)$_POST['action'];
38
+$action = (string) $_POST['action'];
39 39
 
40 40
 
41
-if(!isset($_POST['ldap_serverconfig_chooser'])) {
41
+if (!isset($_POST['ldap_serverconfig_chooser'])) {
42 42
 	\OCP\JSON::error(array('message' => $l->t('No configuration specified')));
43 43
 }
44
-$prefix = (string)$_POST['ldap_serverconfig_chooser'];
44
+$prefix = (string) $_POST['ldap_serverconfig_chooser'];
45 45
 
46 46
 $ldapWrapper = new \OCA\User_LDAP\LDAP();
47 47
 $configuration = new \OCA\User_LDAP\Configuration($prefix);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 $wizard = new \OCA\User_LDAP\Wizard($configuration, $ldapWrapper, $access);
68 68
 
69
-switch($action) {
69
+switch ($action) {
70 70
 	case 'guessPortAndTLS':
71 71
 	case 'guessBaseDN':
72 72
 	case 'detectEmailAttribute':
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	case 'countInBaseDN':
86 86
 		try {
87 87
 			$result = $wizard->$action();
88
-			if($result !== false) {
88
+			if ($result !== false) {
89 89
 				OCP\JSON::success($result->getResultArray());
90 90
 				exit;
91 91
 			}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		try {
102 102
 			$loginName = $_POST['ldap_test_loginname'];
103 103
 			$result = $wizard->$action($loginName);
104
-			if($result !== false) {
104
+			if ($result !== false) {
105 105
 				OCP\JSON::success($result->getResultArray());
106 106
 				exit;
107 107
 			}
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
 	case 'save':
118 118
 		$key = isset($_POST['cfgkey']) ? $_POST['cfgkey'] : false;
119 119
 		$val = isset($_POST['cfgval']) ? $_POST['cfgval'] : null;
120
-		if($key === false || is_null($val)) {
120
+		if ($key === false || is_null($val)) {
121 121
 			\OCP\JSON::error(array('message' => $l->t('No data specified')));
122 122
 			exit;
123 123
 		}
124 124
 		$cfg = array($key => $val);
125 125
 		$setParameters = array();
126 126
 		$configuration->setConfiguration($cfg, $setParameters);
127
-		if(!in_array($key, $setParameters)) {
127
+		if (!in_array($key, $setParameters)) {
128 128
 			\OCP\JSON::error(array('message' => $l->t($key.
129 129
 				' Could not set configuration %s', $setParameters[0])));
130 130
 			exit;
Please login to merge, or discard this patch.
apps/user_ldap/ajax/getNewServerConfigPrefix.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@
 block discarded – undo
32 32
 sort($serverConnections);
33 33
 $lk = array_pop($serverConnections);
34 34
 $ln = intval(str_replace('s', '', $lk));
35
-$nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT);
35
+$nk = 's'.str_pad($ln + 1, 2, '0', STR_PAD_LEFT);
36 36
 
37 37
 $resultData = array('configPrefix' => $nk);
38 38
 
39 39
 $newConfig = new \OCA\User_LDAP\Configuration($nk, false);
40
-if(isset($_POST['copyConfig'])) {
40
+if (isset($_POST['copyConfig'])) {
41 41
 	$originalConfig = new \OCA\User_LDAP\Configuration($_POST['copyConfig']);
42 42
 	$newConfig->setConfiguration($originalConfig->getConfiguration());
43 43
 } else {
Please login to merge, or discard this patch.
apps/user_ldap/lib/Mapping/AbstractMapping.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @return bool
54 54
 	 */
55 55
 	public function isColNameValid($col) {
56
-		switch($col) {
56
+		switch ($col) {
57 57
 			case 'ldap_dn':
58 58
 			case 'owncloud_name':
59 59
 			case 'directory_uuid':
@@ -72,19 +72,19 @@  discard block
 block discarded – undo
72 72
 	 * @return string|false
73 73
 	 */
74 74
 	protected function getXbyY($fetchCol, $compareCol, $search) {
75
-		if(!$this->isColNameValid($fetchCol)) {
75
+		if (!$this->isColNameValid($fetchCol)) {
76 76
 			//this is used internally only, but we don't want to risk
77 77
 			//having SQL injection at all.
78 78
 			throw new \Exception('Invalid Column Name');
79 79
 		}
80 80
 		$query = $this->dbc->prepare('
81
-			SELECT `' . $fetchCol . '`
82
-			FROM `'. $this->getTableName() .'`
83
-			WHERE `' . $compareCol . '` = ?
81
+			SELECT `' . $fetchCol.'`
82
+			FROM `'. $this->getTableName().'`
83
+			WHERE `' . $compareCol.'` = ?
84 84
 		');
85 85
 
86 86
 		$res = $query->execute(array($search));
87
-		if($res !== false) {
87
+		if ($res !== false) {
88 88
 			return $query->fetchColumn();
89 89
 		}
90 90
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function setDNbyUUID($fdn, $uuid) {
122 122
 		$query = $this->dbc->prepare('
123
-			UPDATE `' . $this->getTableName() . '`
123
+			UPDATE `' . $this->getTableName().'`
124 124
 			SET `ldap_dn` = ?
125 125
 			WHERE `directory_uuid` = ?
126 126
 		');
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public function setUUIDbyDN($uuid, $fdn) {
141 141
 		$query = $this->dbc->prepare('
142
-			UPDATE `' . $this->getTableName() . '`
142
+			UPDATE `' . $this->getTableName().'`
143 143
 			SET `directory_uuid` = ?
144 144
 			WHERE `ldap_dn` = ?
145 145
 		');
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 	public function getNamesBySearch($search, $prefixMatch = "", $postfixMatch = "") {
167 167
 		$query = $this->dbc->prepare('
168 168
 			SELECT `owncloud_name`
169
-			FROM `'. $this->getTableName() .'`
169
+			FROM `'. $this->getTableName().'`
170 170
 			WHERE `owncloud_name` LIKE ?
171 171
 		');
172 172
 
173 173
 		$res = $query->execute(array($prefixMatch.$this->dbc->escapeLikeParameter($search).$postfixMatch));
174 174
 		$names = array();
175
-		if($res !== false) {
176
-			while($row = $query->fetch()) {
175
+		if ($res !== false) {
176
+			while ($row = $query->fetch()) {
177 177
 				$names[] = $row['owncloud_name'];
178 178
 			}
179 179
 		}
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 				`ldap_dn` AS `dn`,
212 212
 				`owncloud_name` AS `name`,
213 213
 				`directory_uuid` AS `uuid`
214
-			FROM `' . $this->getTableName() . '`',
214
+			FROM `' . $this->getTableName().'`',
215 215
 			$limit,
216 216
 			$offset
217 217
 		);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 * @return bool
229 229
 	 */
230 230
 	public function map($fdn, $name, $uuid) {
231
-		if(mb_strlen($fdn) > 255) {
231
+		if (mb_strlen($fdn) > 255) {
232 232
 			\OC::$server->getLogger()->error(
233 233
 				'Cannot map, because the DN exceeds 255 characters: {dn}',
234 234
 				[
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 		try {
249 249
 			$result = $this->dbc->insertIfNotExist($this->getTableName(), $row);
250 250
 			// insertIfNotExist returns values as int
251
-			return (bool)$result;
251
+			return (bool) $result;
252 252
 		} catch (\Exception $e) {
253 253
 			return false;
254 254
 		}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function unmap($name) {
263 263
 		$query = $this->dbc->prepare('
264
-			DELETE FROM `'. $this->getTableName() .'`
264
+			DELETE FROM `'. $this->getTableName().'`
265 265
 			WHERE `owncloud_name` = ?');
266 266
 
267 267
 		return $this->modify($query, array($name));
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	public function clear() {
275 275
 		$sql = $this->dbc
276 276
 			->getDatabasePlatform()
277
-			->getTruncateTableSQL('`' . $this->getTableName() . '`');
277
+			->getTruncateTableSQL('`'.$this->getTableName().'`');
278 278
 		return $this->dbc->prepare($sql)->execute();
279 279
 	}
280 280
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Group_Proxy.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function __construct($serverConfigPrefixes, ILDAPWrapper $ldap) {
38 38
 		parent::__construct($ldap);
39
-		foreach($serverConfigPrefixes as $configPrefix) {
39
+		foreach ($serverConfigPrefixes as $configPrefix) {
40 40
 			$this->backends[$configPrefix] =
41 41
 				new \OCA\User_LDAP\Group_LDAP($this->getAccess($configPrefix));
42
-			if(is_null($this->refBackend)) {
42
+			if (is_null($this->refBackend)) {
43 43
 				$this->refBackend = &$this->backends[$configPrefix];
44 44
 			}
45 45
 		}
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	protected function walkBackends($gid, $method, $parameters) {
56 56
 		$cacheKey = $this->getGroupCacheKey($gid);
57
-		foreach($this->backends as $configPrefix => $backend) {
58
-			if($result = call_user_func_array(array($backend, $method), $parameters)) {
57
+		foreach ($this->backends as $configPrefix => $backend) {
58
+			if ($result = call_user_func_array(array($backend, $method), $parameters)) {
59 59
 				$this->writeToCache($cacheKey, $configPrefix);
60 60
 				return $result;
61 61
 			}
@@ -72,20 +72,20 @@  discard block
 block discarded – undo
72 72
 	 * @return mixed, the result of the method or false
73 73
 	 */
74 74
 	protected function callOnLastSeenOn($gid, $method, $parameters, $passOnWhen) {
75
-		$cacheKey = $this->getGroupCacheKey($gid);;
75
+		$cacheKey = $this->getGroupCacheKey($gid); ;
76 76
 		$prefix = $this->getFromCache($cacheKey);
77 77
 		//in case the uid has been found in the past, try this stored connection first
78
-		if(!is_null($prefix)) {
79
-			if(isset($this->backends[$prefix])) {
78
+		if (!is_null($prefix)) {
79
+			if (isset($this->backends[$prefix])) {
80 80
 				$result = call_user_func_array(array($this->backends[$prefix], $method), $parameters);
81
-				if($result === $passOnWhen) {
81
+				if ($result === $passOnWhen) {
82 82
 					//not found here, reset cache to null if group vanished
83 83
 					//because sometimes methods return false with a reason
84 84
 					$groupExists = call_user_func_array(
85 85
 						array($this->backends[$prefix], 'groupExists'),
86 86
 						array($gid)
87 87
 					);
88
-					if(!$groupExists) {
88
+					if (!$groupExists) {
89 89
 						$this->writeToCache($cacheKey, null);
90 90
 					}
91 91
 				}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	public function getUserGroups($uid) {
119 119
 		$groups = array();
120 120
 
121
-		foreach($this->backends as $backend) {
121
+		foreach ($this->backends as $backend) {
122 122
 			$backendGroups = $backend->getUserGroups($uid);
123 123
 			if (is_array($backendGroups)) {
124 124
 				$groups = array_merge($groups, $backendGroups);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
136 136
 		$users = array();
137 137
 
138
-		foreach($this->backends as $backend) {
138
+		foreach ($this->backends as $backend) {
139 139
 			$backendUsers = $backend->usersInGroup($gid, $search, $limit, $offset);
140 140
 			if (is_array($backendUsers)) {
141 141
 				$users = array_merge($users, $backendUsers);
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	public function getGroups($search = '', $limit = -1, $offset = 0) {
166 166
 		$groups = array();
167 167
 
168
-		foreach($this->backends as $backend) {
168
+		foreach ($this->backends as $backend) {
169 169
 			$backendGroups = $backend->getGroups($search, $limit, $offset);
170 170
 			if (is_array($backendGroups)) {
171 171
 				$groups = array_merge($groups, $backendGroups);
Please login to merge, or discard this patch.
apps/user_ldap/lib/User/DeletedUsersIndex.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			'user_ldap', 'isDeleted', '1');
72 72
 
73 73
 		$userObjects = array();
74
-		foreach($deletedUsers as $user) {
74
+		foreach ($deletedUsers as $user) {
75 75
 			$userObjects[] = new OfflineUser($user, $this->config, $this->db, $this->mapping);
76 76
 		}
77 77
 		$this->deletedUsers = $userObjects;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @return \OCA\User_LDAP\User\OfflineUser[]
85 85
 	 */
86 86
 	public function getUsers() {
87
-		if(is_array($this->deletedUsers)) {
87
+		if (is_array($this->deletedUsers)) {
88 88
 			return $this->deletedUsers;
89 89
 		}
90 90
 		return $this->fetchDeletedUsers();
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 	 * @return bool
96 96
 	 */
97 97
 	public function hasUsers() {
98
-		if($this->deletedUsers === false) {
98
+		if ($this->deletedUsers === false) {
99 99
 			$this->fetchDeletedUsers();
100 100
 		}
101
-		if(is_array($this->deletedUsers) && count($this->deletedUsers) > 0) {
101
+		if (is_array($this->deletedUsers) && count($this->deletedUsers) > 0) {
102 102
 			return true;
103 103
 		}
104 104
 		return false;
Please login to merge, or discard this patch.
apps/user_ldap/lib/User/OfflineUser.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -179,14 +179,14 @@  discard block
 block discarded – undo
179 179
 	 * reads the user details
180 180
 	 */
181 181
 	protected function fetchDetails() {
182
-		$properties = array (
182
+		$properties = array(
183 183
 			'displayName' => 'user_ldap',
184 184
 			'uid'         => 'user_ldap',
185 185
 			'homePath'    => 'user_ldap',
186 186
 			'email'       => 'settings',
187 187
 			'lastLogin'   => 'login'
188 188
 		);
189
-		foreach($properties as $property => $app) {
189
+		foreach ($properties as $property => $app) {
190 190
 			$this->$property = $this->config->getUserValue($this->ocName, $app, $property, '');
191 191
 		}
192 192
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 		', 1);
210 210
 		$query->execute(array($this->ocName));
211 211
 		$sResult = $query->fetchColumn(0);
212
-		if(intval($sResult) === 1) {
212
+		if (intval($sResult) === 1) {
213 213
 			$this->hasActiveShares = true;
214 214
 			return;
215 215
 		}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		', 1);
222 222
 		$query->execute(array($this->ocName));
223 223
 		$sResult = $query->fetchColumn(0);
224
-		if(intval($sResult) === 1) {
224
+		if (intval($sResult) === 1) {
225 225
 			$this->hasActiveShares = true;
226 226
 			return;
227 227
 		}
Please login to merge, or discard this patch.