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


PHP erLhcoreClassChat::hasAccessToRead方法代码示例

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


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

示例1: array

 $ReturnStatuses = array();
 $tpl = erLhcoreClassTemplate::getInstance('lhchat/syncadmin.tpl.php');
 $currentUser = erLhcoreClassUser::instance();
 if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !$currentUser->validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
     echo json_encode(array('error' => 'true', 'result' => 'Invalid CSRF Token'));
     exit;
 }
 $db = ezcDbInstance::get();
 while (true) {
     $db->beginTransaction();
     try {
         foreach ($_POST['chats'] as $chat_id_list) {
             list($chat_id, $MessageID) = explode(',', $chat_id_list);
             $Chat = erLhcoreClassModelChat::fetch($chat_id);
             $Chat->updateIgnoreColumns = array('last_msg_id');
             if (isset($hasAccessToReadArray[$chat_id]) || erLhcoreClassChat::hasAccessToRead($Chat)) {
                 $hasAccessToReadArray[$chat_id] = true;
                 if ($Chat->last_msg_id > (int) $MessageID && count($Messages = erLhcoreClassChat::getPendingMessages($chat_id, $MessageID)) > 0) {
                     // If chat had flag that it contains unread messages set to 0
                     if ($Chat->has_unread_messages == 1 || $Chat->unread_messages_informed == 1) {
                         $Chat->has_unread_messages = 0;
                         $Chat->unread_messages_informed = 0;
                         $Chat->saveThis();
                     }
                     $newMessagesNumber = count($Messages);
                     $tpl->set('messages', $Messages);
                     $tpl->set('chat', $Chat);
                     $msgText = '';
                     if ($userOwner == 'true') {
                         foreach ($Messages as $msg) {
                             if ($msg['user_id'] != $currentUser->getUserID()) {
开发者ID:niravpatel2008,项目名称:north-american-nemesis-new,代码行数:31,代码来源:syncadmin.php

示例2: array

<?php

if (is_numeric($Params['user_parameters']['chat_id'])) {
    /*
     * If online user mode we have to make different check
     * */
    $browse = false;
    if ($Params['user_parameters_unordered']['cobrowsemode'] == 'onlineuser') {
        $onlineUser = erLhcoreClassModelChatOnlineUser::fetch($Params['user_parameters']['chat_id']);
        $browse = erLhcoreClassCoBrowse::getBrowseInstanceByOnlineUser($onlineUser);
    } else {
        $chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
        if (erLhcoreClassChat::hasAccessToRead($chat)) {
            $browse = erLhcoreClassCoBrowse::getBrowseInstance($chat);
        }
    }
    if ($browse instanceof erLhcoreClassModelCoBrowse) {
        if ($browse->modifications != '') {
            $changes = json_decode($browse->modifications);
            $changes[] = array('url' => $browse->url);
            $changes[] = array('lmsg' => $browse->mtime > 0 ? $browse->mtime_front : '');
            $changes[] = array('finished' => array('status' => !$browse->is_sharing, 'text' => $browse->is_sharing == 0 ? erTranslationClassLhTranslation::getInstance()->getTranslation('cobrowse/browse', 'Screen sharing session has finished') : erTranslationClassLhTranslation::getInstance()->getTranslation('cobrowse/browse', 'Screen is shared')));
            if ($browse->finished == 1) {
                $changes[] = array('clear' => true);
            }
            array_unshift($changes, array('base' => $browse->url));
            echo json_encode($changes);
            $browse->modifications = '';
            $browse->saveThis();
        } else {
            $changes = array();
开发者ID:detain,项目名称:livehelperchat,代码行数:31,代码来源:checkmirrorchanges.php

示例3: __get

 public function __get($var)
 {
     switch ($var) {
         case 'last_visit_front':
             return $this->last_visit_front = date(erLhcoreClassModule::$dateDateHourFormat, $this->last_visit);
             break;
         case 'first_visit_front':
             return $this->first_visit_front = date(erLhcoreClassModule::$dateDateHourFormat, $this->first_visit);
             break;
         case 'invitation':
             $this->invitation = false;
             if ($this->invitation_id > 0) {
                 try {
                     $this->invitation = erLhAbstractModelProactiveChatInvitation::fetch($this->invitation_id);
                 } catch (Exception $e) {
                     $this->invitation = false;
                 }
             }
             return $this->invitation;
             break;
         case 'has_message_from_operator':
             return $this->message_seen == 0 && $this->operator_message != '';
             break;
         case 'notes_intro':
             return $this->notes_intro = $this->notes != '' ? '[ ' . mb_substr($this->notes, 0, 50) . ' ]' . '<br/>' : '';
             break;
         case 'chat':
             $this->chat = false;
             if ($this->chat_id > 0) {
                 try {
                     $this->chat = erLhcoreClassModelChat::fetch($this->chat_id);
                 } catch (Exception $e) {
                     //
                 }
             }
             return $this->chat;
             break;
         case 'can_view_chat':
             $this->can_view_chat = false;
             $currentUser = erLhcoreClassUser::instance();
             if ($this->operator_user_id == $currentUser->getUserID()) {
                 $this->can_view_chat = true;
                 // Faster way
             } else {
                 if ($this->chat instanceof erLhcoreClassModelChat) {
                     $this->can_view_chat = erLhcoreClassChat::hasAccessToRead($this->chat);
                 }
             }
             return $this->can_view_chat;
             break;
         case 'operator_user':
             $this->operator_user = false;
             if ($this->operator_user_id > 0) {
                 try {
                     $this->operator_user = erLhcoreClassModelUser::fetch($this->operator_user_id);
                 } catch (Exception $e) {
                 }
             }
             return $this->operator_user;
             break;
         case 'operator_user_send':
             $this->operator_user_send = $this->operator_user !== false;
             return $this->operator_user_send;
             break;
         case 'operator_user_string':
             $this->operator_user_string = (string) $this->operator_user;
             return $this->operator_user_string;
             break;
         case 'time_on_site_front':
             $this->time_on_site_front = gmdate(erLhcoreClassModule::$dateHourFormat, $this->time_on_site);
             return $this->time_on_site_front;
             break;
         case 'tt_time_on_site_front':
             $this->tt_time_on_site_front = null;
             $diff = $this->tt_time_on_site;
             $days = floor($diff / (3600 * 24));
             $hours = floor(($diff - $days * 3600 * 24) / 3600);
             $minits = floor(($diff - $hours * 3600 - $days * 3600 * 24) / 60);
             $seconds = $diff - $hours * 3600 - $minits * 60 - $days * 3600 * 24;
             if ($days > 0) {
                 $this->tt_time_on_site_front = $days . ' d.';
             } elseif ($hours > 0) {
                 $this->tt_time_on_site_front = $hours . ' h.';
             } elseif ($minits > 0) {
                 $this->tt_time_on_site_front = $minits . ' m.';
             } elseif ($seconds >= 0) {
                 $this->tt_time_on_site_front = $seconds . ' s.';
             }
             return $this->tt_time_on_site_front;
             break;
         case 'last_visit_seconds_ago':
             $this->last_visit_seconds_ago = time() - $this->last_visit;
             return $this->last_visit_seconds_ago;
             break;
         case 'last_check_time_ago':
             $this->last_check_time_ago = time() - $this->last_check_time;
             return $this->last_check_time_ago;
             break;
         case 'visitor_tz_time':
             $this->visitor_tz_time = '-';
//.........这里部分代码省略.........
开发者ID:kenjiro7,项目名称:livehelperchat,代码行数:101,代码来源:erlhcoreclassmodelchatonlineuser.php

示例4:

<?php

// Set new chat owner
$currentUser = erLhcoreClassUser::instance();
$currentUser->getUserID();
$chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
// Chat can be closed only by owner
if (erLhcoreClassChat::hasAccessToRead($chat) && $currentUser->hasAccessTo('lhchat', 'modifychat')) {
    $tpl = erLhcoreClassTemplate::getInstance('lhchat/modifychat.tpl.php');
    if (ezcInputForm::hasPostData()) {
        $Errors = erLhcoreClassChatValidator::validateChatModify($chat);
        if (count($Errors) == 0) {
            $chat->saveThis();
            $tpl->set('chat_updated', true);
        } else {
            $tpl->set('errors', $Errors);
        }
    }
    $tpl->set('chat', $chat);
    $Result['content'] = $tpl->fetch();
    $Result['pagelayout'] = 'popup';
} else {
    exit;
}
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:24,代码来源:modifychat.php

示例5: array

<?php

$chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
if (erLhcoreClassChat::hasAccessToRead($chat) && $currentUser->hasAccessTo('lhfile', 'use_operator') === true) {
    $errors = array();
    erLhcoreClassChatEventDispatcher::getInstance()->dispatch('file.before_admin_uploadfile.file_store', ['errors' => &$errors]);
    if (empty($errors)) {
        $fileData = erLhcoreClassModelChatConfig::fetch('file_configuration');
        $data = (array) $fileData->data;
        $userData = $currentUser->getUserData();
        $path = 'var/storage/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $chat->id . '/';
        erLhcoreClassChatEventDispatcher::getInstance()->dispatch('file.uploadfileadmin.file_path', array('path' => &$path, 'storage_id' => $chat->id));
        $upload_handler = new erLhcoreClassFileUpload(array('name_support' => $userData->name_support, 'user_id' => $currentUser->getUserID(), 'max_file_size' => $data['fs_max'] * 1024, 'accept_file_types_lhc' => '/\\.(' . $data['ft_op'] . ')$/i', 'chat' => $chat, 'download_via_php' => true, 'upload_dir' => $path));
        if ($upload_handler->uploadedFile instanceof erLhcoreClassModelChatFile) {
            erLhcoreClassChatEventDispatcher::getInstance()->dispatch('file.uploadfileadmin.file_store', array('chat_file' => $upload_handler->uploadedFile));
        }
        echo json_encode(array('error' => 'false'));
    } else {
        echo json_encode(array('error' => 'true', 'error_msg' => implode(PHP_EOL, $errors)));
    }
}
exit;
开发者ID:detain,项目名称:livehelperchat,代码行数:22,代码来源:uploadfileadmin.php

示例6: array

<?php

if (is_numeric($Params['user_parameters']['chat_id']) && is_numeric($Params['user_parameters']['item_id'])) {
    $Chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
    $errors = array();
    erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_chat_transfered', array('chat' => &$Chat, 'errors' => &$errors));
    if (erLhcoreClassChat::hasAccessToRead($Chat) && empty($errors)) {
        $currentUser = erLhcoreClassUser::instance();
        // Delete any existing transfer for this chat already underway
        $transferLegacy = erLhcoreClassTransfer::getTransferByChat($Params['user_parameters']['chat_id']);
        if (is_array($transferLegacy)) {
            $chatTransfer = erLhcoreClassTransfer::getSession()->load('erLhcoreClassModelTransfer', $transferLegacy['id']);
            erLhcoreClassTransfer::getSession()->delete($chatTransfer);
        }
        $Transfer = new erLhcoreClassModelTransfer();
        $Transfer->chat_id = $Chat->id;
        if (isset($_POST['type']) && $_POST['type'] == 'dep') {
            $Transfer->dep_id = $Params['user_parameters']['item_id'];
            // Transfer was made to department
        } else {
            $Transfer->transfer_to_user_id = $Params['user_parameters']['item_id'];
            // Transfer was made to user
        }
        // Original department id
        $Transfer->from_dep_id = $Chat->dep_id;
        // User which is transfering
        $Transfer->transfer_user_id = $currentUser->getUserID();
        erLhcoreClassTransfer::getSession()->save($Transfer);
        $tpl = erLhcoreClassTemplate::getInstance('lhkernel/alert_success.tpl.php');
        if (isset($_POST['type']) && $_POST['type'] == 'dep') {
            $tpl->set('msg', erTranslationClassLhTranslation::getInstance()->getTranslation('chat/transferuser', 'Chat was assigned to selected department'));
开发者ID:remdex,项目名称:livehelperchat,代码行数:31,代码来源:transferuser.php

示例7: __get

 public function __get($var)
 {
     switch ($var) {
         case 'last_visit_front':
             return $this->last_visit_front = date(erLhcoreClassModule::$dateDateHourFormat, $this->last_visit);
             break;
         case 'first_visit_front':
             return $this->first_visit_front = date(erLhcoreClassModule::$dateDateHourFormat, $this->first_visit);
             break;
         case 'invitation':
             $this->invitation = false;
             if ($this->invitation_id > 0) {
                 try {
                     $this->invitation = erLhAbstractModelProactiveChatInvitation::fetch($this->invitation_id);
                 } catch (Exception $e) {
                     $this->invitation = false;
                 }
             }
             return $this->invitation;
             break;
         case 'has_message_from_operator':
             return $this->message_seen == 0 && $this->operator_message != '';
             break;
         case 'chat':
             $this->chat = false;
             if ($this->chat_id > 0) {
                 try {
                     $this->chat = erLhcoreClassModelChat::fetch($this->chat_id);
                 } catch (Exception $e) {
                     //
                 }
             }
             return $this->chat;
             break;
         case 'can_view_chat':
             $this->can_view_chat = false;
             $currentUser = erLhcoreClassUser::instance();
             if ($this->operator_user_id == $currentUser->getUserID()) {
                 $this->can_view_chat = true;
                 // Faster way
             } else {
                 if ($this->chat instanceof erLhcoreClassModelChat) {
                     $this->can_view_chat = erLhcoreClassChat::hasAccessToRead($this->chat);
                 }
             }
             return $this->can_view_chat;
             break;
         case 'operator_user':
             $this->operator_user = false;
             if ($this->operator_user_id > 0) {
                 try {
                     $this->operator_user = erLhcoreClassModelUser::fetch($this->operator_user_id);
                 } catch (Exception $e) {
                 }
             }
             return $this->operator_user;
             break;
         case 'operator_user_send':
             $this->operator_user_send = $this->operator_user !== false;
             return $this->operator_user_send;
             break;
         case 'operator_user_string':
             $this->operator_user_string = (string) $this->operator_user;
             return $this->operator_user_string;
             break;
         case 'time_on_site_front':
             $this->time_on_site_front = gmdate(erLhcoreClassModule::$dateHourFormat, $this->time_on_site);
             return $this->time_on_site_front;
             break;
         case 'tt_time_on_site_front':
             $this->tt_time_on_site_front = null;
             $diff = $this->tt_time_on_site;
             $days = floor($diff / (3600 * 24));
             $hours = floor(($diff - $days * 3600 * 24) / 3600);
             $minits = floor(($diff - $hours * 3600 - $days * 3600 * 24) / 60);
             $seconds = $diff - $hours * 3600 - $minits * 60 - $days * 3600 * 24;
             if ($days > 0) {
                 $this->tt_time_on_site_front = $days . ' d.';
             } elseif ($hours > 0) {
                 $this->tt_time_on_site_front = $hours . ' h.';
             } elseif ($minits > 0) {
                 $this->tt_time_on_site_front = $minits . ' m.';
             } elseif ($seconds >= 0) {
                 $this->tt_time_on_site_front = $seconds . ' s.';
             }
             return $this->tt_time_on_site_front;
             break;
         case 'last_visit_seconds_ago':
             $this->last_visit_seconds_ago = time() - $this->last_visit;
             return $this->last_visit_seconds_ago;
             break;
         case 'last_check_time_ago':
             $this->last_check_time_ago = time() - $this->last_check_time;
             return $this->last_check_time_ago;
             break;
         case 'visitor_tz_time':
             $this->visitor_tz_time = '-';
             if ($this->visitor_tz != '') {
                 $date = new DateTime(null, new DateTimeZone($this->visitor_tz));
                 $this->visitor_tz_time = $date->format(erLhcoreClassModule::$dateHourFormat);
//.........这里部分代码省略.........
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:101,代码来源:erlhcoreclassmodelchatonlineuser.php


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