Ignore:
Timestamp:
12/29/09 15:03:07 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #808 - Busca implementada utilizando somente os grupos cadastrados.

Location:
trunk/jabberit_messenger/inc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/jabberit_messenger/inc/class.contacts_im.inc.php

    r1900 r1911  
    201201        if( !$this->groupsLocked() ) 
    202202        { 
    203                         $array_uids_external = array(); 
    204  
    205203                        unset($serversLdap[$this->serverLdap]); 
    206204 
     
    209207                                foreach( $serversLdap as $key => $tmp ) 
    210208                                { 
     209                                        $array_uids_external = array( ); 
    211210                                        $groupsExternal = unserialize($tmp); 
    212211 
     
    217216                                                        $group = explode(":",$tmpExt); 
    218217                                                        $array_result = $this->ldap->getGroupsMemberUid( $group[0], $key ); 
    219                                                         @array_shift($array_result[0]['memberuid']); 
    220                                                         $array_uids_external = @array_merge($array_uids_external, $array_result[0]['memberuid']); 
    221                                                         unset($array_result); 
     218                                                         
     219                                                        if( $array_result[0]['memberuid']['count'] ) 
     220                                                                unset($array_result[0]['memberuid']['count']); 
     221 
     222                                                        $array_uids_external = array_merge($array_uids_external, $array_result[0]['memberuid']); 
    222223                                                } 
    223224                                                 
    224                                                 for( $i = 0; $i < count( $array_uids_external ) ; $i+=50 ) 
    225                                         {    
    226                                         $partial_uids_external  = array_slice($array_uids_external,$i,50); 
    227                                         $filter_uid_external    = implode(")(uid=",$partial_uids_external); 
    228                                         $filter_uid_external    = "(uid=". $filter_uid_external. ")"; 
    229                                         $result[] = $this->ldap->getUsersLdapCatalog("cn=*".$pName."*", $filter_uid_external, $key ); 
    230                                         } 
    231                                         unset($array_uids_external); 
    232                                         } 
    233                                          
    234                                 } 
    235                         } 
    236                          
     225                                                 
     226                                                if( is_array($array_uids_external) ) 
     227                                                { 
     228                                                        for( $i = 0; $i < count( $array_uids_external ) ; $i+=50 ) 
     229                                                {    
     230                                                $partial_uids_external  = array_slice($array_uids_external,$i,50); 
     231                                                $filter_uid_external    = implode(")(uid=",$partial_uids_external); 
     232                                                $filter_uid_external    = "(uid=". $filter_uid_external. ")"; 
     233                                                $result[] = $this->ldap->getUsersLdapCatalog("cn=*".$pName."*", $filter_uid_external, $key ); 
     234                                                } 
     235                                        } 
     236                                        } 
     237                                } 
     238                        } 
     239 
    237240                        if( count($this->hostsJabberLdap) ) 
    238241                        { 
  • trunk/jabberit_messenger/inc/class.ldap_im.inc.php

    r1900 r1911  
    195195                                        @ldap_close($this->ldap); 
    196196                                         
    197                                 if( $pLdap == $confHosts[$i]['serverLdap'] ) 
     197                                if( trim($pLdap) === trim($confHosts[$i]['serverLdap']) ) 
    198198                                { 
    199199                                        $this->ldap_host        = $confHosts[$i]['serverLdap']; 
     
    202202                                        $this->ldap_org         = $confHosts[$i]['org']; 
    203203                                        $this->ldap_pass        = $confHosts[$i]['password']; 
    204                                  
    205204                                        $this->ldap = $this->ldapCatalog(); 
    206205                                         
     
    212211                                                $result = ldap_get_entries($this->ldap,$search); 
    213212                                        } 
     213                                         
    214214                                } 
    215215                        } 
     
    310310                for( $i = 0; $i < count($confHosts); $i++ ) 
    311311                { 
    312                         if( $this->ldap ) 
    313                                 @ldap_close($this->ldap); 
    314                          
    315312                        if( $pLdap && $pLdap == $confHosts[$i]['serverLdap'] ) 
    316313                        { 
     
    321318                                $this->ldap_pass        = $confHosts[$i]['password']; 
    322319                                $this->ldap             = $this->ldapCatalog(); 
    323                         } 
    324                         else 
    325                         { 
    326                                 $this->ldap_host        = $confHosts[$i]['serverLdap']; 
    327                                 $this->ldap_context = $confHosts[$i]['contextLdap']; 
    328                                 $this->ldap_user        = $confHosts[$i]['user']; 
    329                                 $this->ldap_org         = $confHosts[$i]['org']; 
    330                                 $this->ldap_pass        = $confHosts[$i]['password']; 
    331                                 $this->ldap             = $this->ldapCatalog(); 
    332                         }        
    333  
    334                         if( $this->ldap ) 
    335                         { 
    336                                 $filter         = ( $uid ) ? "(&(phpgwaccounttype=u)(|".$uid.")(".$search ."))" : "(&(phpgwaccounttype=u)(".$search ."))"; 
    337                                 $justthese      = array( $this->attribute ,"uidNumber" ,"cn" ,"mail" ,"phpgwAccountVisible" ,"dn" ,"jpegPhoto" );                                                                
    338                                 $searchRoot     = ( $this->ldap_org != "*" ) ? "ou=".$this->ldap_org.",".$this->ldap_context : $this->ldap_context; 
    339                                 $search1        = @ldap_search($this->ldap, $searchRoot, $filter, $justthese, 0, $this->max_result + 1); 
    340                                 $entry1         = @ldap_get_entries( $this->ldap, $search1 ); 
    341                                 $result         = $this->resultArray( $entry1, $this->ldap, $this->ldap_org ); 
    342  
    343                                 if( count($return) > 0 ) 
    344                                 $return = array_merge($return, $result); 
    345                                 else 
    346                                         $return = $result;                               
     320 
     321                                if( $this->ldap ) 
     322                                { 
     323                                        $filter         = ( $uid ) ? "(&(phpgwaccounttype=u)(|".$uid.")(".$search ."))" : "(&(phpgwaccounttype=u)(".$search ."))"; 
     324                                        $justthese      = array( $this->attribute ,"uidNumber" ,"cn" ,"mail" ,"phpgwAccountVisible" ,"dn" ,"jpegPhoto" );                                                                
     325                                        $searchRoot     = ( $this->ldap_org != "*" ) ? "ou=".$this->ldap_org.",".$this->ldap_context : $this->ldap_context; 
     326                                        $search1        = @ldap_search($this->ldap, $searchRoot, $filter, $justthese, 0, $this->max_result + 1); 
     327                                        $entry1         = @ldap_get_entries( $this->ldap, $search1 ); 
     328                                        $result         = $this->resultArray( $entry1, $this->ldap, $this->ldap_org ); 
     329         
     330                                        if( count($return) > 0 ) 
     331                                        $return = array_merge($return, $result); 
     332                                        else 
     333                                                $return = $result;                               
     334                                } 
     335                                 
     336                                if( $this->ldap ) 
     337                                        ldap_close($this->ldap); 
    347338                        } 
    348339                } 
Note: See TracChangeset for help on using the changeset viewer.