本文整理汇总了PHP中CForumMessage::CanUserDeleteMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumMessage::CanUserDeleteMessage方法的具体用法?PHP CForumMessage::CanUserDeleteMessage怎么用?PHP CForumMessage::CanUserDeleteMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumMessage
的用法示例。
在下文中一共展示了CForumMessage::CanUserDeleteMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ForumMoveMessage2Support
function ForumMoveMessage2Support($MID, &$strErrorMessage, &$strOKMessage, $arAddParams = array())
{
global $USER;
$MID = IntVal($MID);
$sError = array();
$sNote = array();
$arAddParams = !is_array($arAddParams) ? array($arAddParams) : $arAddParams;
$arAddParams["PERMISSION"] = !empty($arAddParams["PERMISSION"]) ? $arAddParams["PERMISSION"] : false;
if ($MID <= 0) {
$arError[] = GetMessage("MOVEMES_NO_MESS_EX");
}
if (!CModule::IncludeModule("support")) {
$arError[] = GetMessage("MOVEMES_NO_SUPPORT");
}
if (empty($arError)) {
$arMessage = CForumMessage::GetByID($MID, array("FILTER" => "N"));
if (!$arMessage) {
$arError[] = GetMessage("MOVEMES_NO_MESS_EX");
} elseif (IntVal($arMessage["AUTHOR_ID"]) <= 0) {
$arError[] = GetMessage("MOVEMES_NO_ANONYM");
} elseif (!CForumMessage::CanUserDeleteMessage($MID, $USER->GetUserGroupArray(), $USER->GetID(), $arAddParams["PERMISSION"])) {
$arError[] = GetMessage("MOVEMES_NO_PERMS2MOVE");
} else {
$arTopic = CForumTopic::GetByID($arMessage["TOPIC_ID"]);
$arFieldsSu = array("CLOSE" => "N", "TITLE" => $arTopic["TITLE"], "MESSAGE" => $arMessage["POST_MESSAGE"], "OWNER_USER_ID" => $arMessage["AUTHOR_ID"], "OWNER_SID" => $arMessage["AUTHOR_NAME"], "SOURCE_SID" => "forum");
$arIMAGE = CFile::MakeFileArray($arMessage["ATTACH_IMG"]);
if (is_array($arIMAGE)) {
$arIMAGE["MODULE_ID"] = "support";
$arFieldsSu["FILES"] = array($arIMAGE);
}
$SuID = CTicket::SetTicket($arFieldsSu);
$SuID = IntVal($SuID);
if ($SuID > 0) {
$sNote[] = GetMessage("MOVEMES_SUCCESS_SMOVE");
} else {
$arError[] = GetMessage("MOVEMES_ERROR_SMOVE");
}
}
}
if (!empty($arError)) {
$strErrorMessage .= implode(".\n", $arError) . ".\n";
}
if (!empty($arNote)) {
$strOKMessage .= implode(".\n", $arNote) . ".\n";
}
if (empty($arError)) {
return $SuID;
} else {
return False;
}
}