Hi all,
first I would like to thank you for this beautiful webmail program. I tried it two days ago and decided to replace my squirrelmail installation with it.
The only thing which didn't work as supposed for me was the LDAP directory search. In my LDAP directory a lot off user have multiple mail attributes. So if I look for one, the LDAP search returns all addresses. These are stored as an array in $result[$n][$server['mail_field'] but only the first one is used when generating the $contacts array.
Let's say I am looking for every address with contains 'example' and I have a user John Doe who has the following email addresses:
john@doe.com john@example.com john@example.net
The LDAP search will find the user, but only the first email address john@doe.com will be displayed.
I changed the ldapsearchform.inc on two places:
I hope you can integrate this patch as it doesn't change the functionality of the search, if every user in the directory has only one mail attribute.
Best regards, Drazen Baic
--- ldapsearchform.inc (revision 261) +++ ldapsearchform.inc (working copy) @@ -221,9 +221,12 @@ { for ($n = 0; $n < $result['count']; $n++) {
$contacts[$n]['name'] = $result[$n][$server['name_field']]
[0];
$contacts[$n]['email'] = $result[$n][$server['mail_field']]
[0];
$contacts[$n]['row_id'] = $n + 1;
for ($m = 0; $m < count($result[$n][$server
['mail_field']])-1; $m++)
{
$contacts[$n+$m]['name'] = $result[$n][$server
['name_field']][0];
$contacts[$n+$m]['email'] = $result[$n][$server
['mail_field']][$m];
$contacts[$n+$m]['row_id'] = $n + $m + 1;
}
}
}
}
@@ -242,6 +245,23 @@
if ($contacts[$i]['email'] == $contacts[$n]['email'] && $i !=
$n)
unset($contacts[$n]);
returns
looks
{
if (ereg($search_value, $temp['email']))
{
$tempcontacts[$counter] = $temp;
$counter++;
}
}
$contacts = $tempcontacts;