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


PHP erLhcoreClassIPDetect::isIgnored方法代码示例

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


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

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

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

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


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