Пример #1
0
 if ($_POST['IM_DESKTOP_LOGOUT'] == 'Y') {
     $errorMessage = "";
     CIMMessenger::SetDesktopStatusOffline();
     CIMContactList::SetOffline();
     echo CUtil::PhpToJsObject(array('ERROR' => $errorMessage));
 } else {
     if ($_POST['IM_SET_COLOR'] == 'Y') {
         $errorMessage = "";
         $_POST['CHAT_ID'] = intval($_POST['CHAT_ID']);
         if ($_POST['CHAT_ID'] > 0) {
             $userId = $USER->GetId();
             if (CIMChat::GetGeneralChatId() == intval($_POST['CHAT_ID']) && !CIMChat::CanSendMessageToGeneralChat($userId)) {
                 $errorMessage = GetMessage('IM_ACCESS_ERROR');
             } else {
                 $chat = new CIMChat();
                 $chat->SetColor($_POST['CHAT_ID'], $_POST['COLOR']);
             }
         } else {
             CIMStatus::SetColor($USER->GetId(), $_POST['COLOR']);
         }
         echo CUtil::PhpToJsObject(array('COLOR' => $_POST['COLOR'], 'CHAT_ID' => $_POST['CHAT_ID'], 'ERROR' => $errorMessage));
     } else {
         if ($_POST['IM_GET_MOBILE_CHAT_AVATAR'] == 'Y') {
             $avatar = "";
             $errorMessage = "";
             if ($_POST['CHAT_ID'] > 0) {
                 $chat = new CIMChat();
                 $arChat = CIMChat::GetChatData(array('ID' => $_POST['CHAT_ID'], 'USE_CACHE' => 'N', 'PHOTO_SIZE' => '500', 'USER_ID' => intval($USER->GetId())));
                 $arResult['CHAT'] = $arChat['chat'][$_POST['CHAT_ID']];
                 if ($arResult['CHAT']) {
                     $avatar = $arResult['CHAT']['avatar'] == '/bitrix/js/im/images/blank.gif' ? '' : $arResult['CHAT']['avatar'];