Esempio n. 1
0
     }
 }
 if ($_REQUEST["action"] == "close" && check_bitrix_sessid() && IntVal($_REQUEST["eventID"]) > 0) {
     $errorMessage = "";
     if (!CSocNetMessages::MarkMessageRead($GLOBALS["USER"]->GetID(), IntVal($_REQUEST["eventID"]))) {
         if ($e = $APPLICATION->GetException()) {
             $errorMessage .= $e->GetString();
         }
     }
     if (strlen($errorMessage) > 0) {
         $arResult["ErrorMessage"] = $errorMessage;
     }
 }
 if ($_REQUEST["action"] == "delete" && check_bitrix_sessid() && IntVal($_REQUEST["eventID"]) > 0) {
     $errorMessage = "";
     if (!CSocNetMessages::DeleteMessage(IntVal($_REQUEST["eventID"]), $GLOBALS["USER"]->GetID())) {
         if ($e = $APPLICATION->GetException()) {
             $errorMessage .= $e->GetString();
         }
     }
     if (strlen($errorMessage) > 0) {
         $arResult["ErrorMessage"] = $errorMessage;
     }
 }
 if ($_SERVER["REQUEST_METHOD"] == "POST" && (strlen($_POST["do_read"]) > 0 || strlen($_POST["do_delete"]) > 0 || array_key_exists("do_delete_all_flag", $_POST) && $_POST["do_delete_all_flag"] == "Y") && check_bitrix_sessid()) {
     $errorMessage = "";
     $arIDs = array();
     if (strlen($errorMessage) <= 0 && $_POST["do_delete_all_flag"] != "Y") {
         for ($i = 0; $i <= IntVal($_POST["max_count"]); $i++) {
             if ($_POST["checked_" . $i] == "Y") {
                 $arIDs[] = IntVal($_POST["id_" . $i]);
Esempio n. 2
0
 public static function DeleteConversation($CurrentUserID, $PartnerUserID)
 {
     global $APPLICATION, $DB;
     $CurrentUserID = IntVal($CurrentUserID);
     $PartnerUserID = IntVal($PartnerUserID);
     if ($CurrentUserID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_SENDER_USER_ID"), "ERROR_USER_ID");
         return false;
     }
     if ($PartnerUserID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_TARGET_USER_ID"), "ERROR_USER_ID");
         return false;
     }
     $dbMessages = CSocNetMessages::GetMessagesForChat($CurrentUserID, $PartnerUserID);
     while ($arMessages = $dbMessages->GetNext()) {
         CSocNetMessages::DeleteMessage($arMessages["ID"], $CurrentUserID, false);
     }
     CSocNetMessages::__SpeedFileCheckMessages($CurrentUserID);
     return true;
 }