Ignore:
Timestamp:
01/18/08 15:17:58 (16 years ago)
Author:
niltonneto
Message:

Commit da nova versão do módulo, usando agente em C.
Vide Página do módulo do Trac:
http://www.expressolivre.org/dev/wiki/messenger

A versão anterior encontra-se na subpasta bkp (32/64).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/instant_messenger/inc/class.ldap_im.inc.php

    r68 r151  
    66        private $conn; 
    77        private $user; 
     8        private $jid; 
    89        private $password; 
    910         
    1011        function __construct() 
    1112        { 
    12                 $this->ldap_host        = $_SESSION['phpgw_info']['instant_messenger']['server_ldap_jabber']; 
    13                 $this->ldap_context = $_SESSION['phpgw_info']['instant_messenger']['context_ldap_jabber']; 
    14                 $this->user             = $_SESSION['phpgw_info']['instant_messenger']['user_ldap_jabber']; 
    15                 $this->password         = $_SESSION['phpgw_info']['instant_messenger']['password_ldap_jabber']; 
     13                session_start(); 
     14                $this->ldap_host                = $_SESSION['phpgw_info']['instant_messenger']['server_ldap_jabber']; 
     15                $this->ldap_context     = $_SESSION['phpgw_info']['instant_messenger']['context_ldap_jabber']; 
     16                $this->user                     = $_SESSION['phpgw_info']['instant_messenger']['user_ldap_jabber']; 
     17                $this->password                 = $_SESSION['phpgw_info']['instant_messenger']['password_ldap_jabber']; 
     18                $this->jid                              = $_SESSION['phpgw_info']['instant_messenger']['user']; 
    1619                $this->connect_ldap(false); 
     20                session_write_close(); 
    1721        } 
    1822         
     
    3337        } 
    3438         
    35         function get_photo_ldap($user,$getPhoto) 
     39        function get_photo_ldap($pUser,$getPhoto) 
    3640        { 
    37                 $user = ( $user == "user" ) ? $_SESSION['phpgw_info']['instant_messenger']['user'] : $user ; 
     41                $user = ( $pUser == "im_avatar" ) ? $this->jid : $pUser ; 
    3842                 
    39                 if ($this->conn) { 
     43                if ($this->conn)  
     44                { 
    4045                        $filter="(&(uid=".$user.")(phpgwAccountType=u))";                
    4146                        $justthese = array("jpegphoto"); 
    42                         $search = ldap_search($this->conn,$this->ldap_context, $filter, $justthese); 
    43                         $entry = ldap_first_entry($this->conn, $search); 
     47                        $search = @ldap_search($this->conn,$this->ldap_context, $filter, $justthese); 
     48                        $entry = @ldap_first_entry($this->conn, $search); 
    4449                        $jpeg_data = @ldap_get_values_len($this->conn, $entry, "jpegphoto"); 
    4550                         
    46                         if( count($jpeg_data) > 1){ 
    47  
     51                        if( count($jpeg_data) > 1) 
     52                        { 
    4853                                $photo = imagecreatefromstring($jpeg_data[0]); 
    49                                 if($photo){ 
    50                                         if($getPhoto){ 
     54                                if($photo) 
     55                                { 
     56                                        if($getPhoto) 
     57                                        { 
    5158                                                header("Content-Type: image/jpeg"); 
    5259                                                $width = imagesx($photo); 
     
    5966                                                return;          
    6067                                        }else{ 
    61                                                 return 1; 
     68                                                return "true"; 
    6269                                        }                                
    6370                                }else{ 
    64                                         return 0; 
     71                                        return "false"; 
    6572                                } 
    6673                        }else{ 
    67                                 return 0; 
     74                                return "false"; 
    6875                        } 
    6976                } 
     
    7279        function photo_ldap($user) 
    7380        { 
    74                 $uid = ( $user['uid'] == "user" ) ? $_SESSION['phpgw_info']['instant_messenger']['user'] : $user['uid'] ; 
     81                $uid = ( $user['uid'] == "im_avatar" ) ? $this->jid : $user['uid'] ; 
    7582                return $this->get_photo_ldap($uid,false); 
    7683        } 
     
    143150        function list_organizations_ldap() 
    144151        { 
    145                 $result_org = array(); 
    146                 $i = 0; 
    147                 if ($this->conn) { 
     152                $result_org = "<organizations><ou></ou>"; 
     153 
     154                if ($this->conn)  
     155                { 
    148156                        $filter="ou=*";          
    149157                        $justthese = array("ou"); 
     
    152160                } 
    153161                 
    154                 foreach($entry as $tmp){ 
    155                         if($tmp['ou'][0] != ""){ 
    156                                 $result_org[$i] = $tmp['ou'][0]; 
    157                                 $i++; 
    158                         } 
    159                 } 
    160                 sort($result_org); 
     162                foreach($entry as $tmp) 
     163                        if($tmp['ou'][0] != "") 
     164                                $result_org .= "<ou>" . $tmp['ou'][0] . "</ou>";   
     165 
     166                $result_org .= "</organizations>"; 
     167                 
    161168                return $result_org; 
    162169        } 
     
    176183} 
    177184 
    178 if(trim($_REQUEST['user']) != ""){ 
     185if(trim($_REQUEST['user']) != "") 
     186{ 
    179187        $obj_img = new ldap_im(); 
    180188        $obj_img->get_photo_ldap($_REQUEST['user'],true); 
Note: See TracChangeset for help on using the changeset viewer.