示例#1
0
 public static function getTransferChats($params = array())
 {
     $db = ezcDbInstance::get();
     $currentUser = erLhcoreClassUser::instance();
     $limitationSQL = '';
     if (isset($params['department_transfers']) && $params['department_transfers'] == true) {
         $limitation = self::getDepartmentLimitation();
         // Does not have any assigned department
         if ($limitation === false) {
             return array();
         }
         if ($limitation !== true) {
             $limitationSQL = ' AND ' . $limitation;
         }
         $stmt = $db->prepare('SELECT lh_chat.*,lh_transfer.id as transfer_id FROM lh_chat INNER JOIN lh_transfer ON lh_transfer.chat_id = lh_chat.id WHERE transfer_user_id != :transfer_user_id ' . $limitationSQL . ' ORDER BY lh_transfer.id DESC');
         $stmt->bindValue(':transfer_user_id', $currentUser->getUserID());
         $stmt->setFetchMode(PDO::FETCH_ASSOC);
         $stmt->execute();
         $rows = $stmt->fetchAll();
     } else {
         $stmt = $db->prepare('SELECT lh_chat.*,lh_transfer.id as transfer_id FROM lh_chat INNER JOIN lh_transfer ON lh_transfer.chat_id = lh_chat.id WHERE lh_transfer.transfer_to_user_id = :user_id ORDER BY lh_transfer.id DESC');
         $stmt->bindValue(':user_id', $currentUser->getUserID());
         $stmt->setFetchMode(PDO::FETCH_ASSOC);
         $stmt->execute();
         $rows = $stmt->fetchAll();
     }
     return $rows;
 }
 public function __get($var)
 {
     switch ($var) {
         case 'left_menu':
             $this->left_menu = '';
             return $this->left_menu;
             break;
         case 'content_rendered':
             return erLhcoreClassFormRenderer::renderForm($this);
             break;
         case 'xls_columns_data':
             $parts = explode('||', $this->xls_columns);
             $totalParts = array();
             foreach ($parts as $part) {
                 $subParts = explode(';', $part);
                 $dataParts = array();
                 foreach ($subParts as $subPart) {
                     $data = explode('=', $subPart);
                     $dataParts[$data[0]] = $data[1];
                 }
                 $totalParts[] = $dataParts;
             }
             return $this->xls_columns_data = $totalParts;
             break;
         case 'hide_delete':
             return $this->hide_delete = !erLhcoreClassUser::instance()->hasAccessTo('lhform', 'delete_fm');
             break;
         default:
             break;
     }
 }
 public static function getSetting($identifier, $default_value, $user_id = false, $noSession = false)
 {
     if ($user_id == false) {
         $currentUser = erLhcoreClassUser::instance();
         if ($currentUser->isLogged()) {
             $user_id = $currentUser->getUserID();
         }
     }
     if ($user_id !== false) {
         $value = CSCacheAPC::getMem()->getSession('settings_user_id_' . $user_id . '_' . $identifier, true);
         if ($value === false && ($value = CSCacheAPC::getMem()->restore('settings_user_id_' . $user_id . '_' . $identifier)) === false) {
             $value = $default_value;
             $list = self::getList(array('filter' => array('user_id' => $user_id, 'identifier' => $identifier)));
             if (count($list) > 0) {
                 $item = array_shift($list);
                 $value = $item->value;
             } else {
                 $item = new erLhcoreClassModelUserSetting();
                 $item->value = $default_value;
                 $item->user_id = $user_id;
                 $item->identifier = $identifier;
                 $item->saveThis();
             }
             CSCacheAPC::getMem()->store('settings_user_id_' . $user_id . '_' . $identifier, $value);
             CSCacheAPC::getMem()->setSession('settings_user_id_' . $user_id . '_' . $identifier, $value, true);
         }
     } else {
         $value = $default_value;
         if ($noSession === false && ($value = CSCacheAPC::getMem()->getSession('anonymous_' . $identifier)) === false) {
             $value = $default_value;
             CSCacheAPC::getMem()->setSession('anonymous_' . $identifier, $value);
         }
     }
     return $value;
 }
 public static function validateAdminTheme(erLhAbstractModelAdminTheme &$clickform)
 {
     $definition = array('Name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'header_content' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'header_css' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'static_content_name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_content_hash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_js_content_name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_js_content_hash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_css_content_name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_css_content_hash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     $currentUser = erLhcoreClassUser::instance();
     if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('icclicktocallform/form', 'Invalid CSRF token!');
     }
     if (!$form->hasValidData('Name') || $form->Name == '') {
         $Errors['Name'] = erTranslationClassLhTranslation::getInstance()->getTranslation('icclicktocallform/form', 'Please enter a name');
     } else {
         $clickform->name = $form->Name;
     }
     if ($form->hasValidData('header_content')) {
         $clickform->header_content = $form->header_content;
     }
     if ($form->hasValidData('header_css')) {
         $clickform->header_css = $form->header_css;
     }
     $resourcesArray = array('static_content', 'static_js_content', 'static_css_content');
     $supportedExtensions = array('zip', 'doc', 'docx', 'ttf', 'pdf', 'xls', 'ico', 'gif', 'xlsx', 'jpg', 'jpeg', 'png', 'bmp', 'rar', '7z', 'css', 'js', 'eot', 'woff', 'woff2', 'svg');
     // Validate resources
     foreach ($resourcesArray as $resource) {
         if ($form->hasValidData($resource . '_hash') && !empty($form->{$resource . '_hash'})) {
             $customFields = $currentStaticResources = $clickform->{$resource . '_array'};
             foreach ($form->{$resource . '_hash'} as $key => $customFieldType) {
                 if (!erLhcoreClassSearchHandler::isFile($resource . '_file_' . $key, $supportedExtensions) && !isset($currentStaticResources[$key]['file'])) {
                     $Errors[$resource . '_file_' . $key] = erTranslationClassLhTranslation::getInstance()->getTranslation('icclicktocallform/form', 'File not chosen for') . (isset($form->{$resource . '_name'}[$key]) ? ' - ' . htmlspecialchars($form->{$resource . '_name'}[$key]) : '');
                 }
             }
             // If there is no errors upload files
             if (empty($Errors)) {
                 foreach ($form->{$resource . '_hash'} as $key => $customFieldType) {
                     $customFields[$key]['name'] = $form->{$resource . '_name'}[$key];
                     $customFields[$key]['hash'] = $key;
                     if (erLhcoreClassSearchHandler::isFile($resource . '_file_' . $key, $supportedExtensions)) {
                         // Check there is already uploaded file and remove it
                         $clickform->removeResource($resource, $key);
                         // Store new file if required
                         $dir = 'var/storageadmintheme/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $clickform->id . '/';
                         erLhcoreClassChatEventDispatcher::getInstance()->dispatch('admintheme.filedir', array('dir' => &$dir, 'storage_id' => $clickform->id));
                         erLhcoreClassFileUpload::mkdirRecursive($dir);
                         $customFields[$key]['file'] = erLhcoreClassSearchHandler::moveUploadedFile($resource . '_file_' . $key, $dir . '/', '.');
                         $customFields[$key]['file_dir'] = $dir;
                     }
                 }
                 $clickform->{$resource} = json_encode($customFields, JSON_HEX_APOS);
             }
         } else {
             $clickform->{$resource} = '';
         }
     }
     return $Errors;
 }
示例#5
0
 public static function prepareSendMail(erLhAbstractModelEmailTemplate &$sendMail)
 {
     $currentUser = erLhcoreClassUser::instance();
     if ($currentUser->isLogged() == true) {
         $userData = $currentUser->getUserData();
         $sendMail->subject = str_replace(array('{name_surname}'), array($userData->name . ' ' . $userData->surname), $sendMail->subject);
         $sendMail->from_name = str_replace(array('{name_surname}'), array($userData->name . ' ' . $userData->surname), $sendMail->from_name);
         if (empty($sendMail->from_email)) {
             $sendMail->from_email = $userData->email;
         }
         if (empty($sendMail->reply_to)) {
             $sendMail->reply_to = $userData->email;
         }
     }
 }
示例#6
0
 public static function addUserDepartaments($Departaments, $userID = false, $UserData = false)
 {
     $db = ezcDbInstance::get();
     if ($userID === false) {
         $currentUser = erLhcoreClassUser::instance();
         $userID = $currentUser->getUserID();
     }
     $stmt = $db->prepare('DELETE FROM lh_userdep WHERE user_id = :user_id AND type = 0');
     $stmt->bindValue(':user_id', $userID);
     $stmt->execute();
     foreach ($Departaments as $DepartamentID) {
         $stmt = $db->prepare('INSERT INTO lh_userdep (user_id,dep_id,hide_online,last_activity,last_accepted,active_chats,type,dep_group_id) VALUES (:user_id,:dep_id,:hide_online,0,0,:active_chats,0,0)');
         $stmt->bindValue(':user_id', $userID);
         $stmt->bindValue(':dep_id', $DepartamentID);
         $stmt->bindValue(':hide_online', $UserData->hide_online);
         $stmt->bindValue(':active_chats', erLhcoreClassChat::getCount(array('filter' => array('user_id' => $UserData->id, 'status' => erLhcoreClassModelChat::STATUS_ACTIVE_CHAT))));
         $stmt->execute();
     }
     if (isset($_SESSION['lhCacheUserDepartaments_' . $userID])) {
         unset($_SESSION['lhCacheUserDepartaments_' . $userID]);
     }
 }
 public static function loginBySSO($params)
 {
     $settings = (include 'extension/singlesignon/settings/settings.ini.php');
     // Try to find operator by our logins
     if (isset($params[$settings['attr_map']['username']][0])) {
         $username = $params[$settings['attr_map']['username']][0];
         if (erLhcoreClassModelUser::userExists($username)) {
             $user = array_shift(erLhcoreClassModelUser::getUserList(array('limit' => 1, 'filter' => array('username'))));
             erLhcoreClassUser::instance()->setLoggedUser($user->id);
         } else {
             $user = new erLhcoreClassModelUser();
             foreach ($settings['attr_map'] as $attr => $ssoAttr) {
                 $user->{$attr} = $params[$settings['attr_map'][$attr]][0];
             }
             foreach ($settings['default_attributes'] as $attr => $value) {
                 $user->{$attr} = $value;
             }
             $user->password = sha1(erLhcoreClassModelForgotPassword::randomPassword() . rand(0, 1000) . microtime());
             $user->saveThis();
             // Set that users sees all pending chats
             erLhcoreClassModelUserSetting::setSetting('show_all_pending', 1, $user->id);
             // Set default departments
             erLhcoreClassUserDep::addUserDepartaments($settings['default_departments'], $user->id, $user);
             // Cleanup if previously existed
             erLhcoreClassModelGroupUser::removeUserFromGroups($user->id);
             // Assign user to default group
             foreach ($settings['default_user_groups'] as $group_id) {
                 $groupUser = new erLhcoreClassModelGroupUser();
                 $groupUser->group_id = $group_id;
                 $groupUser->user_id = $user->id;
                 $groupUser->saveThis();
             }
             erLhcoreClassUser::instance()->setLoggedUser($user->id);
         }
         return true;
     } else {
         throw new Exception('Username field not found');
     }
 }
<?php

include erLhcoreClassDesign::designtpl('lhchat/chat_tabs/chat_translation_pre.tpl.php');
if ($chat_translation_enabled == true && erLhcoreClassUser::instance()->hasAccessTo('lhtranslation', 'use')) {
    ?>
    <?php 
    // This values comes from tab template
    if ($dataChatTranslation['enable_translations'] && $dataChatTranslation['enable_translations'] == true) {
        ?>
    <div role="tabpanel" class="tab-pane" id="main-user-info-translation-<?php 
        echo $chat->id;
        ?>
">
        <div class="row">
            <div class="col-xs-6">
                <div class="form-group">
            		<label><?php 
        echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/translation', 'Visitor language');
        ?>
</label> 
            		<?php 
        echo erLhcoreClassRenderHelper::renderCombobox(array('input_name' => 'chat_locale_' . $chat->id, 'optional_field' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/translation', 'Automatically detected'), 'selected_id' => $chat->chat_locale, 'css_class' => 'form-control', 'list_function' => 'erLhcoreClassTranslate::getSupportedLanguages'));
        ?>
 
            	</div>
            </div>
            <div class="col-xs-6">
            	<div class="form-group">
            	       <label><?php 
        echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/translation', 'My language');
        ?>
示例#9
0
		<div class="small-6 columns">
			<label class="inline left" title="<?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('cobrowse/browse', 'Show my mouse position to visitor');
?>
"><input type="checkbox" value="on" id="show-operator-mouse" ><i class="icon-mouse"></i></label> <label title="<?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('cobrowse/browse', 'On highlight scroll user window location to match my');
?>
" class="inline left"><input id="scroll-user-window" value="on" type="checkbox"><i class="icon-window"></i></label> <label title="<?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('cobrowse/browse', 'Follow user scroll position');
?>
" class="inline left"><input id="sync-user-scroll" value="on" type="checkbox"><i class="icon-arrow-combo"></i></label> <label title="<?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('cobrowse/browse', 'On click navigate user browser');
?>
" class="inline left"><input id="status-icon-control" value="on" type="checkbox"><i class="icon-keyboard"></i></label>
			<?php 
if (erLhcoreClassUser::instance()->hasAccessTo('lhchat', 'allowredirect')) {
    ?>
			<a class="icon-network left" onclick="lhinst.redirectToURL('<?php 
    echo $chat->id;
    ?>
','<?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat', 'Please enter a URL');
    ?>
')" title="<?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat', 'Redirect user to another url');
    ?>
"></a>
			<?php 
}
?>
			
<ul class="circle small-list">
	<li ng-repeat="operator in online_op.list track by operator.id" ><a ng-show="operator.user.id != <?php 
echo erLhcoreClassUser::instance()->getUserID();
?>
" href="#" ng-click="lhc.startChatOperator(operator.user.id)" class="small button round"><?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface', 'Start chat');
?>
</a>&nbsp;{{operator.user.name}} {{operator.user.surname}} | <?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface', 'Last activity');
?>
: {{operator.user.lastactivity_ago}} <?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface', 'ago');
?>
.</li>
</ul>
示例#11
0
 /**
  * Custom form fields validation
  */
 public static function validateStartChat(&$inputForm, &$start_data_fields, &$chat, $additionalParams = array())
 {
     $validationFields = array();
     // Dynamic form field
     if ($inputForm->validate_start_chat == true) {
         if (isset($start_data_fields['name_visible_in_popup']) && $start_data_fields['name_visible_in_popup'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_name_visible_in_popup']) && $start_data_fields['offline_name_visible_in_popup'] == true) {
             $validationFields['Username'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
         }
         if (isset($start_data_fields['email_visible_in_popup']) && $start_data_fields['email_visible_in_popup'] == true || isset($additionalParams['offline'])) {
             $validationFields['Email'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email');
         }
         if (isset($start_data_fields['message_visible_in_popup']) && $start_data_fields['message_visible_in_popup'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_message_visible_in_popup']) && $start_data_fields['offline_message_visible_in_popup'] == true) {
             $validationFields['Question'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
         }
         if (isset($start_data_fields['phone_visible_in_popup']) && $start_data_fields['phone_visible_in_popup'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_phone_visible_in_popup']) && $start_data_fields['offline_phone_visible_in_popup'] == true) {
             $validationFields['Phone'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
         }
         if (isset($start_data_fields['tos_visible_in_popup']) && $start_data_fields['tos_visible_in_popup'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_tos_visible_in_popup']) && $start_data_fields['offline_tos_visible_in_popup'] == true) {
             $validationFields['AcceptTOS'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean');
         }
     } else {
         if (isset($start_data_fields['name_visible_in_page_widget']) && $start_data_fields['name_visible_in_page_widget'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_name_visible_in_page_widget']) && $start_data_fields['offline_name_visible_in_page_widget'] == true) {
             $validationFields['Username'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
         }
         if (isset($start_data_fields['email_visible_in_page_widget']) && $start_data_fields['email_visible_in_page_widget'] == true || isset($additionalParams['offline'])) {
             $validationFields['Email'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email');
         }
         if (isset($start_data_fields['message_visible_in_page_widget']) && $start_data_fields['message_visible_in_page_widget'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_message_visible_in_page_widget']) && $start_data_fields['offline_message_visible_in_page_widget'] == true) {
             $validationFields['Question'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
         }
         if (isset($start_data_fields['phone_visible_in_page_widget']) && $start_data_fields['phone_visible_in_page_widget'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_phone_visible_in_page_widget']) && $start_data_fields['offline_phone_visible_in_page_widget'] == true) {
             $validationFields['Phone'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
         }
         if (isset($start_data_fields['tos_visible_in_page_widget']) && $start_data_fields['tos_visible_in_page_widget'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_tos_visible_in_page_widget']) && $start_data_fields['offline_tos_visible_in_page_widget'] == true) {
             $validationFields['AcceptTOS'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean');
         }
     }
     $validationFields['DepartamentID'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => -1));
     $validationFields['DepartmentIDDefined'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1), FILTER_REQUIRE_ARRAY);
     $validationFields['operator'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1));
     $validationFields['user_timezone'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int');
     $validationFields['keyUpStarted'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1));
     $validationFields['name_items'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
     $validationFields['values_req'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY);
     $validationFields['value_items'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
     $validationFields['value_types'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
     $validationFields['value_sizes'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
     $validationFields['value_show'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY);
     $validationFields['hattr'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY);
     // Captcha stuff
     if (erLhcoreClassModelChatConfig::fetch('session_captcha')->current_value == 1) {
         // Start session if required only
         $currentUser = erLhcoreClassUser::instance();
         $hashCaptcha = isset($_SESSION[$_SERVER['REMOTE_ADDR']]['form']) ? $_SESSION[$_SERVER['REMOTE_ADDR']]['form'] : null;
         $nameField = 'captcha_' . $hashCaptcha;
         $validationFields[$nameField] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string');
     } else {
         $nameField = 'captcha_' . sha1(erLhcoreClassIPDetect::getIP() . $_POST['tscaptcha'] . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'));
         $validationFields[$nameField] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string');
     }
     // Custom start chat fields
     $validationFields['value_items_admin'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
     $validationFields['via_hidden'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
     $form = new ezcInputForm(INPUT_POST, $validationFields);
     $Errors = array();
     if (erLhcoreClassModelChatBlockedUser::getCount(array('filter' => array('ip' => erLhcoreClassIPDetect::getIP()))) > 0) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'You do not have permission to chat! Please contact site owner.');
     }
     /**
      * IP Ranges block
      * */
     $ignorable_ip = erLhcoreClassModelChatConfig::fetch('banned_ip_range')->current_value;
     if ($ignorable_ip != '' && erLhcoreClassIPDetect::isIgnored(erLhcoreClassIPDetect::getIP(), explode(',', $ignorable_ip))) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'You do not have permission to chat! Please contact site owner.');
     }
     if (erLhcoreClassModelChatConfig::fetch('session_captcha')->current_value == 1) {
         if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600 || $hashCaptcha != sha1($_SERVER['REMOTE_ADDR'] . $form->{$nameField} . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'))) {
             $Errors['captcha'] = erTranslationClassLhTranslation::getInstance()->getTranslation("chat/startchat", "Your request was not processed as expected - but don't worry it was not your fault. Please re-submit your request. If you experience the same issue you will need to contact us via other means.");
         }
     } else {
         // Captcha validation
         if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600) {
             $Errors['captcha'] = erTranslationClassLhTranslation::getInstance()->getTranslation("chat/startchat", "Your request was not processed as expected - but don't worry it was not your fault. Please re-submit your request. If you experience the same issue you will need to contact us via other means.");
         }
     }
     if (isset($validationFields['Username'])) {
         if (!$form->hasValidData('Username') || $form->Username == '' && ($start_data_fields['name_require_option'] == 'required' && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_name_require_option']) && $start_data_fields['offline_name_require_option'] == 'required')) {
             $Errors['nick'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your name');
         } elseif ($form->hasValidData('Username')) {
             $chat->nick = $inputForm->username = $form->Username;
         }
         if ($form->hasValidData('Username') && $form->Username != '' && strlen($form->Username) > 50) {
             $Errors['nick'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Maximum 50 characters');
         }
     }
     if (isset($validationFields['Email'])) {
         if (!$form->hasValidData('Email') && $start_data_fields['email_require_option'] == 'required' || !$form->hasValidData('Email') && isset($additionalParams['offline'])) {
             $Errors['email'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter a valid email address');
         } elseif ($form->hasValidData('Email')) {
             $chat->email = $inputForm->email = $form->Email;
         } else {
             $chat->email = $inputForm->email = $_POST['Email'];
         }
     }
     // Validate question
     if (isset($validationFields['Question'])) {
         if (!$form->hasValidData('keyUpStarted') && (!$form->hasValidData('Question') || trim($form->Question) == '' && ($start_data_fields['message_require_option'] == 'required' && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_message_require_option']) && $start_data_fields['offline_message_require_option'] == 'required'))) {
             $Errors['question'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your message');
         } elseif ($form->hasValidData('Question')) {
             $inputForm->question = trim($form->Question);
         }
         if ($form->hasValidData('Question') && trim($form->Question) != '' && strlen($form->Question) > (int) erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value) {
             $Errors['question'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Maximum') . ' ' . (int) erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'characters for a message');
         }
     }
     if (isset($validationFields['AcceptTOS'])) {
         if (!$form->hasValidData('AcceptTOS') || $form->AcceptTOS == false) {
             $Errors['accept_tos'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'You have to accept our Terms Of Service');
         } else {
             $inputForm->accept_tos = true;
         }
     }
     // Validate phone
     if (isset($validationFields['Phone'])) {
         if (!$form->hasValidData('Phone') || ($form->Phone == '' || mb_strlen($form->Phone) < erLhcoreClassModelChatConfig::fetch('min_phone_length')->current_value) && ($start_data_fields['phone_require_option'] == 'required' && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_phone_require_option']) && $start_data_fields['offline_phone_require_option'] == 'required')) {
             $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your phone');
         } elseif ($form->hasValidData('Phone')) {
             $chat->phone = $inputForm->phone = $form->Phone;
         }
         if ($form->hasValidData('Phone') && $form->Phone != '' && strlen($form->Phone) > 100) {
             $Errors['phone'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Maximum 100 characters for phone');
         }
     }
     if ($form->hasValidData('operator') && erLhcoreClassModelUser::getUserCount(array('filter' => array('id' => $form->operator, 'disabled' => 0))) > 0) {
         $inputForm->operator = $chat->user_id = $form->operator;
     }
     /**
      * File for offline form
      * */
     $inputForm->has_file = false;
     if (isset($additionalParams['offline']) && ($inputForm->validate_start_chat == true && isset($start_data_fields['offline_file_visible_in_popup']) && $start_data_fields['offline_file_visible_in_popup'] == true || $inputForm->validate_start_chat == false && isset($start_data_fields['offline_file_visible_in_page_widget']) && $start_data_fields['offline_file_visible_in_page_widget'] == true)) {
         $fileData = erLhcoreClassModelChatConfig::fetch('file_configuration');
         $data = (array) $fileData->data;
         if ($_FILES['File']['error'] != 4) {
             // No file was provided
             if (isset($_FILES['File']) && erLhcoreClassSearchHandler::isFile('File', '/\\.(' . $data['ft_us'] . ')$/i', $data['fs_max'] * 1024)) {
                 $inputForm->has_file = true;
                 // Just extract file extension
                 $fileNameAray = explode('.', $_FILES['File']['name']);
                 end($fileNameAray);
                 // Set attribute for futher
                 $inputForm->file_extension = strtolower(current($fileNameAray));
                 $inputForm->file_location = $_FILES['File']['tmp_name'];
             } elseif (isset($_FILES['File'])) {
                 $Errors[] = erLhcoreClassSearchHandler::$lastError != '' ? erLhcoreClassSearchHandler::$lastError : erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Invalid file');
             }
         }
     }
     if ($form->hasValidData('user_timezone')) {
         $timezone_name = timezone_name_from_abbr(null, $form->user_timezone * 3600, true);
         if ($timezone_name !== false) {
             $chat->user_tz_identifier = $timezone_name;
         } else {
             $chat->user_tz_identifier = '';
         }
     }
     if ($form->hasValidData('DepartmentIDDefined')) {
         $inputForm->departament_id_array = $form->DepartmentIDDefined;
     }
     if ($form->hasValidData('DepartamentID') && erLhcoreClassModelDepartament::getCount(array('filter' => array('id' => $form->DepartamentID, 'disabled' => 0))) > 0) {
         $chat->dep_id = $form->DepartamentID;
     } elseif ($form->hasValidData('DepartamentID') && $form->DepartamentID == -1) {
         $chat->dep_id == 0;
         if (isset($additionalParams['theme']) && $additionalParams['theme'] !== false && $additionalParams['theme']->department_title != '') {
             $Errors['department'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please choose') . ' ' . htmlspecialchars($additionalParams['theme']->department_title) . '!';
         } else {
             $Errors['department'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please choose department!');
         }
     } elseif ($chat->dep_id == 0 || erLhcoreClassModelDepartament::getCount(array('filter' => array('id' => $chat->dep_id, 'disabled' => 0))) == 0) {
         // Perhaps extension overrides default department?
         $response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.validate_department', array('input_form' => $inputForm));
         // There was no callbacks or file not found etc, we try to download from standard location
         if ($response === false) {
             $departments = erLhcoreClassModelDepartament::getList(array('limit' => 1, 'filter' => array('disabled' => 0)));
             if (!empty($departments)) {
                 $department = array_shift($departments);
                 $chat->dep_id = $department->id;
             } else {
                 $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Could not determine a default department!');
             }
         } else {
             $chat->dep_id = $response['department_id'];
         }
     }
     // Set chat attributes for transfer workflow logic
     if ($chat->department !== false && $chat->department->department_transfer_id > 0) {
         $chat->transfer_if_na = 1;
         $chat->transfer_timeout_ts = time();
         $chat->transfer_timeout_ac = $chat->department->transfer_timeout;
     }
     if ($chat->department !== false && $chat->department->inform_unread == 1) {
         $chat->reinform_timeout = $chat->department->inform_unread_delay;
     }
     $inputForm->departament_id = $chat->dep_id;
     if ($inputForm->priority !== false && is_numeric($inputForm->priority)) {
         $chat->priority = (int) $inputForm->priority;
     } else {
         if ($chat->department !== false) {
             $chat->priority = $chat->department->priority;
         }
     }
     $stringParts = array();
     if ($form->hasValidData('name_items') && !empty($form->name_items)) {
         $valuesArray = array();
         if ($form->hasValidData('value_items') && !empty($form->value_items)) {
             $inputForm->value_items = $valuesArray = $form->value_items;
         }
         if ($form->hasValidData('values_req') && !empty($form->values_req)) {
             $inputForm->values_req = $form->values_req;
         }
         if ($form->hasValidData('value_types') && !empty($form->value_types)) {
             $inputForm->value_types = $form->value_types;
         }
         if ($form->hasValidData('value_sizes') && !empty($form->value_sizes)) {
             $inputForm->value_sizes = $form->value_sizes;
         }
         if ($form->hasValidData('value_show') && !empty($form->value_show)) {
             $inputForm->value_show = $form->value_show;
         }
         if ($form->hasValidData('hattr') && !empty($form->hattr)) {
             $inputForm->hattr = $form->hattr;
         }
         $inputForm->name_items = $form->name_items;
         foreach ($form->name_items as $key => $name_item) {
             if (isset($inputForm->values_req[$key]) && $inputForm->values_req[$key] == 't' && ($inputForm->value_show[$key] == 'b' || $inputForm->value_show[$key] == (isset($additionalParams['offline']) ? 'off' : 'on')) && (!isset($valuesArray[$key]) || trim($valuesArray[$key]) == '')) {
                 $Errors['additional_' . $key] = trim($name_item) . ' : ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'is required');
             }
             $stringParts[] = array('h' => $inputForm->value_types[$key] && $inputForm->value_types[$key] == 'hidden' ? true : false, 'key' => $name_item, 'value' => isset($valuesArray[$key]) ? trim($valuesArray[$key]) : '');
         }
     }
     if (isset($start_data_fields['custom_fields']) && $start_data_fields['custom_fields'] != '') {
         $customAdminfields = json_decode($start_data_fields['custom_fields'], true);
         $valuesArray = array();
         // Fill values if exists
         if ($form->hasValidData('value_items_admin')) {
             $inputForm->value_items_admin = $valuesArray = $form->value_items_admin;
         }
         if ($form->hasValidData('via_hidden')) {
             $inputForm->via_hidden = $form->via_hidden;
         }
         if (is_array($customAdminfields)) {
             foreach ($customAdminfields as $key => $adminField) {
                 if (isset($inputForm->value_items_admin[$key]) && isset($adminField['isrequired']) && $adminField['isrequired'] == 'true' && ($adminField['visibility'] == 'all' || $adminField['visibility'] == (isset($additionalParams['offline']) ? 'off' : 'on')) && (!isset($valuesArray[$key]) || trim($valuesArray[$key]) == '')) {
                     $Errors['additional_admin_' . $key] = trim($adminField['fieldname']) . ': ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'is required');
                 }
                 if (isset($valuesArray[$key]) && $valuesArray[$key] != '') {
                     $stringParts[] = array('identifier' => $adminField['fieldidentifier'], 'key' => $adminField['fieldname'], 'value' => isset($valuesArray[$key]) ? trim($valuesArray[$key]) : '');
                 }
             }
         }
     }
     if (!empty($stringParts)) {
         $chat->additional_data = json_encode($stringParts);
     }
     erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.validate_start_chat', array('errors' => &$Errors, 'input_form' => &$inputForm, 'start_data_fields' => &$start_data_fields, 'chat' => &$chat, 'additional_params' => &$additionalParams));
     return $Errors;
 }
示例#12
0
include_once erLhcoreClassDesign::designtpl('pagelayouts/parts/page_head.tpl.php');
?>
	</head>
<body ng-controller="LiveHelperChatCtrl as lhc">


<?php 
include_once erLhcoreClassDesign::designtpl('pagelayouts/parts/top_menu.tpl.php');
?>

<div class="row pt10 border-top-grey">
<div class="columns large-12">

<?php 
include_once erLhcoreClassDesign::designtpl('pagelayouts/parts/path.tpl.php');
$canUseChat = erLhcoreClassUser::instance()->hasAccessTo('lhchat', 'use');
?>

<div class="row">

    <div class="columns large-<?php 
$canUseChat == true ? print '9' : (print '12');
?>
">
    	<?php 
echo $Result['content'];
?>
    </div>

    <?php 
if ($canUseChat == true) {
示例#13
0
        }
        try {
            if (is_numeric($dataRequest['u'])) {
                $userToLogin = erLhcoreClassModelUser::fetch((int) $dataRequest['u']);
            } else {
                $users = erLhcoreClassModelUser::getUserList(array('limit' => 1, 'filter' => array('username' => $dataRequest['l'])));
                if (!empty($users)) {
                    $userToLogin = array_shift($users);
                } else {
                    die(erTranslationClassLhTranslation::getInstance()->getTranslation('users/autologin', 'Could not find a user'));
                }
            }
        } catch (Exception $e) {
            die($e->getMessage());
        }
        if ($userToLogin instanceof erLhcoreClassModelUser) {
            erLhcoreClassUser::instance()->setLoggedUser($userToLogin->id);
            header('Location: ' . erLhcoreClassDesign::baseurldirect('site_admin') . '/' . ltrim($dataRequest['r'], '/'));
            exit;
        } else {
            die(erTranslationClassLhTranslation::getInstance()->getTranslation('users/autologin', 'Could not find a provided user'));
        }
    } else {
        die(erTranslationClassLhTranslation::getInstance()->getTranslation('users/autologin', 'Invalid autologin hash'));
        exit;
    }
} else {
    die(erTranslationClassLhTranslation::getInstance()->getTranslation('users/autologin', 'Auto login module is not enabled'));
    exit;
}
exit;
示例#14
0
<h1><?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('form/index', 'Form');
?>
</h1>

<ul class="circle small-list">
    <li><a href="<?php 
echo erLhcoreClassDesign::baseurl('abstract/list');
?>
/Form"><?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('form/index', 'List of forms');
?>
</a></li>
    <?php 
if (erLhcoreClassUser::instance()->hasAccessTo('lhform', 'generate_js')) {
    ?>
    <li><a href="<?php 
    echo erLhcoreClassDesign::baseurl('form/embedcode');
    ?>
"><?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('form/index', 'Page embed code');
    ?>
</a></li>
    <?php 
}
?>
</ul>
<?php

include erLhcoreClassDesign::designtpl('lhchat/chat_tabs/operator_screenshot_tab_pre.tpl.php');
if ($operator_screenshot_tab_enabled == true && erLhcoreClassUser::instance()->hasAccessTo('lhchat', 'take_screenshot')) {
    ?>
<li role="presentation"<?php 
    if ($chatTabsOrderDefault == 'operator_screenshot_tab') {
        print ' class="active"';
    }
    ?>
><a href="#main-user-info-screenshot-<?php 
    echo $chat->id;
    ?>
" aria-controls="main-user-info-screenshot-<?php 
    echo $chat->id;
    ?>
" title="<?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/screenshot', 'Screenshot');
    ?>
" role="tab" data-toggle="tab"><i class="material-icons mr-0">photo_camera</i></a></li>
<?php 
}
示例#16
0
            ?>
checked="checked"<?php 
        }
        ?>
 /> <?php 
        echo erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit', 'Execute unanswered chat logic again for recipient department?');
        ?>
</label>
				</div>	  
			 </div>
			<?php 
    }
    ?>
			
			<?php 
    if (erLhcoreClassUser::instance()->hasAccessTo('lhdepartament', 'actautoassignment')) {
        ?>
			<div role="tabpanel" class="tab-pane" id="autoassignment">
			    <label><?php 
        echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/operatorsbalancing', 'Active');
        ?>
 <input type="checkbox" ng-init="AutoAssignActive=<?php 
        if ($departament->active_balancing == 1) {
            ?>
true<?php 
        } else {
            ?>
false<?php 
        }
        ?>
" ng-model="AutoAssignActive" name="AutoAssignActive" value="on" <?php 
示例#17
0
 public static function validateDepartment(erLhcoreClassModelDepartament &$department)
 {
     $definition = array('Name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'XMPPRecipients' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'XMPPRecipientsGroup' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Identifier' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'Priority' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'TansferDepartmentID' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1)), 'TransferTimeout' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 5)), 'delay_lm' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 5)), 'mod' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'tud' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'wed' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'thd' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'frd' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'sad' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'sud' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'OnlineHoursActive' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'Disabled' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'Hidden' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'inform_close' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'inform_unread' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'nc_cb_execute' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'na_cb_execute' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'AutoAssignActive' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'VisibleIfOnline' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'MaxNumberActiveChats' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'MaxWaitTimeoutSeconds' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'StartHour' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0, 'mx_range' => 24)), 'StartHourMinit' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0, 'mx_range' => 60)), 'inform_unread_delay' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 5)), 'EndHour' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0, 'mx_range' => 24)), 'EndHourMinit' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0, 'mx_range' => 60)), 'inform_delay' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0)), 'inform_options' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     if (!$form->hasValidData('Name') || $form->Name == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('departament/edit', 'Please enter a department name');
     } else {
         $department->name = $form->Name;
     }
     if (erLhcoreClassUser::instance()->hasAccessTo('lhdepartment', 'actautoassignment')) {
         if ($form->hasValidData('AutoAssignActive') && $form->AutoAssignActive == true) {
             $department->active_balancing = 1;
         } else {
             $department->active_balancing = 0;
         }
         if ($form->hasValidData('MaxNumberActiveChats')) {
             $department->max_active_chats = $form->MaxNumberActiveChats;
         } else {
             $department->max_active_chats = 0;
         }
         if ($form->hasValidData('MaxWaitTimeoutSeconds')) {
             $department->max_timeout_seconds = $form->MaxWaitTimeoutSeconds;
         } else {
             $department->max_timeout_seconds = 0;
         }
     }
     if (erLhcoreClassUser::instance()->hasAccessTo('lhdepartment', 'actworkflow')) {
         if ($form->hasValidData('TansferDepartmentID')) {
             $department->department_transfer_id = $form->TansferDepartmentID;
         } else {
             $department->department_transfer_id = 0;
         }
         if ($form->hasValidData('TransferTimeout')) {
             $department->transfer_timeout = $form->TransferTimeout;
         } else {
             $department->transfer_timeout = 0;
         }
         if ($form->hasValidData('nc_cb_execute') && $form->nc_cb_execute == true) {
             $department->nc_cb_execute = 1;
         } else {
             $department->nc_cb_execute = 0;
         }
         if ($form->hasValidData('na_cb_execute') && $form->na_cb_execute == true) {
             $department->na_cb_execute = 1;
         } else {
             $department->na_cb_execute = 0;
         }
     }
     if ($form->hasValidData('Identifier')) {
         $department->identifier = $form->Identifier;
     }
     if ($form->hasValidData('delay_lm')) {
         $department->delay_lm = $form->delay_lm;
     } else {
         $department->delay_lm = 0;
     }
     if ($form->hasValidData('Email')) {
         $partsEmail = explode(',', $form->Email);
         $validatedEmail = array();
         foreach ($partsEmail as $email) {
             if (filter_var(trim($email), FILTER_VALIDATE_EMAIL)) {
                 $validatedEmail[] = trim($email);
             }
         }
         $department->email = implode(',', $validatedEmail);
     } else {
         $department->email = '';
     }
     if ($form->hasValidData('XMPPRecipients')) {
         $department->xmpp_recipients = $form->XMPPRecipients;
     } else {
         $department->xmpp_recipients = '';
     }
     if ($form->hasValidData('XMPPRecipientsGroup')) {
         $department->xmpp_group_recipients = $form->XMPPRecipientsGroup;
     } else {
         $department->xmpp_group_recipients = '';
     }
     if ($form->hasValidData('Priority')) {
         $department->priority = $form->Priority;
     } else {
         $department->priority = 0;
     }
     if ($form->hasValidData('inform_close') && $form->inform_close === true) {
         $department->inform_close = 1;
     } else {
         $department->inform_close = 0;
     }
     if ($form->hasValidData('inform_unread') && $form->inform_unread === true) {
         $department->inform_unread = 1;
     } else {
         $department->inform_unread = 0;
     }
     if ($form->hasValidData('VisibleIfOnline') && $form->VisibleIfOnline === true) {
         $department->visible_if_online = 1;
     } else {
         $department->visible_if_online = 0;
     }
     if ($form->hasValidData('inform_unread_delay')) {
         $department->inform_unread_delay = $form->inform_unread_delay;
     } elseif ($department->inform_unread == 1) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('departament/edit', 'Minimum 5 seconds');
     } else {
         $department->inform_unread_delay = 0;
     }
     if ($form->hasValidData('Disabled') && $form->Disabled === true) {
         $department->disabled = 1;
     } else {
         $department->disabled = 0;
     }
     if ($form->hasValidData('Hidden') && $form->Hidden === true) {
         $department->hidden = 1;
     } else {
         $department->hidden = 0;
     }
     if ($form->hasValidData('mod') && $form->mod === true) {
         $department->mod = 1;
     } else {
         $department->mod = 0;
     }
     if ($form->hasValidData('tud') && $form->tud === true) {
         $department->tud = 1;
     } else {
         $department->tud = 0;
     }
     if ($form->hasValidData('wed') && $form->wed === true) {
         $department->wed = 1;
     } else {
         $department->wed = 0;
     }
     if ($form->hasValidData('thd') && $form->thd === true) {
         $department->thd = 1;
     } else {
         $department->thd = 0;
     }
     if ($form->hasValidData('frd') && $form->frd === true) {
         $department->frd = 1;
     } else {
         $department->frd = 0;
     }
     if ($form->hasValidData('sad') && $form->sad === true) {
         $department->sad = 1;
     } else {
         $department->sad = 0;
     }
     if ($form->hasValidData('sud') && $form->sud === true) {
         $department->sud = 1;
     } else {
         $department->sud = 0;
     }
     if ($form->hasValidData('OnlineHoursActive') && $form->OnlineHoursActive === true) {
         $department->online_hours_active = 1;
     } else {
         $department->online_hours_active = 0;
     }
     if ($form->hasValidData('inform_options')) {
         $department->inform_options = serialize($form->inform_options);
         $department->inform_options_array = $form->inform_options;
     } else {
         $department->inform_options = serialize(array());
     }
     if ($form->hasValidData('StartHour')) {
         $startHour = $form->StartHour;
     } else {
         $startHour = 0;
     }
     if ($form->hasValidData('EndHour')) {
         $endHour = $form->EndHour;
     } else {
         $endHour = 0;
     }
     if ($form->hasValidData('StartHourMinit')) {
         $StartHourMinit = str_pad($form->StartHourMinit, 2, '0', STR_PAD_LEFT);
     } else {
         $StartHourMinit = '00';
     }
     if ($form->hasValidData('EndHourMinit')) {
         $endHourMinit = str_pad($form->EndHourMinit, 2, '0', STR_PAD_LEFT);
     } else {
         $endHourMinit = '00';
     }
     $department->start_hour = $startHour . $StartHourMinit;
     $department->end_hour = $endHour . $endHourMinit;
     if ($form->hasValidData('inform_delay')) {
         $department->inform_delay = $form->inform_delay;
     } else {
         $department->inform_delay = 0;
     }
     if ($department->id > 0 && $department->department_transfer_id == $department->id) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('departament/edit', 'Transfer department has to be different one than self');
     }
     return $Errors;
 }
    echo $chat->id;
    ?>
',$('#tabs'),true)" title="<?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat', 'Close chat');
    ?>
"></a>
		<a class="icon-cancel-squared" onclick="lhinst.deleteChat('<?php 
    echo $chat->id;
    ?>
',$('#tabs'),true)" title="<?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat', 'Delete chat');
    ?>
"></a>
			
		<?php 
    if (erLhcoreClassUser::instance()->hasAccessTo('lhchat', 'allowtransfer')) {
        ?>
		<a class="icon-users" onclick="lhinst.transferUserDialog('<?php 
        echo $chat->id;
        ?>
',$(this).attr('title'))" title="<?php 
        echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat', 'Transfer chat');
        ?>
">
		<?php 
    }
    ?>

		<a class="icon-block" data-title="<?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat', 'Are you sure?');
    ?>
 public function __get($var)
 {
     switch ($var) {
         case 'last_visit_front':
             return $this->last_visit_front = date(erLhcoreClassModule::$dateDateHourFormat, $this->last_visit);
             break;
         case 'first_visit_front':
             return $this->first_visit_front = date(erLhcoreClassModule::$dateDateHourFormat, $this->first_visit);
             break;
         case 'invitation':
             $this->invitation = false;
             if ($this->invitation_id > 0) {
                 try {
                     $this->invitation = erLhAbstractModelProactiveChatInvitation::fetch($this->invitation_id);
                 } catch (Exception $e) {
                     $this->invitation = false;
                 }
             }
             return $this->invitation;
             break;
         case 'has_message_from_operator':
             return $this->message_seen == 0 && $this->operator_message != '';
             break;
         case 'notes_intro':
             return $this->notes_intro = $this->notes != '' ? '[ ' . mb_substr($this->notes, 0, 50) . ' ]' . '<br/>' : '';
             break;
         case 'chat':
             $this->chat = false;
             if ($this->chat_id > 0) {
                 try {
                     $this->chat = erLhcoreClassModelChat::fetch($this->chat_id);
                 } catch (Exception $e) {
                     //
                 }
             }
             return $this->chat;
             break;
         case 'can_view_chat':
             $this->can_view_chat = false;
             $currentUser = erLhcoreClassUser::instance();
             if ($this->operator_user_id == $currentUser->getUserID()) {
                 $this->can_view_chat = true;
                 // Faster way
             } else {
                 if ($this->chat instanceof erLhcoreClassModelChat) {
                     $this->can_view_chat = erLhcoreClassChat::hasAccessToRead($this->chat);
                 }
             }
             return $this->can_view_chat;
             break;
         case 'operator_user':
             $this->operator_user = false;
             if ($this->operator_user_id > 0) {
                 try {
                     $this->operator_user = erLhcoreClassModelUser::fetch($this->operator_user_id);
                 } catch (Exception $e) {
                 }
             }
             return $this->operator_user;
             break;
         case 'operator_user_send':
             $this->operator_user_send = $this->operator_user !== false;
             return $this->operator_user_send;
             break;
         case 'operator_user_string':
             $this->operator_user_string = (string) $this->operator_user;
             return $this->operator_user_string;
             break;
         case 'time_on_site_front':
             $this->time_on_site_front = gmdate(erLhcoreClassModule::$dateHourFormat, $this->time_on_site);
             return $this->time_on_site_front;
             break;
         case 'tt_time_on_site_front':
             $this->tt_time_on_site_front = null;
             $diff = $this->tt_time_on_site;
             $days = floor($diff / (3600 * 24));
             $hours = floor(($diff - $days * 3600 * 24) / 3600);
             $minits = floor(($diff - $hours * 3600 - $days * 3600 * 24) / 60);
             $seconds = $diff - $hours * 3600 - $minits * 60 - $days * 3600 * 24;
             if ($days > 0) {
                 $this->tt_time_on_site_front = $days . ' d.';
             } elseif ($hours > 0) {
                 $this->tt_time_on_site_front = $hours . ' h.';
             } elseif ($minits > 0) {
                 $this->tt_time_on_site_front = $minits . ' m.';
             } elseif ($seconds >= 0) {
                 $this->tt_time_on_site_front = $seconds . ' s.';
             }
             return $this->tt_time_on_site_front;
             break;
         case 'last_visit_seconds_ago':
             $this->last_visit_seconds_ago = time() - $this->last_visit;
             return $this->last_visit_seconds_ago;
             break;
         case 'last_check_time_ago':
             $this->last_check_time_ago = time() - $this->last_check_time;
             return $this->last_check_time_ago;
             break;
         case 'visitor_tz_time':
             $this->visitor_tz_time = '-';
             if ($this->visitor_tz != '') {
                 $date = new DateTime(null, new DateTimeZone($this->visitor_tz));
                 $this->visitor_tz_time = $date->format(erLhcoreClassModule::$dateHourFormat);
             }
             return $this->visitor_tz_time;
             break;
         case 'lastactivity_ago':
             $this->lastactivity_ago = '';
             if ($this->last_visit > 0) {
                 $periods = array("s.", "m.", "h.", "d.", "w.", "m.", "y.", "dec.");
                 $lengths = array("60", "60", "24", "7", "4.35", "12", "10");
                 $difference = time() - $this->last_visit;
                 for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths) - 1; $j++) {
                     $difference /= $lengths[$j];
                 }
                 $difference = round($difference);
                 $this->lastactivity_ago = "{$difference} {$periods[$j]}";
             }
             return $this->lastactivity_ago;
             break;
         case 'screenshot':
             $this->screenshot = false;
             if ($this->screenshot_id > 0) {
                 try {
                     $this->screenshot = erLhcoreClassModelChatFile::fetch($this->screenshot_id);
                 } catch (Exception $e) {
                 }
             }
             return $this->screenshot;
             break;
         case 'online_attr_system_array':
             $this->online_attr_system_array = array();
             if ($this->online_attr_system != '') {
                 $this->online_attr_system_array = json_decode($this->online_attr_system, true);
             }
             return $this->online_attr_system_array;
             break;
         case 'online_status':
             $this->online_status = 2;
             // Offline
             if (erLhcoreClassChat::$trackTimeout == 0) {
                 erLhcoreClassChat::$trackTimeout = 15;
             }
             if (erLhcoreClassChat::$trackActivity == true) {
                 if ($this->last_check_time_ago < erLhcoreClassChat::$trackTimeout + 10 && $this->user_active == 1) {
                     //User still on site, it does not matter that he have closed widget.
                     $this->online_status = 0;
                     // Online
                 } elseif ($this->last_check_time_ago < erLhcoreClassChat::$trackTimeout + 10 && $this->user_active == 0) {
                     $this->online_status = 1;
                     // Away
                 }
             } else {
                 if ($this->last_check_time_ago < erLhcoreClassChat::$trackTimeout + 10 && time() - $this->last_user_msg_time < 300) {
                     //User still on site, it does not matter that he have closed widget.
                     $this->online_status = 0;
                     // Online
                 } elseif ($this->last_check_time_ago < erLhcoreClassChat::$trackTimeout + 10 && time() - $this->last_user_msg_time >= 300) {
                     $this->online_status = 1;
                     // Away
                 }
             }
             return $this->online_status;
             break;
         default:
             break;
     }
 }
echo (int) ($soundData['chat_message_sinterval'] * 1000);
?>
;confLH.new_chat_sound_enabled = <?php 
echo (int) erLhcoreClassModelUserSetting::getSetting('new_chat_sound', (int) $soundData['new_chat_sound_enabled']);
?>
;confLH.new_message_sound_admin_enabled = <?php 
echo (int) erLhcoreClassModelUserSetting::getSetting('chat_message', (int) $soundData['new_message_sound_admin_enabled']);
?>
;confLH.new_message_sound_user_enabled = <?php 
echo (int) erLhcoreClassModelUserSetting::getSetting('chat_message', (int) $soundData['new_message_sound_user_enabled']);
?>
;confLH.new_message_browser_notification = <?php 
echo isset($soundData['browser_notification_message']) ? (int) $soundData['browser_notification_message'] : 0;
?>
;confLH.transLation = {'new_chat':'New chat request'};confLH.csrf_token = '<?php 
echo erLhcoreClassUser::instance()->getCSFRToken();
?>
';confLH.repeat_sound = <?php 
echo (int) $soundData['repeat_sound'];
?>
;confLH.repeat_sound_delay = <?php 
echo (int) $soundData['repeat_sound_delay'];
?>
;confLH.show_alert = <?php 
echo (int) $soundData['show_alert'];
?>
;</script><script type="text/javascript" src="/north-american-nemesis-new/chattool/cache/compiledtemplates/4079b29f9b336083f1a058bab4e0ccbb.js"></script><?php 
echo isset($Result['additional_header_js']) ? $Result['additional_header_js'] : '';
?>
</head><body><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><span><a href="/north-american-nemesis-new/chattool/index.php/site_admin/" title="Home"><img src="/north-american-nemesis-new/chattool/design/defaulttheme/images/general/logo.png" alt="demox user chat" title="demox user chat"></a></span></div><div class="modal-body"><?php 
echo $Result['content'];
示例#21
0
    }
    if (count($globalDepartament) > 0) {
        erLhcoreClassUserDep::addUserDepartaments($globalDepartament, false, $UserData);
    } else {
        erLhcoreClassUserDep::addUserDepartaments(array(), false, $UserData);
    }
    $tpl->set('account_updated_departaments', 'done');
    $tpl->set('tab', 'tab_departments');
}
// If already set during account update
if (!isset($UserData)) {
    $UserData = $currentUser->getUserData();
}
$tpl->set('editdepartaments', $allowEditDepartaments);
$tpl->set('user', $UserData);
if (erLhcoreClassUser::instance()->hasAccessTo('lhuser', 'personalcannedmsg')) {
    /**
     * Canned messages part
     * */
    $cannedMessage = new erLhcoreClassModelCannedMsg();
    if (is_numeric($Params['user_parameters_unordered']['msg']) && $Params['user_parameters_unordered']['action'] == '') {
        $cannedMessage = erLhcoreClassModelCannedMsg::fetch($Params['user_parameters_unordered']['msg']);
        if ($cannedMessage->user_id != $UserData->id) {
            erLhcoreClassModule::redirect('user/account', '#canned');
            exit;
        }
    }
    if (isset($_POST['Cancel_canned_action'])) {
        erLhcoreClassModule::redirect('user/account', '#canned');
        exit;
    }
示例#22
0
 public static function isOwner($id, $skipChecking = false)
 {
     $obj = self::fetch($id);
     if ($skipChecking == true) {
         return $obj;
     }
     $currentUser = erLhcoreClassUser::instance();
     if ($obj->user_id == $currentUser->getUserID()) {
         return $obj;
     }
     return false;
 }
示例#23
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;
    $closedTabEnabled = (int) erLhcoreClassModelUserSetting::getSetting('enable_close_list', 0);
    $unreadTabEnabled = (int) erLhcoreClassModelUserSetting::getSetting('enable_unread_list', 1);
    ?>
<div class="columns col-sm-4 col-md-3" id="right-column-page" ng-cloak><?php 
    $transfer_panel_container_pre_enabled = erLhcoreClassUser::instance()->hasAccessTo('lhchat', 'use');
    if ($transfer_panel_container_pre_enabled == true) {
        ?>
<div role="tabpanel" ng-show="transfer_dep_chats.list.length > 0 || transfer_chats.list.length > 0"><!-- Nav tabs -->
<ul class="nav nav-pills" role="tablist"><li role="presentation" class="active"><a title="Chats transferred to you directly" href="#transferedperson" aria-controls="transferedperson" role="tab" data-toggle="tab"><i class="icon-user"></i><span class="tru-cnt"></span></a></li><li role="presentation"><a title="Transferred to your department" href="#transfereddep" aria-controls="transfereddep" role="tab" data-toggle="tab"><i class="icon-users"></i><span class="trd-cnt"></span></a></li></ul><!-- Tab panes -->
<div class="tab-content"><div role="tabpanel" class="tab-pane active" id="transferedperson"><div id="right-transfer-chats"><ul class="no-bullet small-list"><li ng-repeat="chat in transfer_chats.list"><img class="action-image right-action-hide" align="absmiddle" ng-click="lhc.startChatTransfer(chat.id,chat.nick,chat.transfer_id)" src="/design/defaulttheme/images/icons/accept.png" alt="Accept chat" title="Accept chat"><img class="action-image" align="absmiddle" ng-click="lhc.startChatNewWindowTransfer(chat.id,chat.nick,chat.transfer_id)" src="/design/defaulttheme/images/icons/application_add.png" alt="Open in a new window" title="Open in a new window"> {{chat.id}}. {{chat.nick}} ({{chat.time_front}})</li></ul><p ng-show="transfer_chats.list.length == 0">Empty...</p></div></div><div role="tabpanel" class="tab-pane" id="transfereddep"><div id="right-transfer-departments"><ul class="no-bullet small-list"><li ng-repeat="chat in transfer_dep_chats.list"><img class="action-image right-action-hide" align="absmiddle" ng-click="lhc.startChatTransfer(chat.id,chat.nick,chat.transfer_id)" src="/design/defaulttheme/images/icons/accept.png" alt="Accept chat" title="Accept chat"><img class="action-image" align="absmiddle" ng-click="lhc.startChatNewWindowTransfer(chat.id,chat.nick,chat.transfer_id)" src="/design/defaulttheme/images/icons/application_add.png" alt="Open in a new window" title="Open in a new window"> {{chat.id}}. {{chat.nick}} ({{chat.time_front}})</li></ul><p ng-show="transfer_dep_chats.list.length == 0">Empty...</p></div></div></div></div><?php 
    }
    ?>
<div class="panel panel-default panel-lhc" ng-show="pending_chats.list.length > 0 || active_chats.list.length > 0 || unread_chats.list.length > 0 || closed_chats.list.length > 0<?php 
    ?>
"><?php 
    $basicChatEnabled = erLhcoreClassUser::instance()->hasAccessTo('lhchat', 'use');
    if ($basicChatEnabled == true) {
        if ($pendingTabEnabled == true) {
            ?>
<div class="panel-heading" ng-if="pending_chats.list.length > 0"><a href="/index.php/chat/pendingchats"><i class="icon-chat chat-pending"></i> Pending chats ({{pending_chats.list.length}}{{pending_chats.list.length == 10 ? '+' : ''}})</a><a title="collapse/expand" ng-click="lhc.toggleList('pending_chats_expanded')" ng-class="pending_chats_expanded == true ? 'icon-minus' : 'icon-plus'" class="fs18 pull-right"></a></div><div class="panel-body" id="right-pending-chats" ng-if="pending_chats.list.length > 0 && pending_chats_expanded == true"><ul class="list-unstyled"><li ng-repeat="chat in pending_chats.list track by chat.id"><span ng-if="chat.country_code != undefined"><img ng-src="/design/defaulttheme/images/flags/{{chat.country_code}}.png" alt="{{chat.country_name}}" title="{{chat.country_name}}" /></span><i class="icon-user icon-user-assigned" ng-show="chat.user_name" title="Assigned operator - {{chat.user_name}}"></i><a class="icon-info" title="ID - {{chat.id}}" ng-click="lhc.previewChat(chat.id)"></a><a class="icon-reply" title="Redirect user to contact form." ng-click="lhc.redirectContact(chat.id,'Are you sure?')" ></a><a class="right-action-hide icon-chat" ng-click="lhc.startChat(chat.id,chat.nick)" title="Accept chat"></a><a title="Open in a new window" class="icon-popup" ng-click="lhc.startChatNewWindow(chat.id,chat.nick)"></a>{{chat.nick}}, <small><i>{{chat.wait_time_pending}},</i></small> {{chat.department_name}}</li></ul><p ng-show="pending_chats.list.length == 0">Empty...</p></div><?php 
        }
    }
    if ($basicChatEnabled == true) {
        if ($activeTabEnabled == true) {
            ?>
<div class="panel-heading" ng-if="active_chats.list.length > 0"><a href="/index.php/chat/activechats"><i class="icon-chat chat-active"></i> Active chats({{active_chats.list.length}}{{active_chats.list.length == 10 ? '+' : ''}})</a><a title="collapse/expand" ng-click="lhc.toggleList('active_chats_expanded')" ng-class="active_chats_expanded == true ? 'icon-minus' : 'icon-plus'" class="fs18 pull-right"></a></div><div class="panel-body"  id="right-active-chats" ng-show="active_chats.list.length > 0 && active_chats_expanded == true"><ul class="list-unstyled"><li ng-repeat="chat in active_chats.list track by chat.id" ><span ng-if="chat.country_code != undefined"><img ng-src="/design/defaulttheme/images/flags/{{chat.country_code}}.png" alt="{{chat.country_name}}" title="{{chat.country_name}}" /></span><a class="icon-info" title="ID - {{chat.id}}, {{chat.user_name}}" ng-click="lhc.previewChat(chat.id)" ></a><a class="right-action-hide icon-chat" ng-click="lhc.startChat(chat.id,chat.nick)" title="Add chat"></a><a class="icon-popup" ng-click="lhc.startChatNewWindow(chat.id,chat.nick)" title="Open in a new window"></a> {{chat.nick}}, <small><i>{{chat.time_created_front}},</i></small> {{chat.department_name}}</li></ul><p ng-show="active_chats.list.length == 0">Empty...</p></div><?php 
        }
        if ($unreadTabEnabled == true) {
            ?>
<div class="panel-heading" ng-if="unread_chats.list.length > 0"><a href="/index.php/chat/unreadchats"><i class="icon-comment chat-unread"></i> Unread messages ({{unread_chats.list.length}}{{unread_chats.list.length == 10 ? '+' : ''}})</a><a title="collapse/expand" ng-click="lhc.toggleList('unread_chats_expanded')" ng-class="unread_chats_expanded == true ? 'icon-minus' : 'icon-plus'" class="fs18 pull-right"></a></div><div class="panel-body" ng-if="unread_chats.list.length > 0 && unread_chats_expanded == true" id="right-unread-chats"><ul class="list-unstyled"><li ng-repeat="chat in unread_chats.list track by chat.id"  ><span ng-if="chat.country_code != undefined"><img ng-src="/design/defaulttheme/images/flags/{{chat.country_code}}.png" alt="{{chat.country_name}}" title="{{chat.country_name}}" /></span><a class="icon-info" title="ID - {{chat.id}}" ng-click="lhc.previewChat(chat.id)" ></a><a class="right-action-hide icon-chat" ng-click="lhc.startChat(chat.id,chat.nick)" title="Add chat"></a><a class="icon-popup" ng-click="lhc.startChatNewWindow(chat.id,chat.nick)" title="Open in a new window"></a> {{chat.nick}}, {{chat.time_created_front}}, {{chat.department_name}} | <b>{{chat.unread_time.hours}} h. {{chat.unread_time.minits}} m. {{chat.unread_time.seconds}} s. ago.</b></li></ul><p ng-show="unread_chats.list.length == 0">Empty...</p></div><?php 
        }
示例#25
0
<?php

if (erLhcoreClassUser::instance()->hasAccessTo('lhsystem', 'generatejs')) {
    ?>
<ul class="button-group round right-button">
	<li><a href="<?php 
    echo erLhcoreClassDesign::baseurl('system/htmlcode');
    ?>
" class="button small"><?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'Widget embed code');
    ?>
</a></li>
	<li><a href="<?php 
    echo erLhcoreClassDesign::baseurl('system/embedcode');
    ?>
" class="button small"><?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'Page embed code');
    ?>
</a></li>
</ul>
<?php 
}
?>
<h1><?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists', 'Choose what type of list you want to see');
?>
</h1>

<ul class="circle small-list">
    <li><a href="<?php 
echo erLhcoreClassDesign::baseurl('chat/pendingchats');
        ?>
 
	       <?php 
    } elseif ($tabItem == 'operator_remarks_tab') {
        ?>
	       <?php 
        include erLhcoreClassDesign::designtpl('lhchat/chat_tabs/operator_remarks_tab.tpl.php');
        ?>
	       <?php 
    } elseif ($tabItem == 'information_tab_user_files_tab') {
        ?>
	       <?php 
        $fileData = (array) erLhcoreClassModelChatConfig::fetch('file_configuration')->data;
        ?>
	    <?php 
        if (isset($fileData['active_admin_upload']) && $fileData['active_admin_upload'] == true && erLhcoreClassUser::instance()->hasAccessTo('lhfile', 'use_operator')) {
            ?>
	    <?php 
            include erLhcoreClassDesign::designtpl('lhchat/chat_tabs/information_tab_user_files_tab.tpl.php');
            ?>
	
	    <?php 
        }
        ?>
	       <?php 
    } elseif ($tabItem == 'operator_screenshot_tab') {
        ?>
	       <?php 
        include erLhcoreClassDesign::designtpl('lhchat/chat_tabs/operator_screenshot_tab.tpl.php');
        ?>
	       <?php 
示例#27
0
<?php

$currentUser = erLhcoreClassUser::instance();
$userData = $currentUser->getUserData(true);
if ($Params['user_parameters']['status'] == 'false') {
    $userData->invisible_mode = 0;
} else {
    $userData->invisible_mode = 1;
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.operator_visibility_changed', array('user' => &$userData, 'reason' => 'user_action'));
erLhcoreClassUser::getSession()->update($userData);
exit;
<?php

if (erLhcoreClassUser::instance()->hasAccessTo('lhchat', 'take_screenshot')) {
    ?>
<section>
    <p class="title" data-section-title><a href="#screenshot"><?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/screenshot', 'Screenshot');
    ?>
</a></p>
    <div class="content" data-section-content>    
      <div>
            
	    <ul class="button-group radius">
	      <li><input type="button" value="<?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/screenshot', 'Take user screenshot');
    ?>
" class="button tiny" onclick="lhinst.addRemoteCommand('<?php 
    echo $chat->id;
    ?>
','lhc_screenshot')" /></li>
		  <li><input type="button" value="<?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/screenshot', 'Refresh');
    ?>
" class="button tiny" onclick="lhinst.updateScreenshot('<?php 
    echo $chat->id;
    ?>
')" /></li>
		</ul>
	
      	<div id="user-screenshot-container">
      	
 public function blockUser()
 {
     if (erLhcoreClassModelChatBlockedUser::getCount(array('filter' => array('ip' => $this->ip))) == 0) {
         $block = new erLhcoreClassModelChatBlockedUser();
         $block->ip = $this->ip;
         $block->user_id = erLhcoreClassUser::instance()->getUserID();
         $block->saveThis();
     }
 }
 />&nbsp;<?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/sendnotice', 'Requires phone');
?>
</label></div>
	</div>
	
	<select class="form-control" id="id_CannedMessage-<?php 
echo $chat->id;
?>
" onchange="$('#sendMessageContent').val(($(this).val() > 0) ? $(this).find(':selected').text() : '');">
		        <option value=""><?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat', 'Select a canned message');
?>
</option>
		        <?php 
foreach (erLhcoreClassModelCannedMsg::getCannedMessages($chat->dep_id, erLhcoreClassUser::instance()->getUserID()) as $item) {
    ?>
		            <option value="<?php 
    echo $item->id;
    ?>
"><?php 
    echo htmlspecialchars(str_replace('{nick}', isset($chat) ? $chat->nick : '', $item->msg));
    ?>
</option>
		       <?php 
}
?>
	</select>
		      
	<input type="hidden" name="SendMessage" value="1" />
	<hr>