public function delete() { if (!$this->isActionAllowed(self::ACTION_COMMENT_REMOVE)) { throw new TasksException('', TasksException::TE_ACTION_NOT_ALLOWED); } $taskData = $this->oTaskItem->getData(); if (intval($taskData['FORUM_TOPIC_ID'])) { /** @noinspection PhpDeprecationInspection */ $rc = CTaskComments::Remove($this->taskId, $this->itemId, $this->executiveUserId, array('FORUM_TOPIC_ID' => $taskData['FORUM_TOPIC_ID'])); } if (!$rc) { throw new TasksException('', TasksException::TE_ACTION_FAILED_TO_BE_PROCESSED); } }
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("forum")) { return false; } elseif (is_set($_REQUEST["TASK_ID"]) && $arParams["TASK_ID"] != $_REQUEST["TASK_ID"]) { return false; } $this->IncludeComponentLang("action.php"); if (!check_bitrix_sessid()) { $arError[] = array("code" => "session time is up", "title" => GetMessage("F_ERR_SESSION_TIME_IS_UP")); } elseif ($arParams['PERMISSION'] <= "E") { $arError[] = array("code" => "access denied", "title" => GetMessage("F_ERR_NOT_RIGHT_FOR_ADD")); } elseif (isset($_POST['remove_comment']) && $_POST['remove_comment'] === 'Y') { try { CTaskComments::Remove($arResult["TASK"]['ID'], $_REQUEST["COMMENT_ID"], $USER->getId(), array('FORUM_ID' => $arParams['FORUM_ID'], 'FORUM_TOPIC_ID' => $arResult["FORUM_TOPIC_ID"], 'APPROVED' => 'Y')); $arResult['TASK']['COMMENTS_COUNT']--; LocalRedirect($APPLICATION->GetCurPageParam("", array("sessid", "ACTION"))); } catch (Exception $e) { $arError[] = array("code" => 'failure during comment removing', "title" => GetMessage('F_ERR_REMOVE_COMMENT')); } } elseif (empty($_REQUEST["preview_comment"]) || $_REQUEST["preview_comment"] == "N") { $FORUM_TOPIC_ID = $arResult["FORUM_TOPIC_ID"] ? $arResult["FORUM_TOPIC_ID"] : 0; $strErrorMessage = ""; if (strLen($_POST["REVIEW_TEXT"]) < 1) { if (empty($_REQUEST["FILES"]) && empty($_FILES)) { $arError[] = array("code" => "post is empty", "title" => GetMessage("F_ERR_NO_REVIEW_TEXT")); } else { $_POST['REVIEW_TEXT'] = '[COLOR=#FFFFFF] [/COLOR]'; } }