Ignore:
Timestamp:
10/09/09 09:34:25 (15 years ago)
Author:
alexandrecorreia
Message:

Ticket #680 - Revertida as modificacoes para autenticacao do Modulo IM.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/jabberit_messenger/inc/webservice.php

    r1502 r1504  
    3131                        $handle   = unserialize(base64_decode($LDAP_INTERNAL)); 
    3232         
    33                         $this->jabberName               = $handle['jabberName']; 
    34                         $this->serverLdap               = $handle['serverLdap']; 
     33                        $this->jabberName       = $handle['jabberName']; 
     34                        $this->serverLdap       = $handle['serverLdap']; 
    3535                        $this->contextLdap      = $handle['contextLdap']; 
    3636                        $this->userLDAP         = $handle['user']; 
    37                         $this->passwd                   = $handle['password']; 
     37                        $this->passwd           = $handle['password']; 
    3838                         
    3939                        $this->refer    = true; 
     
    170170                 
    171171                if( $this->jabberName == (substr($pJid, strpos($pJid, "@") + 1 ))) 
     172                { 
    172173                        $this->ldapConnect(); 
     174 
     175                        if( $this->fileLdapInternal ) 
     176                        { 
     177                                if( $this->conn ) 
     178                                { 
     179                                        $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
     180                                        $justthese = array("uid","cn","dn"); 
     181                                        $search = ldap_search( $this->conn, $this->contextLdap, $filter,$justthese); 
     182                                        $get_entries = ldap_get_entries( $this->conn, $search); 
     183                 
     184                                        if( $get_entries['count'] > 0 ) 
     185                                        {                                        
     186                                                $cn = $get_entries[0]['cn'][0]; 
     187                                                $ou = explode("dc=", $get_entries[0]['dn']); 
     188                                                $ou = explode("ou=",$ou[0]); 
     189                                                $ou = array_pop($ou); 
     190                                                $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 
     191                                                $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 
     192                                        } 
     193                                } 
     194                        } 
     195                } 
    173196                else 
     197                { 
    174198                        $this->ldapConnectExternal(substr($pJid, strpos($pJid, "@") + 1 )); 
    175  
    176                 if( $this->conn ) 
    177                 { 
    178                         // Verificando atributo que a organização utiliza para autenticar no servidor jabber 
    179                         switch ($_SESSION['phpgw_info']['jabberit_messenger']['user_org_att']) 
    180                         { 
    181                                 case 'description': 
    182                                         $filter = "(&(phpgwaccounttype=u)(description=".$uid.")(!(phpgwaccountvisible=-1)))"; 
    183                                         break; 
    184                                 case 'uid': 
     199                         
     200                        if( $this->fileLdapExternal ) 
     201                        { 
     202                                if( $this->conn ) 
     203                                { 
    185204                                        $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
    186                                         break; 
    187                                 case 'mail': 
    188                                         $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
    189                                         break; 
    190                         } 
    191  
    192                         $justthese = array("uid","cn","dn"); 
    193                         $search = ldap_search( $this->conn, $this->contextLdap, $filter, $justthese); 
    194                         $get_entries = ldap_get_entries( $this->conn, $search); 
     205                                        $justthese = array("uid","cn","dn"); 
     206                                        $search = ldap_search( $this->conn, $this->contextLdap, $filter, $justthese); 
     207                                        $get_entries = ldap_get_entries( $this->conn, $search); 
    195208                                         
    196                         if( $get_entries['count'] > 0 ) 
    197                         { 
    198                                 $cn = $get_entries[0]['cn'][0]; 
    199                                 $ou = explode("dc=", $get_entries[0]['dn']); 
    200                                 $ou = explode("ou=",$ou[0]); 
    201                                 $ou = array_pop($ou); 
    202                                 $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 
    203                                 $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 
     209                                        if( $get_entries['count'] > 0 ) 
     210                                        { 
     211                                                $cn = $get_entries[0]['cn'][0]; 
     212                                                $ou = explode("dc=", $get_entries[0]['dn']); 
     213                                                $ou = explode("ou=",$ou[0]); 
     214                                                $ou = array_pop($ou); 
     215                                                $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 
     216                                                $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 
     217                                        } 
     218                                } 
    204219                        } 
    205220                } 
     
    224239                                 
    225240                                $this->ldapConnect(); 
     241                                 
     242                                if( $this->conn ) 
     243                                { 
     244                                        $filter                 = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
     245                                        $justthese              = array("uid","jpegPhoto"); 
     246                                        $search                 = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 
     247                                        $get_entries    = ldap_get_entries($this->conn,$search); 
     248                                         
     249                                        if( $get_entries['count'] > 0 ) 
     250                                        { 
     251                                                $first_entry = ldap_first_entry( $this->conn, $search ); 
     252                                                $photo = @ldap_get_values_len($this->conn, $first_entry, 'jpegphoto'); 
     253                                                 
     254                                                if ( $photo ) 
     255                                                        return $photo[0]; 
     256                                                 
     257                                                return false;                                                            
     258                                        } 
     259                                } 
    226260                        } 
    227261                } 
     
    237271                        if( !$this->fileLdapExternal ) 
    238272                                return false; 
    239                 } 
    240  
    241                 if( $this->conn ) 
    242                 { 
    243                         // Verificando atributo que a organização utiliza para autenticar no servidor jabber 
    244                         switch ($_SESSION['phpgw_info']['jabberit_messenger']['user_org_att']) 
    245                         { 
    246                                 case 'description': 
    247                                         $filter = "(&(phpgwaccounttype=u)(description=".$uid.")(!(phpgwaccountvisible=-1)))"; 
    248                                         $justthese = array("description","jpegPhoto"); 
    249                                         break; 
    250                                 case 'uid': 
    251                                         $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
    252                                         $justthese = array("uid","jpegPhoto"); 
    253                                         break; 
    254                                 case 'mail': 
    255                                         $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
    256                                         $justthese = array("uid","jpegPhoto"); 
    257                                         break; 
    258                         } 
    259  
    260                         $search                 = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 
    261                         $get_entries    = ldap_get_entries($this->conn,$search); 
     273 
     274                        if( $this->conn ) 
     275                        { 
     276                                $filter                 = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
     277                                $justthese              = array("uid","jpegPhoto"); 
     278                                $search                 = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 
     279                                $get_entries    = ldap_get_entries($this->conn,$search); 
    262280                                 
    263                         if( $get_entries['count'] > 0 ) 
    264                         { 
    265                                 $first_entry = ldap_first_entry( $this->conn, $search ); 
    266                                 $photo = @ldap_get_values_len($this->conn, $first_entry, 'jpegphoto'); 
    267                                  
    268                                 if ( $photo ) 
    269                                         return $photo[0]; 
    270                                  
    271                                 return false;                                                            
     281                                if( $get_entries['count'] > 0 ) 
     282                                { 
     283                                        $first_entry = ldap_first_entry( $this->conn, $search ); 
     284                                        $photo = @ldap_get_values_len($this->conn, $first_entry, 'jpegphoto'); 
     285                                         
     286                                        if ( $photo ) 
     287                                                return $photo[0]; 
     288                                         
     289                                        return false;                                                            
     290                                } 
    272291                        } 
    273292                } 
Note: See TracChangeset for help on using the changeset viewer.