Changeset 314 for trunk/contactcenter


Ignore:
Timestamp:
06/17/08 14:41:55 (16 years ago)
Author:
niltonneto
Message:

Verificar Ocorrência #222.

Location:
trunk/contactcenter/inc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/contactcenter/inc/class.bo_global_ldap_catalog.inc.php

    r285 r314  
    133133                        $filter = $this->process_restrictions($rules, $trans_f); 
    134134 
    135                         if(strstr($this->src_info['context'], "ldap://")) { 
    136                                 $refer_context  = str_replace("??base","",preg_replace('!^(ldap://[^/]+)/(.*$)!', '\\2', $this->src_info['context'])); 
    137                                 $host   = preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $this->src_info['context']);                              
    138                                 $this->src_info['host'] = $host; 
    139                         }                        
    140  
    141                         if($refer_context || "ou" === strtolower(substr($this->src_info['context'], 0, 2))) 
    142                         {                
    143                                 $followReferral = false;                         
    144                         } 
    145                         elseif(trim($rules[4]['value']) != "inetOrgPerson")      
     135                        if("ou" === strtolower(substr($this->src_info['context'], 0, 2)) || 
     136                                (trim($rules[4]['value']) != "inetOrgPerson"))   
    146137                        {                        
    147                                 $followReferral = true; 
     138                                $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'], $this->src_info['acc'], $this->src_info['pw'], true); 
     139                                $result_r = ldap_search($ldap , $this->src_info['context'], $filter, $fields, 0); 
    148140                        } 
    149141                        else 
     
    152144                        } 
    153145                         
    154                         $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'], $this->src_info['acc'], $this->src_info['pw'], $followReferral); 
    155                         $result_r = ldap_search($ldap ,($refer_context  ? $refer_context  : $this->src_info['context']), $filter, $fields, 0); 
    156146 
    157147                        if (!$result_r) 
     
    570560                        } 
    571561                         
    572                         $resource = ldap_read($ldap, $id_contact, 'objectClass='.$this->src_info['obj']); 
    573                         $n_entries = ldap_count_entries($ldap, $resource); 
     562                        $resource = @ldap_read($ldap, $id_contact, 'objectClass='.$this->src_info['obj']); 
     563                        $n_entries = @ldap_count_entries($ldap, $resource); 
    574564                        if ( $n_entries > 1 or $n_entries < 1) 
    575565                        { 
  • trunk/contactcenter/inc/class.bo_ldap_manager.inc.php

    r285 r314  
    249249                        } 
    250250                         
    251                         $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->srcs[$id_source]['host'], $this->srcs[$id_source]['acc'],$this->srcs[$id_source]['pw'], false); 
     251                        $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->srcs[$id_source]['host'], $this->srcs[$id_source]['acc'],$this->srcs[$id_source]['pw'], true); 
    252252                        if (!$ldap) 
    253253                        { 
     
    410410                        else  
    411411                                return false; 
     412                         
     413                         
    412414                } 
    413415 
     
    447449                function get_ldap_tree_level($id_source, $resource, $context, $objectClass, $branch_dn, $external = 0) 
    448450                { 
    449                         if(strstr($context, "ldap://")){ 
    450                                 $refer_context = str_replace("??base","",preg_replace('!^(ldap://[^/]+)/(.*$)!', '\\2', $context)); 
    451                                 $host   = preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $context); 
    452                                 $resource = ldap_connect($host); 
    453                                 ldap_bind($resource); 
    454                         } 
    455  
     451                                                 
    456452                        /* 
    457453                         * TODO: Search timeouts 
    458454                         */ 
    459  
    460                         $dn_parts = ldap_explode_dn(($refer_context ? $refer_context : $context),1); 
     455                         
     456                        $dn_parts = ldap_explode_dn($context,1); 
    461457                        //$filter = '(!(objectClass='.$objectClass.'))'; 
    462458                        // Don't show OU's whith phpgwAccountVisible equal to '-1' 
     
    472468                                $filter = '(&(!(objectClass='.$objectClass.')) (!(phpgwAccountVisible=-1)))'; 
    473469                        } 
    474                         $result_res = @ldap_list($resource,  ($refer_context ? $refer_context : $context), $filter, array(), 0, 0); 
     470                        $result_res = @ldap_list($resource,  $context, $filter, array(), 0, 0); 
    475471                        @ldap_sort($resource, $result_res, 'ou'); 
    476  
     472                         
    477473                        // Timeouts commented out 
    478474                        /* 
     
    484480 
    485481                        $count = ldap_count_entries($resource,$result_res); 
    486  
     482                         
    487483                        if ( $count == 0 ) 
    488484                        { 
    489485                                $filter = '(objectClass='.$objectClass.')'; 
    490486                                // Get only one attribute of the source's objectClass 
    491                                 $result_res2 = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, Array('cn'), 0, 1); 
     487                                $result_res2 = @ldap_list($resource, $context, $filter, Array('cn'), 0, 1); 
    492488                                $entries_count = ldap_count_entries($resource, $result_res2); 
    493489 
     
    513509                                } 
    514510                        } 
    515  
     511                         
    516512                        $sub_branch_found = false; 
    517513                        $i = 0; 
     
    531527                                                'name'  => $this->translate_accentuation($dn_parts_1[0]), 
    532528                                                'type'  => 'unknown', 
    533                                                 'value' =>  ($refer_context ? $host."/" : "").$dn, 
     529                                                'value' =>  $dn, 
    534530                                                'sub_branch' => false 
    535531                                        ); 
     
    538534                                $i++; 
    539535                        } 
    540  
    541                         if(! $refer_context) { 
    542                                 $array_referral = $this -> get_ldap_sub_branches_referrals($resource, $context,'(objectClass=organizationalUnit)'); 
    543                                 for($z = 0; $z < count($array_referral); $z++) { 
    544                                         $tree['sub_branch'][$i++] = $array_referral[$z]; 
    545                                 } 
    546                         } 
    547  
     536                                                 
    548537                        $filter = 'objectClass='.$objectClass; 
    549                         $result_res2 = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, Array('cn'), 0, 1); 
     538                        $result_res2 = @ldap_list($resource, $context, $filter, Array('cn'), 0, 1); 
    550539                        $entries_count = ldap_count_entries($resource, $result_res2); 
    551540 
Note: See TracChangeset for help on using the changeset viewer.