[Tickets #2529] Problems with "cn", "name" and ldap (patch)
bugs@bugs.horde.org
bugs at bugs.horde.org
Tue Aug 30 03:36:26 PDT 2005
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: http://bugs.horde.org/ticket/?id=2529
-----------------------------------------------------------------------
Ticket | 2529
Updated By | horde at olen.net
Summary | Problems with "cn", "name" and ldap (patch)
Queue | Turba
Version | FRAMEWORK_3
State | Unconfirmed
Priority | 1. Low
Type | Bug
Owners |
-----------------------------------------------------------------------
horde at olen.net (2005-08-30 03:36) wrote:
Another patch to Driver.php to make sure we can import addresses from imp,
even when "name" is set as staed above.
--- turba/lib/Driver.php.orig 2005-08-30 11:09:44.000000000 +0200
+++ turba/lib/Driver.php 2005-08-30 12:33:41.000000000 +0200
@@ -141,8 +141,38 @@
{
$fields = array();
foreach ($hash as $key => $val) {
- if (isset($this->map[$key]) && !is_array($this->map[$key])) {
- $fields[$this->map[$key]] = $val;
+ if (isset($this->map[$key])) {
+ if (!is_array($this->map[$key])) {
+ $fields[$this->map[$key]] = $val;
+ }
+ else {
+ $map = $this->map[$key];
+
+ $mapfields = $map['fields'];
+ $mapformat = $map['format'];
+ $values = sscanf($val, $mapformat);
+ // To make sure we get ALL values, even if the format
does not specify
+ // enough arguments...
+ if (vsprintf($mapformat, $values) != $val) {
+ $format .= " %[^[]]";
+ $values = sscanf($val, $format);
+ }
+ // Now this is ugly! BUT...
+ // I believe this is mos widely used for names, and to
make sure
+ // Firstname Middlename Lastname is parsed correctly
(with
+ // Middlename as part of Givenname, I had to do it this
way.
+ // IE. map from the end of the array.
+ // Should this be made configureable?
+ while ($field = array_pop($mapfields)) {
+ if ($mapfields[0]) {
+ $value = array_pop($values);
+ }
+ else {
+ $value = join(" ", $values);
+ }
+ $fields[$this->map[$field]] = $value;
+ }
+ }
}
}
return $fields;
More information about the bugs
mailing list