Changeset 6138 in subversion
- Timestamp:
- May 2, 2012 4:56:29 PM (13 months ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 2 edited
-
config/main.inc.php.dist (modified) (2 diffs)
-
program/include/rcube_ldap.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/config/main.inc.php.dist
r6095 r6138 581 581 'required_fields' => array('cn', 'sn', 'mail'), 582 582 'search_fields' => array('mail', 'cn'), // fields to search in 583 // Map of contact sub-objects (attribute name => objectClass(es)), e.g. 'c' => 'country'584 'sub_fields' => array(),585 583 // mapping of contact fields to directory attributes 584 // for every attribute one can specify the number of values (limit) allowed. 585 // default is 1, a wildcard * means unlimited 586 586 'fieldmap' => array( 587 // Roundcube => LDAP 587 // Roundcube => LDAP:limit 588 588 'name' => 'cn', 589 589 'surname' => 'sn', 590 590 'firstname' => 'givenName', 591 591 'title' => 'title', 592 'email' => 'mail ',592 'email' => 'mail:*', 593 593 'phone:home' => 'homePhone', 594 594 'phone:work' => 'telephoneNumber', … … 599 599 'region' => 'st', 600 600 'locality' => 'l', 601 // if you uncomment country, you need to modify 'sub_fields' above 602 // 'country'=> 'c',601 // if you country is a complex object, you need to configure 'sub_fields' below 602 'country' => 'c', 603 603 'organization' => 'o', 604 'department' => 'departmentNumber', 605 'notes' => 'description', 606 // these currently don't work: 607 // 'phone:workfax' => 'facsimileTelephoneNumber', 608 // 'photo' => 'jpegPhoto', 609 // 'manager' => 'manager', 610 // 'assistant' => 'secretary', 604 'department' => 'ou', 605 'jobtitle' => 'title', 606 'notes' => 'description', 607 // these currently don't work: 608 // 'phone:workfax' => 'facsimileTelephoneNumber', 609 // 'photo' => 'jpegPhoto', 610 // 'manager' => 'manager', 611 // 'assistant' => 'secretary', 611 612 ), 613 // Map of contact sub-objects (attribute name => objectClass(es)), e.g. 'c' => 'country' 614 'sub_fields' => array(), 612 615 'sort' => 'cn', // The field to sort the listing by. 613 616 'scope' => 'sub', // search mode: sub|base|list -
trunk/roundcubemail/program/include/rcube_ldap.php
r6092 r6138 103 103 104 104 // use fieldmap to advertise supported coltypes to the application 105 foreach ($this->fieldmap as $col => $lf) { 106 list($col, $type) = explode(':', $col); 105 foreach ($this->fieldmap as $colv => $lfv) { 106 list($col, $type) = explode(':', $colv); 107 list($lf, $limit, $delim) = explode(':', $lfv); 108 109 if ($limit == '*') $limit = null; 110 else $limit = max(1, intval($limit)); 111 107 112 if (!is_array($this->coltypes[$col])) { 108 113 $subtypes = $type ? array($type) : null; 109 $this->coltypes[$col] = array('limit' => 1, 'subtypes' => $subtypes);114 $this->coltypes[$col] = array('limit' => $limit, 'subtypes' => $subtypes); 110 115 } 111 116 elseif ($type) { 112 117 $this->coltypes[$col]['subtypes'][] = $type; 113 $this->coltypes[$col]['limit']++; 114 } 118 $this->coltypes[$col]['limit'] += $limit; 119 } 120 121 if ($delim) 122 $this->coltypes[$col]['serialized'][$type] = $delim; 123 115 124 if ($type && !$this->fieldmap[$col]) 116 $this->fieldmap[$col] = $lf; 125 $this->fieldmap[$col] = $lf; 126 127 $this->fieldmap[$colv] = $lf; 117 128 } 118 129 119 130 // support for composite address 120 131 if ($this->fieldmap['street'] && $this->fieldmap['locality']) { 121 $this->coltypes['address'] = array('limit' => max(1, $this->coltypes['locality']['limit']), 'subtypes' => $this->coltypes['locality']['subtypes'], 'childs' => array()); 132 $this->coltypes['address'] = array( 133 'limit' => max(1, $this->coltypes['locality']['limit'] + $this->coltypes['address']['limit']), 134 'subtypes' => array_merge((array)$this->coltypes['address']['subtypes'], $this->coltypes['locality']['subtypes']), 135 'childs' => array(), 136 ) + (array)$this->coltypes['address']; 137 122 138 foreach (array('street','locality','zipcode','region','country') as $childcol) { 123 139 if ($this->fieldmap[$childcol]) { … … 1182 1198 } // end if 1183 1199 } // end foreach 1184 /* 1185 console($old_data); 1186 console($ldap_data); 1187 console('----'); 1188 console($newdata); 1189 console($replacedata); 1190 console($deletedata); 1191 console('----'); 1192 console($subdata); 1193 console($subnewdata); 1194 console($subdeldata); 1195 */ 1200 1201 // console($old_data, $ldap_data, '----', $newdata, $replacedata, $deletedata, '----', $subdata, $subnewdata, $subdeldata); 1202 1196 1203 $dn = self::dn_decode($id); 1197 1204 … … 1481 1488 else if (in_array($col, array('street','zipcode','locality','country','region'))) 1482 1489 $out['address'.($subtype?':':'').$subtype][$i][$col] = $value; 1490 else if ($col == 'address' && strpos($value, '$') !== false) // address data is represented as string separated with $ 1491 list($out[$rf][$i]['street'], $out[$rf][$i]['locality'], $out[$rf][$i]['zipcode'], $out[$rf][$i]['country']) = explode('$', $value); 1483 1492 else if ($rec[$lf]['count'] > 1) 1484 1493 $out[$rf][] = $value; … … 1523 1532 } 1524 1533 } 1534 1535 // if addresses are to be saved as serialized string, do so 1536 if (is_array($colprop['serialized'])) { 1537 foreach ($colprop['serialized'] as $subtype => $delim) { 1538 $key = $col.':'.$subtype; 1539 foreach ((array)$save_cols[$key] as $i => $val) 1540 $save_cols[$key][$i] = join($delim, array($val['street'], $val['locality'], $val['zipcode'], $val['country'])); 1541 } 1542 } 1525 1543 } 1526 1544 … … 1543 1561 * Returns unified attribute name (resolving aliases) 1544 1562 */ 1545 private static function _attr_name($name )1563 private static function _attr_name($namev) 1546 1564 { 1547 1565 // list of known attribute aliases 1548 $aliases = array(1566 static $aliases = array( 1549 1567 'gn' => 'givenname', 1550 1568 'rfc822mailbox' => 'email', … … 1553 1571 'pkcs9email' => 'email', 1554 1572 ); 1555 return isset($aliases[$name]) ? $aliases[$name] : $name; 1573 1574 list($name, $limit) = explode(':', $namev, 2); 1575 $suffix = $limit ? ':'.$limit : ''; 1576 1577 return (isset($aliases[$name]) ? $aliases[$name] : $name) . $suffix; 1556 1578 } 1557 1579
Note: See TracChangeset
for help on using the changeset viewer.
