[Svn] r2894 - in trunk/roundcubemail: . program/include program/steps/addressbook

trac at roundcube.net trac at roundcube.net
Sat Aug 29 22:56:00 CEST 2009


Author: alec
Date: 2009-08-29 15:56:00 -0500 (Sat, 29 Aug 2009)
New Revision: 2894

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/include/rcube_ldap.php
   trunk/roundcubemail/program/steps/addressbook/func.inc
   trunk/roundcubemail/program/steps/addressbook/search.inc
Log:
- Fix gn and givenName should be synonymous in LDAP addressbook (#1485892)


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2009-08-29 20:24:03 UTC (rev 2893)
+++ trunk/roundcubemail/CHANGELOG	2009-08-29 20:56:00 UTC (rev 2894)
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Fix gn and givenName should be synonymous in LDAP addressbook (#1485892)
 - Add mail_domain to LDAP email entries without @ sign (#1485201)
 - Fix saving empty values in LDAP contact data (#1485781)
 - Fix LDAP contact update when RDN field is changed (#1485788)

Modified: trunk/roundcubemail/program/include/rcube_ldap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_ldap.php	2009-08-29 20:24:03 UTC (rev 2893)
+++ trunk/roundcubemail/program/include/rcube_ldap.php	2009-08-29 20:56:00 UTC (rev 2894)
@@ -55,8 +55,11 @@
 
     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'];
 
     $this->connect();
@@ -552,7 +555,7 @@
    *
    * @access private
    */
-  function _exec_search()
+  private function _exec_search()
   {
     if ($this->ready)
     {
@@ -569,7 +572,7 @@
   /**
    * @access private
    */
-  function _ldap2result($rec)
+  private function _ldap2result($rec)
   {
     global $RCMAIL;
 
@@ -595,13 +598,30 @@
   /**
    * @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)

Modified: trunk/roundcubemail/program/steps/addressbook/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/addressbook/func.inc	2009-08-29 20:24:03 UTC (rev 2893)
+++ trunk/roundcubemail/program/steps/addressbook/func.inc	2009-08-29 20:56:00 UTC (rev 2894)
@@ -56,7 +56,6 @@
 if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']]))
   $CONTACTS->set_search_set($_SESSION['search'][$_REQUEST['_search']]);
 
-
 // set data source env
 $OUTPUT->set_env('source', $source ? $source : '0');
 $OUTPUT->set_env('readonly', $CONTACTS->readonly, false);

Modified: trunk/roundcubemail/program/steps/addressbook/search.inc
===================================================================
--- trunk/roundcubemail/program/steps/addressbook/search.inc	2009-08-29 20:24:03 UTC (rev 2893)
+++ trunk/roundcubemail/program/steps/addressbook/search.inc	2009-08-29 20:56:00 UTC (rev 2894)
@@ -32,7 +32,7 @@
 {
   // save search settings in session
   $_SESSION['search'][$search_request] = $CONTACTS->get_search_set();
-  
+
   // create javascript list
   rcmail_js_contacts_list($result);
 }

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list