<?php

header('content-type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
if ($Params['user_parameters_unordered']['hash'] != '' || $Params['user_parameters_unordered']['vid'] != '') {
    $checkHash = true;
    $vid = false;
    if ($Params['user_parameters_unordered']['hash'] != '') {
        list($chatID, $hash) = explode('_', $Params['user_parameters_unordered']['hash']);
    } else {
        if ($Params['user_parameters_unordered']['hash_resume'] != '') {
            list($chatID, $hash) = explode('_', $Params['user_parameters_unordered']['hash_resume']);
        } elseif ($Params['user_parameters_unordered']['vid'] != '') {
            $vid = erLhcoreClassModelChatOnlineUser::fetchByVid($Params['user_parameters_unordered']['vid']);
            if ($vid !== false) {
                $chatID = $vid->chat_id;
                $checkHash = false;
            } else {
                echo json_encode(array('stored' => 'false'));
                exit;
            }
        }
    }
    try {
        if ($chatID > 0) {
            $chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $chatID);
        } else {
            $chat = false;
        }
        if (($checkHash == true && $chat !== false && $chat->hash == $hash || $checkHash == false) && (is_object($vid) || ($chat !== false && $chat->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT || $chat->status == erLhcoreClassModelChat::STATUS_ACTIVE_CHAT))) {
Пример #2
0
<?php

$online_user = erLhcoreClassModelChatOnlineUser::fetchByVid($Params['user_parameters']['vid']);
if ($online_user !== false && isset($online_user->online_attr_system_array['ishare_enabled']) && $online_user->online_attr_system_array['ishare_enabled'] == 1) {
    $fileData = erLhcoreClassModelChatConfig::fetch('file_configuration');
    $data = (array) $fileData->data;
    $path = 'var/storage/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/ou' . $online_user->id . '/';
    erLhcoreClassChatEventDispatcher::getInstance()->dispatch('file.uploadfile.file_path', array('path' => &$path, 'storage_id' => $online_user->id));
    $upload_handler = new erLhcoreClassFileUpload(array('user_id' => 0, 'max_file_size' => $data['fs_max'] * 1024, 'accept_file_types_lhc' => '/\\.(' . $data['ft_us'] . ')$/i', 'online_user' => $online_user, 'download_via_php' => true, 'upload_dir' => $path));
    if ($upload_handler->uploadedFile instanceof erLhcoreClassModelChatFile) {
        erLhcoreClassChatEventDispatcher::getInstance()->dispatch('file.uploadfile.file_store', array('chat_file' => $upload_handler->uploadedFile));
    }
    echo json_encode(array('error' => 'false'));
}
exit;
Пример #3
0
 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;
 }