public function LdapQuery::query in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_query/LdapQuery.class.php \LdapQuery::query()
- 7 ldap_query/LdapQuery.class.php \LdapQuery::query()
Function search($base_dn = NULL, $filter, $attributes = array(), $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER) {.
File
- ldap_query/
LdapQuery.class.php, line 106 - Defines server classes and related functions.
Class
- LdapQuery
- LDAP Server Class.
Code
public function query() {
ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServer.class');
$ldap_server = new LdapServer($this->sid);
$ldap_server
->connect();
$ldap_server
->bind();
$results = [];
$count = 0;
foreach ($this->baseDn as $base_dn) {
$result = $ldap_server
->search($base_dn, $this->filter, $this->attributes, 0, $this->sizelimit, $this->timelimit, $this->deref, $this->scope);
if ($result !== FALSE && $result['count'] > 0) {
$count = $count + $result['count'];
$results = array_merge($results, $result);
}
}
$results['count'] = $count;
return $results;
}