コード例 #1
0
ファイル: im.ajax.php プロジェクト: webgksupport/alpina
     if (CIMChat::GetGeneralChatId() == intval($_POST['CHAT_ID'])) {
         $errorMessage = GetMessage('IM_ACCESS_ERROR');
     } else {
         $CIMChat = new CIMChat();
         $result = $CIMChat->AddUser($_POST['CHAT_ID'], $_POST['USERS'], array('SEARCH_MARK' => $_POST['SEARCH_MARK']));
         if (!$result) {
             if ($e = $GLOBALS["APPLICATION"]->GetException()) {
                 $errorMessage = $e->GetString();
             }
         }
     }
     echo CUtil::PhpToJsObject(array('ERROR' => $errorMessage));
 } else {
     if ($_POST['IM_CHAT_JOIN'] == 'Y') {
         $CIMChat = new CIMChat();
         $result = $CIMChat->Join($_POST['CHAT_ID']);
     } else {
         if ($_POST['IM_CHAT_LEAVE'] == 'Y') {
             $userId = $USER->GetId();
             if (CIMChat::GetGeneralChatId() == intval($_POST['CHAT_ID'])) {
                 $result = false;
             } else {
                 $CIMChat = new CIMChat();
                 $result = $CIMChat->DeleteUser($_POST['CHAT_ID'], intval($_POST['USER_ID']) > 0 ? intval($_POST['USER_ID']) : $USER->GetID());
             }
             echo CUtil::PhpToJsObject(array('CHAT_ID' => intval($_POST['CHAT_ID']), 'USER_ID' => intval($_POST['USER_ID']), 'ERROR' => $result ? '' : 'ACCESS_ERROR'));
         } else {
             if ($_POST['IM_CHAT_MUTE'] == 'Y') {
                 $CIMChat = new CIMChat();
                 $result = $CIMChat->MuteNotify($_POST['CHAT_ID'], $_POST['MUTE'] == 'Y');
                 echo CUtil::PhpToJsObject(array('CHAT_ID' => intval($_POST['CHAT_ID']), 'ERROR' => $result ? '' : 'ACCESS_ERROR'));