summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-05-13 12:41:22 +0200
committerArthur Schiwon <blizzz@owncloud.com>2013-05-13 12:41:22 +0200
commitbeaa10b823a426b4cba16e2bf6d72fd532345290 (patch)
tree9d7d401f94d995957356ca4b357db7c73d55f60c /apps/user_ldap/lib
parentd69579f7733c742eb0ca17e80747d1f6b06c80e9 (diff)
parente60cf2a99793aa9f0071b40b4d119b36df44d110 (diff)
downloadnextcloud-server-beaa10b823a426b4cba16e2bf6d72fd532345290.tar.gz
nextcloud-server-beaa10b823a426b4cba16e2bf6d72fd532345290.zip
Merge branch 'master' into ldap_configurable_username_n_uuid
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r--apps/user_ldap/lib/access.php22
-rw-r--r--apps/user_ldap/lib/connection.php14
-rw-r--r--apps/user_ldap/lib/helper.php2
3 files changed, 19 insertions, 19 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 8c372766c00..a7611eb3e84 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];
@@ -474,7 +474,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);
@@ -562,7 +562,7 @@ abstract class Access {
$sqlAdjustment = '';
$dbtype = \OCP\Config::getSystemValue('dbtype');
- if($dbtype == 'mysql') {
+ if($dbtype === 'mysql') {
$sqlAdjustment = 'FROM DUAL';
}
@@ -586,7 +586,7 @@ abstract class Access {
$insRows = $res->numRows();
- if($insRows == 0) {
+ if($insRows === 0) {
return false;
}
@@ -668,7 +668,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);
@@ -736,7 +736,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];
@@ -828,7 +828,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;
@@ -869,7 +869,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 '';
}
@@ -879,7 +879,7 @@ abstract class Access {
$filter[] = $attribute . '=' . $search;
}
}
- if(count($filter) == 1) {
+ if(count($filter) === 1) {
return '('.$filter[0].')';
}
return $this->combineFilterWithOr($filter);
@@ -905,7 +905,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;
}
@@ -1025,7 +1025,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;
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index 7292ca15e78..ba4de135341 100644
--- a/apps/user_ldap/lib/connection.php
+++ b/apps/user_ldap/lib/connection.php
@@ -101,7 +101,7 @@ class Connection {
public function __set($name, $value) {
$changed = false;
//only few options are writable
- if($name == 'ldapUuidAttribute') {
+ if($name === 'ldapUuidAttribute') {
\OCP\Util::writeLog('user_ldap', 'Set config ldapUuidAttribute to '.$value, \OCP\Util::DEBUG);
$this->config[$name] = $value;
if(!empty($this->configID)) {
@@ -328,9 +328,9 @@ class Connection {
$params = $this->getConfigTranslationArray();
foreach($config as $parameter => $value) {
- if(($parameter == 'homeFolderNamingRule'
+ if(($parameter === 'homeFolderNamingRule'
|| (isset($params[$parameter])
- && $params[$parameter] == 'homeFolderNamingRule'))
+ && $params[$parameter] === 'homeFolderNamingRule'))
&& !empty($value)) {
$value = 'attr:'.$value;
}
@@ -396,7 +396,7 @@ class Connection {
$trans = $this->getConfigTranslationArray();
$config = array();
foreach($trans as $dbKey => $classKey) {
- if($classKey == 'homeFolderNamingRule') {
+ if($classKey === 'homeFolderNamingRule') {
if(strpos($this->config[$classKey], 'attr:') === 0) {
$config[$dbKey] = substr($this->config[$classKey], 5);
} else {
@@ -449,7 +449,7 @@ class Connection {
}
foreach(array('ldapAttributesForUserSearch', 'ldapAttributesForGroupSearch') as $key) {
if(is_array($this->config[$key])
- && count($this->config[$key]) == 1
+ && count($this->config[$key]) === 1
&& empty($this->config[$key][0])) {
$this->config[$key] = array();
}
@@ -603,12 +603,12 @@ class Connection {
$error = null;
//if LDAP server is not reachable, try the Backup (Replica!) Server
- if((!$bindStatus && ($error == -1))
+ if((!$bindStatus && ($error === -1))
|| $this->config['ldapOverrideMainServer']
|| $this->getFromCache('overrideMainServer')) {
$this->doConnect($this->config['ldapBackupHost'], $this->config['ldapBackupPort']);
$bindStatus = $this->bind();
- if($bindStatus && $error == -1) {
+ if($bindStatus && $error === -1) {
//when bind to backup server succeeded and failed to main server,
//skip contacting him until next cache refresh
$this->writeToCache('overrideMainServer', true);
diff --git a/apps/user_ldap/lib/helper.php b/apps/user_ldap/lib/helper.php
index 7720c356a13..07d13a806a6 100644
--- a/apps/user_ldap/lib/helper.php
+++ b/apps/user_ldap/lib/helper.php
@@ -96,7 +96,7 @@ class Helper {
return false;
}
- if($res->numRows() == 0) {
+ if($res->numRows() === 0) {
return false;
}