ldap = new ldap_im();
$this->db = new db_im();
}
private final function users_auth_im($pName)
{
$array_uids = $this->db->get_accounts_acl();
$count = count($array_uids);
$uids_members = array();
for($i = 0; $i < $count ;$i+=50)
{
$partial_uids = array_slice($array_uids,$i,50);
$filter_uid = implode(")(uidnumber=",$partial_uids);
$filter_uid = "(uidnumber=". $filter_uid. ")";
$result = $this->ldap->list_users_ldap("cn=*".$pName."*", $filter_uid);
if ( is_array($result) )
$uids_members = array_merge($uids_members,$result);
if(count($uids_members) > 50){
unset($_SESSION['phpgw_info']['jabberit_messenger']['photo']);
return 'Many Results';
}
}
if(count($uids_members) > 0)
return $uids_members;
else
return 0;
}
public final function list_contacts($param)
{
$users = $this->users_auth_im($param['name']);
$order = array();
if (!is_array($users) && trim($users) === 'Many Results')
return "Many Results";
if( is_array($users) )
{
foreach($users as $tmp)
{
if ( !array_key_exists($tmp['dn'], $order) )
$order[$tmp['dn']] = array();
//SERPRO
//$order[$tmp['dn']][] = '' . $tmp['cn'] . '' . $tmp['mail'] .'' . $tmp['uid'] . '' . $tmp['photo'] . '';
$order[$tmp['dn']][] = '' . $tmp['cn'] . '' . $tmp['mail'] .'' . $tmp['description'] . '' . $tmp['photo'] . '';
}
ksort($order);
$return = '';
foreach ( $order as $key => $val )
$return .= '<'.$key.'>'.implode('',$val).''.$key.'>';
$return .= '';
}
else
$return = '';
return $return;
}
}
?>