Esempio n. 1
0
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;
}
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
            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'] . ' (Удалён)';