Example #1
0
 public static function setupSMTP(PHPMailer &$phpMailer)
 {
     // Allow extension override mail settings
     $response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chatmail.setup_smtp', array('phpmailer' => &$phpMailer));
     if ($response !== false && isset($response['status']) && $response['status'] == erLhcoreClassChatEventDispatcher::STOP_WORKFLOW) {
         return;
     }
     $smtpData = erLhcoreClassModelChatConfig::fetch('smtp_data');
     $data = (array) $smtpData->data;
     if (isset($data['sender']) && $data['sender'] != '') {
         $phpMailer->Sender = $data['sender'];
     }
     if ($phpMailer->From == 'root@localhost') {
         $phpMailer->From = $data['default_from'];
     }
     if ($phpMailer->FromName == 'Root User') {
         $phpMailer->FromName = $data['default_from_name'];
     }
     if (isset($data['use_smtp']) && $data['use_smtp'] == 1) {
         $phpMailer->IsSMTP();
         $phpMailer->Host = $data['host'];
         $phpMailer->Port = $data['port'];
         if ($data['username'] != '' && $data['password'] != '') {
             $phpMailer->Username = $data['username'];
             $phpMailer->Password = $data['password'];
             $phpMailer->SMTPAuth = true;
             $phpMailer->From = isset($data['default_from']) ? $data['default_from'] : $data['username'];
         } else {
             $phpMailer->From = '';
         }
     }
 }
Example #2
0
 public function __get($var)
 {
     switch ($var) {
         case 'settings':
             $this->settings = erLhcoreClassModelChatConfig::fetch('sugarcrm_data')->data;
             return $this->settings;
             break;
         default:
             break;
     }
 }
Example #3
0
 /**
  * Opening chat widget
  * */
 public static function openChatWidget($params)
 {
     try {
         $chatPaid = erLhcoreClassModelChatPaid::fetch($params['pchat']);
         $paidchatData = erLhcoreClassModelChatConfig::fetch('paidchat_data');
         $data = (array) $paidchatData->data;
         if ((!isset($data['paidchat_read_denied']) || $data['paidchat_read_denied'] == 0) && $chatPaid->chat_id == $params['chat']->id) {
             $params['tpl']->set('paid_chat_params', array('allow_read' => true));
         }
     } catch (Exception $e) {
     }
 }
Example #4
0
 public static function setupSMTP(PHPMailer &$phpMailer)
 {
     $smtpData = erLhcoreClassModelChatConfig::fetch('smtp_data');
     $data = (array) $smtpData->data;
     if (isset($data['use_smtp']) && $data['use_smtp'] == 1) {
         $phpMailer->IsSMTP();
         $phpMailer->Host = $data['host'];
         $phpMailer->Port = $data['port'];
         if ($data['username'] != '' && $data['password'] != '') {
             $phpMailer->Username = $data['username'];
             $phpMailer->Password = $data['password'];
             $phpMailer->SMTPAuth = true;
         }
     }
 }
Example #5
0
 public static function getSpeechInstance(erLhcoreClassModelChat $chat)
 {
     $chatLanguageSession = null;
     $chatSpeech = erLhcoreClassModelSpeechChatLanguage::getList(array('filter' => array('chat_id' => $chat->id)));
     if (empty($chatSpeech)) {
         $chatLanguageSession = new erLhcoreClassModelSpeechChatLanguage();
         $chatLanguageSession->chat_id = $chat->id;
         $speechUserLanguage = erLhcoreClassModelUserSetting::getSetting('speech_language', '');
         $speechUserDialect = erLhcoreClassModelUserSetting::getSetting('speech_dialect', '');
         if ($speechUserLanguage != '' && $speechUserDialect != '') {
             $chatLanguageSession->dialect = $speechUserDialect;
             $chatLanguageSession->language_id = $speechUserLanguage;
         } else {
             $speechData = erLhcoreClassModelChatConfig::fetch('speech_data');
             $data = (array) $speechData->data;
             $chatLanguageSession->language_id = $data['language'];
             $chatLanguageSession->dialect = $data['dialect'];
         }
     } else {
         $chatLanguageSession = array_pop($chatSpeech);
     }
     return $chatLanguageSession;
 }
Example #6
0
 public static function setupSMTP(PHPMailer &$phpMailer)
 {
     $smtpData = erLhcoreClassModelChatConfig::fetch('smtp_data');
     $data = (array) $smtpData->data;
     if (isset($data['use_smtp']) && $data['use_smtp'] == 1) {
         $phpMailer->IsSMTP();
         $phpMailer->Host = $data['host'];
         $phpMailer->Port = $data['port'];
         if ($data['username'] != '' && $data['password'] != '') {
             $phpMailer->Username = $data['username'];
             $phpMailer->Password = $data['password'];
             $phpMailer->SMTPAuth = true;
         }
     }
     if (isset($data['sender']) && $data['sender'] != '') {
         $phpMailer->Sender = $data['sender'];
     }
     if ($phpMailer->From == 'root@localhost') {
         $phpMailer->From = $data['default_from'];
     }
     if ($phpMailer->FromName == 'Root User') {
         $phpMailer->FromName = $data['default_from_name'];
     }
 }
<?php

$currentUser = erLhcoreClassUser::instance();
$onlineTimeout = (int) erLhcoreClassModelChatConfig::fetchCache('sync_sound_settings')->data['online_timeout'];
$canListOnlineUsers = false;
$canListOnlineUsersAll = false;
if (erLhcoreClassModelChatConfig::fetchCache('list_online_operators')->current_value == 1) {
    $canListOnlineUsers = $currentUser->hasAccessTo('lhuser', 'userlistonline');
    $canListOnlineUsersAll = $currentUser->hasAccessTo('lhuser', 'userlistonlineall');
}
// We do not need a session anymore
session_write_close();
$ReturnMessages = array();
$pendingTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_pending_list', 1);
$activeTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_active_list', 1);
$closedTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_close_list', 0);
$unreadTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_unread_list', 1);
$showAllPending = erLhcoreClassModelUserSetting::getSetting('show_all_pending', 1);
$showDepartmentsStats = $currentUser->hasAccessTo('lhuser', 'canseedepartmentstats');
if ($showDepartmentsStats == true) {
    /**
     * Departments stats
     * */
    $limitList = is_numeric($Params['user_parameters_unordered']['limitd']) ? (int) $Params['user_parameters_unordered']['limitd'] : 10;
    $filter = array('ignore_fields' => erLhcoreClassChat::$chatListIgnoreField);
    $filter['limit'] = $limitList;
    if (is_array($Params['user_parameters_unordered']['departmentd']) && !empty($Params['user_parameters_unordered']['departmentd'])) {
        erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['departmentd']);
        $filter['filterin']['id'] = $Params['user_parameters_unordered']['departmentd'];
    }
    $filter['sort'] = 'pending_chats_counter DESC';
Example #8
0
<?php

$cfgSite = erConfigClassLhConfig::getInstance();
$secretHash = $cfgSite->getSetting('site', 'secrethash');
if ($Params['user_parameters']['validation_hash'] == sha1(sha1($Params['user_parameters']['email'] . $secretHash) . $secretHash)) {
    $accept = erLhcoreClassModelChatAccept::fetchByHash($Params['user_parameters']['hash']);
    if ($accept !== false) {
        $chat_id = $accept->chat_id;
        if ($accept->wused == 0) {
            $userID = erLhcoreClassModelUser::fetchUserByEmail($Params['user_parameters']['email'], trim($Params['user_parameters']['email']) != '' ? trim($Params['user_parameters']['email']) : false);
            if ($userID !== false && $accept->ctime > time() - erLhcoreClassModelChatConfig::fetch('accept_chat_link_timeout')->current_value) {
                $accept->wused = 1;
                $accept->saveThis();
                erLhcoreClassUser::instance()->setLoggedUser($userID);
                erLhcoreClassModule::redirect('chat/single', '/' . $chat_id);
                exit;
            } else {
                erLhcoreClassModule::redirect('user/login', '/(r)/' . rawurlencode(base64_encode('chat/single/' . $chat_id)));
                exit;
            }
        } else {
            erLhcoreClassModule::redirect('user/login', '/(r)/' . rawurlencode(base64_encode('chat/single/' . $chat_id)));
            exit;
        }
        erLhcoreClassModelChatAccept::cleanup();
    }
}
erLhcoreClassModule::redirect('user/login');
exit;
isset($dynamic_url_append) ? print $dynamic_url_append : '';
?>
" method="post" onsubmit="return lhinst.addCaptcha('<?php 
echo time();
?>
',$(this))">
			  <h4><?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('faq/faqwidget', 'Type your question');
?>
</h4>
              <div class="form-group">
			     <label><?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('faq/faqwidget', 'E-mail');
?>
:<?php 
if (erLhcoreClassModelChatConfig::fetch('faq_email_required')->current_value == 1) {
    ?>
*<?php 
}
?>
</label>
			     <input type="text" class="form-control" name="email" value="<?php 
echo htmlspecialchars($item_new->email);
?>
" />
              </div>

			  <div class="form-group">
			     <label><?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('faq/faqwidget', 'Question');
?>
    echo json_encode(array('third' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'User has not seen a message from the operator, or the message window is still open.'), 'msg_seen' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Seen'), 'msg_not_seen' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Unseen'), 'second' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'User has seen the message from the operator.'), 'first' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'User does not have any messages from the operator')), JSON_HEX_APOS);
    ?>
'>
<thead>
<tr>
    <th width="5%" nowrap><a class="icon-clock" ng-click="online.predicate = 'last_visit'; online.reverse=!online.reverse" title="<?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Last activity');
    ?>
" ></a><a class="icon-clock" ng-click="online.predicate = 'time_on_site'; online.reverse=!online.reverse" title="<?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Time on site');
    ?>
"></a><a class="icon-clock" ng-click="online.predicate = 'visitor_tz_time'; online.reverse=!online.reverse" title="<?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Visitor local time');
    ?>
"></a><?php 
    if (erLhcoreClassModelChatConfig::fetch('track_is_online')->current_value == 1) {
        ?>
<a class="icon-clock" ng-click="online.predicate = 'last_check_time'; online.reverse=!online.reverse" title="<?php 
        echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'By user status on site');
        ?>
"></a><?php 
    }
    ?>
</th>
    <th width="50%"><a href="" ng-click="online.predicate = 'current_page'; online.reverse=!online.reverse" /><?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Page');
    ?>
</a></th>
    <th width="30%"><a href="" ng-click="online.predicate = 'referrer'; online.reverse=!online.reverse" /><?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Came from');
    ?>
Example #11
0
<?php

$is_root = !isset($_GET['nomenu']) || isset($_GET['nomenu']) && empty($_GET['nomenu']);
?>
<div class="row footer-row<?php 
echo $is_root ? "" : " hidden";
?>
">
    <div class="columns col-xs-12">
        <p class="pull-right"><a target="_blank" href="http://livehelperchat.com">Live Helper Chat &copy; <?php 
echo date('Y');
?>
</a></p>
        <p><a href="<?php 
echo erLhcoreClassModelChatConfig::fetch('customer_site_url')->current_value;
?>
"><?php 
echo htmlspecialchars(erLhcoreClassModelChatConfig::fetch('customer_company_name')->current_value);
?>
</a></p>
    </div>
</div>

<?php 
include_once erLhcoreClassDesign::designtpl('pagelayouts/parts/page_footer_js.tpl.php');
include_once erLhcoreClassDesign::designtpl('pagelayouts/parts/page_footer_js_extension_multiinclude.tpl.php');
Example #12
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhuser/autologinconfig.tpl.php');
$autologinData = erLhcoreClassModelChatConfig::fetch('autologin_data');
$data = (array) $autologinData->data;
if (isset($_POST['StoreAutologinSettings'])) {
    $definition = array('secret_hash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'enabled' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/autologinconfig');
        exit;
    }
    $Errors = array();
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    try {
        if ($form->hasValidData('secret_hash') && strlen($form->secret_hash) >= 10) {
            $data['secret_hash'] = $form->secret_hash;
        } else {
            throw new Exception('Please enter secret hash');
        }
        if ($form->hasValidData('enabled') && $form->enabled == true) {
            $data['enabled'] = 1;
        } else {
            $data['enabled'] = 0;
        }
        $autologinData->value = serialize($data);
        $autologinData->saveThis();
        $CacheManager = erConfigClassLhCacheConfig::getInstance();
        $CacheManager->expireCache();
        $tpl->set('updated', 'done');
    } catch (Exception $e) {
Example #13
0
 if ($chat->hash == $Params['user_parameters']['hash'] && erLhcoreClassChat::canReopen($chat, true)) {
     // Is IP blocked directly?
     if (erLhcoreClassModelChatBlockedUser::getCount(array('filter' => array('ip' => erLhcoreClassIPDetect::getIP()))) > 0) {
         header('Location: ' . $_SERVER['HTTP_REFERER']);
         exit;
     }
     /**
      * is IP range blocked
      * */
     $ignorable_ip = erLhcoreClassModelChatConfig::fetch('banned_ip_range')->current_value;
     if ($ignorable_ip != '' && erLhcoreClassIPDetect::isIgnored(erLhcoreClassIPDetect::getIP(), explode(',', $ignorable_ip))) {
         header('Location: ' . $_SERVER['HTTP_REFERER']);
         exit;
     }
     if ($chat->status != erLhcoreClassModelChat::STATUS_ACTIVE_CHAT && $chat->status != erLhcoreClassModelChat::STATUS_PENDING_CHAT) {
         if (erLhcoreClassModelChatConfig::fetch('reopen_as_new')->current_value == 1 || $chat->user_id == 0) {
             // Reset to fresh state to workflow triggers to work
             $chat->status = erLhcoreClassModelChat::STATUS_PENDING_CHAT;
             $chat->nc_cb_executed = 0;
             $chat->na_cb_executed = 0;
             $chat->time = time();
             // Set time to new
         } else {
             $chat->status = erLhcoreClassModelChat::STATUS_ACTIVE_CHAT;
         }
         $chat->updateThis();
     }
     erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.user_reopened', array('chat' => &$chat));
     if ($Params['user_parameters_unordered']['mode'] == 'widget') {
         // Redirect user
         erLhcoreClassModule::redirect('chat/chatwidgetchat', '/' . $chat->id . '/' . $chat->hash . $modeAppend . $modeAppendTheme);
Example #14
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']));
             }
         }
     }
 }
$timeout = isset($Params['user_parameters_unordered']['timeout']) && is_numeric($Params['user_parameters_unordered']['timeout']) ? (int) $Params['user_parameters_unordered']['timeout'] : 30;
$maxrows = isset($Params['user_parameters_unordered']['maxrows']) && is_numeric($Params['user_parameters_unordered']['maxrows']) ? (int) $Params['user_parameters_unordered']['maxrows'] : 50;
$filter = array('offset' => 0, 'limit' => $maxrows, 'sort' => 'last_visit DESC', 'filtergt' => array('last_visit' => time() - $timeout));
$department = isset($Params['user_parameters_unordered']['department']) && is_numeric($Params['user_parameters_unordered']['department']) ? (int) $Params['user_parameters_unordered']['department'] : false;
if ($department !== false) {
    $filter['filter']['dep_id'] = $department;
}
/**
 * Append user departments filter
 * */
$departmentParams = array();
$userDepartments = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID());
if ($userDepartments !== true) {
    $departmentParams['filterin']['id'] = $userDepartments;
    if (!$currentUser->hasAccessTo('lhchat', 'sees_all_online_visitors')) {
        $filter['filterin']['dep_id'] = $userDepartments;
    }
}
if ($is_ajax == true) {
    $items = erLhcoreClassModelChatOnlineUser::getList($filter);
    erLhcoreClassChat::prefillGetAttributes($items, array('online_attr_system_array', 'notes_intro', 'last_check_time_ago', 'visitor_tz_time', 'last_visit_seconds_ago', 'lastactivity_ago', 'time_on_site_front', 'can_view_chat', 'operator_user_send', 'operator_user_string', 'first_visit_front', 'last_visit_front'), array('notes', 'online_attr_system'), array('do_not_clean' => true));
    echo json_encode(array_values($items));
    exit;
}
$tpl->set('departmentParams', $departmentParams);
$tpl->set('tracking_enabled', erLhcoreClassModelChatConfig::fetch('track_online_visitors')->current_value == 1);
$tpl->set('geo_location_data', erLhcoreClassModelChatConfig::fetch('geo_location_data')->data);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Online visitors')));
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.onlineusers_path', array('result' => &$Result));
$Result['additional_footer_js'] = '<script src="' . erLhcoreClassDesign::designJS('js/angular.lhc.online.min.js') . '"></script>';
Example #16
0
 /**
  * Open, parse, and return the template file.
  *
  * @param $file string the template file name
  */
 function fetch($fileTemplate = null)
 {
     $instance = erLhcoreClassSystem::instance();
     $port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : 80;
     if (!$fileTemplate) {
         $fileTemplate = $this->file;
     }
     if ($this->cacheEnabled == true && key_exists(md5($fileTemplate . $instance->WWWDirLang . $instance->Language . $port), $this->cacheTemplates)) {
         try {
             return $this->fetchExecute($this->cacheTemplates[md5($fileTemplate . $instance->WWWDirLang . $instance->Language . $port)]);
         } catch (Exception $e) {
         }
     }
     $cfg = erConfigClassLhConfig::getInstance();
     $file = erLhcoreClassDesign::designtpl($fileTemplate);
     if ($this->templatecompile == true) {
         $contentFile = php_strip_whitespace($file);
         // Compile templates - 3 level of inclusions
         for ($i = 0; $i < 9; $i++) {
             $Matches = array();
             preg_match_all('/<\\?php(\\s*)include_once\\(erLhcoreClassDesign::designtpl\\(\'([a-zA-Z0-9-\\.-\\/\\_]+)\'\\)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
             foreach ($Matches[2] as $key => $Match) {
                 $contentFile = str_replace($Matches[0][$key], php_strip_whitespace(erLhcoreClassDesign::designtpl($Match)), $contentFile);
             }
             //Compile templates inclusions first level.
             $Matches = array();
             preg_match_all('/<\\?php(\\s*)include\\(erLhcoreClassDesign::designtpl\\(\'([a-zA-Z0-9-\\.-\\/\\_]+)\'\\)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
             foreach ($Matches[2] as $key => $Match) {
                 $contentFile = str_replace($Matches[0][$key], php_strip_whitespace(erLhcoreClassDesign::designtpl($Match)), $contentFile);
             }
         }
         //Compile image css paths. Etc..
         $Matches = array();
         preg_match_all('/<\\?php echo erLhcoreClassDesign::design\\(\'([a-zA-Z0-9-\\.-\\/\\_]+)\'\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $Match) {
             $contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::design($Match), $contentFile);
         }
         //Compile translations, pure translations
         $Matches = array();
         preg_match_all('/<\\?php echo erTranslationClassLhTranslation::getInstance\\(\\)->getTranslation\\(\'(.*?)\',\'(.*?)\'\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $TranslateContent) {
             $contentFile = str_replace($Matches[0][$key], erTranslationClassLhTranslation::getInstance()->getTranslation($TranslateContent, $Matches[2][$key]), $contentFile);
         }
         //Translations used in logical conditions
         $Matches = array();
         preg_match_all('/erTranslationClassLhTranslation::getInstance\\(\\)->getTranslation\\(\'(.*?)\',\'(.*?)\'\\)/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $TranslateContent) {
             $contentFile = str_replace($Matches[0][$key], '\'' . erTranslationClassLhTranslation::getInstance()->getTranslation($TranslateContent, $Matches[2][$key]) . '\'', $contentFile);
         }
         // Compile url addresses
         $Matches = array();
         preg_match_all('/<\\?php echo erLhcoreClassDesign::baseurl\\((.*?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::baseurl(trim($UrlAddress, '\'')), $contentFile);
         }
         // Compile url direct addresses
         $Matches = array();
         preg_match_all('/<\\?php echo erLhcoreClassDesign::baseurldirect\\((.*?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::baseurldirect(trim($UrlAddress, '\'')), $contentFile);
         }
         // Compile url direct addresses
         $Matches = array();
         preg_match_all('/<\\?php echo erLhcoreClassDesign::baseurlsite\\(\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::baseurlsite(), $contentFile);
         }
         // Compile css url addresses
         $Matches = array();
         preg_match_all('/<\\?php echo erLhcoreClassDesign::designCSS\\((.*?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::designCSS(trim($UrlAddress, '\'')), $contentFile);
         }
         // Compile css url addresses
         $Matches = array();
         preg_match_all('/<\\?php echo erLhcoreClassDesign::designJS\\((.*?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::designJS(trim($UrlAddress, '\'')), $contentFile);
         }
         // Compile url addresses in logical operations
         $Matches = array();
         preg_match_all('/erLhcoreClassDesign::baseurl\\((.*?)\\)/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], '\'' . erLhcoreClassDesign::baseurl(trim($UrlAddress, '\'')) . '\'', $contentFile);
         }
         // Compile url addresses in logical operations
         $Matches = array();
         preg_match_all('/erLhcoreClassDesign::baseurldirect\\((.*?)\\)/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], '\'' . erLhcoreClassDesign::baseurldirect(trim($UrlAddress, '\'')) . '\'', $contentFile);
         }
         // Compile config settings, direct output
         $Matches = array();
         preg_match_all('/<\\?php echo erConfigClassLhConfig::getInstance\\(\\)->getSetting\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?),(\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $valueConfig = erConfigClassLhConfig::getInstance()->getSetting($Matches[2][$key], $Matches[5][$key]);
             $valueReplace = '';
             if (is_bool($valueConfig)) {
                 $valueReplace = $valueConfig == false ? 'false' : 'true';
             } elseif (is_integer($valueConfig)) {
                 $valueReplace = $valueConfig;
             } elseif (is_array($valueConfig)) {
                 $valueReplace = var_export($valueConfig, true);
             } else {
                 $valueReplace = $valueConfig;
             }
             $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
         }
         // Compile config settings
         $Matches = array();
         preg_match_all('/erConfigClassLhConfig::getInstance\\(\\)->getSetting\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?),(\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $valueConfig = erConfigClassLhConfig::getInstance()->getSetting($Matches[2][$key], $Matches[5][$key]);
             $valueReplace = '';
             if (is_bool($valueConfig)) {
                 $valueReplace = $valueConfig == false ? 'false' : 'true';
             } elseif (is_integer($valueConfig)) {
                 $valueReplace = $valueConfig;
             } elseif (is_array($valueConfig)) {
                 $valueReplace = var_export($valueConfig, true);
             } else {
                 $valueReplace = '\'' . $valueConfig . '\'';
             }
             $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
         }
         // Compile override config settings, used in title, description override
         $Matches = array();
         preg_match_all('/<\\?php echo erConfigClassLhConfig::getInstance\\(\\)->getOverrideValue\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?),(\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $valueConfig = erConfigClassLhConfig::getInstance()->getOverrideValue($Matches[2][$key], $Matches[5][$key]);
             $valueReplace = '';
             if (is_bool($valueConfig)) {
                 $valueReplace = $valueConfig == false ? 'false' : 'true';
             } elseif (is_integer($valueConfig)) {
                 $valueReplace = $valueConfig;
             } elseif (is_array($valueConfig)) {
                 $valueReplace = var_export($valueConfig, true);
             } else {
                 $valueReplace = $valueConfig;
             }
             $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
         }
         // Compile override config settings
         $Matches = array();
         preg_match_all('/erConfigClassLhConfig::getInstance\\(\\)->getOverrideValue\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?),(\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $valueConfig = erConfigClassLhConfig::getInstance()->getOverrideValue($Matches[2][$key], $Matches[5][$key]);
             $valueReplace = '';
             if (is_bool($valueConfig)) {
                 $valueReplace = $valueConfig == false ? 'false' : 'true';
             } elseif (is_integer($valueConfig)) {
                 $valueReplace = $valueConfig;
             } elseif (is_array($valueConfig)) {
                 $valueReplace = var_export($valueConfig, true);
             } else {
                 $valueReplace = '\'' . $valueConfig . '\'';
             }
             $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
         }
         $Matches = array();
         preg_match_all('/<\\?php echo erConfigClassLhConfig::getInstance\\(\\)->getDirLanguage\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $valueConfig = erConfigClassLhConfig::getInstance()->getDirLanguage($Matches[2][$key]);
             $valueReplace = '';
             if (is_bool($valueConfig)) {
                 $valueReplace = $valueConfig == false ? 'false' : 'true';
             } elseif (is_integer($valueConfig)) {
                 $valueReplace = $valueConfig;
             } elseif (is_array($valueConfig)) {
                 $valueReplace = var_export($valueConfig, true);
             } else {
                 $valueReplace = $valueConfig;
             }
             $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
         }
         // Compile config settings
         $Matches = array();
         preg_match_all('/erConfigClassLhConfig::getInstance\\(\\)->getDirLanguage\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $var) {
             $valueConfig = erConfigClassLhConfig::getInstance()->getDirLanguage($Matches[2][$key]);
             $valueReplace = '';
             if (is_bool($valueConfig)) {
                 $valueReplace = $valueConfig == false ? 'false' : 'true';
             } elseif (is_integer($valueConfig)) {
                 $valueReplace = $valueConfig;
             } elseif (is_array($valueConfig)) {
                 $valueReplace = var_export($valueConfig, true);
             } else {
                 $valueReplace = '\'' . $valueConfig . '\'';
             }
             $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
         }
         if ($this->cacheDbVariables == true) {
             // Compile config completely
             $Matches = array();
             preg_match_all('/<\\?php echo erLhcoreClassModelChatConfig::fetch\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)->current_value(.*?)\\?\\>/i', $contentFile, $Matches);
             foreach ($Matches[1] as $key => $UrlAddress) {
                 $valueConfig = erLhcoreClassModelChatConfig::fetch($Matches[2][$key])->current_value;
                 $contentFile = str_replace($Matches[0][$key], $valueConfig, $contentFile);
             }
             // Compile config settings in php scripts
             $Matches = array();
             preg_match_all('/erLhcoreClassModelChatConfig::fetch\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)->current_value/i', $contentFile, $Matches);
             foreach ($Matches[1] as $key => $UrlAddress) {
                 $valueConfig = erLhcoreClassModelChatConfig::fetch($Matches[2][$key])->current_value;
                 $valueReplace = '';
                 $valueReplace = '\'' . str_replace("'", "\\'", $valueConfig) . '\'';
                 $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
             }
             // Compile config settings in php scripts
             $Matches = array();
             preg_match_all('/erLhcoreClassModelChatConfig::fetch\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)->data_value/i', $contentFile, $Matches);
             foreach ($Matches[1] as $key => $UrlAddress) {
                 $valueConfig = erLhcoreClassModelChatConfig::fetch($Matches[2][$key])->data_value;
                 $valueReplace = var_export($valueConfig, true);
                 $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
             }
             // Compile config settings array
             $Matches = array();
             preg_match_all('/erLhcoreClassModelChatConfig::fetch\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)->data\\[\'([a-zA-Z0-9-\\.-\\/\\_]+)\'\\]/i', $contentFile, $Matches);
             foreach ($Matches[1] as $key => $UrlAddress) {
                 $valueConfig = erLhcoreClassModelChatConfig::fetch($Matches[2][$key])->data[$Matches[4][$key]];
                 $valueReplace = '';
                 $valueReplace = '\'' . str_replace("'", "\\'", $valueConfig) . '\'';
                 $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
             }
         }
         // Compile content language
         $contentFile = str_replace('<?php echo erLhcoreClassSystem::instance()->ContentLanguage?>', erLhcoreClassSystem::instance()->ContentLanguage, $contentFile);
         // Compile siteaccess
         $contentFile = str_replace('erLhcoreClassSystem::instance()->SiteAccess', '\'' . erLhcoreClassSystem::instance()->SiteAccess . '\'', $contentFile);
         // Atomoc template compilation to avoid concurent request compiling and writing to the same file
         $fileName = 'cache/compiledtemplates/' . md5(time() . rand(0, 1000) . microtime() . $file . $instance->WWWDirLang . $instance->Language . $port) . '.php';
         file_put_contents($fileName, erLhcoreClassTemplate::strip_html($contentFile));
         $file = 'cache/compiledtemplates/' . md5($file . $instance->WWWDirLang . $instance->Language . $port) . '.php';
         rename($fileName, $file);
         $this->cacheTemplates[md5($fileTemplate . $instance->WWWDirLang . $instance->Language . $port)] = $file;
         $this->storeCache();
     }
     return $this->fetchExecute($file);
 }
<?php

$online_user = erLhcoreClassModelChatOnlineUser::fetchByVid($Params['user_parameters']['vid']);
if ($online_user !== false && isset($online_user->online_attr_system_array['ishare_enabled']) && $online_user->online_attr_system_array['ishare_enabled'] == 1) {
    $fileData = erLhcoreClassModelChatConfig::fetch('file_configuration');
    $data = (array) $fileData->data;
    $path = 'var/storage/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/ou' . $online_user->id . '/';
    erLhcoreClassChatEventDispatcher::getInstance()->dispatch('file.uploadfile.file_path', array('path' => &$path, 'storage_id' => $online_user->id));
    $upload_handler = new erLhcoreClassFileUpload(array('user_id' => 0, 'max_file_size' => $data['fs_max'] * 1024, 'accept_file_types_lhc' => '/\\.(' . $data['ft_us'] . ')$/i', 'online_user' => $online_user, 'download_via_php' => true, 'upload_dir' => $path));
    if ($upload_handler->uploadedFile instanceof erLhcoreClassModelChatFile) {
        erLhcoreClassChatEventDispatcher::getInstance()->dispatch('file.uploadfile.file_store', array('chat_file' => $upload_handler->uploadedFile));
    }
    echo json_encode(array('error' => 'false'));
}
exit;
Example #18
0
    ?>

<?php 
    $canListOnlineUsers = false;
    $canListOnlineUsersAll = false;
    $currentUser = erLhcoreClassUser::instance();
    if (erLhcoreClassModelChatConfig::fetch('list_online_operators')->current_value == 1) {
        $canListOnlineUsers = $currentUser->hasAccessTo('lhuser', 'userlistonline');
        $canListOnlineUsersAll = $currentUser->hasAccessTo('lhuser', 'userlistonlineall');
    }
    $canseedepartmentstats = $currentUser->hasAccessTo('lhuser', 'canseedepartmentstats');
    $pendingTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_pending_list', 1);
    $activeTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_active_list', 1);
    $closedTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_close_list', 0);
    $unreadTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_unread_list', 1);
    $frontTabsOrder = explode(',', erLhcoreClassModelChatConfig::fetch('front_tabs')->current_value);
    ?>
 
<?php 
    include erLhcoreClassDesign::designtpl('lhchat/onlineusers/online_settings_general.tpl.php');
    ?>

<div ng-controller="OnlineCtrl as online" ng-init='groupByField = <?php 
    echo json_encode($ogroupBy);
    ?>
;online.maxRows=<?php 
    echo (int) $omaxRows;
    ?>
;online.updateTimeout=<?php 
    echo (int) $oupdTimeout;
    ?>
        $tosVariable = 'offline_tos_visible_in_page_widget';
        $tosCheckedVariable = 'tos_checked_offline';
        ?>
	<?php 
        include_once erLhcoreClassDesign::designtpl('lhchat/part/accept_tos.tpl.php');
        ?>

	<div class="btn-group" role="group" aria-label="...">
  		<?php 
        include erLhcoreClassDesign::designtpl('lhchat/part/buttons/leave_a_message_button_widget.tpl.php');
        ?>
  		<?php 
        include erLhcoreClassDesign::designtpl('lhchat/part/offline_button_multiinclude.tpl.php');
        ?>
		<?php 
        if (erLhcoreClassModelChatConfig::fetch('reopen_chat_enabled')->current_value == 1 && ($reopenData = erLhcoreClassChat::canReopenDirectly(array('reopen_closed' => erLhcoreClassModelChatConfig::fetch('allow_reopen_closed')->current_value))) !== false) {
            ?>
		    <?php 
            include erLhcoreClassDesign::designtpl('lhchat/part/buttons/reopen_offline_button_widget.tpl.php');
            ?>
	  	<?php 
        }
        ?>
	</div>
	
	<input type="hidden" value="<?php 
        echo htmlspecialchars($referer);
        ?>
" name="URLRefer"/>
	<input type="hidden" value="1" name="StartChat"/>
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhchat/listchatconfig.tpl.php');
if ($currentUser->hasAccessTo('lhchat', 'administrateconfig')) {
    if (isset($_POST['UpdateConfig'])) {
        foreach (erLhcoreClassModelChatConfig::getItems() as $item) {
            $ConfigData = erLhcoreClassModelChatConfig::fetch($item->identifier);
            switch ($ConfigData->type) {
                case erLhcoreClassModelChatConfig::SITE_ACCESS_PARAM_ON:
                    $data = array();
                    foreach (erConfigClassLhConfig::getInstance()->getSetting('site', 'available_site_access') as $siteaccess) {
                        $data[$siteaccess] = $_POST[$item->identifier . 'Value' . $siteaccess];
                    }
                    $ConfigData->value = serialize($data);
                    break;
                case erLhcoreClassModelChatConfig::SITE_ACCESS_PARAM_OFF:
                    $ConfigData->value = isset($_POST[$item->identifier . 'ValueParam']) ? $_POST[$item->identifier . 'ValueParam'] : 0;
                    break;
                default:
                    break;
            }
            $ConfigData->saveThis();
        }
        // Cleanup cache to recompile templates etc.
        $CacheManager = erConfigClassLhCacheConfig::getInstance();
        $CacheManager->expireCache();
        $tpl->set('updated', 'done');
    }
}
$tpl->set('currentUser', $currentUser);
$Result['content'] = $tpl->fetch();
Example #21
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhsystem/smtp.tpl.php');
$smtpData = erLhcoreClassModelChatConfig::fetch('smtp_data');
$data = (array) $smtpData->data;
if (isset($_POST['StoreSMTPSettings']) || isset($_POST['StoreSMTPSettingsTest'])) {
    $definition = array('host' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'username' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'password' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'port' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'use_smtp' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('system/smtp');
        exit;
    }
    $Errors = array();
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('host')) {
        $data['host'] = $form->host;
    } else {
        $data['host'] = '';
    }
    if ($form->hasValidData('port')) {
        $data['port'] = $form->port;
    } else {
        $data['port'] = '';
    }
    if ($form->hasValidData('use_smtp') && $form->use_smtp == true) {
        $data['use_smtp'] = 1;
    } else {
        $data['use_smtp'] = 0;
    }
    if ($form->hasValidData('username')) {
        $data['username'] = $form->username;
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhdocshare/configuration.tpl.php');
$docSharer = erLhcoreClassModelChatConfig::fetch('doc_sharer');
$data = (array) $docSharer->data;
if (isset($_POST['StoreConfiguration'])) {
    $definition = array('LibreOfficePath' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'SupportedExtensions' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'PdftoppmPath' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'HttpUserName' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'HttpGroupName' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'BackgroundProcess' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'MaxFileSize' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 2)), 'PdftoppmLimit' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0)));
    $Errors = array();
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('docshare/configuration');
        exit;
    }
    if ($form->hasValidData('LibreOfficePath')) {
        $data['libre_office_path'] = $form->LibreOfficePath;
    } else {
        $data['libre_office_path'] = '/usr/bin/libreoffice';
    }
    if ($form->hasValidData('PdftoppmPath')) {
        $data['pdftoppm_path'] = $form->PdftoppmPath;
    } else {
        $data['pdftoppm_path'] = '/usr/bin/pdftoppm';
    }
    if ($form->hasValidData('PdftoppmLimit')) {
        $data['pdftoppm_limit'] = $form->PdftoppmLimit;
    } else {
        $data['pdftoppm_limit'] = '0';
    }
    if ($form->hasValidData('HttpUserName')) {
        $data['http_user_name'] = $form->HttpUserName;
Example #23
0
var subStatus = '';
<?php 
if (erLhcoreClassModelChatConfig::fetch('need_help_tip')->current_value == 1) {
    ?>
if (this.isOnline == true) {
var lhc_hnh = <?php 
    if (erLhcoreClassModelChatConfig::fetch('need_help_tip_timeout')->current_value > 0) {
        ?>
lh_inst.getPersistentAttribute('lhc_hnh');<?php 
    } else {
        ?>
lh_inst.cookieData.lhc_hnh;<?php 
    }
    ?>
if (lhc_hnh == null || lhc_hnh == undefined || parseInt(lhc_hnh) < <?php 
    echo time();
    ?>
) {

<?php 
    include erLhcoreClassDesign::designtpl('lhchat/getstatus/we_here_substatus.tpl.php');
    ?>
	

if (!this.cssNHWasAdded) {
	this.cssNHWasAdded = true;
	var raw_css_need_hl = '#lhc_need_help_container{width:235px;border-radius:20px;background:#<?php 
    $theme !== false ? print $theme->need_help_bcolor : (print '92B830');
    ?>
;position:absolute;color:#<?php 
    $theme !== false ? print $theme->need_help_tcolor : (print 'ffffff');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time() + 60 * 60 * 8) . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
$tpl = erLhcoreClassTemplate::getInstance('lhchat/chatcheckstatus.tpl.php');
if (is_array($Params['user_parameters_unordered']['department'])) {
    erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['department']);
    $tpl->set('department', implode('/', $Params['user_parameters_unordered']['department']));
    $tpl->set('department_array', $Params['user_parameters_unordered']['department']);
} else {
    $tpl->set('department', false);
    $tpl->set('department_array', false);
}
$tpl->set('status', $Params['user_parameters_unordered']['status'] == 'true' ? true : false);
if (erLhcoreClassModelChatConfig::fetch('track_is_online')->current_value) {
    $ignorable_ip = erLhcoreClassModelChatConfig::fetch('ignorable_ip')->current_value;
    if ($ignorable_ip == '' || !erLhcoreClassIPDetect::isIgnored(erLhcoreClassIPDetect::getIP(), explode(',', $ignorable_ip))) {
        if ((string) $Params['user_parameters_unordered']['vid'] != '') {
            $db = ezcDbInstance::get();
            /**
             * Perhaps there is some pending operations for online visitor
             * */
            $stmt = $db->prepare('SELECT operation FROM lh_chat_online_user WHERE vid = :vid');
            $stmt->bindValue(':vid', (string) $Params['user_parameters_unordered']['vid']);
            $stmt->execute();
            $operation = $stmt->fetch(PDO::FETCH_COLUMN);
            echo $operation;
            $stmt = $db->prepare("UPDATE lh_chat_online_user SET last_check_time = :time, operation = '', operation_chat = '' WHERE vid = :vid");
            $stmt->bindValue(':time', time(), PDO::PARAM_INT);
            $stmt->bindValue(':vid', (string) $Params['user_parameters_unordered']['vid']);
            $stmt->execute();
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhchat/geoadjustment.tpl.php');
$geoData = erLhcoreClassModelChatConfig::fetch('geoadjustment_data');
$data = (array) $geoData->data;
if (isset($_POST['SaveGeoAdjustment'])) {
    $definition = array('use_geo_adjustment' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'AvailableFor' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'OtherCountries' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'HideFor' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'OtherStatus' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'RestStatus' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ApplyWidget' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('xmp/configuration');
        exit;
    }
    $Errors = array();
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('use_geo_adjustment')) {
        $data['use_geo_adjustment'] = true;
    } else {
        $data['use_geo_adjustment'] = false;
    }
    if ($data['use_geo_adjustment']) {
        if ($form->hasValidData('AvailableFor')) {
            $data['available_for'] = $form->AvailableFor;
        } else {
            $data['available_for'] = '';
        }
        if ($form->hasValidData('OtherCountries')) {
            $data['other_countries'] = $form->OtherCountries;
        } else {
            $data['other_countries'] = '';
        }
        if ($form->hasValidData('HideFor')) {
             $msg->chat_id = $chat->id;
             $msg->user_id = -1;
             $msg->time = time();
             erLhcoreClassChat::getSession()->save($msg);
             // We do not store last msg time for chat here, because in any case none of opeators has opened it
             $contactRedirected = true;
             if ($chat->status_sub != erLhcoreClassModelChat::STATUS_SUB_CONTACT_FORM) {
                 $chat->status_sub = erLhcoreClassModelChat::STATUS_SUB_CONTACT_FORM;
                 $chat->updateThis();
             }
         } else {
             erLhcoreClassChatWorkflow::autoAssign($chat, $department);
         }
     }
 }
 if (erLhcoreClassChat::isOnline($chat->dep_id, false, array('online_timeout' => (int) erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout']))) {
     $tpl->set('is_online', true);
 } else {
     $tpl->set('is_online', false);
 }
 if ($chat->chat_initiator == erLhcoreClassModelChat::CHAT_INITIATOR_PROACTIVE) {
     $tpl->set('is_proactive_based', true);
 } else {
     $tpl->set('is_proactive_based', false);
 }
 if ($chat->status == erLhcoreClassModelChat::STATUS_ACTIVE_CHAT) {
     $activated = 'true';
     $tpl->set('is_activated', true);
     $ott = $chat->user !== false ? $chat->user->name_support . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chat', 'is typing now...') : erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chat', 'Operator is typing now...');
 } else {
     $tpl->set('is_activated', false);
    echo json_encode(htmlspecialchars_decode(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/getstatus', 'Our staff is always ready to help'), ENT_QUOTES));
}
?>
;
<?php 
$iconsStatuses['need_help_image_url'] = $theme !== false && $theme->need_help_image_url !== false && strpos($theme->need_help_image_url, 'http') !== false;
?>
var imageTooltip = (typeof <?php 
echo $chatOptionsVariable;
?>
.opt.nh_image != 'undefined') ? <?php 
echo $chatOptionsVariable;
?>
.opt.nh_image : '<?php 
if ($iconsStatuses['need_help_image_url'] == false) {
    echo erLhcoreClassModelChatConfig::fetch('explicit_http_mode')->current_value;
    ?>
//<?php 
    echo $_SERVER['HTTP_HOST'];
}
if ($theme !== false && $theme->need_help_image_url !== false) {
    print $theme->need_help_image_url;
} else {
    echo erLhcoreClassDesign::design('images/general/operator.png');
}
?>
';

subStatus = '<div id="lhc_need_help_container" style="<?php 
echo $currentPosition['nh_hor_pos'];
?>
Example #28
0
?>
">
<head>

<title><?php 
if (isset($Result['path'])) {
    $ReverseOrder = $Result['path'];
    krsort($ReverseOrder);
    foreach ($ReverseOrder as $pathItem) {
        echo htmlspecialchars($pathItem['title']) . ' ';
        ?>
&laquo;<?php 
        echo ' ';
    }
}
echo htmlspecialchars(erLhcoreClassModelChatConfig::fetch('application_name')->current_value);
?>
</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<link rel="icon" type="image/png" href="<?php 
echo erLhcoreClassDesign::design('images/favicon.ico');
?>
" />
<link rel="shortcut icon" type="image/x-icon" href="<?php 
echo erLhcoreClassDesign::design('images/favicon.ico');
?>
">
<meta name="Keywords" content="" />
<meta name="Description" content="<?php 
echo erConfigClassLhConfig::getInstance()->getOverrideValue('site', 'description');
 public static function detectLocation(erLhcoreClassModelChat &$instance)
 {
     $geoData = erLhcoreClassModelChatConfig::fetch('geo_data');
     $geo_data = (array) $geoData->data;
     if (isset($geo_data['geo_detection_enabled']) && $geo_data['geo_detection_enabled'] == 1) {
         $params = array();
         if ($geo_data['geo_service_identifier'] == 'mod_geoip2') {
             $params['country_code'] = $geo_data['mod_geo_ip_country_code'];
             $params['country_name'] = $geo_data['mod_geo_ip_country_name'];
             $params['mod_geo_ip_city_name'] = $geo_data['mod_geo_ip_city_name'];
             $params['mod_geo_ip_latitude'] = $geo_data['mod_geo_ip_latitude'];
             $params['mod_geo_ip_longitude'] = $geo_data['mod_geo_ip_longitude'];
         } elseif ($geo_data['geo_service_identifier'] == 'locatorhq') {
             $params['username'] = $geo_data['locatorhqusername'];
             $params['api_key'] = $geo_data['locatorhq_api_key'];
         } elseif ($geo_data['geo_service_identifier'] == 'ipinfodbcom') {
             $params['api_key'] = $geo_data['ipinfodbcom_api_key'];
         } elseif ($geo_data['geo_service_identifier'] == 'max_mind') {
             $params['detection_type'] = $geo_data['max_mind_detection_type'];
             $params['city_file'] = isset($geo_data['max_mind_city_location']) ? $geo_data['max_mind_city_location'] : '';
         }
         $location = erLhcoreClassModelChatOnlineUser::getUserData($geo_data['geo_service_identifier'], $instance->ip, $params);
         if ($location !== false) {
             $instance->country_code = $location->country_code;
             $instance->country_name = $location->country_name;
             $instance->lat = $location->lat;
             $instance->lon = $location->lon;
             $instance->city = $location->city;
         }
     }
 }
Example #30
0
 $chat->session_referrer = isset($_POST['r']) ? $_POST['r'] : '';
 if ($chat->nick == '') {
     $chat->nick = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Visitor');
 }
 erLhcoreClassModelChat::detectLocation($chat);
 $chat->priority = is_numeric($Params['user_parameters_unordered']['priority']) ? (int) $Params['user_parameters_unordered']['priority'] : $chat->department->priority;
 $chat->chat_initiator = erLhcoreClassModelChat::CHAT_INITIATOR_PROACTIVE;
 // Store chat
 erLhcoreClassChat::getSession()->save($chat);
 // Mark as user has read message from operator.
 $userInstance->message_seen = 1;
 $userInstance->message_seen_ts = time();
 $userInstance->chat_id = $chat->id;
 $userInstance->saveThis();
 $chat->online_user_id = $userInstance->id;
 if (erLhcoreClassModelChatConfig::fetch('track_footprint')->current_value == 1) {
     erLhcoreClassModelChatOnlineUserFootprint::assignChatToPageviews($userInstance);
 }
 // Store Message from operator
 $msg = new erLhcoreClassModelmsg();
 $msg->msg = trim($userInstance->operator_message);
 $msg->chat_id = $chat->id;
 $msg->name_support = $userInstance->operator_user !== false ? trim($userInstance->operator_user->name . ' ' . $userInstance->operator_user->surname) : (!empty($userInstance->operator_user_proactive) ? $userInstance->operator_user_proactive : erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Live Support'));
 $msg->user_id = $userInstance->operator_user_id > 0 ? $userInstance->operator_user_id : 1;
 $msg->time = time() - 7;
 // Deduct 7 seconds so for user all looks more natural
 erLhcoreClassChat::getSession()->save($msg);
 // Store User Message
 $msg = new erLhcoreClassModelmsg();
 $msg->msg = trim($inputData->question);
 $msg->chat_id = $chat->id;