summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/access.php
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-05-15 23:56:42 +0200
committerThomas Mueller <thomas.mueller@tmit.eu>2013-05-15 23:56:42 +0200
commit31d8258d6c0846c1452a7d0af151770650268db5 (patch)
tree5c22af656981cded9c6c2de21af2411aeb590a80 /apps/user_ldap/lib/access.php
parent331ad15d9b6b5d6c71285f19e7fda5ea0097d875 (diff)
parentdfddaf8fbf5ff515f26ff462c7ba6166b3d0ed18 (diff)
downloadnextcloud-server-31d8258d6c0846c1452a7d0af151770650268db5.tar.gz
nextcloud-server-31d8258d6c0846c1452a7d0af151770650268db5.zip
Merge branch 'master' into ext-fs-irods-master
Diffstat (limited to 'apps/user_ldap/lib/access.php')
-rw-r--r--apps/user_ldap/lib/access.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 6d32e9b2ab0..ad355ce5e24 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -87,7 +87,7 @@ abstract class Access {
for($i=0;$i<$result[$attr]['count'];$i++) {
if($this->resemblesDN($attr)) {
$values[] = $this->sanitizeDN($result[$attr][$i]);
- } elseif(strtolower($attr) == 'objectguid' || strtolower($attr) == 'guid') {
+ } elseif(strtolower($attr) === 'objectguid' || strtolower($attr) === 'guid') {
$values[] = $this->convertObjectGUID2Str($result[$attr][$i]);
} else {
$values[] = $result[$attr][$i];
@@ -317,7 +317,7 @@ abstract class Access {
}
$ldapname = $ldapname[0];
}
- $intname = $isUser ? $this->sanitizeUsername($uuid) : $this->sanitizeUsername($ldapname);
+ $intname = $isUser ? $this->sanitizeUsername($uuid) : $ldapname;
//a new user/group! Add it only if it doesn't conflict with other backend's users or existing groups
//disabling Cache is required to avoid that the new user is cached as not-existing in fooExists check
@@ -462,7 +462,7 @@ abstract class Access {
while($row = $res->fetchRow()) {
$usedNames[] = $row['owncloud_name'];
}
- if(!($usedNames) || count($usedNames) == 0) {
+ if(!($usedNames) || count($usedNames) === 0) {
$lastNo = 1; //will become name_2
} else {
natsort($usedNames);
@@ -550,7 +550,7 @@ abstract class Access {
$sqlAdjustment = '';
$dbtype = \OCP\Config::getSystemValue('dbtype');
- if($dbtype == 'mysql') {
+ if($dbtype === 'mysql') {
$sqlAdjustment = 'FROM DUAL';
}
@@ -574,7 +574,7 @@ abstract class Access {
$insRows = $res->numRows();
- if($insRows == 0) {
+ if($insRows === 0) {
return false;
}
@@ -656,7 +656,7 @@ abstract class Access {
$linkResources = array_pad(array(), count($base), $link_resource);
$sr = ldap_search($linkResources, $base, $filter, $attr);
$error = ldap_errno($link_resource);
- if(!is_array($sr) || $error != 0) {
+ if(!is_array($sr) || $error !== 0) {
\OCP\Util::writeLog('user_ldap',
'Error when searching: '.ldap_error($link_resource).' code '.ldap_errno($link_resource),
\OCP\Util::ERROR);
@@ -724,7 +724,7 @@ abstract class Access {
foreach($attr as $key) {
$key = mb_strtolower($key, 'UTF-8');
if(isset($item[$key])) {
- if($key != 'dn') {
+ if($key !== 'dn') {
$selection[$i][$key] = $this->resemblesDN($key) ?
$this->sanitizeDN($item[$key][0])
: $item[$key][0];
@@ -816,7 +816,7 @@ abstract class Access {
private function combineFilter($filters, $operator) {
$combinedFilter = '('.$operator;
foreach($filters as $filter) {
- if($filter[0] != '(') {
+ if($filter[0] !== '(') {
$filter = '('.$filter.')';
}
$combinedFilter.=$filter;
@@ -857,7 +857,7 @@ abstract class Access {
private function getFilterPartForSearch($search, $searchAttributes, $fallbackAttribute) {
$filter = array();
$search = empty($search) ? '*' : '*'.$search.'*';
- if(!is_array($searchAttributes) || count($searchAttributes) == 0) {
+ if(!is_array($searchAttributes) || count($searchAttributes) === 0) {
if(empty($fallbackAttribute)) {
return '';
}
@@ -867,7 +867,7 @@ abstract class Access {
$filter[] = $attribute . '=' . $search;
}
}
- if(count($filter) == 1) {
+ if(count($filter) === 1) {
return '('.$filter[0].')';
}
return $this->combineFilterWithOr($filter);
@@ -893,7 +893,7 @@ abstract class Access {
* @returns true on success, false otherwise
*/
private function detectUuidAttribute($dn, $force = false) {
- if(($this->connection->ldapUuidAttribute != 'auto') && !$force) {
+ if(($this->connection->ldapUuidAttribute !== 'auto') && !$force) {
return true;
}
@@ -1007,7 +1007,7 @@ abstract class Access {
* @returns string containing the key or empty if none is cached
*/
private function getPagedResultCookie($base, $filter, $limit, $offset) {
- if($offset == 0) {
+ if($offset === 0) {
return '';
}
$offset -= $limit;
@@ -1031,7 +1031,7 @@ abstract class Access {
*/
private function setPagedResultCookie($base, $filter, $limit, $offset, $cookie) {
if(!empty($cookie)) {
- $cachekey = 'lc' . dechex(crc32($base)) . '-' . dechex(crc32($filter)) . '-' .$limit . '-' . $offset;
+ $cachekey = 'lc' . crc32($base) . '-' . crc32($filter) . '-' .$limit . '-' . $offset;
$cookie = $this->connection->writeToCache($cachekey, $cookie);
}
}