summaryrefslogtreecommitdiff
path: root/program/include/rcube_ldap.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-08-29 20:56:00 +0000
committeralecpl <alec@alec.pl>2009-08-29 20:56:00 +0000
commit4368a079f5f88e92e18c5366e80126fe35dc8608 (patch)
tree2769b950d7304c81e1ee984b411ae503c040c3a7 /program/include/rcube_ldap.php
parent08ff050efc63045d7c3bd54a35add68c3f90ada2 (diff)
- Fix gn and givenName should be synonymous in LDAP addressbook (#1485892)
Diffstat (limited to 'program/include/rcube_ldap.php')
-rw-r--r--program/include/rcube_ldap.php28
1 files changed, 24 insertions, 4 deletions
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index e73508670..71476ced7 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -55,7 +55,10 @@ class rcube_ldap extends rcube_addressbook
foreach ($p as $prop => $value)
if (preg_match('/^(.+)_field$/', $prop, $matches))
- $this->fieldmap[$matches[1]] = strtolower($value);
+ $this->fieldmap[$matches[1]] = $this->_attr_name(strtolower($value));
+
+ foreach ($this->prop['required_fields'] as $key => $val)
+ $this->prop['required_fields'][$key] = $this->_attr_name(strtolower($val));
$this->sort_col = $p['sort'];
@@ -552,7 +555,7 @@ class rcube_ldap extends rcube_addressbook
*
* @access private
*/
- function _exec_search()
+ private function _exec_search()
{
if ($this->ready)
{
@@ -569,7 +572,7 @@ class rcube_ldap extends rcube_addressbook
/**
* @access private
*/
- function _ldap2result($rec)
+ private function _ldap2result($rec)
{
global $RCMAIL;
@@ -595,13 +598,30 @@ class rcube_ldap extends rcube_addressbook
/**
* @access private
*/
- function _map_field($field)
+ private function _map_field($field)
{
return $this->fieldmap[$field];
}
/**
+ * @access private
+ */
+ private function _attr_name($name)
+ {
+ // list of known attribute aliases
+ $aliases = array(
+ 'gn' => 'givenname',
+ 'rfc822mailbox' => 'mail',
+ 'userid' => 'uid',
+ 'emailaddress' => 'email',
+ 'pkcs9email' => 'email',
+ );
+ return isset($aliases[$name]) ? $aliases[$name] : $name;
+ }
+
+
+ /**
* @static
*/
function quote_string($str)