summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-26 09:30:18 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-26 16:34:56 +0100
commitb80ebc96748b45fd2e0ba9323308657c4b00b7ec (patch)
treeec20e0ffa2f86b9b54939a83a785407319f94559 /apps/user_ldap/lib
parent62403d0932be7d620c7bdadc6b4e13eb496fcd6f (diff)
downloadnextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.tar.gz
nextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.zip
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r--apps/user_ldap/lib/Access.php60
-rw-r--r--apps/user_ldap/lib/Command/ShowConfig.php6
-rw-r--r--apps/user_ldap/lib/Command/TestConfig.php4
-rw-r--r--apps/user_ldap/lib/Configuration.php14
-rw-r--r--apps/user_ldap/lib/Connection.php20
-rw-r--r--apps/user_ldap/lib/GroupPluginManager.php4
-rw-r--r--apps/user_ldap/lib/Group_LDAP.php66
-rw-r--r--apps/user_ldap/lib/Group_Proxy.php34
-rw-r--r--apps/user_ldap/lib/Helper.php10
-rw-r--r--apps/user_ldap/lib/Jobs/Sync.php4
-rw-r--r--apps/user_ldap/lib/Jobs/UpdateGroups.php12
-rw-r--r--apps/user_ldap/lib/LDAP.php6
-rw-r--r--apps/user_ldap/lib/Mapping/AbstractMapping.php14
-rw-r--r--apps/user_ldap/lib/Proxy.php2
-rw-r--r--apps/user_ldap/lib/User/OfflineUser.php6
-rw-r--r--apps/user_ldap/lib/User/User.php12
-rw-r--r--apps/user_ldap/lib/UserPluginManager.php4
-rw-r--r--apps/user_ldap/lib/User_LDAP.php6
-rw-r--r--apps/user_ldap/lib/User_Proxy.php32
-rw-r--r--apps/user_ldap/lib/Wizard.php140
-rw-r--r--apps/user_ldap/lib/WizardResult.php8
21 files changed, 232 insertions, 232 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index a16e8f04cb2..6f6e3648e30 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -75,7 +75,7 @@ class Access extends LDAPUtility {
/**
* @var string[] $cookies an array of returned Paged Result cookies
*/
- protected $cookies = array();
+ protected $cookies = [];
/**
* @var string $lastCookie the last cookie returned from a Paged Results
@@ -268,9 +268,9 @@ class Access extends LDAPUtility {
* @throws ServerNotAvailableException
*/
public function executeRead($cr, $dn, $attribute, $filter, $maxResults) {
- $this->initPagedSearch($filter, array($dn), array($attribute), $maxResults, 0);
+ $this->initPagedSearch($filter, [$dn], [$attribute], $maxResults, 0);
$dn = $this->helper->DNasBaseParameter($dn);
- $rr = @$this->invokeLDAPMethod('read', $cr, $dn, $filter, array($attribute));
+ $rr = @$this->invokeLDAPMethod('read', $cr, $dn, $filter, [$attribute]);
if (!$this->ldap->isResource($rr)) {
if ($attribute !== '') {
//do not throw this message on userExists check, irritates
@@ -384,13 +384,13 @@ class Access extends LDAPUtility {
* @return boolean if so true, otherwise false
*/
private function resemblesDN($attr) {
- $resemblingAttributes = array(
+ $resemblingAttributes = [
'dn',
'uniquemember',
'member',
// memberOf is an "operational" attribute, without a definition in any RFC
'memberof'
- );
+ ];
return in_array($attr, $resemblingAttributes);
}
@@ -419,7 +419,7 @@ class Access extends LDAPUtility {
//not a valid DN
return '';
}
- $domainParts = array();
+ $domainParts = [];
$dcFound = false;
foreach($allParts as $part) {
if(!$dcFound && strpos($part, 'dc=') === 0) {
@@ -865,13 +865,13 @@ class Access extends LDAPUtility {
*/
private function createAltInternalOwnCloudName($name, $isUser) {
$originalTTL = $this->connection->ldapCacheTTL;
- $this->connection->setConfiguration(array('ldapCacheTTL' => 0));
+ $this->connection->setConfiguration(['ldapCacheTTL' => 0]);
if($isUser) {
$altName = $this->_createAltInternalOwnCloudNameForUsers($name);
} else {
$altName = $this->_createAltInternalOwnCloudNameForGroups($name);
}
- $this->connection->setConfiguration(array('ldapCacheTTL' => $originalTTL));
+ $this->connection->setConfiguration(['ldapCacheTTL' => $originalTTL]);
return $altName;
}
@@ -884,7 +884,7 @@ class Access extends LDAPUtility {
* @param array $attributes optional, list of attributes to read
* @return array
*/
- public function fetchUsersByLoginName($loginName, $attributes = array('dn')) {
+ public function fetchUsersByLoginName($loginName, $attributes = ['dn']) {
$loginName = $this->escapeFilterPart($loginName);
$filter = str_replace('%uid', $loginName, $this->connection->ldapLoginFilter);
return $this->fetchListOfUsers($filter, $attributes);
@@ -996,13 +996,13 @@ class Access extends LDAPUtility {
$attribute = array_keys($item)[0];
$carry[] = $item[$attribute][0];
return $carry;
- }, array());
+ }, []);
return array_unique($list, SORT_LOCALE_STRING);
}
}
//error cause actually, maybe throw an exception in future.
- return array();
+ return [];
}
/**
@@ -1033,7 +1033,7 @@ class Access extends LDAPUtility {
* @return false|int
* @throws ServerNotAvailableException
*/
- public function countUsers($filter, $attr = array('dn'), $limit = null, $offset = null) {
+ public function countUsers($filter, $attr = ['dn'], $limit = null, $offset = null) {
$result = false;
foreach($this->connection->ldapBaseUsers as $base) {
$count = $this->count($filter, [$base], $attr, $limit, $offset);
@@ -1072,7 +1072,7 @@ class Access extends LDAPUtility {
* @return int|bool
* @throws ServerNotAvailableException
*/
- public function countGroups($filter, $attr = array('dn'), $limit = null, $offset = null) {
+ public function countGroups($filter, $attr = ['dn'], $limit = null, $offset = null) {
$result = false;
foreach($this->connection->ldapBaseGroups as $base) {
$count = $this->count($filter, [$base], $attr, $limit, $offset);
@@ -1122,7 +1122,7 @@ class Access extends LDAPUtility {
if ($command == 'controlPagedResultResponse') {
throw new \InvalidArgumentException('Invoker does not support controlPagedResultResponse, call LDAP Wrapper directly instead.');
} else {
- return call_user_func_array(array($this->ldap, $command), $arguments);
+ return call_user_func_array([$this->ldap, $command], $arguments);
}
};
try {
@@ -1162,7 +1162,7 @@ class Access extends LDAPUtility {
*/
private function executeSearch($filter, $base, &$attr = null, $limit = null, $offset = null) {
if(!is_null($attr) && !is_array($attr)) {
- $attr = array(mb_strtolower($attr, 'UTF-8'));
+ $attr = [mb_strtolower($attr, 'UTF-8')];
}
// See if we have a resource, in case not cancel with message
@@ -1177,7 +1177,7 @@ class Access extends LDAPUtility {
//check whether paged search should be attempted
$pagedSearchOK = $this->initPagedSearch($filter, $base, $attr, (int)$limit, $offset);
- $linkResources = array_pad(array(), count($base), $cr);
+ $linkResources = array_pad([], count($base), $cr);
$sr = $this->invokeLDAPMethod('search', $linkResources, $base, $filter, $attr);
// cannot use $cr anymore, might have changed in the previous call!
$error = $this->ldap->errno($this->connection->getConnectionResource());
@@ -1186,7 +1186,7 @@ class Access extends LDAPUtility {
return false;
}
- return array($sr, $pagedSearchOK);
+ return [$sr, $pagedSearchOK];
}
/**
@@ -1349,7 +1349,7 @@ class Access extends LDAPUtility {
$this->processPagedSearchStatus($sr, $filter, $base, 1, $limitPerPage,
$offset, $pagedSearchOK,
$skipHandling);
- return array();
+ return [];
}
$iFoundItems = 0;
@@ -1370,7 +1370,7 @@ class Access extends LDAPUtility {
// if we're here, probably no connection resource is returned.
// to make Nextcloud behave nicely, we simply give back an empty array.
if(is_null($findings)) {
- return array();
+ return [];
}
if(!is_null($attr)) {
@@ -1463,8 +1463,8 @@ class Access extends LDAPUtility {
$asterisk = '*';
$input = mb_substr($input, 1, null, 'UTF-8');
}
- $search = array('*', '\\', '(', ')');
- $replace = array('\\*', '\\\\', '\\(', '\\)');
+ $search = ['*', '\\', '(', ')'];
+ $replace = ['\\*', '\\\\', '\\(', '\\)'];
return $asterisk . str_replace($search, $replace, $input);
}
@@ -1541,11 +1541,11 @@ class Access extends LDAPUtility {
throw new \Exception('searchAttributes must be an array with at least two string');
}
$searchWords = explode(' ', trim($search));
- $wordFilters = array();
+ $wordFilters = [];
foreach($searchWords as $word) {
$word = $this->prepareSearchTerm($word);
//every word needs to appear at least once
- $wordMatchOneAttrFilters = array();
+ $wordMatchOneAttrFilters = [];
foreach($searchAttributes as $attr) {
$wordMatchOneAttrFilters[] = $attr . '=' . $word;
}
@@ -1563,7 +1563,7 @@ class Access extends LDAPUtility {
* @return string the final filter part to use in LDAP searches
*/
private function getFilterPartForSearch($search, $searchAttributes, $fallbackAttribute) {
- $filter = array();
+ $filter = [];
$haveMultiSearchAttributes = (is_array($searchAttributes) && count($searchAttributes) > 0);
if($haveMultiSearchAttributes && strpos(trim($search), ' ') !== false) {
try {
@@ -1619,10 +1619,10 @@ class Access extends LDAPUtility {
* @return string
*/
public function getFilterForUserCount() {
- $filter = $this->combineFilterWithAnd(array(
+ $filter = $this->combineFilterWithAnd([
$this->connection->ldapUserFilter,
$this->connection->ldapUserDisplayName . '=*'
- ));
+ ]);
return $filter;
}
@@ -1635,10 +1635,10 @@ class Access extends LDAPUtility {
public function areCredentialsValid($name, $password) {
$name = $this->helper->DNasBaseParameter($name);
$testConnection = clone $this->connection;
- $credentials = array(
+ $credentials = [
'ldapAgentName' => $name,
'ldapAgentPassword' => $password
- );
+ ];
if(!$testConnection->setConfiguration($credentials)) {
return false;
}
@@ -1919,7 +1919,7 @@ class Access extends LDAPUtility {
// precision (see https://gist.github.com/bantu/886ac680b0aef5812f71)
$iav = number_format(hexdec(bin2hex(substr($sid, 2, 6))), 0, '', '');
- $subIDs = array();
+ $subIDs = [];
for ($i = 0; $i < $numberSubID; $i++) {
$subID = unpack('V', substr($sid, $subIdStart + $subIdLength * $i, $subIdLength));
$subIDs[] = sprintf('%u', $subID[1]);
@@ -2065,7 +2065,7 @@ class Access extends LDAPUtility {
// to start from 0 to come to the desired page. cookie value
// of '0' is valid, because 389ds
$reOffset = ($offset - $limit) < 0 ? 0 : $offset - $limit;
- $this->search($filter, array($base), $attr, $limit, $reOffset, true);
+ $this->search($filter, [$base], $attr, $limit, $reOffset, true);
$cookie = $this->getPagedResultCookie($base, $filter, $limit, $offset);
//still no cookie? obviously, the server does not like us. Let's skip paging efforts.
// '0' is valid, because 389ds
diff --git a/apps/user_ldap/lib/Command/ShowConfig.php b/apps/user_ldap/lib/Command/ShowConfig.php
index fd33a0bc0df..46d08986617 100644
--- a/apps/user_ldap/lib/Command/ShowConfig.php
+++ b/apps/user_ldap/lib/Command/ShowConfig.php
@@ -94,8 +94,8 @@ class ShowConfig extends Command {
ksort($configuration);
$table = new Table($output);
- $table->setHeaders(array('Configuration', $id));
- $rows = array();
+ $table->setHeaders(['Configuration', $id]);
+ $rows = [];
foreach($configuration as $key => $value) {
if($key === 'ldapAgentPassword' && !$withPassword) {
$value = '***';
@@ -103,7 +103,7 @@ class ShowConfig extends Command {
if(is_array($value)) {
$value = implode(';', $value);
}
- $rows[] = array($key, $value);
+ $rows[] = [$key, $value];
}
$table->setRows($rows);
$table->render($output);
diff --git a/apps/user_ldap/lib/Command/TestConfig.php b/apps/user_ldap/lib/Command/TestConfig.php
index 67ff73d4e91..b38d2e972a2 100644
--- a/apps/user_ldap/lib/Command/TestConfig.php
+++ b/apps/user_ldap/lib/Command/TestConfig.php
@@ -80,9 +80,9 @@ class TestConfig extends Command {
//ensure validation is run before we attempt the bind
$connection->getConfiguration();
- if(!$connection->setConfiguration(array(
+ if(!$connection->setConfiguration([
'ldap_configuration_active' => 1,
- ))) {
+ ])) {
return 1;
}
if($connection->bind()) {
diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php
index 724f240847a..9fa386a8215 100644
--- a/apps/user_ldap/lib/Configuration.php
+++ b/apps/user_ldap/lib/Configuration.php
@@ -53,7 +53,7 @@ class Configuration {
protected $unsavedChanges = ['ldapConfigurationActive' => 'ldapConfigurationActive'];
//settings
- protected $config = array(
+ protected $config = [
'ldapHost' => null,
'ldapPort' => null,
'ldapBackupHost' => null,
@@ -109,7 +109,7 @@ class Configuration {
'ldapDynamicGroupMemberURL' => null,
'ldapDefaultPPolicyDN' => null,
'ldapExtStorageHomeAttribute' => null,
- );
+ ];
/**
* @param string $configPrefix
@@ -138,7 +138,7 @@ class Configuration {
* @param mixed $value
*/
public function __set($name, $value) {
- $this->setConfiguration(array($name => $value));
+ $this->setConfiguration([$name => $value]);
}
/**
@@ -426,7 +426,7 @@ class Configuration {
* to config-value entries in the database table
*/
public function getDefaults() {
- return array(
+ return [
'ldap_host' => '',
'ldap_port' => '',
'ldap_backup_host' => '',
@@ -481,7 +481,7 @@ class Configuration {
'ldap_default_ppolicy_dn' => '',
'ldap_user_avatar_rule' => 'default',
'ldap_ext_storage_home_attribute' => '',
- );
+ ];
}
/**
@@ -489,7 +489,7 @@ class Configuration {
*/
public function getConfigTranslationArray() {
//TODO: merge them into one representation
- static $array = array(
+ static $array = [
'ldap_host' => 'ldapHost',
'ldap_port' => 'ldapPort',
'ldap_backup_host' => 'ldapBackupHost',
@@ -543,7 +543,7 @@ class Configuration {
'ldap_default_ppolicy_dn' => 'ldapDefaultPPolicyDN',
'ldap_ext_storage_home_attribute' => 'ldapExtStorageHomeAttribute',
'ldapIgnoreNamingRules' => 'ldapIgnoreNamingRules', // sysconfig
- );
+ ];
return $array;
}
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php
index 8d499a4ee1c..5e2d7fb8583 100644
--- a/apps/user_ldap/lib/Connection.php
+++ b/apps/user_ldap/lib/Connection.php
@@ -298,7 +298,7 @@ class Connection extends LDAPUtility {
*/
public function setConfiguration($config, &$setParameters = null) {
if(is_null($setParameters)) {
- $setParameters = array();
+ $setParameters = [];
}
$this->doNotValidate = false;
$this->configuration->setConfiguration($config, $setParameters);
@@ -328,7 +328,7 @@ class Connection extends LDAPUtility {
$this->readConfiguration();
$config = $this->configuration->getConfiguration();
$cta = $this->configuration->getConfigTranslationArray();
- $result = array();
+ $result = [];
foreach($cta as $dbkey => $configkey) {
switch($configkey) {
case 'homeFolderNamingRule':
@@ -356,15 +356,15 @@ class Connection extends LDAPUtility {
private function doSoftValidation() {
//if User or Group Base are not set, take over Base DN setting
- foreach(array('ldapBaseUsers', 'ldapBaseGroups') as $keyBase) {
+ foreach(['ldapBaseUsers', 'ldapBaseGroups'] as $keyBase) {
$val = $this->configuration->$keyBase;
if(empty($val)) {
$this->configuration->$keyBase = $this->configuration->ldapBase;
}
}
- foreach(array('ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute',
- 'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute')
+ foreach(['ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute',
+ 'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute']
as $expertSetting => $effectiveSetting) {
$uuidOverride = $this->configuration->$expertSetting;
if(!empty($uuidOverride)) {
@@ -392,12 +392,12 @@ class Connection extends LDAPUtility {
}
//make sure empty search attributes are saved as simple, empty array
- $saKeys = array('ldapAttributesForUserSearch',
- 'ldapAttributesForGroupSearch');
+ $saKeys = ['ldapAttributesForUserSearch',
+ 'ldapAttributesForGroupSearch'];
foreach($saKeys as $key) {
$val = $this->configuration->$key;
if(is_array($val) && count($val) === 1 && empty($val[0])) {
- $this->configuration->$key = array();
+ $this->configuration->$key = [];
}
}
@@ -421,8 +421,8 @@ class Connection extends LDAPUtility {
(string)$this->configPrefix .'): ';
//options that shall not be empty
- $options = array('ldapHost', 'ldapPort', 'ldapUserDisplayName',
- 'ldapGroupDisplayName', 'ldapLoginFilter');
+ $options = ['ldapHost', 'ldapPort', 'ldapUserDisplayName',
+ 'ldapGroupDisplayName', 'ldapLoginFilter'];
foreach($options as $key) {
$val = $this->configuration->$key;
if(empty($val)) {
diff --git a/apps/user_ldap/lib/GroupPluginManager.php b/apps/user_ldap/lib/GroupPluginManager.php
index 115cc8d3fdb..f1b36923ada 100644
--- a/apps/user_ldap/lib/GroupPluginManager.php
+++ b/apps/user_ldap/lib/GroupPluginManager.php
@@ -29,14 +29,14 @@ class GroupPluginManager {
private $respondToActions = 0;
- private $which = array(
+ private $which = [
GroupInterface::CREATE_GROUP => null,
GroupInterface::DELETE_GROUP => null,
GroupInterface::ADD_TO_GROUP => null,
GroupInterface::REMOVE_FROM_GROUP => null,
GroupInterface::COUNT_USERS => null,
GroupInterface::GROUP_DETAILS => null
- );
+ ];
/**
* @return int All implemented actions
diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php
index 40b8bcf16c9..c19f6ac4ed6 100644
--- a/apps/user_ldap/lib/Group_LDAP.php
+++ b/apps/user_ldap/lib/Group_LDAP.php
@@ -138,8 +138,8 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
//extra work if we don't get back user DNs
if(strtolower($this->access->connection->ldapGroupMemberAssocAttr) === 'memberuid') {
- $dns = array();
- $filterParts = array();
+ $dns = [];
+ $filterParts = [];
$bytes = 0;
foreach($members as $mid) {
$filter = str_replace('%uid', $mid, $this->access->connection->ldapLoginFilter);
@@ -150,7 +150,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
// to take even the chance to exceed it
$filter = $this->access->combineFilterWithOr($filterParts);
$bytes = 0;
- $filterParts = array();
+ $filterParts = [];
$users = $this->access->fetchListOfUsers($filter, 'dn', count($filterParts));
$dns = array_merge($dns, $users);
}
@@ -182,10 +182,10 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
$dynamicGroupMemberURL = strtolower($this->access->connection->ldapDynamicGroupMemberURL);
if (empty($dynamicGroupMemberURL)) {
- return array();
+ return [];
}
- $dynamicMembers = array();
+ $dynamicMembers = [];
$memberURLs = $this->access->readAttribute(
$dnGroup,
$dynamicGroupMemberURL,
@@ -199,7 +199,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
if ($pos !== false) {
$memberUrlFilter = substr($memberURLs[0], $pos);
$foundMembers = $this->access->searchUsers($memberUrlFilter,'dn');
- $dynamicMembers = array();
+ $dynamicMembers = [];
foreach($foundMembers as $value) {
$dynamicMembers[$value['dn'][0]] = 1;
}
@@ -335,7 +335,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
'objectClass=posixGroup',
$this->access->connection->ldapGidNumber . '=' . $gid
]);
- $result = $this->access->searchGroups($filter, array('dn'), 1);
+ $result = $this->access->searchGroups($filter, ['dn'], 1);
if(empty($result)) {
return false;
}
@@ -493,11 +493,11 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
}
//we need to get the DN from LDAP
- $filter = $this->access->combineFilterWithAnd(array(
+ $filter = $this->access->combineFilterWithAnd([
$this->access->connection->ldapGroupFilter,
'objectsid=' . $domainObjectSid . '-' . $gid
- ));
- $result = $this->access->searchGroups($filter, array('dn'), 1);
+ ]);
+ $result = $this->access->searchGroups($filter, ['dn'], 1);
if(empty($result)) {
return false;
}
@@ -590,13 +590,13 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
$filter = $this->prepareFilterForUsersInPrimaryGroup($groupDN, $search);
$users = $this->access->fetchListOfUsers(
$filter,
- array($this->access->connection->ldapUserDisplayName, 'dn'),
+ [$this->access->connection->ldapUserDisplayName, 'dn'],
$limit,
$offset
);
return $this->access->nextcloudUserNames($users);
} catch (\Exception $e) {
- return array();
+ return [];
}
}
@@ -612,7 +612,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
public function countUsersInPrimaryGroup($groupDN, $search = '', $limit = -1, $offset = 0) {
try {
$filter = $this->prepareFilterForUsersInPrimaryGroup($groupDN, $search);
- $users = $this->access->countUsers($filter, array('dn'), $limit, $offset);
+ $users = $this->access->countUsers($filter, ['dn'], $limit, $offset);
return (int)$users;
} catch (\Exception $e) {
return 0;
@@ -648,7 +648,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
*/
public function getUserGroups($uid) {
if(!$this->enabled) {
- return array();
+ return [];
}
$cacheKey = 'getUserGroups'.$uid;
$userGroups = $this->access->connection->getFromCache($cacheKey);
@@ -657,8 +657,8 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
}
$userDN = $this->access->username2dn($uid);
if(!$userDN) {
- $this->access->connection->writeToCache($cacheKey, array());
- return array();
+ $this->access->connection->writeToCache($cacheKey, []);
+ return [];
}
$groups = [];
@@ -670,7 +670,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
if (!empty($dynamicGroupMemberURL)) {
// look through dynamic groups to add them to the result array if needed
$groupsToMatch = $this->access->fetchListOfGroups(
- $this->access->connection->ldapGroupFilter,array('dn',$dynamicGroupMemberURL));
+ $this->access->connection->ldapGroupFilter,['dn',$dynamicGroupMemberURL]);
foreach($groupsToMatch as $dynamicGroup) {
if (!array_key_exists($dynamicGroupMemberURL, $dynamicGroup)) {
continue;
@@ -816,10 +816,10 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
*/
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
if(!$this->enabled) {
- return array();
+ return [];
}
if(!$this->groupExists($gid)) {
- return array();
+ return [];
}
$search = $this->access->escapeFilterPart($search, true);
$cacheKey = 'usersInGroup-'.$gid.'-'.$search.'-'.$limit.'-'.$offset;
@@ -843,8 +843,8 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
$groupDN = $this->access->groupname2dn($gid);
if(!$groupDN) {
// group couldn't be found, return empty resultset
- $this->access->connection->writeToCache($cacheKey, array());
- return array();
+ $this->access->connection->writeToCache($cacheKey, []);
+ return [];
}
$primaryUsers = $this->getUsersInPrimaryGroup($groupDN, $search, $limit, $offset);
@@ -856,19 +856,19 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
return [];
}
- $groupUsers = array();
+ $groupUsers = [];
$isMemberUid = (strtolower($this->access->connection->ldapGroupMemberAssocAttr) === 'memberuid');
$attrs = $this->access->userManager->getAttributes(true);
foreach($members as $member) {
if($isMemberUid) {
//we got uids, need to get their DNs to 'translate' them to user names
- $filter = $this->access->combineFilterWithAnd(array(
+ $filter = $this->access->combineFilterWithAnd([
str_replace('%uid', trim($member), $this->access->connection->ldapLoginFilter),
$this->access->combineFilterWithAnd([
$this->access->getFilterPartForUserSearch($search),
$this->access->connection->ldapUserFilter
])
- ));
+ ]);
$ldap_users = $this->access->fetchListOfUsers($filter, $attrs, 1);
if(count($ldap_users) < 1) {
continue;
@@ -968,14 +968,14 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
// and let it count.
//For now this is not important, because the only use of this method
//does not supply a search string
- $groupUsers = array();
+ $groupUsers = [];
foreach($members as $member) {
if($isMemberUid) {
//we got uids, need to get their DNs to 'translate' them to user names
- $filter = $this->access->combineFilterWithAnd(array(
+ $filter = $this->access->combineFilterWithAnd([
str_replace('%uid', $member, $this->access->connection->ldapLoginFilter),
$this->access->getFilterPartForUserSearch($search)
- ));
+ ]);
$ldap_users = $this->access->fetchListOfUsers($filter, 'dn', 1);
if(count($ldap_users) < 1) {
continue;
@@ -1013,7 +1013,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
*/
protected function getGroupsChunk($search = '', $limit = -1, $offset = 0) {
if(!$this->enabled) {
- return array();
+ return [];
}
$cacheKey = 'getGroups-'.$search.'-'.$limit.'-'.$offset;
@@ -1029,13 +1029,13 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
if($limit <= 0) {
$limit = null;
}
- $filter = $this->access->combineFilterWithAnd(array(
+ $filter = $this->access->combineFilterWithAnd([
$this->access->connection->ldapGroupFilter,
$this->access->getFilterPartForGroupSearch($search)
- ));
+ ]);
\OCP\Util::writeLog('user_ldap', 'getGroups Filter '.$filter, ILogger::DEBUG);
$ldap_groups = $this->access->fetchListOfGroups($filter,
- array($this->access->connection->ldapGroupDisplayName, 'dn'),
+ [$this->access->connection->ldapGroupDisplayName, 'dn'],
$limit,
$offset);
$ldap_groups = $this->access->nextcloudGroupNames($ldap_groups);
@@ -1059,7 +1059,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
*/
public function getGroups($search = '', $limit = -1, $offset = 0) {
if(!$this->enabled) {
- return array();
+ return [];
}
$search = $this->access->escapeFilterPart($search, true);
$pagingSize = (int)$this->access->connection->ldapPagingSize;
@@ -1073,7 +1073,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
$overallLimit = $maxGroups;
}
$chunkOffset = $offset;
- $allGroups = array();
+ $allGroups = [];
while ($chunkOffset < $overallLimit) {
$chunkLimit = min($pagingSize, $overallLimit - $chunkOffset);
$ldapGroups = $this->getGroupsChunk($search, $chunkLimit, $chunkOffset);
diff --git a/apps/user_ldap/lib/Group_Proxy.php b/apps/user_ldap/lib/Group_Proxy.php
index 3b39d4398c7..441bf141a38 100644
--- a/apps/user_ldap/lib/Group_Proxy.php
+++ b/apps/user_ldap/lib/Group_Proxy.php
@@ -30,7 +30,7 @@ namespace OCA\User_LDAP;
use OCP\Group\Backend\IGetDisplayNameBackend;
class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGetDisplayNameBackend {
- private $backends = array();
+ private $backends = [];
private $refBackend = null;
/**
@@ -58,7 +58,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
protected function walkBackends($gid, $method, $parameters) {
$cacheKey = $this->getGroupCacheKey($gid);
foreach($this->backends as $configPrefix => $backend) {
- if($result = call_user_func_array(array($backend, $method), $parameters)) {
+ if($result = call_user_func_array([$backend, $method], $parameters)) {
$this->writeToCache($cacheKey, $configPrefix);
return $result;
}
@@ -80,13 +80,13 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
//in case the uid has been found in the past, try this stored connection first
if(!is_null($prefix)) {
if(isset($this->backends[$prefix])) {
- $result = call_user_func_array(array($this->backends[$prefix], $method), $parameters);
+ $result = call_user_func_array([$this->backends[$prefix], $method], $parameters);
if($result === $passOnWhen) {
//not found here, reset cache to null if group vanished
//because sometimes methods return false with a reason
$groupExists = call_user_func_array(
- array($this->backends[$prefix], 'groupExists'),
- array($gid)
+ [$this->backends[$prefix], 'groupExists'],
+ [$gid]
);
if(!$groupExists) {
$this->writeToCache($cacheKey, null);
@@ -107,7 +107,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
* Checks whether the user is member of a group or not.
*/
public function inGroup($uid, $gid) {
- return $this->handleRequest($gid, 'inGroup', array($uid, $gid));
+ return $this->handleRequest($gid, 'inGroup', [$uid, $gid]);
}
/**
@@ -119,7 +119,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
* if the user exists at all.
*/
public function getUserGroups($uid) {
- $groups = array();
+ $groups = [];
foreach($this->backends as $backend) {
$backendGroups = $backend->getUserGroups($uid);
@@ -136,7 +136,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
* @return string[] with user ids
*/
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
- $users = array();
+ $users = [];
foreach($this->backends as $backend) {
$backendUsers = $backend->usersInGroup($gid, $search, $limit, $offset);
@@ -154,7 +154,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
*/
public function createGroup($gid) {
return $this->handleRequest(
- $gid, 'createGroup', array($gid));
+ $gid, 'createGroup', [$gid]);
}
/**
@@ -164,7 +164,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
*/
public function deleteGroup($gid) {
return $this->handleRequest(
- $gid, 'deleteGroup', array($gid));
+ $gid, 'deleteGroup', [$gid]);
}
/**
@@ -177,7 +177,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
*/
public function addToGroup($uid, $gid) {
return $this->handleRequest(
- $gid, 'addToGroup', array($uid, $gid));
+ $gid, 'addToGroup', [$uid, $gid]);
}
/**
@@ -190,7 +190,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
*/
public function removeFromGroup($uid, $gid) {
return $this->handleRequest(
- $gid, 'removeFromGroup', array($uid, $gid));
+ $gid, 'removeFromGroup', [$uid, $gid]);
}
/**
@@ -201,7 +201,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
*/
public function countUsersInGroup($gid, $search = '') {
return $this->handleRequest(
- $gid, 'countUsersInGroup', array($gid, $search));
+ $gid, 'countUsersInGroup', [$gid, $search]);
}
/**
@@ -211,7 +211,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
*/
public function getGroupDetails($gid) {
return $this->handleRequest(
- $gid, 'getGroupDetails', array($gid));
+ $gid, 'getGroupDetails', [$gid]);
}
/**
@@ -221,7 +221,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
* Returns a list with all groups
*/
public function getGroups($search = '', $limit = -1, $offset = 0) {
- $groups = array();
+ $groups = [];
foreach($this->backends as $backend) {
$backendGroups = $backend->getGroups($search, $limit, $offset);
@@ -239,7 +239,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
* @return bool
*/
public function groupExists($gid) {
- return $this->handleRequest($gid, 'groupExists', array($gid));
+ return $this->handleRequest($gid, 'groupExists', [$gid]);
}
/**
@@ -271,7 +271,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
* @return resource of the LDAP connection
*/
public function getNewLDAPConnection($gid) {
- return $this->handleRequest($gid, 'getNewLDAPConnection', array($gid));
+ return $this->handleRequest($gid, 'getNewLDAPConnection', [$gid]);
}
public function getDisplayName(string $gid): string {
diff --git a/apps/user_ldap/lib/Helper.php b/apps/user_ldap/lib/Helper.php
index 4279ea72c71..6962a3cb978 100644
--- a/apps/user_ldap/lib/Helper.php
+++ b/apps/user_ldap/lib/Helper.php
@@ -99,7 +99,7 @@ class Helper {
$keys = $this->getServersConfig($referenceConfigkey);
- $result = array();
+ $result = [];
foreach($keys as $key) {
$len = strlen($key) - strlen($referenceConfigkey);
$prefix = substr($key, 0, $len);
@@ -164,7 +164,7 @@ class Helper {
AND `appid` = \'user_ldap\'
AND `configkey` NOT IN (\'enabled\', \'installed_version\', \'types\', \'bgjUpdateGroupsLastRun\')
');
- $delRows = $query->execute(array($prefix.'%'));
+ $delRows = $query->execute([$prefix.'%']);
if($delRows === null) {
return false;
@@ -234,7 +234,7 @@ class Helper {
public function sanitizeDN($dn) {
//treating multiple base DNs
if(is_array($dn)) {
- $result = array();
+ $result = [];
foreach($dn as $singleDN) {
$result[] = $this->sanitizeDN($singleDN);
}
@@ -251,7 +251,7 @@ class Helper {
//escape DN values according to RFC 2253 – this is already done by ldap_explode_dn
//to use the DN in search filters, \ needs to be escaped to \5c additionally
//to use them in bases, we convert them back to simple backslashes in readAttribute()
- $replacements = array(
+ $replacements = [
'\,' => '\5c2C',
'\=' => '\5c3D',
'\+' => '\5c2B',
@@ -263,7 +263,7 @@ class Helper {
'(' => '\28',
')' => '\29',
'*' => '\2A',
- );
+ ];
$dn = str_replace(array_keys($replacements), array_values($replacements), $dn);
return $dn;
diff --git a/apps/user_ldap/lib/Jobs/Sync.php b/apps/user_ldap/lib/Jobs/Sync.php
index 174897d8639..7b95950bda5 100644
--- a/apps/user_ldap/lib/Jobs/Sync.php
+++ b/apps/user_ldap/lib/Jobs/Sync.php
@@ -161,11 +161,11 @@ class Sync extends TimedJob {
$access = $this->accessFactory->get($connection);
$access->setUserMapper($this->mapper);
- $filter = $access->combineFilterWithAnd(array(
+ $filter = $access->combineFilterWithAnd([
$access->connection->ldapUserFilter,
$access->connection->ldapUserDisplayName . '=*',
$access->getFilterPartForUserSearch('')
- ));
+ ]);
$results = $access->fetchListOfUsers(
$filter,
$access->userManager->getAttributes(),
diff --git a/apps/user_ldap/lib/Jobs/UpdateGroups.php b/apps/user_ldap/lib/Jobs/UpdateGroups.php
index ef42f36f54f..bf5d730c3b8 100644
--- a/apps/user_ldap/lib/Jobs/UpdateGroups.php
+++ b/apps/user_ldap/lib/Jobs/UpdateGroups.php
@@ -104,21 +104,21 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
$actualUsers = self::getGroupBE()->usersInGroup($group);
$hasChanged = false;
foreach(array_diff($knownUsers, $actualUsers) as $removedUser) {
- \OCP\Util::emitHook('OC_User', 'post_removeFromGroup', array('uid' => $removedUser, 'gid' => $group));
+ \OCP\Util::emitHook('OC_User', 'post_removeFromGroup', ['uid' => $removedUser, 'gid' => $group]);
\OCP\Util::writeLog('user_ldap',
'bgJ "updateGroups" – "'.$removedUser.'" removed from "'.$group.'".',
ILogger::INFO);
$hasChanged = true;
}
foreach(array_diff($actualUsers, $knownUsers) as $addedUser) {
- \OCP\Util::emitHook('OC_User', 'post_addToGroup', array('uid' => $addedUser, 'gid' => $group));
+ \OCP\Util::emitHook('OC_User', 'post_addToGroup', ['uid' => $addedUser, 'gid' => $group]);
\OCP\Util::writeLog('user_ldap',
'bgJ "updateGroups" – "'.$addedUser.'" added to "'.$group.'".',
ILogger::INFO);
$hasChanged = true;
}
if($hasChanged) {
- $query->execute(array(serialize($actualUsers), $group));
+ $query->execute([serialize($actualUsers), $group]);
}
}
\OCP\Util::writeLog('user_ldap',
@@ -141,7 +141,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
'bgJ "updateGroups" – new group "'.$createdGroup.'" found.',
ILogger::INFO);
$users = serialize(self::getGroupBE()->usersInGroup($createdGroup));
- $query->execute(array($createdGroup, $users));
+ $query->execute([$createdGroup, $users]);
}
\OCP\Util::writeLog('user_ldap',
'bgJ "updateGroups" – FINISHED dealing with created Groups.',
@@ -162,7 +162,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
\OCP\Util::writeLog('user_ldap',
'bgJ "updateGroups" – group "'.$removedGroup.'" was removed.',
ILogger::INFO);
- $query->execute(array($removedGroup));
+ $query->execute([$removedGroup]);
}
\OCP\Util::writeLog('user_ldap',
'bgJ "updateGroups" – FINISHED dealing with removed groups.',
@@ -217,7 +217,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
FROM `*PREFIX*ldap_group_members`
');
$result = $query->execute()->fetchAll();
- self::$groupsFromDB = array();
+ self::$groupsFromDB = [];
foreach($result as $dataset) {
self::$groupsFromDB[$dataset['owncloudname']] = $dataset;
}
diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php
index e68c3149696..8c8a6bfbf1e 100644
--- a/apps/user_ldap/lib/LDAP.php
+++ b/apps/user_ldap/lib/LDAP.php
@@ -35,7 +35,7 @@ use OCA\User_LDAP\Exceptions\ConstraintViolationException;
class LDAP implements ILDAPWrapper {
protected $curFunc = '';
- protected $curArgs = array();
+ protected $curArgs = [];
/**
* @param resource $link
@@ -71,7 +71,7 @@ class LDAP implements ILDAPWrapper {
*/
public function controlPagedResultResponse($link, $result, &$cookie) {
$this->preFunctionCall('ldap_control_paged_result_response',
- array($link, $result, $cookie));
+ [$link, $result, $cookie]);
$result = ldap_control_paged_result_response($link, $result, $cookie);
$this->postFunctionCall();
@@ -217,7 +217,7 @@ class LDAP implements ILDAPWrapper {
* @return bool
*/
public function modReplace($link, $userDN, $password) {
- return $this->invokeLDAPMethod('mod_replace', $link, $userDN, array('userPassword' => $password));
+ return $this->invokeLDAPMethod('mod_replace', $link, $userDN, ['userPassword' => $password]);
}
/**
diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php
index 472cd8d2779..fecc25da92e 100644
--- a/apps/user_ldap/lib/Mapping/AbstractMapping.php
+++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php
@@ -84,7 +84,7 @@ abstract class AbstractMapping {
WHERE `' . $compareCol . '` = ?
');
- $res = $query->execute(array($search));
+ $res = $query->execute([$search]);
if($res !== false) {
return $query->fetchColumn();
}
@@ -126,7 +126,7 @@ abstract class AbstractMapping {
WHERE `directory_uuid` = ?
');
- return $this->modify($query, array($fdn, $uuid));
+ return $this->modify($query, [$fdn, $uuid]);
}
/**
@@ -171,8 +171,8 @@ abstract class AbstractMapping {
WHERE `owncloud_name` LIKE ?
');
- $res = $query->execute(array($prefixMatch.$this->dbc->escapeLikeParameter($search).$postfixMatch));
- $names = array();
+ $res = $query->execute([$prefixMatch.$this->dbc->escapeLikeParameter($search).$postfixMatch]);
+ $names = [];
if($res !== false) {
while($row = $query->fetch()) {
$names[] = $row['owncloud_name'];
@@ -240,11 +240,11 @@ abstract class AbstractMapping {
return false;
}
- $row = array(
+ $row = [
'ldap_dn' => $fdn,
'owncloud_name' => $name,
'directory_uuid' => $uuid
- );
+ ];
try {
$result = $this->dbc->insertIfNotExist($this->getTableName(), $row);
@@ -265,7 +265,7 @@ abstract class AbstractMapping {
DELETE FROM `'. $this->getTableName() .'`
WHERE `owncloud_name` = ?');
- return $this->modify($query, array($name));
+ return $this->modify($query, [$name]);
}
/**
diff --git a/apps/user_ldap/lib/Proxy.php b/apps/user_ldap/lib/Proxy.php
index 24313fc7bfb..4515e53c6c4 100644
--- a/apps/user_ldap/lib/Proxy.php
+++ b/apps/user_ldap/lib/Proxy.php
@@ -37,7 +37,7 @@ use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\User\Manager;
abstract class Proxy {
- static private $accesses = array();
+ static private $accesses = [];
private $ldap = null;
/** @var \OCP\ICache|null */
diff --git a/apps/user_ldap/lib/User/OfflineUser.php b/apps/user_ldap/lib/User/OfflineUser.php
index 1511f3bcd61..c75a144e909 100644
--- a/apps/user_ldap/lib/User/OfflineUser.php
+++ b/apps/user_ldap/lib/User/OfflineUser.php
@@ -105,7 +105,7 @@ class OfflineUser {
* @return array
*/
public function export() {
- $data = array();
+ $data = [];
$data['ocName'] = $this->getOCName();
$data['dn'] = $this->getDN();
$data['uid'] = $this->getUID();
@@ -223,7 +223,7 @@ class OfflineUser {
FROM `*PREFIX*share`
WHERE `uid_owner` = ?
', 1);
- $query->execute(array($this->ocName));
+ $query->execute([$this->ocName]);
$sResult = $query->fetchColumn(0);
if((int)$sResult === 1) {
$this->hasActiveShares = true;
@@ -235,7 +235,7 @@ class OfflineUser {
FROM `*PREFIX*share_external`
WHERE `owner` = ?
', 1);
- $query->execute(array($this->ocName));
+ $query->execute([$this->ocName]);
$sResult = $query->fetchColumn(0);
if((int)$sResult === 1) {
$this->hasActiveShares = true;
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index 467d5ca025b..eb126b94bfe 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -96,7 +96,7 @@ class User {
/**
* @var string[]
*/
- protected $refreshedFeatures = array();
+ protected $refreshedFeatures = [];
/**
* @var string
*/
@@ -711,7 +711,7 @@ class User {
$uid = $params['uid'];
if (isset($uid) && $uid === $this->getUsername()) {
//retrieve relevant user attributes
- $result = $this->access->search('objectclass=*', array($this->dn), ['pwdpolicysubentry', 'pwdgraceusetime', 'pwdreset', 'pwdchangedtime']);
+ $result = $this->access->search('objectclass=*', [$this->dn], ['pwdpolicysubentry', 'pwdgraceusetime', 'pwdreset', 'pwdchangedtime']);
if (array_key_exists('pwdpolicysubentry', $result[0])) {
$pwdPolicySubentry = $result[0]['pwdpolicysubentry'];
@@ -728,7 +728,7 @@ class User {
$cacheKey = 'ppolicyAttributes' . $ppolicyDN;
$result = $this->connection->getFromCache($cacheKey);
if(is_null($result)) {
- $result = $this->access->search('objectclass=*', array($ppolicyDN), ['pwdgraceauthnlimit', 'pwdmaxage', 'pwdexpirewarning']);
+ $result = $this->access->search('objectclass=*', [$ppolicyDN], ['pwdgraceauthnlimit', 'pwdmaxage', 'pwdexpirewarning']);
$this->connection->writeToCache($cacheKey, $result);
}
@@ -742,10 +742,10 @@ class User {
&& count($pwdGraceUseTime) < (int)$pwdGraceAuthNLimit[0]) { //at least one more grace login available?
$this->config->setUserValue($uid, 'user_ldap', 'needsPasswordReset', 'true');
header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute(
- 'user_ldap.renewPassword.showRenewPasswordForm', array('user' => $uid)));
+ 'user_ldap.renewPassword.showRenewPasswordForm', ['user' => $uid]));
} else { //no more grace login available
header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute(
- 'user_ldap.renewPassword.showLoginFormInvalidPassword', array('user' => $uid)));
+ 'user_ldap.renewPassword.showLoginFormInvalidPassword', ['user' => $uid]));
}
exit();
}
@@ -753,7 +753,7 @@ class User {
if (!empty($pwdReset) && $pwdReset[0] === 'TRUE') { //user must change his password
$this->config->setUserValue($uid, 'user_ldap', 'needsPasswordReset', 'true');
header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute(
- 'user_ldap.renewPassword.showRenewPasswordForm', array('user' => $uid)));
+ 'user_ldap.renewPassword.showRenewPasswordForm', ['user' => $uid]));
exit();
}
//handle password expiry warning
diff --git a/apps/user_ldap/lib/UserPluginManager.php b/apps/user_ldap/lib/UserPluginManager.php
index 1407bec011d..6301257b1af 100644
--- a/apps/user_ldap/lib/UserPluginManager.php
+++ b/apps/user_ldap/lib/UserPluginManager.php
@@ -32,7 +32,7 @@ class UserPluginManager {
private $respondToActions = 0;
- private $which = array(
+ private $which = [
Backend::CREATE_USER => null,
Backend::SET_PASSWORD => null,
Backend::GET_HOME => null,
@@ -41,7 +41,7 @@ class UserPluginManager {
Backend::PROVIDE_AVATAR => null,
Backend::COUNT_USERS => null,
'deleteUser' => null
- );
+ ];
/**
* @return int All implemented actions, except for 'deleteUser'
diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php
index 323e59860f3..fec3b25a78e 100644
--- a/apps/user_ldap/lib/User_LDAP.php
+++ b/apps/user_ldap/lib/User_LDAP.php
@@ -260,11 +260,11 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
if($limit <= 0) {
$limit = null;
}
- $filter = $this->access->combineFilterWithAnd(array(
+ $filter = $this->access->combineFilterWithAnd([
$this->access->connection->ldapUserFilter,
$this->access->connection->ldapUserDisplayName . '=*',
$this->access->getFilterPartForUserSearch($search)
- ));
+ ]);
Util::writeLog('user_ldap',
'getUsers: Options: search '.$search.' limit '.$limit.' offset '.$offset.' Filter: '.$filter,
@@ -511,7 +511,7 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
return $displayNames;
}
- $displayNames = array();
+ $displayNames = [];
$users = $this->getUsers($search, $limit, $offset);
foreach ($users as $user) {
$displayNames[$user] = $this->getDisplayName($user);
diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php
index 96be4a7529f..2edc0d2d64a 100644
--- a/apps/user_ldap/lib/User_Proxy.php
+++ b/apps/user_ldap/lib/User_Proxy.php
@@ -84,7 +84,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
&& method_exists($this->getAccess($configPrefix), $method)) {
$instance = $this->getAccess($configPrefix);
}
- if($result = call_user_func_array(array($instance, $method), $parameters)) {
+ if($result = call_user_func_array([$instance, $method], $parameters)) {
$this->writeToCache($cacheKey, $configPrefix);
return $result;
}
@@ -160,7 +160,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
*/
public function getUsers($search = '', $limit = 10, $offset = 0) {
//we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends
- $users = array();
+ $users = [];
foreach($this->backends as $backend) {
$backendUsers = $backend->getUsers($search, $limit, $offset);
if (is_array($backendUsers)) {
@@ -177,7 +177,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
*/
public function userExists($uid) {
$existsOnLDAP = false;
- $existsLocally = $this->handleRequest($uid, 'userExists', array($uid));
+ $existsLocally = $this->handleRequest($uid, 'userExists', [$uid]);
if($existsLocally) {
$existsOnLDAP = $this->userExistsOnLDAP($uid);
}
@@ -202,7 +202,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
*/
public function userExistsOnLDAP($user) {
$id = ($user instanceof User) ? $user->getUsername() : $user;
- return $this->handleRequest($id, 'userExistsOnLDAP', array($user));
+ return $this->handleRequest($id, 'userExistsOnLDAP', [$user]);
}
/**
@@ -214,7 +214,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
* Check if the password is correct without logging in the user
*/
public function checkPassword($uid, $password) {
- return $this->handleRequest($uid, 'checkPassword', array($uid, $password));
+ return $this->handleRequest($uid, 'checkPassword', [$uid, $password]);
}
/**
@@ -225,7 +225,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
*/
public function loginName2UserName($loginName) {
$id = 'LOGINNAME,' . $loginName;
- return $this->handleRequest($id, 'loginName2UserName', array($loginName));
+ return $this->handleRequest($id, 'loginName2UserName', [$loginName]);
}
/**
@@ -236,7 +236,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
*/
public function dn2UserName($dn) {
$id = 'DN,' . $dn;
- return $this->handleRequest($id, 'dn2UserName', array($dn));
+ return $this->handleRequest($id, 'dn2UserName', [$dn]);
}
/**
@@ -245,7 +245,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
* @return boolean
*/
public function getHome($uid) {
- return $this->handleRequest($uid, 'getHome', array($uid));
+ return $this->handleRequest($uid, 'getHome', [$uid]);
}
/**
@@ -254,7 +254,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
* @return string display name
*/
public function getDisplayName($uid) {
- return $this->handleRequest($uid, 'getDisplayName', array($uid));
+ return $this->handleRequest($uid, 'getDisplayName', [$uid]);
}
/**
@@ -265,7 +265,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
* @return string display name
*/
public function setDisplayName($uid, $displayName) {
- return $this->handleRequest($uid, 'setDisplayName', array($uid, $displayName));
+ return $this->handleRequest($uid, 'setDisplayName', [$uid, $displayName]);
}
/**
@@ -286,7 +286,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
*/
public function getDisplayNames($search = '', $limit = null, $offset = null) {
//we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends
- $users = array();
+ $users = [];
foreach($this->backends as $backend) {
$backendUsers = $backend->getDisplayNames($search, $limit, $offset);
if (is_array($backendUsers)) {
@@ -304,7 +304,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
* Deletes a user
*/
public function deleteUser($uid) {
- return $this->handleRequest($uid, 'deleteUser', array($uid));
+ return $this->handleRequest($uid, 'deleteUser', [$uid]);
}
/**
@@ -315,7 +315,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
*
*/
public function setPassword($uid, $password) {
- return $this->handleRequest($uid, 'setPassword', array($uid, $password));
+ return $this->handleRequest($uid, 'setPassword', [$uid, $password]);
}
/**
@@ -346,7 +346,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
* @return Access instance of Access for LDAP interaction
*/
public function getLDAPAccess($uid) {
- return $this->handleRequest($uid, 'getLDAPAccess', array($uid));
+ return $this->handleRequest($uid, 'getLDAPAccess', [$uid]);
}
/**
@@ -356,7 +356,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
* @return resource of the LDAP connection
*/
public function getNewLDAPConnection($uid) {
- return $this->handleRequest($uid, 'getNewLDAPConnection', array($uid));
+ return $this->handleRequest($uid, 'getNewLDAPConnection', [$uid]);
}
/**
@@ -366,6 +366,6 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
* @return bool
*/
public function createUser($username, $password) {
- return $this->handleRequest($username, 'createUser', array($username,$password));
+ return $this->handleRequest($username, 'createUser', [$username,$password]);
}
}
diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php
index 82f06010bcf..4e3f41d6fc9 100644
--- a/apps/user_ldap/lib/Wizard.php
+++ b/apps/user_ldap/lib/Wizard.php
@@ -48,7 +48,7 @@ class Wizard extends LDAPUtility {
protected $cr;
protected $configuration;
protected $result;
- protected $resultCache = array();
+ protected $resultCache = [];
const LRESULT_PROCESSED_OK = 2;
const LRESULT_PROCESSED_INVALID = 3;
@@ -135,7 +135,7 @@ class Wizard extends LDAPUtility {
$filter = $this->configuration->ldapGroupFilter;
if(empty($filter)) {
- $output = self::$l->n('%s group found', '%s groups found', 0, array(0));
+ $output = self::$l->n('%s group found', '%s groups found', 0, [0]);
$this->result->addChange('ldap_group_count', $output);
return $this->result;
}
@@ -200,22 +200,22 @@ class Wizard extends LDAPUtility {
* @return int|bool
*/
public function countUsersWithAttribute($attr, $existsCheck = false) {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapBase',
'ldapUserFilter',
- ))) {
+ ])) {
return false;
}
- $filter = $this->access->combineFilterWithAnd(array(
+ $filter = $this->access->combineFilterWithAnd([
$this->configuration->ldapUserFilter,
$attr . '=*'
- ));
+ ]);
$limit = ($existsCheck === false) ? null : 1;
- return $this->access->countUsers($filter, array('dn'), $limit);
+ return $this->access->countUsers($filter, ['dn'], $limit);
}
/**
@@ -225,11 +225,11 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
public function detectUserDisplayNameAttribute() {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapBase',
'ldapUserFilter',
- ))) {
+ ])) {
return false;
}
@@ -247,7 +247,7 @@ class Wizard extends LDAPUtility {
}
// first attribute that has at least one result wins
- $displayNameAttrs = array('displayname', 'cn');
+ $displayNameAttrs = ['displayname', 'cn'];
foreach ($displayNameAttrs as $attr) {
$count = (int)$this->countUsersWithAttribute($attr, true);
@@ -267,11 +267,11 @@ class Wizard extends LDAPUtility {
* @return WizardResult|bool
*/
public function detectEmailAttribute() {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapBase',
'ldapUserFilter',
- ))) {
+ ])) {
return false;
}
@@ -286,7 +286,7 @@ class Wizard extends LDAPUtility {
$writeLog = false;
}
- $emailAttributes = array('mail', 'mailPrimaryAddress');
+ $emailAttributes = ['mail', 'mailPrimaryAddress'];
$winner = '';
$maxUsers = 0;
foreach($emailAttributes as $attr) {
@@ -314,11 +314,11 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
public function determineAttributes() {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapBase',
'ldapUserFilter',
- ))) {
+ ])) {
return false;
}
@@ -343,11 +343,11 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
private function getUserAttributes() {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapBase',
'ldapUserFilter',
- ))) {
+ ])) {
return false;
}
$cr = $this->getConnection();
@@ -357,13 +357,13 @@ class Wizard extends LDAPUtility {
$base = $this->configuration->ldapBase[0];
$filter = $this->configuration->ldapUserFilter;
- $rr = $this->ldap->search($cr, $base, $filter, array(), 1, 1);
+ $rr = $this->ldap->search($cr, $base, $filter, [], 1, 1);
if(!$this->ldap->isResource($rr)) {
return false;
}
$er = $this->ldap->firstEntry($cr, $rr);
$attributes = $this->ldap->getAttributes($cr, $er);
- $pureAttributes = array();
+ $pureAttributes = [];
for($i = 0; $i < $attributes['count']; $i++) {
$pureAttributes[] = $attributes[$i];
}
@@ -399,10 +399,10 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
private function determineGroups($dbKey, $confKey, $testMemberOf = true) {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapBase',
- ))) {
+ ])) {
return false;
}
$cr = $this->getConnection();
@@ -432,9 +432,9 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
public function fetchGroups($dbKey, $confKey) {
- $obclasses = array('posixGroup', 'group', 'zimbraDistributionList', 'groupOfNames', 'groupOfUniqueNames');
+ $obclasses = ['posixGroup', 'group', 'zimbraDistributionList', 'groupOfNames', 'groupOfUniqueNames'];
- $filterParts = array();
+ $filterParts = [];
foreach($obclasses as $obclass) {
$filterParts[] = 'objectclass='.$obclass;
}
@@ -442,16 +442,16 @@ class Wizard extends LDAPUtility {
//- that looks like a group and
//- has the group display name set
$filter = $this->access->combineFilterWithOr($filterParts);
- $filter = $this->access->combineFilterWithAnd(array($filter, 'cn=*'));
+ $filter = $this->access->combineFilterWithAnd([$filter, 'cn=*']);
- $groupNames = array();
- $groupEntries = array();
+ $groupNames = [];
+ $groupEntries = [];
$limit = 400;
$offset = 0;
do {
// we need to request dn additionally here, otherwise memberOf
// detection will fail later
- $result = $this->access->searchGroups($filter, array('cn', 'dn'), $limit, $offset);
+ $result = $this->access->searchGroups($filter, ['cn', 'dn'], $limit, $offset);
foreach($result as $item) {
if(!isset($item['cn']) && !is_array($item['cn']) && !isset($item['cn'][0])) {
// just in case - no issue known
@@ -479,17 +479,17 @@ class Wizard extends LDAPUtility {
}
public function determineGroupMemberAssoc() {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapGroupFilter',
- ))) {
+ ])) {
return false;
}
$attribute = $this->detectGroupMemberAssoc();
if($attribute === false) {
return false;
}
- $this->configuration->setConfiguration(array('ldapGroupMemberAssocAttr' => $attribute));
+ $this->configuration->setConfiguration(['ldapGroupMemberAssocAttr' => $attribute]);
$this->result->addChange('ldap_group_member_assoc_attribute', $attribute);
return $this->result;
@@ -501,10 +501,10 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
public function determineGroupObjectClasses() {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapBase',
- ))) {
+ ])) {
return false;
}
$cr = $this->getConnection();
@@ -512,7 +512,7 @@ class Wizard extends LDAPUtility {
throw new \Exception('Could not connect to LDAP');
}
- $obclasses = array('groupOfNames', 'groupOfUniqueNames', 'group', 'posixGroup', '*');
+ $obclasses = ['groupOfNames', 'groupOfUniqueNames', 'group', 'posixGroup', '*'];
$this->determineFeature($obclasses,
'objectclass',
'ldap_groupfilter_objectclass',
@@ -528,10 +528,10 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
public function determineUserObjectClasses() {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapBase',
- ))) {
+ ])) {
return false;
}
$cr = $this->getConnection();
@@ -539,8 +539,8 @@ class Wizard extends LDAPUtility {
throw new \Exception('Could not connect to LDAP');
}
- $obclasses = array('inetOrgPerson', 'person', 'organizationalPerson',
- 'user', 'posixAccount', '*');
+ $obclasses = ['inetOrgPerson', 'person', 'organizationalPerson',
+ 'user', 'posixAccount', '*'];
$filter = $this->configuration->ldapUserFilter;
//if filter is empty, it is probably the first time the wizard is called
//then, apply suggestions.
@@ -558,10 +558,10 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
public function getGroupFilter() {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapBase',
- ))) {
+ ])) {
return false;
}
//make sure the use display name is set
@@ -582,10 +582,10 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
public function getUserListFilter() {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapBase',
- ))) {
+ ])) {
return false;
}
//make sure the use display name is set
@@ -608,11 +608,11 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
public function getUserLoginFilter() {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapBase',
'ldapUserFilter',
- ))) {
+ ])) {
return false;
}
@@ -631,11 +631,11 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
public function testLoginName($loginName) {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
'ldapBase',
'ldapLoginFilter',
- ))) {
+ ])) {
return false;
}
@@ -665,8 +665,8 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
public function guessPortAndTLS() {
- if(!$this->checkRequirements(array('ldapHost',
- ))) {
+ if(!$this->checkRequirements(['ldapHost',
+ ])) {
return false;
}
$this->checkHost();
@@ -698,10 +698,10 @@ class Wizard extends LDAPUtility {
}
if ($settingsFound === true) {
- $config = array(
+ $config = [
'ldapPort' => $p,
'ldapTLS' => (int)$t
- );
+ ];
$this->configuration->setConfiguration($config);
\OCP\Util::writeLog('user_ldap', 'Wiz: detected Port ' . $p, ILogger::DEBUG);
$this->result->addChange('ldap_port', $p);
@@ -718,9 +718,9 @@ class Wizard extends LDAPUtility {
* @return WizardResult|false WizardResult on success, false otherwise
*/
public function guessBaseDN() {
- if(!$this->checkRequirements(array('ldapHost',
+ if(!$this->checkRequirements(['ldapHost',
'ldapPort',
- ))) {
+ ])) {
return false;
}
@@ -766,7 +766,7 @@ class Wizard extends LDAPUtility {
*/
private function applyFind($key, $value) {
$this->result->addChange($key, $value);
- $this->configuration->setConfiguration(array($key => $value));
+ $this->configuration->setConfiguration([$key => $value]);
}
/**
@@ -844,7 +844,7 @@ class Wizard extends LDAPUtility {
//base is there, let's validate it. If we search for anything, we should
//get a result set > 0 on a proper base
- $rr = $this->ldap->search($cr, $base, 'objectClass=*', array('dn'), 0, 1);
+ $rr = $this->ldap->search($cr, $base, 'objectClass=*', ['dn'], 0, 1);
if(!$this->ldap->isResource($rr)) {
$errorNo = $this->ldap->errno($cr);
$errorMsg = $this->ldap->error($cr);
@@ -870,7 +870,7 @@ class Wizard extends LDAPUtility {
if(!$cr) {
throw new \Exception('Could not connect to LDAP');
}
- $result = $this->access->countUsers('memberOf=*', array('memberOf'), 1);
+ $result = $this->access->countUsers('memberOf=*', ['memberOf'], 1);
if(is_int($result) && $result > 0) {
return true;
}
@@ -911,7 +911,7 @@ class Wizard extends LDAPUtility {
}
$base = $this->configuration->ldapBase[0];
foreach($cns as $cn) {
- $rr = $this->ldap->search($cr, $base, 'cn=' . $cn, array('dn', 'primaryGroupToken'));
+ $rr = $this->ldap->search($cr, $base, 'cn=' . $cn, ['dn', 'primaryGroupToken']);
if(!$this->ldap->isResource($rr)) {
continue;
}
@@ -1132,8 +1132,8 @@ class Wizard extends LDAPUtility {
* @return array|false an array with the values on success, false otherwise
*/
public function cumulativeSearchOnAttribute($filters, $attr, $dnReadLimit = 3, &$maxF = null) {
- $dnRead = array();
- $foundItems = array();
+ $dnRead = [];
+ $foundItems = [];
$maxEntries = 0;
if(!is_array($this->configuration->ldapBase)
|| !isset($this->configuration->ldapBase[0])) {
@@ -1154,7 +1154,7 @@ class Wizard extends LDAPUtility {
continue;
}
// 20k limit for performance and reason
- $rr = $this->ldap->search($cr, $base, $filter, array($attr), 0, 20000);
+ $rr = $this->ldap->search($cr, $base, $filter, [$attr], 0, 20000);
if(!$this->ldap->isResource($rr)) {
continue;
}
@@ -1178,7 +1178,7 @@ class Wizard extends LDAPUtility {
if($dn === false || in_array($dn, $dnRead)) {
continue;
}
- $newItems = array();
+ $newItems = [];
$state = $this->getAttributeValuesFromEntry($attributes,
$attr,
$newItems);
@@ -1317,14 +1317,14 @@ class Wizard extends LDAPUtility {
* @return array
*/
private function getDefaultLdapPortSettings() {
- static $settings = array(
- array('port' => 7636, 'tls' => false),
- array('port' => 636, 'tls' => false),
- array('port' => 7389, 'tls' => true),
- array('port' => 389, 'tls' => true),
- array('port' => 7389, 'tls' => false),
- array('port' => 389, 'tls' => false),
- );
+ static $settings = [
+ ['port' => 7636, 'tls' => false],
+ ['port' => 636, 'tls' => false],
+ ['port' => 7389, 'tls' => true],
+ ['port' => 389, 'tls' => true],
+ ['port' => 7389, 'tls' => false],
+ ['port' => 389, 'tls' => false],
+ ];
return $settings;
}
@@ -1337,7 +1337,7 @@ class Wizard extends LDAPUtility {
//7xxx ← UCS. need to be checked first, because both ports may be open
$host = $this->configuration->ldapHost;
$port = (int)$this->configuration->ldapPort;
- $portSettings = array();
+ $portSettings = [];
//In case the port is already provided, we will check this first
if($port > 0) {
@@ -1345,9 +1345,9 @@ class Wizard extends LDAPUtility {
if(!(is_array($hostInfo)
&& isset($hostInfo['scheme'])
&& stripos($hostInfo['scheme'], 'ldaps') !== false)) {
- $portSettings[] = array('port' => $port, 'tls' => true);
+ $portSettings[] = ['port' => $port, 'tls' => true];
}
- $portSettings[] =array('port' => $port, 'tls' => false);
+ $portSettings[] =['port' => $port, 'tls' => false];
}
//default ports
diff --git a/apps/user_ldap/lib/WizardResult.php b/apps/user_ldap/lib/WizardResult.php
index 74bb1171d48..ae90cfe437a 100644
--- a/apps/user_ldap/lib/WizardResult.php
+++ b/apps/user_ldap/lib/WizardResult.php
@@ -29,8 +29,8 @@
namespace OCA\User_LDAP;
class WizardResult {
- protected $changes = array();
- protected $options = array();
+ protected $changes = [];
+ protected $options = [];
protected $markedChange = false;
/**
@@ -52,7 +52,7 @@ class WizardResult {
*/
public function addOptions($key, $values) {
if(!is_array($values)) {
- $values = array($values);
+ $values = [$values];
}
$this->options[$key] = $values;
}
@@ -68,7 +68,7 @@ class WizardResult {
* @return array
*/
public function getResultArray() {
- $result = array();
+ $result = [];
$result['changes'] = $this->changes;
if(count($this->options) > 0) {
$result['options'] = $this->options;