Changeset 1160


Ignore:
Timestamp:
07/22/09 16:20:46 (15 years ago)
Author:
alexandrecorreia
Message:

Ticket #571 - Somente criando os *.jars( applet.jar, filetransfer.jar e xhtml.jar )

Location:
trunk/jabberit_messenger
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/jabberit_messenger/inc/class.contacts_im.inc.php

    r991 r1160  
    3434                // Server Name Jabber 
    3535                $this->serverJabber = $_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit']; 
     36                 
    3637        } 
    3738 
     
    6970                // Hosts Jabber 
    7071                $hostsJabber = unserialize($_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']); 
    71                          
     72 
    7273                if( is_array($users) ) 
    7374                {        
     
    7879                                        foreach($hostsJabber as $itens) 
    7980                                        { 
    80                                                 if( trim($users[$i]['ou']) === trim($itens['org']) && strpos($users[$i]['jid'],"@") === false) 
    81                                                                 $users[$i]['jid'] = $users[$i]['jid']."@".$itens['jabberName'];                                          
    82                                                 else 
     81                                                if( trim($users[$i]['ou']) === trim($itens['org']) && strpos($users[$i]['jid'],"@") === false ) 
    8382                                                { 
    84                                                         if(strpos($users[$i]['jid'],"@") === false) 
    85                                                                         $users[$i]['jid'] = $users[$i]['jid']."@".$this->serverJabber; 
     83                                                        $users[$i]['jid'] = $users[$i]['jid']."@".$itens['jabberName']; 
    8684                                                } 
    8785                                        } 
     86                                } 
     87 
     88                                if( strpos($users[$i]['jid'],"@") === false ) 
     89                                { 
     90                                        $users[$i]['jid'] = $users[$i]['jid']."@".$this->serverJabber; 
    8891                                } 
    8992                        } 
     
    139142                                $result[] = $this->ldap->getUsersLdapRoot("cn=*".$pName."*", $filter_uid); 
    140143        } 
    141         if(!$this->groupsLocked()) 
     144         
     145        if( !$this->groupsLocked() ) 
    142146                $result[] = $this->ldap->getUsersLdapCatalog("cn=*".$pName."*"); 
    143147 
  • trunk/jabberit_messenger/inc/class.ldap_im.inc.php

    r988 r1160  
    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); 
  • trunk/jabberit_messenger/inc/webservice.php

    r1139 r1160  
    1515        private $conn; 
    1616        private $contextLdap; 
    17         private $userDn;         
     17        private $userLDAP;       
    1818        private $jabberName = null; 
    1919        private $passwd; 
     
    2121        private $refer; 
    2222        private $serverLdap; 
     23        private $fileLdapInternal = false; 
     24        private $fileLdapExternal = false; 
    2325         
    2426        function __construct() 
     
    3234                        $this->serverLdap       = $handle['serverLdap']; 
    3335                        $this->contextLdap      = $handle['contextLdap']; 
    34                         $this->userDn           = $handle['user']; 
     36                        $this->userLDAP         = $handle['user']; 
    3537                        $this->passwd           = $handle['password']; 
    3638                         
    3739                        $this->refer    = true; 
    3840                        $this->version3 = true; 
     41                         
     42                        $this->fileLdapInternal = true; 
    3943                } 
    4044        } 
     
    5559 
    5660                // Bind as Admin 
    57                 if($this->userDn && $this->passwd && !ldap_bind($this->conn, $this->userDn, $this->passwd)) 
     61                if( $this->userLDAP && $this->passwd && !ldap_bind($this->conn, $this->userLDAP . "," . $this->contextLdap, $this->passwd) ) 
    5862                        return False; 
    5963                 
    6064                // Bind as Anonymous 
    61                 if(!$this->userDn && !$this->passwd && !@ldap_bind($this->conn)) 
     65                if( !$this->userLDAP && !$this->passwd && !@ldap_bind($this->conn) ) 
    6266                        return False; 
    6367        } 
     
    6569        private final function ldapConnectExternal($pHostJabber) 
    6670        { 
    67                 require_once('confLDAPExternal.php'); 
    68                 $handle   = unserialize(base64_decode($LDAP_EXTERNAL)); 
    69  
    70                 foreach($handle as $itens) 
    71                         if(trim($pHostJabber) == $itens['jabberName']) 
    72                         { 
    73                                 $this->jabberName       = $itens['jabberName']; 
    74                                 $this->serverLdap       = $itens['serverLdap']; 
    75                                 $this->contextLdap      = $itens['contextLdap']; 
    76                                 $this->userDn           = $itens['user']; 
    77                                 $this->passwd           = $itens['password']; 
    78                         }                
    79  
    80                 $this->refer    = true; 
    81                 $this->version3 = true; 
    82                  
    83                 $this->ldapConnect(); 
     71                if( file_exists('confLDAPExternal.php')) 
     72                { 
     73                        require_once('confLDAPExternal.php'); 
     74                        $handle   = unserialize(base64_decode($LDAP_EXTERNAL)); 
     75         
     76                        foreach($handle as $itens) 
     77                                if(trim($pHostJabber) == $itens['jabberName']) 
     78                                { 
     79                                        $this->jabberName       = $itens['jabberName']; 
     80                                        $this->serverLdap       = $itens['serverLdap']; 
     81                                        $this->contextLdap      = $itens['contextLdap']; 
     82                                        $this->userLDAP         = $itens['user']; 
     83                                        $this->passwd           = $itens['password']; 
     84                                }                
     85         
     86                        $this->refer    = true; 
     87                        $this->version3 = true; 
     88                         
     89                        $this->ldapConnect(); 
     90                         
     91                        $this->fileLdapExternal = true; 
     92                } 
    8493        } 
    8594         
     
    161170        { 
    162171                $uid = substr($pJid, 0, strpos($pJid,"@")); 
     172                $return = utf8_encode("Nome : Não Identificado ;Organização : Não Identificado"); 
    163173                 
    164174                if( $this->jabberName == (substr($pJid, strpos($pJid, "@") + 1 ))) 
    165175                { 
    166176                        $this->ldapConnect(); 
    167                          
    168                         if( $this->conn ) 
    169                         { 
    170                                 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
    171                                 $justthese = array("uid","cn","dn"); 
    172                                 $search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 
    173                                 $entry = ldap_get_entries($this->conn,$search); 
    174                                 $cn = $entry[0]['cn'][0]; 
    175                                 $ou = explode("dc=", $entry[0]['dn']); 
    176                                 $ou = explode("ou=",$ou[0]); 
    177                                 $ou = array_pop($ou); 
    178                                 $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 
    179          
    180                                 $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 
     177 
     178                        if( $this->fileLdapInternal ) 
     179                        { 
     180                                if( $this->conn ) 
     181                                { 
     182                                        $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
     183                                        $justthese = array("uid","cn","dn"); 
     184                                        $search = ldap_search( $this->conn, $this->contextLdap, $filter,$justthese); 
     185                                        $get_entries = ldap_get_entries( $this->conn, $search); 
     186                 
     187                                        if( $get_entries['count'] > 0 ) 
     188                                        {                                        
     189                                                $cn = $get_entries[0]['cn'][0]; 
     190                                                $ou = explode("dc=", $get_entries[0]['dn']); 
     191                                                $ou = explode("ou=",$ou[0]); 
     192                                                $ou = array_pop($ou); 
     193                                                $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 
     194                                                $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 
     195                                        } 
     196                                } 
    181197                        } 
    182198                } 
     
    184200                { 
    185201                        $this->ldapConnectExternal(substr($pJid, strpos($pJid, "@") + 1 )); 
    186  
    187                         if( $this->conn ) 
    188                         { 
    189                                 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
    190                                 $justthese = array("uid","cn","dn"); 
    191                                 $search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 
    192                                 $entry = ldap_get_entries($this->conn,$search); 
    193                                 $cn = $entry[0]['cn'][0]; 
    194                                 $ou = explode("dc=", $entry[0]['dn']); 
    195                                 $ou = explode("ou=",$ou[0]); 
    196                                 $ou = array_pop($ou); 
    197                                 $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 
    198          
    199                                 $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 
    200                         } 
    201                 } 
    202  
    203                 if( $pCharset === "1" ) 
     202                         
     203                        if( $this->fileLdapExternal ) 
     204                        { 
     205                                if( $this->conn ) 
     206                                { 
     207                                        $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
     208                                        $justthese = array("uid","cn","dn"); 
     209                                        $search = ldap_search( $this->conn, $this->contextLdap, $filter, $justthese); 
     210                                        $get_entries = ldap_get_entries( $this->conn, $search); 
     211                                         
     212                                        if( $get_entries['count'] > 0 ) 
     213                                        { 
     214                                                $cn = $get_entries[0]['cn'][0]; 
     215                                                $ou = explode("dc=", $get_entries[0]['dn']); 
     216                                                $ou = explode("ou=",$ou[0]); 
     217                                                $ou = array_pop($ou); 
     218                                                $dn = strtoupper(substr($ou,0,strlen($ou)-1)); 
     219                                                $return = utf8_encode("Nome : " . $cn . ";Organização : " . $dn); 
     220                                        } 
     221                                } 
     222                        } 
     223                } 
     224 
     225                if( $pCharset === "1" || $pCharset === 1 ) 
    204226                        return $return; 
    205227                else 
    206228                        return mb_convert_encoding($return, "ISO-8859-1", "UTF-8"); 
    207229 
    208                 $return = utf8_encode("Nome : Não Identificado ;Organização : Não Identificado");                        
    209  
    210                 if( $pCharset === 1 ) 
    211                         return $return; 
    212                 else 
    213                         return mb_convert_encoding($return, "ISO-8859-1", "UTF-8"); 
    214  
    215         } 
    216          
    217         public final function getPhotoLdap( $pJid, $pCatalog ) 
    218         { 
    219                 if ( ! $this->jabberName ) 
    220                         return false; 
    221  
    222                 $uid = substr($pJid, 0, strpos($pJid,"@")); 
    223                  
    224                 if( ($this->jabberName == (substr($pJid, strpos($pJid, "@") + 1 ))) && $pCatalog) 
    225                 { 
    226                         $this->ldapConnect(); 
    227                          
    228                         if( $this->conn ) 
    229                         { 
    230                                 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
    231                                 $justthese = array("uid","jpegPhoto"); 
     230        } 
     231         
     232        public final function getPhotoLdap( $pJid , $pLdapInternal ) 
     233        { 
     234                $uid = substr($pJid, 0, strpos($pJid, "@")); 
     235 
     236                if( $pLdapInternal ) 
     237                { 
     238                        if( $this->jabberName == (substr($pJid, strpos($pJid, "@") + 1 ))) 
     239                        { 
     240                                if( ! $this->fileLdapInternal ) 
     241                                        return false; 
    232242                                 
    233                                 $search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 
    234                                 $entry1 = ldap_get_entries($this->conn,$search); 
    235                                 $entry = ldap_first_entry( $this->conn, $search ); 
    236                                 if( $entry1['count'] > 0 ) 
    237                                 { 
    238                                         $i = 0; 
    239                                         $photo = ""; 
    240                                         $return_photo = ""; 
    241                                         $photo = @ldap_get_values_len($this->conn, $entry, 'jpegphoto'); 
    242  
    243                                         if ($photo) 
    244                                                 $return_photo = $photo[0];                                                               
    245                                         return $return_photo; 
     243                                $this->ldapConnect(); 
     244                                 
     245                                if( $this->conn ) 
     246                                { 
     247                                        $filter                 = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
     248                                        $justthese              = array("uid","jpegPhoto"); 
     249                                        $search                 = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 
     250                                        $get_entries    = ldap_get_entries($this->conn,$search); 
     251                                         
     252                                        if( $get_entries['count'] > 0 ) 
     253                                        { 
     254                                                $first_entry = ldap_first_entry( $this->conn, $search ); 
     255                                                $photo = @ldap_get_values_len($this->conn, $first_entry, 'jpegphoto'); 
     256                                                 
     257                                                if ( $photo ) 
     258                                                        return $photo[0]; 
     259                                                 
     260                                                return false;                                                            
     261                                        } 
    246262                                } 
    247263                        } 
     
    250266                {                                        
    251267                        $jabberName = substr($pJid, strpos($pJid, "@") + 1 ); 
    252                          
     268 
    253269                        if( strpos($jabberName, "/") ) 
    254270                                $jabberName = substr($jabberName, 0, strpos($jabberName, "/")); 
     
    256272                        $this->ldapConnectExternal($jabberName); 
    257273 
     274                        if( !$this->fileLdapExternal ) 
     275                                return false; 
     276 
    258277                        if( $this->conn ) 
    259278                        { 
    260                                 $filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
    261                                 $justthese = array("uid","jpegPhoto"); 
    262                                 $search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 
    263                                 $entry1 = ldap_get_entries($this->conn,$search); 
    264                                 $entry = ldap_first_entry( $this->conn, $search ); 
    265                                 if( $entry1['count'] > 0 ) 
    266                                 { 
    267                                         $i = 0; 
    268                                         $photo = ""; 
    269                                         $return_photo = ""; 
    270                                         $photo = @ldap_get_values_len($this->conn, $entry, 'jpegphoto'); 
    271                                         if ($photo) 
    272                                                 $return_photo = $photo[0];                                                               
    273                                         return $return_photo; 
     279                                $filter                 = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))"; 
     280                                $justthese              = array("uid","jpegPhoto"); 
     281                                $search                 = ldap_search($this->conn,$this->contextLdap,$filter,$justthese); 
     282                                $get_entries    = ldap_get_entries($this->conn,$search); 
     283                                 
     284                                if( $get_entries['count'] > 0 ) 
     285                                { 
     286                                        $first_entry = ldap_first_entry( $this->conn, $search ); 
     287                                        $photo = @ldap_get_values_len($this->conn, $first_entry, 'jpegphoto'); 
     288                                         
     289                                        if ( $photo ) 
     290                                                return $photo[0]; 
     291                                         
     292                                        return false;                                                            
    274293                                } 
    275294                        } 
    276295                } 
    277                                          
     296                 
    278297                return false; 
    279298        } 
     
    305324} 
    306325 
    307 // Utilizando o serviço Asteriks; 
     326// Applet - utilizando o serviço Voip; 
    308327if(trim($_REQUEST['javaVoipFrom']) != "" && trim($_REQUEST['javaVoipTo']) != "" ) 
    309328{ 
     
    314333} 
    315334 
    316 // Fotos pelo applet;  
     335// Applet - fotos pelo applet;  
    317336if(trim($_REQUEST['javaPhoto']) != "" ) 
    318337{ 
    319338        $obj = new webService(); 
    320339        $jid = $_REQUEST['javaPhoto']; 
    321         $jid = strpos($jid, "/") ? substr($jid, 0, strpos($jid, "/")) : $jid; 
    322          
    323         $photo = $obj->getPhotoLdap($jid, true); 
     340        $jid = ( strpos($jid, "/") !== false ) ? substr($jid, 0, strpos($jid, "/")) : $jid; 
     341         
     342        $photo = $obj->getPhotoLdap( $jid, true ); 
    324343        $photoWidth = 70; 
    325344        $photoHeight = 90; 
     
    352371        ob_end_clean(); 
    353372        printf("%s",base64_encode($imagePhoto)); 
    354          
    355 } 
    356  
    357 // Jid pelo applet; 
    358 if(trim($_POST['jid']) != "") 
    359 { 
    360         $jid = trim($_POST['jid']); 
    361         $charset = trim($_POST['charset']); 
     373} 
     374 
     375// Applet - jid; 
     376if(trim($_REQUEST['jid']) != "") 
     377{ 
     378         
     379        $jid = trim($_REQUEST['jid']); 
     380        $charset = trim($_REQUEST['charset']); 
    362381        $obj = new webService(); 
    363382         
     
    365384} 
    366385 
    367 // Fotos pelo php; 
     386// Php - fotos pelo php; 
    368387if(trim($_REQUEST['phpPhoto']) != "") 
    369388{ 
  • trunk/jabberit_messenger/xsl/list_ldap_contacts.xsl

    r946 r1160  
    2727                                <b><xsl:value-of select="name(..)"/></b> 
    2828                                <br/><xsl:value-of select="cn" /> 
    29                                 <br/><xsl:value-of select="mail" /> 
    3029                                <br/> 
    3130                                <br/> 
    3231                                <label style="color:blue;cursor:pointer;">Adicionar Contato</label> 
     32                                <br/> 
    3333                        </span> 
    3434                </xsl:for-each> 
Note: See TracChangeset for help on using the changeset viewer.