• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP erLhcoreClassIPDetect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: 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


示例3: 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


示例4: 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


示例5: saveThis

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


示例6: 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


示例7: 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


示例8: 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


示例9: array

                 $responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('locatorhq', erLhcoreClassIPDetect::getServerAddress(), array('ip' => $data['locatorhqip'], 'username' => $data['locatorhqusername'], 'api_key' => $data['locatorhq_api_key']));
                 if ($responseDetection == false || !isset($responseDetection->country_code)) {
                     $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Setting service provider failed, please check that your service provider allows you to make requests to remote pages and your API key and username is correct!');
                 }
             }
         } elseif ($form->UseGeoIP == 'ipinfodbcom') {
             $data['geo_service_identifier'] = 'ipinfodbcom';
             $filledAPIData = true;
             if ($form->hasValidData('ipinfodbAPIKey') && $form->ipinfodbAPIKey != '') {
                 $data['ipinfodbcom_api_key'] = $form->ipinfodbAPIKey;
             } else {
                 $filledAPIData = false;
                 $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Please enter the API key!');
             }
             if ($filledAPIData == true) {
                 $responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('ipinfodbcom', erLhcoreClassIPDetect::getServerAddress(), array('api_key' => $data['ipinfodbcom_api_key']));
                 if ($responseDetection == false || !isset($responseDetection->country_code)) {
                     $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Setting service provider failed, please check that your service provider allows you to make requests to remote pages and your API key is correct!');
                 }
             }
         } elseif ($form->UseGeoIP == 'php_geoip') {
             $data['geo_service_identifier'] = 'php_geoip';
             $responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('php_geoip', '94.23.200.91');
             if ($responseDetection == false || !isset($responseDetection->country_code)) {
                 $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Setting service provider failed, please check that you have installed php-GeoIP module and GeoIPCity.dat file is available!');
             }
         }
     } else {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Please choose a service provider!');
     }
 }
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:31,代码来源:geoconfiguration.php


示例10: 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


示例11: 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


示例12: implode

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP erLhcoreClassInstance类代码示例发布时间:2022-05-23
下一篇:
PHP erLhcoreClassDesign类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap