summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorkondou <kondou@ts.unde.re>2013-04-20 22:45:50 +0200
committerkondou <kondou@ts.unde.re>2013-04-20 22:46:37 +0200
commitd6b13ccd12e48257e0d085d190f57b159795c6dc (patch)
treef3539007382ce69992444acb3109f06026c70ca4 /apps/user_ldap
parentb8fe7025da4b0b6f0fde9dde4553d0b29eefb10c (diff)
downloadnextcloud-server-d6b13ccd12e48257e0d085d190f57b159795c6dc.tar.gz
nextcloud-server-d6b13ccd12e48257e0d085d190f57b159795c6dc.zip
Use !== and === in user_ldap app – Part 2
Diffstat (limited to 'apps/user_ldap')
-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
-rw-r--r--apps/user_ldap/templates/settings.php4
-rw-r--r--apps/user_ldap/user_ldap.php4
5 files changed, 23 insertions, 23 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 6d32e9b2ab0..69d07b6bb00 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];
@@ -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;
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index 20784570e93..f3946a0d613 100644
--- a/apps/user_ldap/lib/connection.php
+++ b/apps/user_ldap/lib/connection.php
@@ -99,7 +99,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)) {
@@ -321,9 +321,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;
}
@@ -389,7 +389,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 {
@@ -440,7 +440,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();
}
@@ -588,12 +588,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 612a088269b..8bebd84c12e 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;
}
diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php
index d3c2c298904..f0ee8c6b08a 100644
--- a/apps/user_ldap/templates/settings.php
+++ b/apps/user_ldap/templates/settings.php
@@ -14,7 +14,7 @@
<fieldset id="ldapSettings-1">
<p><label for="ldap_serverconfig_chooser"><?php p($l->t('Server configuration'));?></label>
<select id="ldap_serverconfig_chooser" name="ldap_serverconfig_chooser">
- <?php if(count($_['serverConfigurationPrefixes']) == 0 ) {
+ <?php if(count($_['serverConfigurationPrefixes']) === 0 ) {
?>
<option value="" selected>1. Server</option>');
<?php
@@ -85,7 +85,7 @@
<p><label for="ldap_group_display_name"><?php p($l->t('Group Display Name Field'));?></label><input type="text" id="ldap_group_display_name" name="ldap_group_display_name" data-default="<?php p($_['ldap_group_display_name_default']); ?>" title="<?php p($l->t('The LDAP attribute to use to generate the groups`s ownCloud name.'));?>" /></p>
<p><label for="ldap_base_groups"><?php p($l->t('Base Group Tree'));?></label><textarea id="ldap_base_groups" name="ldap_base_groups" placeholder="<?php p($l->t('One Group Base DN per line'));?>" data-default="<?php p($_['ldap_base_groups_default']); ?>" title="<?php p($l->t('Base Group Tree'));?>"></textarea></p>
<p><label for="ldap_attributes_for_group_search"><?php p($l->t('Group Search Attributes'));?></label><textarea id="ldap_attributes_for_group_search" name="ldap_attributes_for_group_search" placeholder="<?php p($l->t('Optional; one attribute per line'));?>" data-default="<?php p($_['ldap_attributes_for_group_search_default']); ?>" title="<?php p($l->t('Group Search Attributes'));?>"></textarea></p>
- <p><label for="ldap_group_member_assoc_attribute"><?php p($l->t('Group-Member association'));?></label><select id="ldap_group_member_assoc_attribute" name="ldap_group_member_assoc_attribute" data-default="<?php p($_['ldap_group_member_assoc_attribute_default']); ?>" ><option value="uniqueMember"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] == 'uniqueMember')) p(' selected'); ?>>uniqueMember</option><option value="memberUid"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] == 'memberUid')) p(' selected'); ?>>memberUid</option><option value="member"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] == 'member')) p(' selected'); ?>>member (AD)</option></select></p>
+ <p><label for="ldap_group_member_assoc_attribute"><?php p($l->t('Group-Member association'));?></label><select id="ldap_group_member_assoc_attribute" name="ldap_group_member_assoc_attribute" data-default="<?php p($_['ldap_group_member_assoc_attribute_default']); ?>" ><option value="uniqueMember"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'uniqueMember')) p(' selected'); ?>>uniqueMember</option><option value="memberUid"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'memberUid')) p(' selected'); ?>>memberUid</option><option value="member"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'member')) p(' selected'); ?>>member (AD)</option></select></p>
</div>
<h3><?php p($l->t('Special Attributes'));?></h3>
<div>
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 1277e074714..41e2926605e 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -197,9 +197,9 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface {
//if attribute's value is an absolute path take this, otherwise append it to data dir
//check for / at the beginning or pattern c:\ resp. c:/
if(
- '/' == $path[0]
+ '/' === $path[0]
|| (3 < strlen($path) && ctype_alpha($path[0])
- && $path[1] == ':' && ('\\' == $path[2] || '/' == $path[2]))
+ && $path[1] === ':' && ('\\' === $path[2] || '/' === $path[2]))
) {
$homedir = $path;
} else {