Ignore:
Timestamp:
07/27/09 14:04:22 (15 years ago)
Author:
niltonneto
Message:

Ticket #586 - Correções para adaptar template e funcionar com API 2.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/jabberit_messenger/inc/class.ldap_im.inc.php

    r988 r1198  
    2222        private $ldap; 
    2323        private $ldap_context; 
    24         private $ldap_dn; 
     24        private $ldap_user; 
    2525        private $ldap_host; 
    2626        private $ldap_org; 
     
    5252                $GLOBALS['phpgw_info']['server']['ldap_version3'] = true; 
    5353 
    54                 $this->ldap = $this->common->ldapConnect( $this->ldap_host, $this->ldap_dn, $this->ldap_pass, false ); 
     54                $this->ldap = $this->common->ldapConnect( $this->ldap_host, $this->ldap_user . "," . $this->ldap_context , $this->ldap_pass, false ); 
    5555        } 
    5656         
     
    5959                $this->ldap_host        = (isset($_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_host']; 
    6060                $this->ldap_context     = (isset($_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_context']; 
    61                 $this->ldap_dn          = (isset($_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 
     61                $this->ldap_user        = (isset($_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 
    6262                $this->ldap_pass        = (isset($_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 
    6363 
     
    8383 
    8484                // Bind as Admin 
    85                 if($this->ldap_dn && $this->ldap_pass && !ldap_bind($conn, $this->ldap_dn, $this->ldap_pass)) 
     85                if($this->ldap_user && $this->ldap_pass && !ldap_bind($conn, $this->ldap_user . "," .$this->ldap_context, $this->ldap_pass)) 
    8686                        return false; 
    8787                 
    8888                // Bind as Anonymous 
    89                 if(!$this->ldap_dn && !$this->ldap_pass && !@ldap_bind($conn)) 
    90                         return false; 
    91                          
     89                if(!$this->ldap_user && !$this->ldap_pass && !@ldap_bind($conn)) 
     90                        return false; 
     91 
    9292                return $conn; 
    9393        } 
     
    9696        { 
    9797                $this->ldapRoot(); 
    98  
    99                 if( $this->ldap )        
     98                $result_groups = ""; 
     99 
     100                if( $this->ldap && $pOrg['ou'] != "-1")  
    100101                { 
    101102                        $organization = 'ou=' . $pOrg['ou'] .",". $this->ldap_context; 
     
    114115                                $result_groups .= "</ldap>";                                             
    115116                        } 
    116                 } 
    117  
     117                         
     118                        return $result_groups; 
     119                } 
     120                 
    118121                return $result_groups; 
    119122        } 
     
    140143        { 
    141144                $this->ldapRoot(); 
    142          
     145                 
    143146                if( $this->ldap ) 
    144147                { 
     
    168171                        $this->ldap_host        = $confHosts[$i]['serverLdap']; 
    169172                        $this->ldap_context = $confHosts[$i]['contextLdap']; 
    170                         $this->ldap_dn          = $confHosts[$i]['user']; 
     173                        $this->ldap_user        = $confHosts[$i]['user']; 
    171174                        $this->ldap_org         = $confHosts[$i]['org']; 
    172175                        $this->ldap_pass        = $confHosts[$i]['password']; 
     
    179182                                $justthese = array("uid","uidNumber","cn","mail","phpgwAccountVisible","dn","jpegPhoto");                                                                
    180183                                $searchRoot = ( $this->ldap_org != "*" ) ? "ou=".$this->ldap_org.",".$this->ldap_context : $this->ldap_context; 
     184                                 
    181185                                $search1 = @ldap_search($conn, $searchRoot, $filter, $justthese, 0, $this->max_result + 1); 
    182186                                $entry1 = @ldap_get_entries( $conn, $search1 ); 
    183187                                $result = $this->resultArray($entry1, $conn ); 
    184  
     188                                 
    185189                                if( count($return) > 0 ) 
    186190                                $return = array_merge($return, $result); 
Note: See TracChangeset for help on using the changeset viewer.