Changeset e44e5cc in github
- Timestamp:
- May 8, 2012 6:12:13 AM (13 months ago)
- Branches:
- release-0.8
- Children:
- 60d9c79
- Parents:
- 89fc59d
- git-author:
- thomascube <thomas@…> (05/02/12 16:56:29)
- git-committer:
- Aleksander Machniak <alec@…> (05/08/12 06:12:13)
- Files:
-
- 2 edited
-
config/main.inc.php.dist (modified) (2 diffs)
-
program/include/rcube_ldap.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
config/main.inc.php.dist
r463ec6b re44e5cc 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', … … 610 610 // 'assistant' => 'secretary', 611 611 ), 612 // Map of contact sub-objects (attribute name => objectClass(es)), e.g. 'c' => 'country' 613 'sub_fields' => array(), 612 614 'sort' => 'cn', // The field to sort the listing by. 613 615 'scope' => 'sub', // search mode: sub|base|list -
program/include/rcube_ldap.php
r9336ba2 re44e5cc 104 104 105 105 // use fieldmap to advertise supported coltypes to the application 106 foreach ($this->fieldmap as $col => $lf) { 107 list($col, $type) = explode(':', $col); 106 foreach ($this->fieldmap as $colv => $lfv) { 107 list($col, $type) = explode(':', $colv); 108 list($lf, $limit, $delim) = explode(':', $lfv); 109 110 if ($limit == '*') $limit = null; 111 else $limit = max(1, intval($limit)); 112 108 113 if (!is_array($this->coltypes[$col])) { 109 114 $subtypes = $type ? array($type) : null; 110 $this->coltypes[$col] = array('limit' => 1, 'subtypes' => $subtypes);115 $this->coltypes[$col] = array('limit' => $limit, 'subtypes' => $subtypes); 111 116 } 112 117 elseif ($type) { 113 118 $this->coltypes[$col]['subtypes'][] = $type; 114 $this->coltypes[$col]['limit']++; 115 } 119 $this->coltypes[$col]['limit'] += $limit; 120 } 121 122 if ($delim) 123 $this->coltypes[$col]['serialized'][$type] = $delim; 124 116 125 if ($type && !$this->fieldmap[$col]) 117 $this->fieldmap[$col] = $lf; 126 $this->fieldmap[$col] = $lf; 127 128 $this->fieldmap[$colv] = $lf; 118 129 } 119 130 120 131 // support for composite address 121 132 if ($this->fieldmap['street'] && $this->fieldmap['locality']) { 122 $this->coltypes['address'] = array('limit' => max(1, $this->coltypes['locality']['limit']), 'subtypes' => $this->coltypes['locality']['subtypes'], 'childs' => array()); 133 $this->coltypes['address'] = array( 134 'limit' => max(1, $this->coltypes['locality']['limit'] + $this->coltypes['address']['limit']), 135 'subtypes' => array_merge((array)$this->coltypes['address']['subtypes'], $this->coltypes['locality']['subtypes']), 136 'childs' => array(), 137 ) + (array)$this->coltypes['address']; 138 123 139 foreach (array('street','locality','zipcode','region','country') as $childcol) { 124 140 if ($this->fieldmap[$childcol]) { … … 1183 1199 } // end if 1184 1200 } // end foreach 1185 /* 1186 console($old_data); 1187 console($ldap_data); 1188 console('----'); 1189 console($newdata); 1190 console($replacedata); 1191 console($deletedata); 1192 console('----'); 1193 console($subdata); 1194 console($subnewdata); 1195 console($subdeldata); 1196 */ 1201 1202 // console($old_data, $ldap_data, '----', $newdata, $replacedata, $deletedata, '----', $subdata, $subnewdata, $subdeldata); 1203 1197 1204 $dn = self::dn_decode($id); 1198 1205 … … 1482 1489 else if (in_array($col, array('street','zipcode','locality','country','region'))) 1483 1490 $out['address'.($subtype?':':'').$subtype][$i][$col] = $value; 1491 else if ($col == 'address' && strpos($value, '$') !== false) // address data is represented as string separated with $ 1492 list($out[$rf][$i]['street'], $out[$rf][$i]['locality'], $out[$rf][$i]['zipcode'], $out[$rf][$i]['country']) = explode('$', $value); 1484 1493 else if ($rec[$lf]['count'] > 1) 1485 1494 $out[$rf][] = $value; … … 1524 1533 } 1525 1534 } 1535 1536 // if addresses are to be saved as serialized string, do so 1537 if (is_array($colprop['serialized'])) { 1538 foreach ($colprop['serialized'] as $subtype => $delim) { 1539 $key = $col.':'.$subtype; 1540 foreach ((array)$save_cols[$key] as $i => $val) 1541 $save_cols[$key][$i] = join($delim, array($val['street'], $val['locality'], $val['zipcode'], $val['country'])); 1542 } 1543 } 1526 1544 } 1527 1545 … … 1544 1562 * Returns unified attribute name (resolving aliases) 1545 1563 */ 1546 private static function _attr_name($name )1564 private static function _attr_name($namev) 1547 1565 { 1548 1566 // list of known attribute aliases 1549 $aliases = array(1567 static $aliases = array( 1550 1568 'gn' => 'givenname', 1551 1569 'rfc822mailbox' => 'email', … … 1554 1572 'pkcs9email' => 'email', 1555 1573 ); 1556 return isset($aliases[$name]) ? $aliases[$name] : $name; 1574 1575 list($name, $limit) = explode(':', $namev, 2); 1576 $suffix = $limit ? ':'.$limit : ''; 1577 1578 return (isset($aliases[$name]) ? $aliases[$name] : $name) . $suffix; 1557 1579 } 1558 1580
Note: See TracChangeset
for help on using the changeset viewer.
