コード例 #1
0
ファイル: im.ajax.php プロジェクト: k-kalashnikov/geekcon_new
                 $arMessage['message'][$id]['recipientId'] = 'chat' . $ar['recipientId'];
             }
             $arMessage['usersMessage']['chat' . $chatId] = $arMessage['usersMessage'][$chatId];
             unset($arMessage['usersMessage'][$chatId]);
         }
     } else {
         if (CIMContactList::AllowToSend(array('TO_USER_ID' => $_POST['USER_ID']))) {
             $CIMMessage = new CIMMessage();
             $arMessage = $CIMMessage->GetLastMessage(intval($_POST['USER_ID']), false, $_POST['USER_LOAD'] == 'Y' ? true : false, false);
         }
     }
     echo CUtil::PhpToJsObject(array('USER_ID' => $chatId > 0 ? htmlspecialcharsbx($_POST['USER_ID']) : intval($_POST['USER_ID']), 'MESSAGE' => isset($arMessage['message']) ? $arMessage['message'] : array(), 'USERS_MESSAGE' => isset($arMessage['message']) ? $arMessage['usersMessage'] : array(), 'USERS' => isset($arMessage['users']) ? $arMessage['users'] : array(), 'USER_IN_GROUP' => isset($arMessage['userInGroup']) ? $arMessage['userInGroup'] : array(), 'WO_USER_IN_GROUP' => isset($arMessage['woUserInGroup']) ? $arMessage['woUserInGroup'] : array(), 'CHAT' => isset($arMessage['chat']) ? $arMessage['chat'] : array(), 'USER_IN_CHAT' => isset($arMessage['userInChat']) ? $arMessage['userInChat'] : array(), 'ERROR' => ''));
 } else {
     if ($_POST['IM_HISTORY_LOAD_MORE'] == 'Y') {
         $arMessage = array();
         if (CIMContactList::AllowToSend(array('TO_USER_ID' => $_POST['USER_ID']))) {
             $CIMHistory = new CIMHistory(false, array('hide_link' => isset($_POST['MOBILE']) ? true : false));
             if (substr($_POST['USER_ID'], 0, 4) == 'chat') {
                 $chatId = substr($_POST['USER_ID'], 4);
                 $arMessage = $CIMHistory->GetMoreChatMessage(intval($_POST['PAGE_ID']), $chatId, false);
                 if (!empty($arMessage['message'])) {
                     foreach ($arMessage['message'] as $id => $ar) {
                         $arMessage['message'][$id]['recipientId'] = 'chat' . $ar['recipientId'];
                     }
                     $arMessage['usersMessage']['chat' . $chatId] = $arMessage['usersMessage'][$chatId];
                     unset($arMessage['usersMessage'][$chatId]);
                 }
             } else {
                 $arMessage = $CIMHistory->GetMoreMessage(intval($_POST['PAGE_ID']), intval($_POST['USER_ID']), false, false);
             }
         }