Ignore:
Timestamp:
06/06/08 13:54:09 (16 years ago)
Author:
niltonneto
Message:

Correçoes

Location:
trunk/instant_messenger/inc
Files:
1 deleted
12 edited

Legend:

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

    r287 r305  
    155155                $obj = new ReflectionClass($class); 
    156156 
    157                 if ( $pRequest['classConstructor'] ) 
     157                if ( $pRequest['classCostructor'] ) 
    158158                { 
    159                         $obj = $obj->newInstance($pRequest['classConstructor']); 
    160                         unset($pRequest['classConstructor']); 
     159                        $obj = $obj->newInstance($pRequest['classCostructor']); 
     160                        unset($pRequest['classCostructor']); 
    161161                } 
    162162                else 
  • trunk/instant_messenger/inc/Jabber.abstract.php

    r287 r305  
    3333 
    3434        private final function _connect( $pUser = false, $pPassword = false, $pConnectionType = false, $pWebjabber = false ) 
    35         {        
     35        { 
    3636                try 
    3737                { 
     
    4848 
    4949                        $this->_socket = $socket; 
    50                          
     50 
    5151                        //stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); 
    52                          
     52 
    5353                        fwrite($socket, "{$USER}@{$SERVER}##{$pPassword}##{$pConnectionType}"); 
    5454 
     
    8080 
    8181        protected function connect($pUser = false, $pPassword = false, $pConnectionType = false, $pWebjabber = false ) 
    82         {  
    83                 try 
    84                 { 
    85                         $_connect = $this->_connect($pUser, $pPassword, $pConnectionType, $pWebjabber ); 
     82        { 
     83                try 
     84                { 
     85                        $_connect = $this->_connect($pUser, $pPassword, $pConnectionType, $pWebjabber); 
    8686 
    8787                        if ( !$_connect ) 
     
    162162 
    163163                        usleep(50000); 
    164                          
     164 
    165165                        fread($this->_socket, 4096); 
    166                          
     166 
    167167                        if ( !$this->_plain() ) 
    168168                                throw new Exception('[starttls] #3 it isn\'t possible carry out the verification. File: ' . __FILE__ . '  ::  ' . __LINE__); 
     
    186186                                throw new Exception('[_plain] #1 it isn\'t possible read the socket. File: ' . __FILE__ . '  ::  ' . __LINE__); 
    187187 
    188                         $xml  = "<username>" . $this->_username . "</username>"; 
    189                         $xml .= "<password>" . $this->_password . "</password>"; 
    190                         $xml .= "<resource>" . $this->_resource . "</resource>"; 
     188                        $xml  = "<username><![CDATA[" . $this->_username . "]]></username>"; 
     189                        $xml .= "<password><![CDATA[" . $this->_password . "]]></password>"; 
     190                        $xml .= "<resource><![CDATA[" . $this->_resource . "]]></resource>"; 
    191191 
    192192                        unset($this->_password); 
  • trunk/instant_messenger/inc/Jabberd2.abstract.php

    r287 r305  
    77class Jabberd2 extends Jabber 
    88{ 
    9         final function connect($pUser = false, $pPassword = false, $pConnectionType = false) 
     9        final function connect($pUser = false, $pPassword = false, $pConnectionType = false, $pWebjabber = false ) 
    1010        { 
    1111                try 
    1212                { 
    1313                        if ( $pUser && $pPassword && $pConnectionType ) 
    14                                 if ( $_connect = parent::connect($pUser, $pPassword, $pConnectionType) ) 
     14                                if ( $_connect = parent::connect($pUser, $pPassword, $pConnectionType, $pWebjabber) ) 
    1515                                        return $_connect; 
    1616 
     
    4848         */ 
    4949 
    50         final function addContacts($pContact) 
    51         { 
    52                 $jid = explode("@",$pContact['email']); 
    53                 $jid = $jid[0]."@".$this->_server; 
    54                 $name = $pContact['name']; 
    55                 $group = $pContact['group']; 
    56  
    57                 if(trim($jid[0]) != trim($this->_user)) 
    58                 { 
    59                         if ( $jid ) 
     50        final function addRoster($pRoster) 
     51        { 
     52                if ( !$this->connected ) 
     53                        return "disconnected"; 
     54 
     55                if ( trim($pRoster['uid']) ) 
     56                { 
     57                        $jid = $pRoster['uid'] . "@" . $this->_server; 
     58 
     59                        $newroster  = "<item jid='" . $jid . "'"; 
     60                        $newroster .= " name='" . $pRoster['name'] . "'"; 
     61                        $newroster .= "><group>" . $pRoster['group'] . "</group></item>"; 
     62 
     63                        if ( $this->iq('set', "addroster_" . time(), NULL, NULL, "jabber:iq:roster", $newroster) ) 
    6064                        { 
    61                                 $newcontact  = "<item jid='".$jid."'"; 
    62                                 $newcontact .= " name='" . $name . "'"; 
    63                                 $newcontact .= "><group>" . $group . "</group></item>"; 
     65                                $this->getContacts(); 
     66                                return true; 
    6467                        } 
    6568                } 
    66                 $addid = "adduser_" . time(); 
    67                 if ( !$this->connected ) 
    68                         echo "disconnected"; 
    69                 else 
    70                 { 
    71                         if ( $this->iq('set', $addid, NULL, NULL, "jabber:iq:roster", $newcontact) ) 
    72                                 $this->getContacts(); 
    73                         echo "OK"; 
    74                 } 
     69                return false; 
     70        } 
     71 
     72        final function addContact($pContact) 
     73        { 
     74                $this->addRoster($pContact); 
     75                $this->subscription($pContact['uid'] . "@" . $this->_server, 'subscribe'); 
    7576        } 
    7677 
     
    8990                        $jid = ( trim($pJid['jid']) == "this" ) ? $this->_user . '@' . $this->_server : $pJid['jid']; 
    9091                        $vcard = (trim($pJid['jid']) == "this") ? 'vCard_user' : 'vCard'; 
    91                          
     92 
    9293                        if ( !$this->connected ) 
    9394                        { 
     
    120121        final function removeContact($pContact) 
    121122        { 
    122                 $delid  = 'deluser_' . time(); 
    123123                if ( !$this->isConnected() ) 
    124124                        return "disconnected"; 
    125                          
    126                 if ( $this->iq('set',$delid,NULL,NULL,"jabber:iq:roster","<item jid='".$pContact['jid']."' subscription='remove'/>") ) 
    127                         if ( $this->subscription($pContact['jid'],"unsubscribed") ) 
    128                                 echo "OK"; 
     125 
     126                if ( $this->iq('set', 'delroster_' . time(), NULL, NULL, 'jabber:iq:roster',"<item jid='".$pContact['jid']."' subscription='remove'/>") ) 
     127                { 
     128                        $this->getContacts(); 
     129                        return true; 
     130                } 
     131                return false; 
     132        } 
     133 
     134        function allowContact($pRoster) 
     135        { 
     136                $this->addRoster($pRoster); 
     137                $jid = $pRoster['uid'] . "@" . $this->_server; 
     138                $this->subscription($jid, 'subscribed'); 
     139                $this->subscription($jid, 'subscribe'); 
    129140        } 
    130141 
     
    141152                        return true; 
    142153                } 
    143         } 
    144  
    145         final function compression() 
    146         { 
    147                 $compress = "<compress xmlns='http://jabber.org/protocol/compress'><method>zlib</method></compress>";    
    148                 $this->writeSocket($compress); 
    149154        } 
    150155 
     
    166171        } 
    167172 
    168         final function get_last_access_user($pUser) 
    169         { 
    170                 $id = "last_time_user"; 
    171                 $jid = ( trim($pUser['jid']) == "this" ) ? $this->_user . '@' . $this->_server : $pUser['jid']; 
    172                 $this->iq('get', $id, $jid, NULL, "jabber:iq:last"); 
    173         } 
    174  
    175173        final function setStatus() 
    176174        { 
    177175                $this->setPresence(array("type" => "unavailable")); 
    178                 $this->setPresence(array("type" => "available"));        
     176                $this->setPresence(array("type" => "available")); 
    179177        } 
    180178 
  • trunk/instant_messenger/inc/Socket.abstract.php

    r287 r305  
    5252                set_magic_quotes_runtime(0); 
    5353                $return = @fread($pSocket, $pLength); 
     54                set_magic_quotes_runtime(get_magic_quotes_gpc()); 
    5455 
    55                 set_magic_quotes_runtime(get_magic_quotes_gpc()); 
    5656 
    5757                if ( $php_errormsg ) 
  • trunk/instant_messenger/inc/class.Ujabber.inc.php

    r287 r305  
    11<?php 
    2  
     2#error_reporting(E_ALL); 
    33require_once 'Jabberd2.abstract.php'; 
    44 
    55class Ujabber extends Jabberd2 
    66{ 
    7         private $set_presence; 
    8          
    97        public final function __construct($pConnectionType = 'write') 
    10         {        
    11                 session_start(); 
     8        { 
     9                /*session_start(); 
     10 
    1211                $this->_user     = $_SESSION['phpgw_info']['instant_messenger']['user']; 
     12                //$this->_user     = 'niltonneto';//$_SESSION['phpgw_info']['instant_messenger']['user']; 
     13                //$this->_pass     = 'nine59ever';//$_SESSION['phpgw_info']['instant_messenger']['passwd']; 
     14                //$this->_pass     = 'senha';//$_SESSION['phpgw_info']['instant_messenger']['passwd']; 
    1315                $this->_pass     = $_SESSION['phpgw_info']['instant_messenger']['passwd']; 
    1416                $this->_server   = $_SESSION['phpgw_info']['instant_messenger']['name_jabber']; 
    15                 $this->_port     = $_SESSION['phpgw_info']['instant_messenger']['port_jabber']; 
     17                $this->_port     = '8883';//$_SESSION['phpgw_info']['instant_messenger']['port_jabber']; 
    1618                $this->_resource = $_SESSION['phpgw_info']['instant_messenger']['resource_jabber']; 
    17                 $webjabber       = $_SESSION['phpgw_info']['instant_messenger']['webjabber']; 
    18                 session_write_close(); 
     19                //$webjabber       = 'im.pr.gov.br';//$_SESSION['phpgw_info']['instant_messenger']['webjabber']; 
     20                $webjabber       = '10.15.22.236';//$_SESSION['phpgw_info']['instant_messenger']['webjabber']; 
    1921 
    20                 if ( $this->connect($this->_user . '@' . $this->_server . '/' . $this->_resource . ':' . $this->_port, $this->_pass, $pConnectionType, $webjabber) ) 
    21                         $this->connected = true; 
    22                 else 
     22                session_write_close();*/ 
     23 
     24                try 
     25                { 
     26                        if ( !file_exists(dirname(__FILE__) . '/../instant_messenger.define.php') ) 
     27                                throw new Exception(__CLASS__ . '[ ERROR #1 ] : Not found configuration file'); 
     28 
     29                        require_once dirname(__FILE__) . '/../instant_messenger.define.php'; 
     30 
     31                        if ( !(defined('JABBER_URL') && defined('JABBER_RESOURCE')) ) 
     32                                throw new Exception(__CLASS__ . '[ ERROR #2 ] : Jabber server is not cofigured'); 
     33 
     34                        if ( !(defined('WEBJABBER_URL') && defined('WEBJABBER_PORT')) ) 
     35                                throw new Exception(__CLASS__ . '[ ERROR #3 ] : Webabber server is not cofigured'); 
     36 
     37                        $this->_server = constant('JABBER_URL'); 
     38                        $this->_resource = constant('JABBER_RESOURCE'); 
     39 
     40                        $this->_port = constant('WEBJABBER_PORT'); 
     41 
     42                        session_start(); 
     43                        $this->_user = $_SESSION['phpgw_info']['instant_messenger']['user']; 
     44                        $this->_pass = $_SESSION['phpgw_info']['instant_messenger']['passwd']; 
     45                        session_write_close(); 
     46 
     47                        $access_string = $this->_user . '@' . $this->_server . '/' . $this->_resource . ':' . $this->_port; 
     48 
    2349                        $this->connected = false; 
     50                        if ( $this->connect($access_string, $this->_pass, $pConnectionType, constant('WEBJABBER_URL')) ) 
     51                                $this->connected = true; 
     52                } 
     53                catch(Exception $e) 
     54                { 
     55                        echo $e->getMessage(); 
     56                } 
    2457        } 
    2558 
     
    3063                flush(); 
    3164        } 
    32          
     65 
    3366        public final function isConnected() 
    3467        { 
     
    4073                if ( !$this->isConnected() ) 
    4174                        return "disconnected"; 
    42  
    43                 $this->get_last_access_user(array("jid" => "this"));     
    4475 
    4576                if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) 
     
    5687 
    5788                        $init = time(); 
     89                        $buffer = ''; 
    5890 
    5991                        while ( ( connection_aborted() === 0 ) && time() - $init < 50 ) 
    6092                        { 
    61                                 if( isset($xml) )        
    62                                         unset($xml); 
    63                          
    6493                                # read from server and write in the client 
    6594                                $xml = $this->readSocket(); 
     95                                //var_dump($xml); 
     96                                if ( strlen($xml) && $xml != ' ' ) 
     97                                { 
     98                                        if ( $xml[strlen($xml) - 1 ] != '>' ) 
     99                                        { 
     100                                                $buffer .= $xml; 
     101                                                $xml = ''; 
     102                                        } 
     103                                        else 
     104                                        { 
     105                                                $xml = $buffer . $xml; 
     106                                                $buffer = ''; 
     107                                                //var_dump($xml); 
     108                                                //strlen($xml); 
     109                                                //exit; 
     110                                        } 
     111                                } 
    66112                                $xml = ( strlen($xml) ) ? $xml : ' '; 
    67                                 //$xml = ( strlen($xml) ) ? $xml : '_##_'; 
    68113                                printf("%s", $xml); 
    69114                                ob_flush(); 
     
    85130                $pSendMessage['body'] = preg_replace($patterns, $replace, $pSendMessage['body']); 
    86131 
    87                 $_emotions  = '/<img[^>]*emotion="(\S+)?"[^>]*>/';  
     132                $_emotions  = '/<img emotion="(\S+)?"[^>]+>/'; 
    88133                $_emotions = preg_match_all($_emotions, $pSendMessage['body'], $emotions); 
    89134 
     
    134179 
    135180                        //retirar a linha abaixo para voltar ao padrão conforme acima 
    136                         $xml .= "<body><![CDATA[" . htmlentities($content['body']) . "]]></body>"; 
     181                        $xml .= "<body><![CDATA[" . $content['body'] . "]]></body>"; 
    137182                        $xml .= $payload; 
    138183                        $xml .= "</message>"; 
  • trunk/instant_messenger/inc/class.db_im.inc.php

    r287 r305  
    1919        function db_im() 
    2020        { 
     21                 
    2122                session_start();                 
    2223                $this->db_name = $_SESSION['phpgw_info']['instant_messenger']['server']['db_name']; 
  • trunk/instant_messenger/inc/class.ldap_im.inc.php

    r287 r305  
    22class ldap_im 
    33{ 
    4         var $ldap_host; 
    5         var $ldap_context; 
    6         var $conn; 
    7         var $user; 
    8         var $jid; 
    9         var $password; 
     4        private $ldap_host; 
     5        private $ldap_context; 
     6        private $conn; 
     7        private $user; 
     8        private $jid; 
     9        private $password; 
    1010         
    1111        function __construct() 
     
    1313                session_start(); 
    1414                $this->ldap_host                = $_SESSION['phpgw_info']['instant_messenger']['server_ldap_jabber']; 
    15                 $this->ldap_context             = $_SESSION['phpgw_info']['instant_messenger']['context_ldap_jabber']; 
     15                $this->ldap_context     = $_SESSION['phpgw_info']['instant_messenger']['context_ldap_jabber']; 
    1616                $this->user                     = $_SESSION['phpgw_info']['instant_messenger']['user_ldap_jabber']; 
    1717                $this->password                 = $_SESSION['phpgw_info']['instant_messenger']['password_ldap_jabber']; 
    18                 $this->jid                      = $_SESSION['phpgw_info']['instant_messenger']['user']; 
    19                 $this->connect_ldap(true); 
     18                $this->jid                              = $_SESSION['phpgw_info']['instant_messenger']['user']; 
     19                $this->connect_ldap(false); 
    2020                session_write_close(); 
    2121        } 
    22                  
    23         function valor() 
    24         { 
    25  
    26                 if ($this->conn)  
    27                 { 
    28                         $filter="ou=*";          
    29                         $justthese = array("ou"); 
    30                         $search = ldap_list($this->conn,$this->ldap_context, $filter, $justthese); 
    31                         return ldap_get_entries($this->conn, $search); 
    32                          
    33                         $entry = ldap_get_entries($this->conn, $search); 
    34                 } 
    35                  
    36         }        
    37                  
     22         
    3823        function __destruct() 
    3924        { 
     
    5439        function get_photo_ldap($pUser,$getPhoto) 
    5540        { 
    56                 $user = ( $pUser == "im__avatar" ) ? $this->jid : $pUser ; 
     41                $user = ( $pUser == "im_avatar" ) ? $this->jid : $pUser ; 
    5742                 
    5843                if ($this->conn)  
     
    9479        function photo_ldap($user) 
    9580        { 
    96                 $uid = ( $user['uid'] == "im__avatar" ) ? $this->jid : $user['uid'] ; 
     81                $uid = ( $user['uid'] == "im_avatar" ) ? $this->jid : $user['uid'] ; 
    9782                return $this->get_photo_ldap($uid,false); 
    9883        } 
     
    176161                 
    177162                foreach($entry as $tmp) 
    178                         if(trim($tmp['ou'][0]) != "") 
     163                        if($tmp['ou'][0] != "") 
    179164                                $result_org .= "<ou>" . $tmp['ou'][0] . "</ou>";   
    180165 
    181166                $result_org .= "</organizations>"; 
    182  
     167                 
    183168                return $result_org; 
    184169        } 
  • trunk/instant_messenger/inc/controller.xml

    r287 r305  
    2020                        <item ref="connector" js="connector" /> 
    2121                        <item ref="xtools" js="xtools" /> 
     22                        <item ref="ldap" js="ldap" /> 
    2223                        <item ref="jabber" js="jabber" /> 
    2324                        <item ref="client" js="client" /> 
     
    2526                        <item ref="dragdrop" js="dragdrop" /> 
    2627                        <item ref="build_win" js="build_win" /> 
     28                        <item ref="windows" js="windows" /> 
    2729                        <item ref="templates" js="templates" /> 
    2830                        <item ref="fcommon" js="fcommon" /> 
    29                         <item ref="menu_action" js="menu_action" /> 
     31                        <item ref="show_hidden" js="show_hidden" /> 
    3032                        <item ref="functions" js="functions" /> 
    3133                        <item ref="images" js="images" /> 
     
    3739                        <item ref="db_im" alias="get_preferences" class="db_im" method="get_preferences" prefix="class." suffix=".inc.php"/> 
    3840                        <item ref="db_im" alias="set_preferences" class="db_im" method="set_preferences" prefix="class." suffix=".inc.php"/> 
    39                         <item ref="ldap_im" alias="list_organizations_ldap" class="ldap_im" method="list_organizations_ldap" prefix="class." suffix=".inc.php"/>                                         
    40                         <item ref="ldap_im" alias="photo_ldap" class="ldap_im" method="photo_ldap" prefix="class." suffix=".inc.php"/>                                   
    41                         <item ref="Ujabber" alias="addContacts" class="Ujabber" method="addContacts" prefix="class." suffix=".inc.php" /> 
     41                        <item ref="ldap_im" alias="list_organizations_ldap" class="ldap_im" method="list_organizations_ldap" prefix="class." suffix=".inc.php"/> 
     42                        <item ref="ldap_im" alias="photo_ldap" class="ldap_im" method="photo_ldap" prefix="class." suffix=".inc.php"/> 
     43                        <item ref="Ujabber" alias="addContact" class="Ujabber" method="addContact" prefix="class." suffix=".inc.php" /> 
    4244                        <item ref="Ujabber" alias="listen" class="Ujabber" method="listen" prefix="class." suffix=".inc.php" /> 
    4345                        <item ref="Ujabber" alias="getContacts" class="Ujabber" method="getContacts" prefix="class." suffix=".inc.php" /> 
    44                         <item ref="Ujabber" alias="get_last_access_user" class="Ujabber" method="get_last_access_user" prefix="class." suffix=".inc.php" /> 
    4546                        <item ref="Ujabber" alias="getVcard" class="Ujabber" method="getVcard" prefix="class." suffix=".inc.php" /> 
    4647                        <item ref="Ujabber" alias="newVcard" class="Ujabber" method="newVcard" prefix="class." suffix=".inc.php" /> 
     
    4849                        <item ref="Ujabber" alias="setPresence" class="Ujabber" method="setPresence" prefix="class." suffix=".inc.php" /> 
    4950                        <item ref="Ujabber" alias="sendMessage" class="Ujabber" method="sendMessage" prefix="class." suffix=".inc.php" /> 
    50                         <item ref="Ujabber" alias="subscription" class="Ujabber" method="subscription" prefix="class." suffix=".inc.php" />                      
     51                        <item ref="Ujabber" alias="subscription" class="Ujabber" method="subscription" prefix="class." suffix=".inc.php" /> 
     52                        <item ref="Ujabber" alias="allowContact" class="Ujabber" method="allowContact" prefix="class." suffix=".inc.php" /> 
    5153                        <item ref="Ujabber" alias="updateContact" class="Ujabber" method="updateContact" prefix="class." suffix=".inc.php" /> 
    5254                        <item ref="Ujabber" alias="setStatus" class="Ujabber" method="setStatus" prefix="class." suffix=".inc.php" /> 
  • trunk/instant_messenger/inc/im_acl.inc.php

    r287 r305  
    33$size_of_acl = sizeof($GLOBALS['phpgw_info']['user']['acl']); 
    44 
    5 # percorre a ACL até o fim ou até encontrar a entrada para o módulo de mensagem instantânea 
     5# percorre a ACL até o fim ou até encontrar a entrada para o módulo de mensagem instantânea 
    66for ( $i = 0; $i < $size_of_acl && $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] != 'instant_messenger'; $i++ ); 
    77 
    8 # verifica se foi encontrada a permissão para o módulo de mensagem instantânea 
     8# verifica se foi encontrada a permissão para o módulo de mensagem instantânea 
    99if ( $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] == 'instant_messenger' ) 
    1010{ 
    11         $webserver_url_im = $GLOBALS['phpgw_info']['server']['webserver_url']; 
    12         $webserver_url_im = ( !empty($webserver_url_im) ) ? $webserver_url_im : '/'; 
     11        $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; 
     12        $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/'; 
    1313 
    14         if ( strrpos($webserver_url_im, '/') === false || strrpos($webserver_url_im, '/') != (strlen($webserver_url_im) - 1) ) 
    15                 $webserver_url_im .= '/'; 
     14        if ( strrpos($webserver_url, '/') === false || strrpos($webserver_url, '/') != (strlen($webserver_url) - 1) ) 
     15                $webserver_url .= '/'; 
    1616 
    17         $webserver_url_im = $webserver_url_im . 'instant_messenger/'; 
     17        $webserver_url = $webserver_url . 'instant_messenger/'; 
    1818 
    1919        require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/im_sessions.inc.php'; 
    20         require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/load_lang.php'; 
     20        //require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/load_lang.php'; 
    2121 
    2222        $js = array( 
    2323                'connector', 
     24                'xtools', 
     25                'windows', 
    2426                'jabber', 
    25                 'xtools', 
    2627                'client', 
    27                 'images', 
     28                /*'images', 
    2829                'dragdrop', 
    29                 'build_win', 
    30                 'templates', 
    31                 'fcommon', 
    32                 'menu_action', 
     30                'templates',*/ 
     31                #'fcommon', 
     32                /*'menu_action', 
    3333                'functions', 
    3434                'images', 
    3535                'cookies_im', 
    36                 'load', 
     36                'load',*/ 
    3737        ); 
    3838 
    39         print '<script type="text/javascript">var path_im = "'.$webserver_url_im.'";</script>'; 
     39        print '<script type="text/javascript">var path_im = "'.$webserver_url.'";</script>'; 
    4040 
     41        #require_once dirname(__FILE__) . '/Controller.class.php'; 
    4142 
    42         require_once dirname(__FILE__) . '/Controller.class.php'; 
     43        #$controller = new Controller; 
     44        #$script = ''; 
     45        #foreach ( $js as $key => $val ) 
     46        #{ 
     47        #       $val = array('act' => 'j.' . $val); 
     48        #       $script .= $controller->exec($val); 
     49        #} 
    4350 
    44         $controller = new Controller; 
    45         $script = ''; 
    46         foreach ( $js as $key => $val ) 
    47         { 
    48                 $val = array('act' => 'j.' . $val); 
    49                 $script .= $controller->exec($val); 
    50         } 
     51        //printf("<script type=\"text/javascript\">%s</script>", $script); 
    5152 
    52         printf("<script type=\"text/javascript\">%s</script>", $script); 
     53        print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/window.css">'; 
     54        print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/chat.css">'; 
     55        print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/common.css">'; 
    5356 
    54         print '<link rel="stylesheet" type="text/css" href="' . $webserver_url_im . 'templates/default/css/window.css">'; 
    55         print '<link rel="stylesheet" type="text/css" href="' . $webserver_url_im . 'templates/default/css/chat.css">'; 
    56         print '<link rel="stylesheet" type="text/css" href="' . $webserver_url_im . 'templates/default/css/common.css">'; 
    57  
    58         # trecho de código javascript utilizado para 
    59         # controle de possí­vel erro no load do script 
    60         # feito acima e está sendo inserido via PHP 
    61         # pois é um complemento do procedimento acima 
    62         $init_client  = '<script type="text/javascript">'; 
    63         $init_client .= '       function im_init(pTimes)'; 
    64         $init_client .= '       {'; 
    65         $init_client .= '               if ( !pTimes )'; 
    66         $init_client .= '                       pTimes = 0;'; 
    67         $init_client .= '               if ( pTimes == 5 )'; 
    68         $init_client .= '                       return false;'; 
    69         $init_client .= '               if ( window.client )'; 
    70         $init_client .= '                       client();'; 
    71         $init_client .= '               else'; 
    72         $init_client .= '                       setTimeout("im_init("+(++pTimes)+")", (pTimes + 1) * 2000);'; 
    73         $init_client .= '       }'; 
    74         $init_client .= '       im_init();'; 
    75         $init_client .= '</script>'; 
    76         printf("%s", $init_client); 
     57        # trecho de código javascript utilizado para 
     58        # controle de possível erro no load do script 
     59        # feito acima e está sendo inserido via PHP 
     60        # pois é um complemento do procedimento acima 
     61        #$init_client  = '<script type="text/javascript">'; 
     62        #$init_client .= '      function im_init(pTimes)'; 
     63        #$init_client .= '      {'; 
     64        #$init_client .= '              if ( !pTimes )'; 
     65        #$init_client .= '                      pTimes = 0;'; 
     66        #$init_client .= '              if ( pTimes == 5 )'; 
     67        #$init_client .= '                      return false;'; 
     68        #$init_client .= '              if ( window.InstantMessengerClient )'; 
     69        #$init_client .= '                      InstantMessengerClient();'; 
     70        #$init_client .= '              else'; 
     71        #$init_client .= '                      setTimeout("im_init("+(++pTimes)+")", (pTimes + 1) * 2000);'; 
     72        #$init_client .= '      }'; 
     73        #$init_client .= '      var bkp_onload = window.onload;'; 
     74        #$init_client .= '      window.onload = function(){if (typeof bkp_onload == "function") bkp_onload();setTimeout("im_init()",10000);};'; 
     75        #$init_client .= '</script>'; 
     76        //printf("%s", $init_client); 
     77        echo '<iframe style="display:none" height="100%" !width="100%" src="'.$webserver_url.'client.php"></iframe>'; 
    7778} 
    7879?> 
  • trunk/instant_messenger/inc/im_sessions.inc.php

    r287 r305  
    11<?php 
    2          
     2 
    33                $_SESSION['phpgw_info']['instant_messenger']['user']             = $GLOBALS['phpgw_info']['user']['account_lid']; 
    4                 $_SESSION['phpgw_info']['instant_messenger']['user_id']          = $GLOBALS['phpgw_info']['user']['account_id'];                 
     4                $_SESSION['phpgw_info']['instant_messenger']['user_id']                 = $GLOBALS['phpgw_info']['user']['account_id'];                 
    55                $_SESSION['phpgw_info']['instant_messenger']['passwd']           = $GLOBALS['phpgw_info']['user']['passwd']; 
    6                 $_SESSION['phpgw_info']['instant_messenger']['name_jabber']      = $GLOBALS['phpgw_info']['server']['name_jabber']; 
    7                 $_SESSION['phpgw_info']['instant_messenger']['port_jabber']      = $GLOBALS['phpgw_info']['server']['port_jabber']; 
    8                 $_SESSION['phpgw_info']['instant_messenger']['resource_jabber']  = $GLOBALS['phpgw_info']['server']['resource_jabber']; 
     6                #$_SESSION['phpgw_info']['instant_messenger']['name_jabber']      = $GLOBALS['phpgw_info']['server']['name_jabber']; 
     7                #$_SESSION['phpgw_info']['instant_messenger']['port_jabber']      = $GLOBALS['phpgw_info']['server']['port_jabber']; 
     8                #$_SESSION['phpgw_info']['instant_messenger']['resource_jabber']  = $GLOBALS['phpgw_info']['server']['resource_jabber']; 
     9                #$_SESSION['phpgw_info']['instant_messenger']['tls_jabber']      = $GLOBALS['phpgw_info']['server']['tls_jabber']; 
    910                 
    10                 $_SESSION['phpgw_info']['instant_messenger']['server_ldap_jabber']      = $GLOBALS['phpgw_info']['server']['server_ldap_jabber']; 
    11                 $_SESSION['phpgw_info']['instant_messenger']['context_ldap_jabber']     = $GLOBALS['phpgw_info']['server']['context_ldap_jabber']; 
    12                 $_SESSION['phpgw_info']['instant_messenger']['user_ldap_jabber']        = $GLOBALS['phpgw_info']['server']['user_ldap_jabber']; 
    13                 $_SESSION['phpgw_info']['instant_messenger']['password_ldap_jabber']    = $GLOBALS['phpgw_info']['server']['password_ldap_jabber']; 
    14                 $_SESSION['phpgw_info']['instant_messenger']['webjabber']               = $GLOBALS['phpgw_info']['server']['webjabber'];                 
     11                $_SESSION['phpgw_info']['instant_messenger']['server_ldap_jabber']   = $GLOBALS['phpgw_info']['server']['server_ldap_jabber']; 
     12                $_SESSION['phpgw_info']['instant_messenger']['context_ldap_jabber']  = $GLOBALS['phpgw_info']['server']['context_ldap_jabber']; 
     13                $_SESSION['phpgw_info']['instant_messenger']['user_ldap_jabber']     = $GLOBALS['phpgw_info']['server']['user_ldap_jabber']; 
     14                $_SESSION['phpgw_info']['instant_messenger']['password_ldap_jabber'] = $GLOBALS['phpgw_info']['server']['password_ldap_jabber']; 
     15                $_SESSION['phpgw_info']['instant_messenger']['webjabber']                        = $GLOBALS['phpgw_info']['server']['wejabber'];                 
    1516                 
    1617                $_SESSION['phpgw_info']['instant_messenger']['server']['db_name'] = $GLOBALS['phpgw_info']['server']['db_name']; 
     
    2021                $_SESSION['phpgw_info']['instant_messenger']['server']['db_pass'] = $GLOBALS['phpgw_info']['server']['db_pass']; 
    2122                $_SESSION['phpgw_info']['instant_messenger']['server']['db_type'] = $GLOBALS['phpgw_info']['server']['db_type']; 
    22                  
     23 
    2324?> 
  • trunk/instant_messenger/inc/load_lang.php

    r287 r305  
    1212        } 
    1313 
    14 $script  = '<script>'; 
    15 $script .= 'var lang_im = [];'; 
     14$script  = '<script>function imGetLang(pKey){'; 
     15$script .= 'var lang = [];'; 
    1616 
    1717foreach ( $LANG_IM as $key => $value ) 
    18    $script .= "lang_im['" . strtolower(addslashes($key)) . "'] = '" . addslashes($value) . "';"; 
     18   $script .= "lang['" . strtolower(addslashes($key)) . "'] = '" . addslashes($value) . "';"; 
    1919 
    20 $script .= '</script>'; 
     20$script .= "return lang[pKey.toLowerCase()] || '* ' + pKey;}</script>"; 
    2121 
    2222echo $script; 
  • trunk/instant_messenger/inc/teste.php

    r287 r305  
    11<?php 
    22 
    3 require_once "class.Jabber.inc.php"; 
     3require_once 'class.Ujabber.inc.php'; 
    44 
    5         $a = new Jabber(); 
     5$a = new Ujabber; 
    66 
     7exit; 
     8$fp = stream_socket_client("tcp://im.pr.gov.br:8800", $errno, $errstr, 30); 
     9if (!$fp) { 
     10  die("Unable to connect: $errstr ($errno)"); 
     11} 
     12 
     13$xml  = "<?xml version='1.0' ?>"; 
     14$xml .= "<stream:stream to='im.pr.gov.br' xmlns='jabber:client' "; 
     15$xml .= "xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>"; 
     16fwrite($fp, $xml); 
     17usleep(50000); 
     18echo fread($fp, 4096); 
     19echo "\n\n"; 
     20 
     21$xml = "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"; 
     22fwrite($fp, $xml); 
     23usleep(50000); 
     24echo fread($fp, 4096); 
     25echo "\n\n"; 
     26 
     27stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); 
     28 
     29$xml  = "<?xml version='1.0' encoding='UTF-8'?>"; 
     30$xml .= "<stream:stream to='im.pr.gov.br' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>"; 
     31fwrite($fp, $xml); 
     32usleep(50000); 
     33echo fread($fp, 4096); 
     34echo "\n\n"; 
     35 
     36usleep(50000); 
     37echo fread($fp, 4096); 
     38echo "\n\n"; 
     39 
     40$xml  = "<iq type='set' id='conn'><query xmlns='jabber:iq:auth'>"; 
     41$xml .= "<username>teste9</username>"; 
     42$xml .= "<password>teste99</password>"; 
     43$xml .= "<resource>IM</resource>"; 
     44$xml .= "</query></iq>"; 
     45fwrite($fp, $xml); 
     46usleep(50000); 
     47echo fread($fp, 4096); 
     48echo "\n\n"; 
     49 
     50stream_set_blocking ($fp, false); 
     51$xml  = "<presence xmlns='jabber:client' from='alexandrecorreia@im.pr.gov.br' />"; 
     52fwrite($fp, $xml); 
     53usleep(50000); 
     54//echo fread($fp, 4096); 
     55//echo "\n\n"; 
     56 
     57//while(1)  
     58//{ 
     59//      echo fread($fp, 4096); 
     60//      echo "\n\n"; 
     61//      sleep(1); 
     62//} 
     63 
     64echo "=================================================\n\n"; 
     65 
     66$time = time(); 
     67                do 
     68                { 
     69                        $line = NULL; 
     70                        $line = fread($fp, 4096); 
     71 
     72                        if ( !empty($line) ) 
     73                                var_dump($line); 
     74                } 
     75                while ( time() - $time < 20 ); 
     76fclose($fp); 
     77 
     78 
     79        exit(0); 
    780        session_start(); 
    8          
    9         $a->username    = $_SESSION['phpgw_info']['instant_messenger']['user']; 
    10         $a->password    = $_SESSION['phpgw_info']['instant_messenger']['passwd']; 
    11         $a->server      = $_SESSION['phpgw_info']['instant_messenger']['name_jabber']; 
    12         $a->port        = "5222"; 
    13         $a->resource    = "webb"; 
    14          
    15         session_write_close(); 
    16          
    17         echo "Conectando no Jabber"; 
    18  
    19         $a->Connect(); 
    20         $a->SendAuth(); 
    21  
    22         $a->RosterUpdateXML(); 
    2381 
    2482        echo "<pre>"; 
    25         print_r($a->roster); 
     83        print_r($_SESSION['debug']); 
    2684        echo "</pre>"; 
    2785 
    28         $a->Disconnect(); 
     86        session_write_close(); 
     87 
    2988 
    3089?> 
Note: See TracChangeset for help on using the changeset viewer.