Changeset 305 for trunk/instant_messenger/inc
- Timestamp:
- 06/06/08 13:54:09 (16 years ago)
- Location:
- trunk/instant_messenger/inc
- Files:
-
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/instant_messenger/inc/Controller.class.php
r287 r305 155 155 $obj = new ReflectionClass($class); 156 156 157 if ( $pRequest['classCo nstructor'] )157 if ( $pRequest['classCostructor'] ) 158 158 { 159 $obj = $obj->newInstance($pRequest['classCo nstructor']);160 unset($pRequest['classCo nstructor']);159 $obj = $obj->newInstance($pRequest['classCostructor']); 160 unset($pRequest['classCostructor']); 161 161 } 162 162 else -
trunk/instant_messenger/inc/Jabber.abstract.php
r287 r305 33 33 34 34 private final function _connect( $pUser = false, $pPassword = false, $pConnectionType = false, $pWebjabber = false ) 35 { 35 { 36 36 try 37 37 { … … 48 48 49 49 $this->_socket = $socket; 50 50 51 51 //stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); 52 52 53 53 fwrite($socket, "{$USER}@{$SERVER}##{$pPassword}##{$pConnectionType}"); 54 54 … … 80 80 81 81 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); 86 86 87 87 if ( !$_connect ) … … 162 162 163 163 usleep(50000); 164 164 165 165 fread($this->_socket, 4096); 166 166 167 167 if ( !$this->_plain() ) 168 168 throw new Exception('[starttls] #3 it isn\'t possible carry out the verification. File: ' . __FILE__ . ' :: ' . __LINE__); … … 186 186 throw new Exception('[_plain] #1 it isn\'t possible read the socket. File: ' . __FILE__ . ' :: ' . __LINE__); 187 187 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>"; 191 191 192 192 unset($this->_password); -
trunk/instant_messenger/inc/Jabberd2.abstract.php
r287 r305 7 7 class Jabberd2 extends Jabber 8 8 { 9 final function connect($pUser = false, $pPassword = false, $pConnectionType = false )9 final function connect($pUser = false, $pPassword = false, $pConnectionType = false, $pWebjabber = false ) 10 10 { 11 11 try 12 12 { 13 13 if ( $pUser && $pPassword && $pConnectionType ) 14 if ( $_connect = parent::connect($pUser, $pPassword, $pConnectionType ) )14 if ( $_connect = parent::connect($pUser, $pPassword, $pConnectionType, $pWebjabber) ) 15 15 return $_connect; 16 16 … … 48 48 */ 49 49 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) ) 60 64 { 61 $newcontact = "<item jid='".$jid."'"; 62 $newcontact .= " name='" . $name . "'"; 63 $newcontact .= "><group>" . $group . "</group></item>"; 65 $this->getContacts(); 66 return true; 64 67 } 65 68 } 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'); 75 76 } 76 77 … … 89 90 $jid = ( trim($pJid['jid']) == "this" ) ? $this->_user . '@' . $this->_server : $pJid['jid']; 90 91 $vcard = (trim($pJid['jid']) == "this") ? 'vCard_user' : 'vCard'; 91 92 92 93 if ( !$this->connected ) 93 94 { … … 120 121 final function removeContact($pContact) 121 122 { 122 $delid = 'deluser_' . time();123 123 if ( !$this->isConnected() ) 124 124 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'); 129 140 } 130 141 … … 141 152 return true; 142 153 } 143 }144 145 final function compression()146 {147 $compress = "<compress xmlns='http://jabber.org/protocol/compress'><method>zlib</method></compress>";148 $this->writeSocket($compress);149 154 } 150 155 … … 166 171 } 167 172 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 175 173 final function setStatus() 176 174 { 177 175 $this->setPresence(array("type" => "unavailable")); 178 $this->setPresence(array("type" => "available")); 176 $this->setPresence(array("type" => "available")); 179 177 } 180 178 -
trunk/instant_messenger/inc/Socket.abstract.php
r287 r305 52 52 set_magic_quotes_runtime(0); 53 53 $return = @fread($pSocket, $pLength); 54 set_magic_quotes_runtime(get_magic_quotes_gpc()); 54 55 55 set_magic_quotes_runtime(get_magic_quotes_gpc());56 56 57 57 if ( $php_errormsg ) -
trunk/instant_messenger/inc/class.Ujabber.inc.php
r287 r305 1 1 <?php 2 2 #error_reporting(E_ALL); 3 3 require_once 'Jabberd2.abstract.php'; 4 4 5 5 class Ujabber extends Jabberd2 6 6 { 7 private $set_presence;8 9 7 public final function __construct($pConnectionType = 'write') 10 { 11 session_start(); 8 { 9 /*session_start(); 10 12 11 $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']; 13 15 $this->_pass = $_SESSION['phpgw_info']['instant_messenger']['passwd']; 14 16 $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']; 16 18 $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']; 19 21 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 23 49 $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 } 24 57 } 25 58 … … 30 63 flush(); 31 64 } 32 65 33 66 public final function isConnected() 34 67 { … … 40 73 if ( !$this->isConnected() ) 41 74 return "disconnected"; 42 43 $this->get_last_access_user(array("jid" => "this"));44 75 45 76 if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) … … 56 87 57 88 $init = time(); 89 $buffer = ''; 58 90 59 91 while ( ( connection_aborted() === 0 ) && time() - $init < 50 ) 60 92 { 61 if( isset($xml) )62 unset($xml);63 64 93 # read from server and write in the client 65 94 $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 } 66 112 $xml = ( strlen($xml) ) ? $xml : ' '; 67 //$xml = ( strlen($xml) ) ? $xml : '_##_';68 113 printf("%s", $xml); 69 114 ob_flush(); … … 85 130 $pSendMessage['body'] = preg_replace($patterns, $replace, $pSendMessage['body']); 86 131 87 $_emotions = '/<img[^>]*emotion="(\S+)?"[^>]*>/'; 132 $_emotions = '/<img emotion="(\S+)?"[^>]+>/'; 88 133 $_emotions = preg_match_all($_emotions, $pSendMessage['body'], $emotions); 89 134 … … 134 179 135 180 //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>"; 137 182 $xml .= $payload; 138 183 $xml .= "</message>"; -
trunk/instant_messenger/inc/class.db_im.inc.php
r287 r305 19 19 function db_im() 20 20 { 21 21 22 session_start(); 22 23 $this->db_name = $_SESSION['phpgw_info']['instant_messenger']['server']['db_name']; -
trunk/instant_messenger/inc/class.ldap_im.inc.php
r287 r305 2 2 class ldap_im 3 3 { 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; 10 10 11 11 function __construct() … … 13 13 session_start(); 14 14 $this->ldap_host = $_SESSION['phpgw_info']['instant_messenger']['server_ldap_jabber']; 15 $this->ldap_context 15 $this->ldap_context = $_SESSION['phpgw_info']['instant_messenger']['context_ldap_jabber']; 16 16 $this->user = $_SESSION['phpgw_info']['instant_messenger']['user_ldap_jabber']; 17 17 $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); 20 20 session_write_close(); 21 21 } 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 38 23 function __destruct() 39 24 { … … 54 39 function get_photo_ldap($pUser,$getPhoto) 55 40 { 56 $user = ( $pUser == "im_ _avatar" ) ? $this->jid : $pUser ;41 $user = ( $pUser == "im_avatar" ) ? $this->jid : $pUser ; 57 42 58 43 if ($this->conn) … … 94 79 function photo_ldap($user) 95 80 { 96 $uid = ( $user['uid'] == "im_ _avatar" ) ? $this->jid : $user['uid'] ;81 $uid = ( $user['uid'] == "im_avatar" ) ? $this->jid : $user['uid'] ; 97 82 return $this->get_photo_ldap($uid,false); 98 83 } … … 176 161 177 162 foreach($entry as $tmp) 178 if( trim($tmp['ou'][0])!= "")163 if($tmp['ou'][0] != "") 179 164 $result_org .= "<ou>" . $tmp['ou'][0] . "</ou>"; 180 165 181 166 $result_org .= "</organizations>"; 182 167 183 168 return $result_org; 184 169 } -
trunk/instant_messenger/inc/controller.xml
r287 r305 20 20 <item ref="connector" js="connector" /> 21 21 <item ref="xtools" js="xtools" /> 22 <item ref="ldap" js="ldap" /> 22 23 <item ref="jabber" js="jabber" /> 23 24 <item ref="client" js="client" /> … … 25 26 <item ref="dragdrop" js="dragdrop" /> 26 27 <item ref="build_win" js="build_win" /> 28 <item ref="windows" js="windows" /> 27 29 <item ref="templates" js="templates" /> 28 30 <item ref="fcommon" js="fcommon" /> 29 <item ref=" menu_action" js="menu_action" />31 <item ref="show_hidden" js="show_hidden" /> 30 32 <item ref="functions" js="functions" /> 31 33 <item ref="images" js="images" /> … … 37 39 <item ref="db_im" alias="get_preferences" class="db_im" method="get_preferences" prefix="class." suffix=".inc.php"/> 38 40 <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="addContact s" 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" /> 42 44 <item ref="Ujabber" alias="listen" class="Ujabber" method="listen" prefix="class." suffix=".inc.php" /> 43 45 <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" />45 46 <item ref="Ujabber" alias="getVcard" class="Ujabber" method="getVcard" prefix="class." suffix=".inc.php" /> 46 47 <item ref="Ujabber" alias="newVcard" class="Ujabber" method="newVcard" prefix="class." suffix=".inc.php" /> … … 48 49 <item ref="Ujabber" alias="setPresence" class="Ujabber" method="setPresence" prefix="class." suffix=".inc.php" /> 49 50 <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" /> 51 53 <item ref="Ujabber" alias="updateContact" class="Ujabber" method="updateContact" prefix="class." suffix=".inc.php" /> 52 54 <item ref="Ujabber" alias="setStatus" class="Ujabber" method="setStatus" prefix="class." suffix=".inc.php" /> -
trunk/instant_messenger/inc/im_acl.inc.php
r287 r305 3 3 $size_of_acl = sizeof($GLOBALS['phpgw_info']['user']['acl']); 4 4 5 # percorre a ACL at é o fim ou até encontrar a entrada para o módulo de mensagem instantânea5 # percorre a ACL até o fim ou até encontrar a entrada para o módulo de mensagem instantânea 6 6 for ( $i = 0; $i < $size_of_acl && $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] != 'instant_messenger'; $i++ ); 7 7 8 # verifica se foi encontrada a permiss ão para o módulo de mensagem instantânea8 # verifica se foi encontrada a permissão para o módulo de mensagem instantânea 9 9 if ( $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] == 'instant_messenger' ) 10 10 { 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 : '/'; 13 13 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 .= '/'; 16 16 17 $webserver_url _im = $webserver_url_im. 'instant_messenger/';17 $webserver_url = $webserver_url . 'instant_messenger/'; 18 18 19 19 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'; 21 21 22 22 $js = array( 23 23 'connector', 24 'xtools', 25 'windows', 24 26 'jabber', 25 'xtools',26 27 'client', 27 'images',28 /*'images', 28 29 'dragdrop', 29 'build_win', 30 'templates', 31 'fcommon', 32 'menu_action', 30 'templates',*/ 31 #'fcommon', 32 /*'menu_action', 33 33 'functions', 34 34 'images', 35 35 'cookies_im', 36 'load', 36 'load',*/ 37 37 ); 38 38 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>'; 40 40 41 #require_once dirname(__FILE__) . '/Controller.class.php'; 41 42 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 #} 43 50 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); 51 52 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">'; 53 56 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>'; 77 78 } 78 79 ?> -
trunk/instant_messenger/inc/im_sessions.inc.php
r287 r305 1 1 <?php 2 2 3 3 $_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']; 5 5 $_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']; 9 10 10 $_SESSION['phpgw_info']['instant_messenger']['server_ldap_jabber'] 11 $_SESSION['phpgw_info']['instant_messenger']['context_ldap_jabber'] 12 $_SESSION['phpgw_info']['instant_messenger']['user_ldap_jabber'] 13 $_SESSION['phpgw_info']['instant_messenger']['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']; 15 16 16 17 $_SESSION['phpgw_info']['instant_messenger']['server']['db_name'] = $GLOBALS['phpgw_info']['server']['db_name']; … … 20 21 $_SESSION['phpgw_info']['instant_messenger']['server']['db_pass'] = $GLOBALS['phpgw_info']['server']['db_pass']; 21 22 $_SESSION['phpgw_info']['instant_messenger']['server']['db_type'] = $GLOBALS['phpgw_info']['server']['db_type']; 22 23 23 24 ?> -
trunk/instant_messenger/inc/load_lang.php
r287 r305 12 12 } 13 13 14 $script = '<script> ';15 $script .= 'var lang _im= [];';14 $script = '<script>function imGetLang(pKey){'; 15 $script .= 'var lang = [];'; 16 16 17 17 foreach ( $LANG_IM as $key => $value ) 18 $script .= "lang _im['" . strtolower(addslashes($key)) . "'] = '" . addslashes($value) . "';";18 $script .= "lang['" . strtolower(addslashes($key)) . "'] = '" . addslashes($value) . "';"; 19 19 20 $script .= '</script>';20 $script .= "return lang[pKey.toLowerCase()] || '* ' + pKey;}</script>"; 21 21 22 22 echo $script; -
trunk/instant_messenger/inc/teste.php
r287 r305 1 1 <?php 2 2 3 require_once "class.Jabber.inc.php";3 require_once 'class.Ujabber.inc.php'; 4 4 5 $a = new Jabber();5 $a = new Ujabber; 6 6 7 exit; 8 $fp = stream_socket_client("tcp://im.pr.gov.br:8800", $errno, $errstr, 30); 9 if (!$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'>"; 16 fwrite($fp, $xml); 17 usleep(50000); 18 echo fread($fp, 4096); 19 echo "\n\n"; 20 21 $xml = "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"; 22 fwrite($fp, $xml); 23 usleep(50000); 24 echo fread($fp, 4096); 25 echo "\n\n"; 26 27 stream_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'>"; 31 fwrite($fp, $xml); 32 usleep(50000); 33 echo fread($fp, 4096); 34 echo "\n\n"; 35 36 usleep(50000); 37 echo fread($fp, 4096); 38 echo "\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>"; 45 fwrite($fp, $xml); 46 usleep(50000); 47 echo fread($fp, 4096); 48 echo "\n\n"; 49 50 stream_set_blocking ($fp, false); 51 $xml = "<presence xmlns='jabber:client' from='alexandrecorreia@im.pr.gov.br' />"; 52 fwrite($fp, $xml); 53 usleep(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 64 echo "=================================================\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 ); 76 fclose($fp); 77 78 79 exit(0); 7 80 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();23 81 24 82 echo "<pre>"; 25 print_r($ a->roster);83 print_r($_SESSION['debug']); 26 84 echo "</pre>"; 27 85 28 $a->Disconnect(); 86 session_write_close(); 87 29 88 30 89 ?>
Note: See TracChangeset
for help on using the changeset viewer.