当前位置: 首页>>代码示例>>PHP>>正文


PHP erLhcoreClassIPDetect::getIP方法代码示例

本文整理汇总了PHP中erLhcoreClassIPDetect::getIP方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassIPDetect::getIP方法的具体用法?PHP erLhcoreClassIPDetect::getIP怎么用?PHP erLhcoreClassIPDetect::getIP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在erLhcoreClassIPDetect的用法示例。


在下文中一共展示了erLhcoreClassIPDetect::getIP方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: header

header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
$tpl = erLhcoreClassTemplate::getInstance('lhchat/chatcheckstatus.tpl.php');
if (is_array($Params['user_parameters_unordered']['department'])) {
    erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['department']);
    $tpl->set('department', implode('/', $Params['user_parameters_unordered']['department']));
    $tpl->set('department_array', $Params['user_parameters_unordered']['department']);
} else {
    $tpl->set('department', false);
    $tpl->set('department_array', false);
}
$tpl->set('status', $Params['user_parameters_unordered']['status'] == 'true' ? true : false);
if (erLhcoreClassModelChatConfig::fetch('track_is_online')->current_value) {
    $ignorable_ip = erLhcoreClassModelChatConfig::fetch('ignorable_ip')->current_value;
    if ($ignorable_ip == '' || !erLhcoreClassIPDetect::isIgnored(erLhcoreClassIPDetect::getIP(), explode(',', $ignorable_ip))) {
        if ((string) $Params['user_parameters_unordered']['vid'] != '') {
            $db = ezcDbInstance::get();
            /**
             * Perhaps there is some pending operations for online visitor
             * */
            $stmt = $db->prepare('SELECT operation FROM lh_chat_online_user WHERE vid = :vid');
            $stmt->bindValue(':vid', (string) $Params['user_parameters_unordered']['vid']);
            $stmt->execute();
            $operation = $stmt->fetch(PDO::FETCH_COLUMN);
            echo $operation;
            $stmt = $db->prepare("UPDATE lh_chat_online_user SET last_check_time = :time, operation = '', operation_chat = '' WHERE vid = :vid");
            $stmt->bindValue(':time', time(), PDO::PARAM_INT);
            $stmt->bindValue(':vid', (string) $Params['user_parameters_unordered']['vid']);
            $stmt->execute();
        }
开发者ID:niravpatel2008,项目名称:north-american-nemesis-new,代码行数:31,代码来源:chatcheckstatus.php

示例2: setIP

 public function setIP()
 {
     $this->ip = erLhcoreClassIPDetect::getIP();
 }
开发者ID:keenick,项目名称:livehelperchat,代码行数:4,代码来源:erlhcoreclassmodelchat.php

示例3: informChatClosed

 public static function informChatClosed(erLhcoreClassModelChat $chat, $operator = false)
 {
     $sendMail = erLhAbstractModelEmailTemplate::fetch(5);
     $mail = new PHPMailer();
     $mail->CharSet = "UTF-8";
     if ($sendMail->from_email != '') {
         $mail->Sender = $mail->From = $sendMail->from_email;
     }
     $mail->FromName = $sendMail->from_name;
     $mail->Subject = $sendMail->subject;
     $messages = array_reverse(erLhcoreClassModelmsg::getList(array('limit' => 10, 'sort' => 'id DESC', 'filter' => array('chat_id' => $chat->id))));
     $messagesContent = '';
     foreach ($messages as $msg) {
         if ($msg->user_id == -1) {
             $messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmin', 'System assistant') . ': ' . htmlspecialchars($msg->msg) . "\n";
         } else {
             $messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . ($msg->user_id == 0 ? htmlspecialchars($chat->nick) : htmlspecialchars($msg->name_support)) . ': ' . htmlspecialchars($msg->msg) . "\n";
         }
     }
     $emailRecipient = array();
     if ($sendMail->recipient != '') {
         // This time we give priority to template recipients
         $emailRecipient = explode(',', $sendMail->recipient);
     } elseif ($chat->department !== false && $chat->department->email != '') {
         $emailRecipient = explode(',', $chat->department->email);
     } else {
         // Lets find first user and send him an e-mail
         $list = erLhcoreClassModelUser::getUserList(array('limit' => 1, 'sort' => 'id ASC'));
         $user = array_pop($list);
         $emailRecipient = array($user->email);
     }
     self::setupSMTP($mail);
     $cfgSite = erConfigClassLhConfig::getInstance();
     $secretHash = $cfgSite->getSetting('site', 'secrethash');
     if ($chat->email != '') {
         $mail->AddReplyTo($chat->email, $chat->nick);
     }
     // Format user friendly additional data
     if ($chat->additional_data != '') {
         $paramsAdditional = json_decode($chat->additional_data, true);
         $elementsAdditional = array();
         if (is_array($paramsAdditional) && !empty($paramsAdditional)) {
             foreach ($paramsAdditional as $param) {
                 $elementsAdditional[] = $param['key'] . ' - ' . $param['value'];
             }
             $additional_data = implode("\n", $elementsAdditional);
         } else {
             $additional_data = $chat->additional_data;
         }
     } else {
         $additional_data = '';
     }
     foreach ($emailRecipient as $receiver) {
         $veryfyEmail = sha1(sha1($receiver . $secretHash) . $secretHash);
         $mail->Body = str_replace(array('{chat_id}', '{phone}', '{name}', '{email}', '{message}', '{additional_data}', '{url_request}', '{ip}', '{department}', '{url_accept}', '{operator}', '{country}', '{city}'), array($chat->id, $chat->phone, $chat->nick, $chat->email, $messagesContent, $additional_data, $chat->referrer, erLhcoreClassIPDetect::getIP(), (string) $chat->department, 'http://' . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('chat/accept') . '/' . erLhcoreClassModelChatAccept::generateAcceptLink($chat) . '/' . $veryfyEmail . '/' . $receiver, $operator, $chat->country_name, $chat->city), $sendMail->content);
         $mail->AddAddress($receiver);
         $mail->Send();
         $mail->ClearAddresses();
     }
     if ($sendMail->bcc_recipients != '') {
         $recipientsBCC = explode(',', $sendMail->bcc_recipients);
         foreach ($recipientsBCC as $receiver) {
             $receiver = trim($receiver);
             $veryfyEmail = sha1(sha1($receiver . $secretHash) . $secretHash);
             $mail->Body = str_replace(array('{chat_id}', '{phone}', '{name}', '{email}', '{message}', '{additional_data}', '{url_request}', '{ip}', '{department}', '{url_accept}', '{operator}', '{country}', '{city}'), array($chat->id, $chat->phone, $chat->nick, $chat->email, $messagesContent, $additional_data, $chat->referrer, erLhcoreClassIPDetect::getIP(), (string) $chat->department, 'http://' . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('chat/accept') . '/' . erLhcoreClassModelChatAccept::generateAcceptLink($chat) . '/' . $veryfyEmail . '/' . $receiver, $operator, $chat->country_name, $chat->city), $sendMail->content);
             $mail->AddAddress($receiver);
             $mail->Send();
             $mail->ClearAddresses();
         }
     }
 }
开发者ID:sirromas,项目名称:medical,代码行数:71,代码来源:lhchatmail.php

示例4: ezcInputFormDefinitionElement

 // Additional attributes
 $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);
 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;
 } else {
     // Captcha stuff
     $nameField = 'captcha_' . sha1(erLhcoreClassIPDetect::getIP() . $_POST['tscaptcha'] . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'));
 }
 $validationFields[$nameField] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string');
 $form = new ezcInputForm(INPUT_POST, $validationFields);
 $Errors = array();
 if ($form->hasValidData('DepartmentIDDefined')) {
     $inputData->departament_id_array = $form->DepartmentIDDefined;
 }
 if (!$form->hasValidData('Question') || trim($form->Question) == '') {
     $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your message');
 } elseif ($form->hasValidData('Question')) {
     $inputData->question = $form->Question;
 }
 if ((!$form->hasValidData('Username') || trim($form->Username) == '') && $userInstance->requires_username == 1) {
     $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your name');
 } elseif ($form->hasValidData('Username')) {
开发者ID:p4prawin,项目名称:livechat,代码行数:31,代码来源:readoperatormessage.php

示例5: storeCollectedInformation

 public static function storeCollectedInformation($form, $collectedInformation)
 {
     $formCollected = new erLhAbstractModelFormCollected();
     $formCollected->ip = erLhcoreClassIPDetect::getIP();
     $formCollected->ctime = time();
     $formCollected->form_id = $form->id;
     $formCollected->identifier = isset($_POST['identifier']) ? $_POST['identifier'] : (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
     $formCollected->saveThis();
     // Finish collect information
     foreach ($collectedInformation as $fieldName => &$params) {
         if ($params['definition']['type'] == 'file') {
             $dir = 'var/storageform/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $formCollected->id . '/';
             erLhcoreClassChatEventDispatcher::getInstance()->dispatch('form.fill.file_path', array('path' => &$dir, 'storage_id' => $formCollected->id));
             erLhcoreClassFileUpload::mkdirRecursive($dir);
             $file = erLhcoreClassSearchHandler::moveUploadedFile($params['definition']['name'], $dir);
             $params['filename'] = $file;
             $params['filepath'] = $dir;
             erLhcoreClassChatEventDispatcher::getInstance()->dispatch('form.fill.store_file', array('file_params' => &$params));
         }
     }
     $formCollected->content = serialize($collectedInformation);
     $formCollected->saveThis();
     // Inform user about filled form
     erLhcoreClassChatMail::informFormFilled($formCollected, array('email' => self::$mainEmail));
 }
开发者ID:nagyistoce,项目名称:livehelperchat,代码行数:25,代码来源:lhformrenderer.php

示例6: 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'])) {
//.........这里部分代码省略.........
开发者ID:yhchiu,项目名称:livehelperchat,代码行数:101,代码来源:lhchatvalidator.php

示例7: handleRequest

 public static function handleRequest($paramsHandle = array())
 {
     if (isset($_SERVER['HTTP_USER_AGENT']) && !self::isBot($_SERVER['HTTP_USER_AGENT'])) {
         $newVisitor = false;
         if (isset($paramsHandle['vid']) && !empty($paramsHandle['vid'])) {
             $items = erLhcoreClassModelChatOnlineUser::getList(array('filter' => array('vid' => $paramsHandle['vid'])));
             if (!empty($items)) {
                 $item = array_shift($items);
                 // Visit duration les than 30m. Same as google analytics
                 // See: https://support.google.com/analytics/answer/2731565?hl=en
                 if (time() - $item->last_visit <= 30 * 60) {
                     $item->time_on_site += time() - $item->last_visit;
                     $item->tt_time_on_site += time() - $item->last_visit;
                 } else {
                     $item->time_on_site = 0;
                     $item->total_visits++;
                     $item->last_visit = time();
                     $item->pages_count = 0;
                     // Reset chat_id only if chat is not active or pending
                     if ($item->chat_id > 0) {
                         if ($item->chat === false || !in_array($item->chat->status, array(erLhcoreClassModelChat::STATUS_ACTIVE_CHAT, erLhcoreClassModelChat::STATUS_PENDING_CHAT))) {
                             $item->chat_id = 0;
                         }
                     }
                     if ($item->message_seen == 1 && $item->message_seen_ts < time() - (int) $paramsHandle['message_seen_timeout'] * 3600) {
                         $item->message_seen = 0;
                         $item->message_seen_ts = 0;
                         $item->operator_message = '';
                     }
                 }
                 $item->identifier = isset($paramsHandle['identifier']) && !empty($paramsHandle['identifier']) ? $paramsHandle['identifier'] : $item->identifier;
                 if (isset($paramsHandle['department']) && is_array($paramsHandle['department']) && count($paramsHandle['department']) == 1) {
                     $item->dep_id = array_shift($paramsHandle['department']);
                 } elseif (isset($paramsHandle['department']) && is_numeric($paramsHandle['department'])) {
                     $item->dep_id = (int) $paramsHandle['department'];
                 }
             } else {
                 $item = new erLhcoreClassModelChatOnlineUser();
                 $item->ip = erLhcoreClassIPDetect::getIP();
                 $item->vid = $paramsHandle['vid'];
                 $item->identifier = isset($paramsHandle['identifier']) && !empty($paramsHandle['identifier']) ? $paramsHandle['identifier'] : '';
                 $item->referrer = isset($_GET['r']) ? rawurldecode($_GET['r']) : '';
                 $item->total_visits = 1;
                 if (isset($paramsHandle['department']) && is_array($paramsHandle['department']) && count($paramsHandle['department']) == 1) {
                     $item->dep_id = array_shift($paramsHandle['department']);
                 } elseif (isset($paramsHandle['department']) && is_numeric($paramsHandle['department'])) {
                     $item->dep_id = (int) $paramsHandle['department'];
                 }
                 if (isset($paramsHandle['tz']) && is_numeric($paramsHandle['tz'])) {
                     $timezone_name = timezone_name_from_abbr(null, (int) $paramsHandle['tz'] * 3600, true);
                     if ($timezone_name !== false) {
                         $item->visitor_tz = $timezone_name;
                     }
                 }
                 self::detectLocation($item);
                 // Cleanup database then new user comes
                 self::cleanupOnlineUsers();
                 $item->store_chat = true;
                 $newVisitor = true;
             }
         } else {
             self::cleanupOnlineUsers();
             return false;
         }
         if (isset($paramsHandle['pages_count']) && $paramsHandle['pages_count'] == true) {
             $item->pages_count++;
             $item->tt_pages_count++;
             $item->store_chat = true;
             if (isset($_GET['onattr']) && is_array($_GET['onattr']) && !empty($_GET['onattr'])) {
                 $item->online_attr = json_encode($_GET['onattr']);
             }
             if ($item->has_message_from_operator == true) {
                 $item->invitation_seen_count++;
             }
             if (isset($paramsHandle['tz']) && is_numeric($paramsHandle['tz']) && $item->visitor_tz == '') {
                 $timezone_name = timezone_name_from_abbr(null, (int) $paramsHandle['tz'] * 3600, true);
                 if ($timezone_name !== false) {
                     $item->visitor_tz = $timezone_name;
                 }
             }
             // Hide invitation message after n times if required
             if ($item->has_message_from_operator == true && $item->invitation !== false && $item->invitation->hide_after_ntimes > 0 && $item->invitation_seen_count > $item->invitation->hide_after_ntimes) {
                 $item->message_seen = 1;
                 $item->message_seen_ts = time();
             }
         }
         $logPageView = false;
         // Update variables only if it's not JS to check for operator message
         if (!isset($paramsHandle['check_message_operator']) || isset($paramsHandle['pages_count']) && $paramsHandle['pages_count'] == true) {
             $item->user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
             $item->current_page = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
             $item->page_title = isset($_GET['dt']) ? (string) rawurldecode($_GET['dt']) : '';
             $item->last_visit = time();
             $item->store_chat = true;
             $logPageView = true;
         }
         if ((!isset($paramsHandle['wopen']) || $paramsHandle['wopen'] == 0) && $item->operator_message == '' && isset($paramsHandle['pro_active_invite']) && $paramsHandle['pro_active_invite'] == 1 && isset($paramsHandle['pro_active_limitation']) && ($paramsHandle['pro_active_limitation'] == -1 || erLhcoreClassChat::getPendingChatsCountPublic($item->dep_id > 0 ? $item->dep_id : false) <= $paramsHandle['pro_active_limitation'])) {
             //Process pro active chat invitation if this visitor matches any rules
             erLhAbstractModelProactiveChatInvitation::processProActiveInvitation($item);
         }
//.........这里部分代码省略.........
开发者ID:kenjiro7,项目名称:livehelperchat,代码行数:101,代码来源:erlhcoreclassmodelchatonlineuser.php

示例8: saveThis

 public function saveThis()
 {
     $this->ctime = time();
     $this->ip = ip2long(erLhcoreClassIPDetect::getIP());
     erLhcoreClassQuestionary::getSession()->saveOrUpdate($this);
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:6,代码来源:erlhcoreclassmodelquestionanswer.php

示例9: array

            if (erLhcoreClassQuestionary::getCount($baseFilter, 'lh_question_answer') > 0) {
                $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('questionary/votingwidget', 'You have already send your feedback!');
            }
        }
        erLhcoreClassChatEventDispatcher::getInstance()->dispatch('questionaire.before_feedback_left', array('feedback' => &$answer, 'errors' => &$Errors));
        if (count($Errors) == 0) {
            $answer->saveThis();
            erLhcoreClassChatEventDispatcher::getInstance()->dispatch('questionaire.feedback_left', array('feedback' => &$answer));
            $tpl->set('received', true);
        } else {
            $tpl->set('errors', $Errors);
        }
    }
}
if ($votingRelative !== false) {
    $baseFilter = array('filter' => array('question_id' => $votingRelative->id, 'ip' => ip2long(erLhcoreClassIPDetect::getIP())));
    if ($votingRelative->revote > 0) {
        $baseFilter['filtergt']['ctime'] = time() - $votingRelative->revote_seconds;
    }
    if ($votingRelative->is_voting == 1) {
        if (erLhcoreClassQuestionary::getCount($baseFilter, 'lh_question_option_answer') > 0) {
            $tpl->set('already_voted', true);
        }
    } elseif (erLhcoreClassQuestionary::getCount($baseFilter, 'lh_question_answer') > 0) {
        $tpl->set('already_voted', true);
    }
}
$tpl->set('voting', $votingRelative);
$tpl->set('answer', $answer);
$Result['content'] = $tpl->fetch();
$Result['pagelayout'] = 'widget';
开发者ID:detain,项目名称:livehelperchat,代码行数:31,代码来源:votingwidget.php

示例10: erLhcoreClassFaq

        if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600) {
            $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Invalid captcha code, please enable Javascript!');
        }
    }
    // Dynamic URL has higher priority
    if ($dynamic_url != '') {
        $item_new->url = $dynamic_url;
    }
    if (count($Errors) == 0) {
        $item_new->active = 0;
        $item_new->saveThis();
        erLhcoreClassChatMail::sendMailFAQ($item_new);
        $item_new = new erLhcoreClassFaq();
        $tpl->set('success', true);
        if (isset($_SESSION[erLhcoreClassIPDetect::getIP()]['form'])) {
            unset($_SESSION[erLhcoreClassIPDetect::getIP()]['form']);
        }
    } else {
        $tpl->set('errors', $Errors);
    }
    $tpl->set('edittab', true);
}
$tpl->set('items', $items);
$tpl->set('item_new', $item_new);
$tpl->set('pages', $pages);
$Result['content'] = $tpl->fetch();
$Result['pagelayout'] = 'widget';
$Result['dynamic_height'] = true;
$Result['dynamic_height_message'] = 'lhc_sizing_faq';
$Result['dynamic_height_append'] = 0;
if ($embedMode == true) {
开发者ID:p4prawin,项目名称:livechat,代码行数:31,代码来源:faqwidget.php

示例11: getAdjustment

 public static function getAdjustment($geo_adjustment, $onlineUserVid = '', $widgetMode = false, $onlineUserDefined = false)
 {
     $responseStatus = array('status' => 'normal');
     $onlineUser = false;
     if (isset($geo_adjustment['use_geo_adjustment']) && $geo_adjustment['use_geo_adjustment'] == true) {
         if ($widgetMode === true && $geo_adjustment['apply_widget'] == 0) {
             return $responseStatus;
         }
         if (is_object($onlineUserDefined)) {
             $onlineUser = $onlineUserDefined;
         } elseif (!empty($onlineUserVid)) {
             $onlineUser = erLhcoreClassModelChatOnlineUser::fetchByVid($onlineUserVid);
         }
         if ($onlineUser === false) {
             $onlineUser = new erLhcoreClassModelChatOnlineUser();
             // Just to pass instance
             $onlineUser->ip = erLhcoreClassIPDetect::getIP();
             erLhcoreClassModelChatOnlineUser::detectLocation($onlineUser);
         }
         $countriesAvailableFor = array();
         if ($geo_adjustment['available_for'] != '') {
             $countriesAvailableFor = explode(',', $geo_adjustment['available_for']);
         }
         if (!in_array($onlineUser->user_country_code, $countriesAvailableFor)) {
             if ($geo_adjustment['other_countries'] == 'all') {
                 if ($geo_adjustment['other_status'] == 'offline') {
                     $responseStatus = array('status' => 'offline');
                 } else {
                     $responseStatus = array('status' => 'hidden');
                 }
             } else {
                 if ($geo_adjustment['hide_for'] != '') {
                     $countrieshideFor = explode(',', $geo_adjustment['hide_for']);
                     if (in_array($onlineUser->user_country_code, $countrieshideFor)) {
                         if ($geo_adjustment['other_status'] == 'offline') {
                             $responseStatus = array('status' => 'offline');
                         } else {
                             $responseStatus = array('status' => 'hidden');
                         }
                     } else {
                         if ($geo_adjustment['rest_status'] == 'offline') {
                             $responseStatus = array('status' => 'offline');
                         } elseif ($geo_adjustment['rest_status'] == 'normal') {
                             $responseStatus = array('status' => 'normal');
                         } else {
                             $responseStatus = array('status' => 'hidden');
                         }
                     }
                 } else {
                     if ($geo_adjustment['rest_status'] == 'offline') {
                         $responseStatus = array('status' => 'offline');
                     } elseif ($geo_adjustment['rest_status'] == 'normal') {
                         $responseStatus = array('status' => 'normal');
                     } else {
                         $responseStatus = array('status' => 'hidden');
                     }
                 }
             }
         }
         // Normal status
     }
     return $responseStatus;
 }
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:63,代码来源:lhchat.php

示例12: validateRemember

 function validateRemember($hashCookie)
 {
     $parts = explode(':', $hashCookie);
     if (count($parts) == 3) {
         list($salt1, $id, $hash) = $parts;
         $cfgSite = erConfigClassLhConfig::getInstance();
         $salt2 = $cfgSite->getSetting('site', 'secrethash');
         try {
             $ruser = erLhcoreClassModelUserRemember::fetch($id);
             if ($hash == sha1($ruser->user_id . '_' . $ruser->id . $salt2 . $salt1 . erLhcoreClassIPDetect::getIP() . $_SERVER['HTTP_USER_AGENT'])) {
                 $ruser->mtime = time();
                 $ruser->updateThis();
                 $this->setLoggedUser($ruser->user_id);
                 // Update remember hash
                 $salt1 = erLhcoreClassModelForgotPassword::randomPassword(30);
                 $hash = $salt1 . ':' . $ruser->id . ':' . sha1($this->userid . '_' . $ruser->id . $salt2 . $salt1 . erLhcoreClassIPDetect::getIP() . $_SERVER['HTTP_USER_AGENT']);
                 setcookie('lhc_rm_u', $hash, time() + 365 * 24 * 3600, '/');
                 return true;
             }
         } catch (Exception $e) {
             return false;
         }
     } else {
         if (isset($_COOKIE['lhc_rm_u'])) {
             unset($_COOKIE['lhc_rm_u']);
             setcookie('lhc_rm_u', '', time() - 31 * 24 * 3600, '/');
         }
     }
     return false;
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:30,代码来源:lhuser.php

示例13: implode

<?php

$ipUpdate = erLhcoreClassModelChatConfig::fetch('update_ip')->current_value;
if ($ipUpdate != '' && erLhcoreClassIPDetect::isIgnored(erLhcoreClassIPDetect::getIP(), explode(',', $ipUpdate))) {
    $jsonObject = json_decode(erLhcoreClassModelChatOnlineUser::executeRequest('https://raw.githubusercontent.com/LiveHelperChat/livehelperchat/master/lhc_web/doc/update_db/structure.json'), true);
    if (is_array($jsonObject)) {
        $errorMessages = erLhcoreClassUpdate::doTablesUpdate($jsonObject);
        if (empty($errorMessages)) {
            $CacheManager = erConfigClassLhCacheConfig::getInstance();
            $CacheManager->expireCache();
            echo "UPDATE DONE\n";
        } else {
            echo "ERROR:\n" . implode("\n", $errorMessages);
        }
    }
} else {
    echo "Your IP is not allowed to perform updates\n";
}
exit;
开发者ID:Topspot,项目名称:livehelperchat,代码行数:19,代码来源:autodbupdate.php

示例14: 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['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');
     }
     $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.');
     }
     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[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Invalid captcha code, please enable Javascript!');
         }
     } else {
         // Captcha validation
         if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600) {
             $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Invalid captcha code, please enable Javascript!');
         }
     }
     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[] = 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[] = 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[] = 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('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[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your message');
//.........这里部分代码省略.........
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:101,代码来源:lhchatvalidator.php

示例15: header

<?php

header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
header('Content-type: text/javascript');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time() + 60 * 60 * 8) . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
$hash = sha1(erLhcoreClassIPDetect::getIP() . $Params['user_parameters']['timets'] . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'));
if (time() - $Params['user_parameters']['timets'] > 600 || time() - $Params['user_parameters']['timets'] < 0) {
    echo json_encode(array('result' => 'false'));
    exit;
}
if (erLhcoreClassModelChatConfig::fetch('session_captcha')->current_value == 1) {
    // Start session if required only
    $currentUser = erLhcoreClassUser::instance();
    $_SESSION[$_SERVER['REMOTE_ADDR']][$Params['user_parameters']['captcha_name']] = $hash;
}
echo json_encode(array('result' => $hash));
exit;
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:21,代码来源:captchastring.php


注:本文中的erLhcoreClassIPDetect::getIP方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。