Ignore:
Timestamp:
04/13/10 17:48:28 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - Implementado o status de mensagem e a busca da foto no ldap.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/jabberit_messenger/trophy_expresso/inc/class.LdapIM.inc.php

    r2421 r2511  
    303303        } 
    304304 
     305        public final function getPhotoUser( $_uid, $ldapRoot ) 
     306        { 
     307 
     308                $uid    = substr($_uid, 0, strpos($_uid, "@")); 
     309                $host   = substr($_uid, (strpos($_uid, "@") + 1)); 
     310                 
     311                if( $ldapRoot ) 
     312                { 
     313                        $this->ldapRoot(); 
     314                } 
     315                else 
     316                { 
     317                        $confHosts      = $this->hostsJabber;    
     318 
     319                        for( $i = 0; $i < count($confHosts); $i++ ) 
     320                        { 
     321                                if( trim($host) === trim($confHosts[$i]['jabberName']) ) 
     322                                { 
     323                                        $this->ldap_host        = $confHosts[$i]['serverLdap']; 
     324                                        $this->ldap_context = $confHosts[$i]['contextLdap']; 
     325                                        $this->ldap_user        = $confHosts[$i]['user']; 
     326                                        $this->ldap_org         = $confHosts[$i]['org']; 
     327                                        $this->ldap_pass        = $confHosts[$i]['password']; 
     328                                        $this->ldap             = $this->ldapCatalog(); 
     329                                } 
     330                        }                                
     331                } 
     332 
     333                if( $this->ldap ) 
     334                { 
     335                        $filter         = "(&(phpgwaccounttype=u)(uid=".$uid."))"; 
     336                        $justthese      = array($this->attribute, "uidNumber", "phpgwAccontVisible", "dn", "jpegPhoto"); 
     337                        $search         = ldap_search( $this->ldap, $this->ldap_context, $filter, $justthese, 0, $this->max_result + 1); 
     338                        $entry          = ldap_get_entries( $this->ldap, $search ); 
     339                         
     340                        for( $i = 0 ; $i < $entry['count']; $i++ ) 
     341                        { 
     342                                if( $entry[$i]['jpegphoto'][0] && $entry[$i]['phpgwaccountvisible'][0] != '-1' ) 
     343                                { 
     344                                        $filterPhoto    = "(objectclass=*)"; 
     345                                        $photoLdap              = ldap_read($this->ldap, $entry[$i]['dn'], $filterPhoto, array("jpegPhoto")); 
     346                                        $firstEntry     = ldap_first_entry($this->ldap, $photoLdap); 
     347                                        $photo                  = ldap_get_values_len($this->ldap, $firstEntry, "jpegPhoto"); 
     348 
     349                                        if( $this->ldap ) 
     350                                                ldap_close($this->ldap); 
     351 
     352                                        return $photo[0];                
     353                                } 
     354                        } 
     355                } 
     356 
     357                return false; 
     358        } 
     359 
    305360        public final function getUsersLdapCatalog( $search, $uid = false, $pLdap = false ) 
    306361        { 
Note: See TracChangeset for help on using the changeset viewer.