function autocomplete_search() { $stringtofind = trim($_GET["q"]) . "*"; $stringtofind = str_replace("**", "*", $stringtofind); $ldap = new clladp(); $EnableOpenLDAP = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableOpenLDAP")); $IsKerbAuth = $ldap->IsKerbAuth(); if ($IsKerbAuth == 0) { if ($EnableOpenLDAP == 1) { $MAIN_HASH = $ldap->GroupsSearch($stringtofind, 50); } } else { include_once dirname(__FILE__) . "/ressources/class.external.ad.inc"; $ad = new external_ad_search(); $MAIN_HASH = $ad->GroupsSearch(null, $stringtofind, 50); } if (is_array($MAIN_HASH)) { while (list($dn, $displayname) = each($MAIN_HASH)) { if (strpos($dn, "dc=pureftpd,dc=organizations") > 0) { continue; } $f[] = "{$displayname}"; } } echo json_encode($f); }