Extract lowercase conversion out of the loop

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Juan Pablo Villafáñez 2016-10-04 18:12:48 +02:00 committed by Arthur Schiwon
parent 6496b95564
commit efa1077872
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
1 changed files with 2 additions and 1 deletions

View File

@ -280,10 +280,11 @@ class Access extends LDAPUtility implements IUserTools {
public function extractAttributeValuesFromResult($result, $attribute) {
$values = [];
if(isset($result[$attribute]) && $result[$attribute]['count'] > 0) {
$lowercaseAttribute = strtolower($attribute);
for($i=0;$i<$result[$attribute]['count'];$i++) {
if($this->resemblesDN($attribute)) {
$values[] = $this->sanitizeDN($result[$attribute][$i]);
} elseif(strtolower($attribute) === 'objectguid' || strtolower($attribute) === 'guid') {
} elseif($lowercaseAttribute === 'objectguid' || $lowercaseAttribute === 'guid') {
$values[] = $this->convertObjectGUID2Str($result[$attribute][$i]);
} else {
$values[] = $result[$attribute][$i];