Esempio n. 1
0
 /**
  * get's callend then online user does a pageview
  *
  * @param array $params            
  */
 public function onlineUserPageViewLogged($params)
 {
     if ($this->settings['enabled'] == true && $this->settings['online_visitors_tracking'] == true) {
         $onlineOptions = erLhcoreClassModelChatConfig::fetch('xmppservice_options')->data;
         if (isset($onlineOptions['track_online']) && $onlineOptions['track_online'] == true) {
             if (($xmppAccount = erLhcoreClassModelXMPPAccount::findOne(array('filter' => array('type' => erLhcoreClassModelXMPPAccount::USER_TYPE_VISITOR, 'user_id' => $params['ou']->id)))) !== false) {
                 if ($this->settings['handler'] == 'rpc' && is_object($params['tpl']) && $this->settings['online_visitors_tracking'] == true) {
                     /**
                      * In the future then websockets will support attatch method this could be used
                      * */
                     /* $xmppAccount->attach_data = erLhcoreClassExtensionXmppserviceHandler::prebindSession(array(
                            'username' => $xmppAccount->username,
                            'password' => $xmppAccount->password,
                            'host' => $this->settings['prebind_host'] . $xmppAccount->username_plain,
                        )); */
                     $params['tpl']->set('xmppAccount', $xmppAccount);
                 }
                 // Forward this information to NodeJS server
                 erLhcoreClassExtensionXmppserviceHandler::onlineUserPageViewLogged(array('xmpp_account' => $xmppAccount, 'ou' => $params['ou'], 'host_login' => $this->settings['host_login'], 'node_api_server' => $this->settings['node_api_server'], 'handler' => $this->settings['handler'], 'xmpp_host' => $this->settings['xmpp_host'], 'rpc_server' => $this->settings['rpc_server'], 'rpc_username' => $this->settings['rpc_username'], 'rpc_password' => $this->settings['rpc_password'], 'rpc_account_host' => $this->settings['rpc_account_host']));
             }
         }
     }
 }
<?php

if (isset($Result['chat']) && is_numeric($Result['chat']->id)) {
    $xmppServiceExtension = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice');
    if ($xmppServiceExtension->settings['enabled'] == true && ($xmppAccount = $xmppServiceExtension->getXMPPAccountByChat($Result['chat'])) !== false) {
        $pageUser = $Result['chat']->online_user !== false ? $Result['chat']->online_user->current_page : '';
        $paramsOnline = erLhcoreClassExtensionXmppserviceHandler::getNickAndStatusByChat($Result['chat'], $pageUser);
        ?>
<script>var xmppservice = {debug:<?php 
        echo $xmppServiceExtension->settings['debug'] == true ? 'true' : 'false';
        ?>
,use_notification:<?php 
        echo $xmppServiceExtension->settings['use_notification'] == true ? 'true' : 'false';
        ?>
,nick:<?php 
        echo json_encode($paramsOnline['nick']);
        ?>
,status:<?php 
        echo json_encode($paramsOnline['status']);
        ?>
,BOSH_SERVICE : '<?php 
        echo $xmppServiceExtension->settings['bosh_service'];
        ?>
', USR : <?php 
        echo json_encode($xmppAccount->username);
        ?>
,PSW : <?php 
        echo json_encode($xmppAccount->password);
        ?>
}</script>
<script type="text/javascript" language="javascript" src="<?php 
<?php

if (isset($xmppAccount)) {
    $xmppServiceExtension = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice');
    if ($xmppServiceExtension->settings['enabled'] == true && $xmppServiceExtension->settings['online_visitors_tracking'] == true) {
        $paramsOnline = erLhcoreClassExtensionXmppserviceHandler::getNickAndStatusByOnlineVisitor($visitor);
        ?>
var xmppservice = {debug:<?php 
        echo $xmppServiceExtension->settings['debug'] == true ? 'true' : 'false';
        ?>
,use_notification:<?php 
        echo $xmppServiceExtension->settings['use_notification'] == true ? 'true' : 'false';
        ?>
,nick:<?php 
        echo json_encode($paramsOnline['nick']);
        ?>
,status:<?php 
        echo json_encode($paramsOnline['status']);
        ?>
,BOSH_SERVICE : '<?php 
        echo $xmppServiceExtension->settings['bosh_service'];
        ?>
', USR : <?php 
        echo json_encode($xmppAccount->username);
        ?>
,PSW : <?php 
        echo json_encode($xmppAccount->password);
        ?>
};
var th = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
Esempio n. 4
0
<?php

/* This is what messages looks like
$params = array(		
		'body' => 'PArasiau vartotojui zinute',
		'sender' => 'remdex2',
		'receiver' => 'visitor.6034.chat',
		'server' => 'xmpp.livehelperchat.com'
); */
//erLhcoreClassLog::write(print_r($_POST,true));
if (erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->settings['enabled'] == false) {
    erLhcoreClassModule::redirect('/');
    exit;
}
$params = array('body' => isset($_POST['body']) ? $_POST['body'] : '', 'sender' => isset($_POST['sender']) ? $_POST['sender'] : '', 'receiver' => isset($_POST['receiver']) ? $_POST['receiver'] : '', 'server' => isset($_POST['server']) ? $_POST['server'] : '');
try {
    if (!empty($params['body']) && !empty($params['sender']) && !empty($params['receiver']) && !empty($params['server'])) {
        erLhcoreClassExtensionXmppserviceHandler::handleMessageFromOperator($params);
    }
} catch (Exception $e) {
    if (erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->settings['debug'] == true) {
        erLhcoreClassLog::write(print_r($e, true));
    }
}
exit;
Esempio n. 5
0
<?php

if (erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->settings['enabled'] == false) {
    exit;
}
$content = file_get_contents("php://input");
try {
    erLhcoreClassExtensionXmppserviceHandler::handleOperatorPing($content);
} catch (Exception $e) {
    if (erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->settings['debug'] == true) {
        erLhcoreClassLog::write(print_r($e, true));
    }
}
exit;