本文整理汇总了PHP中CForumMessage::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumMessage::Delete方法的具体用法?PHP CForumMessage::Delete怎么用?PHP CForumMessage::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumMessage
的用法示例。
在下文中一共展示了CForumMessage::Delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ForumSpamMessage
function ForumSpamMessage($message, &$strErrorMessage, &$strOKMessage, $arAddParams = array())
{
global $USER;
$arError = array();
$arOK = array();
$arAddParams = !is_array($arAddParams) ? array($arAddParams) : $arAddParams;
$arAddParams["PERMISSION"] = !empty($arAddParams["PERMISSION"]) ? $arAddParams["PERMISSION"] : false;
$message = ForumDataToArray($message);
if (empty($message)) {
$arError[] = GetMessage("SPAM_NO_MESS");
} else {
foreach ($message as $MID) {
if (!CForumMessage::CanUserDeleteMessage($MID, $USER->GetUserGroupArray(), $USER->GetID(), $arAddParams["PERMISSION"])) {
$arError[] = GetMessage("SPAM_NO_PERMS") . "(MID=" . $MID . ")";
} else {
$arMessage = CForumMessage::GetByID($MID, array("FILTER" => "N"));
if (CModule::IncludeModule("mail")) {
CMailMessage::MarkAsSpam($arMessage["XML_ID"], "Y");
}
if (CForumMessage::Delete($MID)) {
$arOK[] = GetMessage("SPAM_OK") . "(MID=" . $MID . ")";
CForumEventLog::Log("message", "spam", $MID, print_r($arMessage, true));
} else {
$arError[] = GetMessage("SPAM_NO") . "(MID=" . $MID . ")";
}
}
}
}
if (!empty($arError)) {
$strErrorMessage .= implode(".\n", $arError) . ".\n";
}
if (!empty($arOK)) {
$strOKMessage .= implode(".\n", $arOK) . ".\n";
}
return empty($arError) ? true : false;
}
示例2: delete
public function delete()
{
if ($this->message === null) {
$this->errorCollection->addOne(new Error(Loc::getMessage("FORUM_CM_ERR_COMMENT_IS_LOST2"), self::ERROR_MESSAGE_IS_NULL));
} else {
if (\CForumMessage::Delete($this->message["ID"])) {
\CForumEventLog::Log("message", "delete", $this->message["ID"], serialize($this->message + array("TITLE" => $this->topic["TITLE"])));
/***************** Events ******************************************/
/***************** Events OnAfterCommentUpdate *********************/
$fields = array($this->entity->getType(), $this->entity->getId(), array("TOPIC_ID" => $this->topic["ID"], "MESSAGE_ID" => $this->message["ID"], "MESSAGE" => $this->getComment(), "ACTION" => "DEL"));
$event = new Event("forum", "OnAfterCommentUpdate", $fields);
$event->send();
/***************** Events OnCommentModerate ************************/
$event = new Event("forum", "OnCommentDelete", $fields);
$event->send();
/***************** /Events *****************************************/
} else {
$text = Loc::getMessage("FORUM_CM_ERR_DELETE");
if (($ex = $this->getApplication()->getException()) && $ex) {
$text = $ex->getString();
}
$this->errorCollection->addOne(new Error($text, self::ERROR_PARAMS_MESSAGE));
}
}
return true;
}
示例3: foreach
if ($exception = $APPLICATION->GetException()) {
$lAdmin->AddGroupError($exception->GetString(), $id);
} else {
$lAdmin->AddGroupError('Ошибка редактирования отзывов', $id);
}
}
}
}
if (($idList = $lAdmin->GroupAction()) && check_bitrix_sessid()) {
foreach ($idList as $id) {
if (!(int) $id) {
continue;
}
switch ($_REQUEST['action']) {
case 'delete':
CForumMessage::Delete($id);
break;
}
}
}
$themeList = [];
$orderList = strtoupper($by) === 'ID' ? [$by => $order] : [$by => $order, 'ID' => 'DESC'];
$reviewCollection = CForumMessage::GetList($orderList);
$adminResult = new CAdminResult($reviewCollection, $tableId);
$adminResult->NavStart();
$lAdmin->NavText($adminResult->GetNavPrint('На странице:', true));
while ($res = $adminResult->NavNext(true, 'f_')) {
$row =& $lAdmin->AddRow($f_ID, $res);
if ((int) $res['PARAM2']) {
$element = CIBlockElement::GetList([], ['ID' => $res['PARAM2']], false, false, ['ID', 'IBLOCK_ID', 'IBLOCK_TYPE', 'NAME'])->Fetch();
$res['IBLOCK_ELEMENT'] = $element ? '<a href="/bitrix/admin/iblock_element_edit.php?IBLOCK_ID=' . $element['IBLOCK_ID'] . '&type=' . $element['IBLOCK_TYPE'] . '&ID=' . $element['ID'] . '" target="_blank"]>' . $element['NAME'] . '</a>' : $res['PARAM2'] . ' (Удалён)';