API16:JLDAP/search
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Perform an LDAP search
Syntax
search($filters, $dnoverride=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $filters | Search Filters (array of strings) | |
| $dnoverride | null | DN Override |
Returns
array Multidimensional array of results public
Defined in
libraries/joomla/client/ldap.php
Importing
jimport( 'joomla.client.ldap' );
Source Body
function search($filters, $dnoverride = null) { $attributes = array (); if ($dnoverride) { $dn = $dnoverride; } else { $dn = $this->base_dn; } $resource = $this->_resource; foreach ($filters as $search_filter) { $search_result = @ldap_search($resource, $dn, $search_filter); if ($search_result && ($count = @ldap_count_entries($resource, $search_result)) > 0) { for ($i = 0; $i < $count; $i++) { $attributes[$i] = Array (); if (!$i) { $firstentry = @ldap_first_entry($resource, $search_result); } else { $firstentry = @ldap_next_entry($resource, $firstentry); } $attributes_array = @ldap_get_attributes($resource, $firstentry); // load user-specified attributes // ldap returns an array of arrays, fit this into attributes result array foreach ($attributes_array as $ki => $ai) { if (is_array($ai)) { $subcount = $ai['count']; $attributes[$i][$ki] = Array (); for ($k = 0; $k < $subcount; $k++) { $attributes[$i][$ki][$k] = $ai[$k]; } } } $attributes[$i]['dn'] = @ldap_get_dn($resource, $firstentry); } } } return $attributes; }
[Edit See Also] SeeAlso:JLDAP/search
Examples
<CodeExamplesForm />
