public function searchAllBaseDns(
    $filter,
    $attributes = array(),
    $attrsonly = 0,
    $sizelimit = 0,
    $timelimit = 0,
    $deref = NULL,
    $scope = LDAP_SCOPE_SUBTREE
    ) {
    $all_entries = array();
    foreach ($this->basedn as $base_dn) {  // need to search on all basedns one at a time
      $entries = $this->search($base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref, $scope);  // no attributes, just dns needed
      if ($entries === FALSE) { // if error in any search, return false
        return FALSE;
      }
      if (count($all_entries) == 0) {
        $all_entries = $entries;
        unset($all_entries['count']);
      }
      else {
        $existing_count = count($all_entries);
        unset($entries['count']);
        foreach ($entries as $i => $entry) {
          $all_entries[$existing_count + $i] = $entry;
        }
      }
    }
    $all_entries['count'] = count($all_entries);
    return $all_entries;

  }
public function searchAllBaseDns(
    $filter,
    $attributes = array(),
    $attrsonly = 0,
    $sizelimit = 0,
    $timelimit = 0,
    $deref = NULL,
    $scope = LDAP_SCOPE_SUBTREE
    ) {
    $all_entries = array();
    foreach ($this->basedn as $base_dn) {  // need to search on all basedns one at a time
      $entries = $this->search($base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref, $scope);  // no attributes, just dns needed
      if ($entries === FALSE) { // if error in any search, return false
        return FALSE;
      }
      if (count($all_entries) == 0) {
        $all_entries = $entries;
        unset($all_entries['count']);
      }
      else {
        $existing_count = count($all_entries);
        unset($entries['count']);
        foreach ($entries as $i => $entry) {
          $all_entries[$existing_count + $i] = $entry;
        }
      }
    }
    $all_entries['count'] = count($all_entries);
    return $all_entries;

  }
public function searchAllBaseDns ( $ filter , $ attributes = array ( ) , $ attrsonly = 0 , $ sizelimit = 0 , $ timelimit = 0 , $ deref = NULL , $ scope = LDAP_SCOPE_SUBTREE ) { $ all_entries = array ( ) ; foreach ( $ this -> basedn as $ base_dn ) { // need to search on all basedns one at a time $ entries = $ this -> search ( $ base_dn , $ filter , $ attributes , $ attrsonly , $ sizelimit , $ timelimit , $ deref , $ scope ) ; // no attributes, just dns needed if ( $ entries === FALSE ) { // if error in any search, return false return FALSE ; } if ( count ( $ all_entries ) == 0 ) { $ all_entries = $ entries ; unset ( $ all_entries [ 'count' ] ) ; } else { $ existing_count = count ( $ all_entries ) ; unset ( $ entries [ 'count' ] ) ; foreach ( $ entries as $ i => $ entry ) { $ all_entries [ $ existing_count + $ i ] = $ entry ; } } } $ all_entries [ 'count' ] = count ( $ all_entries ) ; return $ all_entries ; }
Perform an LDAP search on all base dns and aggregate into one result

@param string $filter
The search filter. such as sAMAccountName=jbarclay.  attribute values (e.g. jbarclay) should be esacaped before calling

@param array $attributes
List of desired attributes. If omitted, we only return "dn".

@remaining params mimick ldap_search() function params

@return
An array of matching entries->attributes (will have 0
elements if search returns no results),
or FALSE on error on any of the basedn queries
Perform an LDAP search on all base dns and aggregate into one result