本文整理汇总了PHP中erLhcoreClassUser::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassUser::instance方法的具体用法?PHP erLhcoreClassUser::instance怎么用?PHP erLhcoreClassUser::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类erLhcoreClassUser
的用法示例。
在下文中一共展示了erLhcoreClassUser::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTransferChats
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;
}
示例2: __get
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;
}
}
示例3: getSetting
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;
}
示例4: validateAdminTheme
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: prepareSendMail
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: addUserDepartaments
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]);
}
}
示例7: loginBySSO
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');
}
}
示例8:
<?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:
<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
}
?>
示例10:
<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>
示例11: validateStartChat
/**
* 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'])) {
//.........这里部分代码省略.........
示例12:
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: array
}
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:
<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>
示例15:
<?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
}