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 getList($paramsSearch = array()) { $paramsDefault = array('limit' => 32, 'offset' => 0); $params = array_merge($paramsDefault, $paramsSearch); $session = erLhcoreClassUser::getSession(); $q = $session->createFindQuery('erLhcoreClassModelUserSetting'); $conditions = array(); if (isset($params['filter']) && count($params['filter']) > 0) { foreach ($params['filter'] as $field => $fieldValue) { $conditions[] = $q->expr->eq($field, $q->bindValue($fieldValue)); } } if (isset($params['filterin']) && count($params['filterin']) > 0) { foreach ($params['filterin'] as $field => $fieldValue) { $conditions[] = $q->expr->in($field, $fieldValue); } } if (isset($params['filterlt']) && count($params['filterlt']) > 0) { foreach ($params['filterlt'] as $field => $fieldValue) { $conditions[] = $q->expr->lt($field, $q->bindValue($fieldValue)); } } if (isset($params['filtergt']) && count($params['filtergt']) > 0) { foreach ($params['filtergt'] as $field => $fieldValue) { $conditions[] = $q->expr->gt($field, $q->bindValue($fieldValue)); } } if (count($conditions) > 0) { $q->where($conditions); } $q->limit($params['limit'], $params['offset']); $q->orderBy(isset($params['sort']) ? $params['sort'] : 'identifier DESC'); $objects = $session->find($q, 'erLhcoreClassModelUserSettingOption'); return $objects; }
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 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; }
public static function deleteGroup($group_id) { $Group = erLhcoreClassUser::getSession()->load('erLhcoreClassModelGroup', $group_id); erLhcoreClassUser::getSession()->delete($Group); $q = ezcDbInstance::get()->createDeleteQuery(); // Transfered chats to user $q->deleteFrom('lh_groupuser')->where($q->expr->eq('group_id', $group_id)); $stmt = $q->prepare(); $stmt->execute(); // Transfered chats to user $q->deleteFrom('lh_grouprole')->where($q->expr->eq('group_id', $group_id)); $stmt = $q->prepare(); $stmt->execute(); }
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; } } }
public static function getCount($params = array()) { $session = erLhcoreClassUser::getSession('slave'); $q = $session->database->createSelectQuery(); $q->select("COUNT(id)")->from("lh_group"); if (isset($params['filter']) && count($params['filter']) > 0) { $conditions = array(); foreach ($params['filter'] as $field => $fieldValue) { $conditions[] = $q->expr->eq($field, $q->bindValue($fieldValue)); } $q->where($conditions); } $stmt = $q->prepare(); $stmt->execute(); $result = $stmt->fetchColumn(); return $result; }
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'); } }
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'];
<?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'); ?>
<?php $currentUser = erLhcoreClassUser::instance(); $UserData = $currentUser->getUserData(true); ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?php echo htmlspecialchars($UserData->name), ' ', htmlspecialchars($UserData->surname); ?> <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="<?php echo erLhcoreClassDesign::baseurl('user/account'); ?> " title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('pagelayout/pagelayout', 'Account'); ?> "><i class="glyphicon glyphicon-user"></i> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('pagelayout/pagelayout', 'Account'); ?> </a></li> <li><a href="<?php echo erLhcoreClassDesign::baseurl('user/logout'); ?> " title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('pagelayout/pagelayout', 'Logout'); ?> "><i class="glyphicon glyphicon-log-out"></i> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('pagelayout/pagelayout', 'Logout'); ?> </a></li>
<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 } 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
$db->query("INSERT INTO `lh_userdep` (`user_id`,`dep_id`,`last_activity`,`hide_online`,`last_accepted`,`active_chats`) VALUES ({$UserData->id},0,0,0,0,0)"); // Transfer chat $db->query("CREATE TABLE IF NOT EXISTS `lh_transfer` (\n\t\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t `chat_id` int(11) NOT NULL,\n\t\t\t\t `dep_id` int(11) NOT NULL,\n\t\t\t\t `transfer_user_id` int(11) NOT NULL,\n\t\t\t\t `from_dep_id` int(11) NOT NULL,\n\t\t\t\t `transfer_to_user_id` int(11) NOT NULL,\n\t\t\t\t PRIMARY KEY (`id`),\n\t\t\t\t KEY `dep_id` (`dep_id`),\n\t\t\t\t KEY `transfer_user_id_dep_id` (`transfer_user_id`,`dep_id`),\n\t\t\t\t KEY `transfer_to_user_id` (`transfer_to_user_id`)\n\t\t\t\t) DEFAULT CHARSET=utf8;"); // Remember user table $db->query("CREATE TABLE IF NOT EXISTS `lh_users_remember` (\n\t\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t `user_id` int(11) NOT NULL,\n\t\t\t\t `mtime` int(11) NOT NULL,\n\t\t\t\t PRIMARY KEY (`id`)\n\t\t\t\t) DEFAULT CHARSET=utf8;"); // Chat messages $db->query("CREATE TABLE IF NOT EXISTS `lh_msg` (\n\t\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t `msg` text NOT NULL,\n\t\t\t\t `time` int(11) NOT NULL,\n\t\t\t\t `chat_id` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t `user_id` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t `name_support` varchar(100) NOT NULL,\n\t\t\t\t PRIMARY KEY (`id`),\n\t\t\t\t KEY `chat_id_id` (`chat_id`, `id`)\n\t\t\t\t) DEFAULT CHARSET=utf8;"); // Forgot password table $db->query("CREATE TABLE IF NOT EXISTS `lh_forgotpasswordhash` (\n `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n `user_id` INT NOT NULL ,\n `hash` VARCHAR( 40 ) NOT NULL ,\n `created` INT NOT NULL\n ) DEFAULT CHARSET=utf8;"); // User groups table $db->query("CREATE TABLE IF NOT EXISTS `lh_groupuser` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `group_id` int(11) NOT NULL,\n `user_id` int(11) NOT NULL,\n PRIMARY KEY (`id`),\n KEY `group_id` (`group_id`),\n KEY `user_id` (`user_id`),\n KEY `group_id_2` (`group_id`,`user_id`)\n ) DEFAULT CHARSET=utf8;"); // Assign admin user to admin group $GroupUser = new erLhcoreClassModelGroupUser(); $GroupUser->group_id = $GroupData->id; $GroupUser->user_id = $UserData->id; erLhcoreClassUser::getSession()->save($GroupUser); //Assign default role functions $db->query("CREATE TABLE IF NOT EXISTS `lh_rolefunction` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `role_id` int(11) NOT NULL,\n `module` varchar(100) NOT NULL,\n `function` varchar(100) NOT NULL,\n PRIMARY KEY (`id`),\n KEY `role_id` (`role_id`)\n ) DEFAULT CHARSET=utf8;"); // Admin role and function $RoleFunction = new erLhcoreClassModelRoleFunction(); $RoleFunction->role_id = $Role->id; $RoleFunction->module = '*'; $RoleFunction->function = '*'; erLhcoreClassRole::getSession()->save($RoleFunction); // Operators rules and functions $permissionsArray = array(array('module' => 'lhuser', 'function' => 'selfedit'), array('module' => 'lhuser', 'function' => 'changeonlinestatus'), array('module' => 'lhuser', 'function' => 'changeskypenick'), array('module' => 'lhuser', 'function' => 'personalcannedmsg'), array('module' => 'lhuser', 'function' => 'change_visibility_list'), array('module' => 'lhuser', 'function' => 'see_assigned_departments'), array('module' => 'lhchat', 'function' => 'use'), array('module' => 'lhchat', 'function' => 'chattabschrome'), array('module' => 'lhchat', 'function' => 'singlechatwindow'), array('module' => 'lhchat', 'function' => 'allowopenremotechat'), array('module' => 'lhchat', 'function' => 'allowchattabs'), array('module' => 'lhchat', 'function' => 'use_onlineusers'), array('module' => 'lhchat', 'function' => 'take_screenshot'), array('module' => 'lhfront', 'function' => 'use'), array('module' => 'lhsystem', 'function' => 'use'), array('module' => 'lhtranslation', 'function' => 'use'), array('module' => 'lhchat', 'function' => 'allowblockusers'), array('module' => 'lhsystem', 'function' => 'generatejs'), array('module' => 'lhsystem', 'function' => 'changelanguage'), array('module' => 'lhchat', 'function' => 'allowredirect'), array('module' => 'lhchat', 'function' => 'allowtransfer'), array('module' => 'lhchat', 'function' => 'administratecannedmsg'), array('module' => 'lhchat', 'function' => 'sees_all_online_visitors'), array('module' => 'lhpermission', 'function' => 'see_permissions'), array('module' => 'lhquestionary', 'function' => 'manage_questionary'), array('module' => 'lhfaq', 'function' => 'manage_faq'), array('module' => 'lhchatbox', 'function' => 'manage_chatbox'), array('module' => 'lhbrowseoffer', 'function' => 'manage_bo'), array('module' => 'lhxml', 'function' => '*'), array('module' => 'lhcobrowse', 'function' => 'browse'), array('module' => 'lhfile', 'function' => 'use_operator'), array('module' => 'lhfile', 'function' => 'file_delete_chat'), array('module' => 'lhspeech', 'function' => 'changedefaultlanguage'), array('module' => 'lhspeech', 'function' => 'use'), array('module' => 'lhspeech', 'function' => 'change_chat_recognition')); foreach ($permissionsArray as $paramsPermission) { $RoleFunctionOperator = new erLhcoreClassModelRoleFunction(); $RoleFunctionOperator->role_id = $RoleOperators->id; $RoleFunctionOperator->module = $paramsPermission['module']; $RoleFunctionOperator->function = $paramsPermission['function'];
$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 }
} else { $UserData->invisible_mode = 0; } $globalDepartament = array(); if (isset($_POST['all_departments']) && $_POST['all_departments'] == 'on') { $UserData->all_departments = 1; $globalDepartament[] = 0; } else { $UserData->all_departments = 0; } if (count($Errors) == 0) { $UserData->setPassword($form->Password); $UserData->email = $form->Email; $UserData->name = $form->Name; $UserData->username = $form->Username; erLhcoreClassUser::getSession()->save($UserData); if (isset($_POST['UserDepartament']) && count($_POST['UserDepartament']) > 0) { $globalDepartament = array_merge($_POST['UserDepartament'], $globalDepartament); } if (count($globalDepartament) > 0) { erLhcoreClassUserDep::addUserDepartaments($globalDepartament, $UserData->id, $UserData); } erLhcoreClassModelGroupUser::removeUserFromGroups($UserData->id); foreach ($UserData->user_groups_id as $group_id) { $groupUser = new erLhcoreClassModelGroupUser(); $groupUser->group_id = $group_id; $groupUser->user_id = $UserData->id; $groupUser->saveThis(); } // Store photo if (isset($_FILES["UserPhoto"]) && is_uploaded_file($_FILES["UserPhoto"]["tmp_name"]) && $_FILES["UserPhoto"]["error"] == 0 && erLhcoreClassImageConverter::isPhoto('UserPhoto')) {
} 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; }
<?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 }
<?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">
<?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;
/> <?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>
<?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 $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;
/** * 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; }
public function saveThis() { erLhcoreClassUser::getSession()->saveOrUpdate($this); }
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) {
<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> {{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>
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(); } }
<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 } ?>