本文整理汇总了PHP中CForumMessage::SendMailMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumMessage::SendMailMessage方法的具体用法?PHP CForumMessage::SendMailMessage怎么用?PHP CForumMessage::SendMailMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumMessage
的用法示例。
在下文中一共展示了CForumMessage::SendMailMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SocnetEMailMessageAdd
//.........这里部分代码省略.........
}
if (!empty($arMessageFields["FIELD_BCC"])) {
$arRes[] = "Bcc: " . $arMessageFields["FIELD_BCC"];
}
$arRes[] = "Subject: " . $arMessageFields["SUBJECT"];
$arRes[] = "Date: " . $arMessageFields["FIELD_DATE"];
$arFields["MAIL_HEADER"] = implode("\r\n", $arRes);
preg_match_all('#Received:\\s+from\\s+(.*)by.*#i', $arMessageFields["HEADER"], $regs);
if (is_array($regs) && is_array($regs[1])) {
$arFields["AUTHOR_IP"] = $arFields["AUTHOR_REAL_IP"] = '<email: ' . $regs[1][count($regs[1]) - 1] . '>';
} else {
$arFields["AUTHOR_IP"] = $arFields["AUTHOR_REAL_IP"] = '<email: no address>';
}
/*
$AUTHOR_IP = ForumGetRealIP();
$AUTHOR_IP_tmp = $AUTHOR_IP;
$AUTHOR_REAL_IP = $_SERVER['REMOTE_ADDR'];
if (COption::GetOptionString("forum", "FORUM_GETHOSTBYADDR", "N") == "Y")
{
$AUTHOR_IP = @gethostbyaddr($AUTHOR_IP);
if ($AUTHOR_IP_tmp==$AUTHOR_REAL_IP)
$AUTHOR_REAL_IP = $AUTHOR_IP;
else
$AUTHOR_REAL_IP = @gethostbyaddr($AUTHOR_REAL_IP);
}
$arFields["AUTHOR_IP"] = ($AUTHOR_IP!==False) ? $AUTHOR_IP : "<no address>";
$arFields["AUTHOR_REAL_IP"] = ($AUTHOR_REAL_IP!==False) ? $AUTHOR_REAL_IP : "<no address>";
*/
$strErrorMessage = '';
$MESSAGE_ID = CForumMessage::Add($arFields, false);
if (intVal($MESSAGE_ID) <= 0) {
$str = $GLOBALS['APPLICATION']->GetException();
if ($str && $str->GetString()) {
$strErrorMessage .= "[" . $str->GetString() . "]";
}
if ($arFields["NEW_TOPIC"] == 'Y') {
CForumTopic::Delete($TOPIC_ID);
}
CMailLog::AddMessage(array("MAILBOX_ID" => $arMessageFields["MAILBOX_ID"], "MESSAGE_ID" => $arMessageFields["ID"], "FILTER_ID" => $arParams["MAIL_FILTER_ID"], "LOG_TYPE" => "FILTER_ERROR", "MESSAGE" => GetMessage("FORUM_MAIL_ERROR5") . " " . $strErrorMessage));
}
if ($MESSAGE_ID > 0) {
CMailLog::AddMessage(array("MAILBOX_ID" => $arMessageFields["MAILBOX_ID"], "MESSAGE_ID" => $arMessageFields["ID"], "FILTER_ID" => $arParams["MAIL_FILTER_ID"], "LOG_TYPE" => "FILTER_COMPLETE", "MESSAGE" => GetMessage("FORUM_MAIL_OK") . " " . $MESSAGE_ID . " (TID#" . $TOPIC_ID . ")"));
CForumMessage::SendMailMessage($MESSAGE_ID, array(), false, "NEW_FORUM_MESSAGE");
$dbSite = CSite::GetById($arMessageFields["LID"]);
if ($arSite = $dbSite->Fetch()) {
$lang = $arSite['LANGUAGE_ID'];
} else {
$lang = $LANGUAGE_ID;
}
$parser = new forumTextParser();
$arForum = CForumNew::GetByID($FORUM_ID);
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "LIST" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "SMILES" => "N", "UPLOAD" => $arForum["ALLOW_UPLOAD"], "NL2BR" => "N", "TABLE" => "N", "ALIGN" => "N");
if ($arFields["NEW_TOPIC"] == "Y") {
$arFieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $SOCNET_GROUP_ID, "EVENT_ID" => "forum", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $AUTHOR_NAME, CForumEmail::GetLangMessage("FORUM_MAIL_SOCNET_TITLE_TOPIC", $lang)), "TITLE" => $subject, "MESSAGE" => $parser->convert($body, $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($body), "URL" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("UID" => $AUTHOR_USER_ID, "FID" => $FORUM_ID, "TID" => $TOPIC_ID, "MID" => $MESSAGE_ID)), "PARAMS" => serialize(array("PATH_TO_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("TID" => $TOPIC_ID)))), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $MESSAGE_ID, "RATING_TYPE_ID" => "FORUM_TOPIC", "RATING_ENTITY_ID" => intval($TOPIC_ID));
if (intVal($AUTHOR_USER_ID) > 0) {
$arFieldsForSocnet["USER_ID"] = $AUTHOR_USER_ID;
}
$logID = CSocNetLog::Add($arFieldsForSocnet, false);
if (intval($logID) > 0) {
CSocNetLog::Update($logID, array("TMP_ID" => $logID));
CSocNetLogRights::SetForSonet($logID, $arFieldsForSocnet["ENTITY_TYPE"], $arFieldsForSocnet["ENTITY_ID"], "forum", "view", true);
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
}
} else {
$dbForumMessage = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $TOPIC_ID));
if ($arForumMessage = $dbForumMessage->Fetch()) {
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "forum", "SOURCE_ID" => $arForumMessage["ID"]), false, false, array("ID", "TMP_ID"));
if ($arRes = $dbRes->Fetch()) {
$log_id = $arRes["TMP_ID"];
} else {
$dbFirstMessage = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $arForumMessage["TOPIC_ID"]), false, 1);
if ($arFirstMessage = $dbFirstMessage->Fetch()) {
$arTopic = CForumTopic::GetByID($arFirstMessage["TOPIC_ID"]);
$sFirstMessageText = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arFirstMessage["POST_MESSAGE_FILTER"] : $arFirstMessage["POST_MESSAGE"];
$sFirstMessageURL = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("UID" => $arFirstMessage["AUTHOR_ID"], "FID" => $arFirstMessage["FORUM_ID"], "TID" => $arFirstMessage["TOPIC_ID"], "MID" => $arFirstMessage["ID"]));
$arFieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $SOCNET_GROUP_ID, "EVENT_ID" => "forum", "LOG_DATE" => $arFirstMessage["POST_DATE"], "LOG_UPDATE" => $arFirstMessage["POST_DATE"], "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $arFirstMessage["AUTHOR_NAME"], GetMessage("SONET_FORUM_LOG_TOPIC_TEMPLATE")), "TITLE" => $arTopic["TITLE"], "MESSAGE" => $parser->convert($sFirstMessageText, $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($sFirstMessageText), "URL" => $sFirstMessageURL, "PARAMS" => serialize(array("PATH_TO_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("TID" => $arFirstMessage["TOPIC_ID"])))), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $arFirstMessage["ID"], "RATING_TYPE_ID" => "FORUM_TOPIC", "RATING_ENTITY_ID" => intval($arFirstMessage["TOPIC_ID"]));
if (intVal($arFirstMessage["AUTHOR_ID"]) > 0) {
$arFieldsForSocnet["USER_ID"] = $arFirstMessage["AUTHOR_ID"];
}
$log_id = CSocNetLog::Add($arFieldsForSocnet, false);
if (intval($log_id) > 0) {
CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
CSocNetLogRights::SetForSonet($log_id, $arFieldsForSocnet["ENTITY_TYPE"], $arFieldsForSocnet["ENTITY_ID"], "forum", "view", true);
}
}
}
if (intval($log_id) > 0) {
$arFieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $SOCNET_GROUP_ID, "EVENT_ID" => "forum", "LOG_ID" => $log_id, "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $parser->convert($body, $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($body), "URL" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("UID" => $AUTHOR_USER_ID, "FID" => $FORUM_ID, "TID" => $TOPIC_ID, "MID" => $MESSAGE_ID)), "MODULE_ID" => false, "SOURCE_ID" => $MESSAGE_ID, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => intval($MESSAGE_ID));
if (intVal($AUTHOR_USER_ID) > 0) {
$arFieldsForSocnet["USER_ID"] = $AUTHOR_USER_ID;
}
CSocNetLogComments::Add($arFieldsForSocnet);
}
}
}
}
}
示例2: AddComment_News
function AddComment_News($arFields)
{
if (!CModule::IncludeModule("forum")) {
return false;
}
if (!CModule::IncludeModule("iblock")) {
return false;
}
if (!CModule::IncludeModule("socialnetwork")) {
return false;
}
$dbResult = CSocNetLog::GetList(array("ID" => "DESC"), array("TMP_ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "PARAMS"));
$bFound = false;
if ($arLog = $dbResult->Fetch()) {
if (intval($arLog["SOURCE_ID"]) > 0) {
$arFilter = array("ID" => $arLog["SOURCE_ID"]);
$arSelectedFields = array("IBLOCK_ID", "ID", "CREATED_BY", "NAME", "PROPERTY_FORUM_TOPIC_ID", "PROPERTY_FORUM_MESSAGE_CNT");
$db_res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelectedFields);
if ($db_res && ($res = $db_res->GetNext())) {
$arElement = $res;
$val = COption::GetOptionString("intranet", "sonet_log_news_iblock_forum");
if (strlen($val) > 0) {
$arIBlockForum = unserialize($val);
} else {
$arIBlockForum = array();
}
if (array_key_exists($arElement["IBLOCK_ID"], $arIBlockForum)) {
$FORUM_ID = $arIBlockForum[$arElement["IBLOCK_ID"]];
}
if (intval($FORUM_ID) > 0) {
CSocNetLogTools::AddComment_Review_CheckIBlock($arElement);
$dbMessage = CForumMessage::GetList(array(), array("PARAM2" => $arElement["ID"]));
if (!($arMessage = $dbMessage->Fetch())) {
// Add Topic
$TOPIC_ID = CSocNetLogTools::AddComment_Review_CreateRoot($arElement, $FORUM_ID);
$bNewTopic = true;
} else {
$TOPIC_ID = $arMessage["TOPIC_ID"];
}
if (intval($TOPIC_ID) > 0) {
// Add comment
$messageID = false;
$bError = false;
if (CForumMessage::CanUserAddMessage($TOPIC_ID, $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID(), false)) {
$bSHOW_NAME = true;
$res = CForumUser::GetByUSER_ID($GLOBALS["USER"]->GetID());
if ($res) {
$bSHOW_NAME = $res["SHOW_NAME"] == "Y";
}
if ($bSHOW_NAME) {
$AUTHOR_NAME = $GLOBALS["USER"]->GetFullName();
}
if (strlen(Trim($AUTHOR_NAME)) <= 0) {
$AUTHOR_NAME = $GLOBALS["USER"]->GetLogin();
}
if (strlen($AUTHOR_NAME) <= 0) {
$bError = true;
}
}
if (!$bError) {
$arFieldsMessage = array("POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "USE_SMILES" => "Y", "APPROVED" => "Y", "PARAM2" => $arElement["ID"], "AUTHOR_NAME" => $AUTHOR_NAME, "AUTHOR_ID" => IntVal($GLOBALS["USER"]->GetParam("USER_ID")), "FORUM_ID" => $FORUM_ID, "TOPIC_ID" => $TOPIC_ID, "NEW_TOPIC" => "N", "GUEST_ID" => $_SESSION["SESS_GUEST_ID"], "ADD_TO_LOG" => "N");
$AUTHOR_IP = ForumGetRealIP();
$AUTHOR_IP_tmp = $AUTHOR_IP;
$AUTHOR_REAL_IP = $_SERVER['REMOTE_ADDR'];
if (COption::GetOptionString("forum", "FORUM_GETHOSTBYADDR", "N") == "Y") {
$AUTHOR_IP = @gethostbyaddr($AUTHOR_IP);
if ($AUTHOR_IP_tmp == $AUTHOR_REAL_IP) {
$AUTHOR_REAL_IP = $AUTHOR_IP;
} else {
$AUTHOR_REAL_IP = @gethostbyaddr($AUTHOR_REAL_IP);
}
}
$arFieldsMessage["AUTHOR_IP"] = $AUTHOR_IP !== False ? $AUTHOR_IP : "<no address>";
$arFieldsMessage["AUTHOR_REAL_IP"] = $AUTHOR_REAL_IP !== False ? $AUTHOR_REAL_IP : "<no address>";
$messageID = CForumMessage::Add($arFieldsMessage, false);
if (intVal($messageID) <= 0) {
$bError = true;
} else {
if (CModule::IncludeModule("statistic")) {
$arForum = CForumNew::GetByID($FORUM_ID);
$F_EVENT1 = $arForum["EVENT1"];
$F_EVENT2 = $arForum["EVENT2"];
$F_EVENT3 = $arForum["EVENT3"];
if (strlen($F_EVENT3) <= 0) {
$arForumSite_tmp = CForumNew::GetSites($FORUM_ID);
$F_EVENT3 = CForumNew::PreparePath2Message($arForumSite_tmp[SITE_ID], array("FORUM_ID" => $FORUM_ID, "TOPIC_ID" => $TOPIC_ID, "MESSAGE_ID" => $messageID));
}
CStatistic::Set_Event($F_EVENT1, $F_EVENT2, $F_EVENT3);
}
CForumMessage::SendMailMessage($messageID, array(), false, "NEW_FORUM_MESSAGE");
CSocNetLogTools::AddComment_Review_UpdateElement($arElement, $TOPIC_ID, $bNewTopic);
}
}
}
}
}
}
}
if (intval($messageID) <= 0) {
$strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
//.........这里部分代码省略.........
示例3: moderate
public function moderate($show)
{
if ($this->message === null) {
$this->errorCollection->addOne(new Error(Loc::getMessage("FORUM_CM_ERR_COMMENT_IS_LOST3"), self::ERROR_MESSAGE_IS_NULL));
} else {
$fields = array("APPROVED" => $show ? "Y" : "N");
if ($this->message["ID"] == $fields["APPROVED"] || ($mid = \CForumMessage::Update($this->message["ID"], $fields)) > 0) {
$this->setComment($this->message["ID"]);
/***************** Events ******************************************/
/***************** Event onMessageModerate *************************/
$event = new Event("forum", "onMessageModerate", array($this->message["ID"], $show ? "SHOW" : "HIDE", $this->message, $this->topic));
$event->send();
/***************** 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" => $show ? "SHOW" : "HIDE", "PARAMS" => $fields));
$event = new Event("forum", "OnAfterCommentUpdate", $fields);
$event->send();
/***************** Events OnCommentModerate ************************/
$event = new Event("forum", "OnCommentModerate", $fields);
$event->send();
/***************** /Events *****************************************/
$res = serialize(array("ID" => $this->message["ID"], "AUTHOR_NAME" => $this->message["AUTHOR_NAME"], "POST_MESSAGE" => $this->message["POST_MESSAGE"], "TITLE" => $this->topic["TITLE"], "TOPIC_ID" => $this->topic["ID"], "FORUM_ID" => $this->topic["FORUM_ID"]));
\CForumMessage::SendMailMessage($this->message["ID"], array(), false, $show ? "NEW_FORUM_MESSAGE" : "EDIT_FORUM_MESSAGE");
\CForumEventLog::Log("message", $show ? "approve" : "unapprove", $this->message["ID"], $res);
return $this->getComment();
} else {
$text = Loc::getMessage("FORUM_CM_ERR_MODERATE");
if (($ex = $this->getApplication()->getException()) && $ex) {
$text = $ex->getString();
}
$this->errorCollection->addOne(new Error($text, self::ERROR_PARAMS_MESSAGE));
}
}
return false;
}
示例4: ForumMoveMessage
//.........这里部分代码省略.........
if ($db_res && ($res = $db_res->Fetch())) {
$arRes["NAME"] = $res["AUTHOR_NAME"];
$arRes["ID"] = $res["AUTHOR_ID"];
}
$arFieldsTopic = array("TITLE" => $arFields["TITLE"], "TITLE_SEO" => $arFields["TITLE_SEO"], "DESCRIPTION" => $arFields["DESCRIPTION"], "ICON" => $arFields["ICON"], "TAGS" => $arFields["TAGS"], "FORUM_ID" => $FID, "USER_START_ID" => $arRes["ID"], "USER_START_NAME" => $arRes["NAME"], "LAST_POSTER_NAME" => $arRes["NAME"], "LAST_POSTER_ID" => $arRes["ID"], "APPROVED" => $arFields["APPROVED"]);
$NewTID = CForumTopic::Add($arFieldsTopic);
if (IntVal($NewTID) <= 0) {
$arError[] = GetMessage("FMM_NO_TOPIC_NOT_CREATED");
} else {
$arNewTopic = CForumTopic::GetByID($NewTID);
if ($arNewTopic) {
$NewFID = $FID;
$arNewForum = $arForum;
$SendSubscribe = true;
} else {
$arError[] = GetMessage("FMM_NO_TOPIC_NOT_CREATED");
}
}
}
}
if (count($arError) <= 0) {
// Move message
$db_res = CForumMessage::GetList(array(), array("@ID" => implode(",", $Message), "TOPIC_ID" => $TID));
if ($db_res && ($res = $db_res->Fetch())) {
do {
// echo "NewFID: ".$NewFID." -- FID:".$FID."<br/>";
$arMessage = array();
if ($NewFID != $FID) {
$arMessage["APPROVED"] = $arNewForum["MODERATION"] == "Y" ? "N" : "Y";
if ($arCurrUser["Perms"]["NewFID"] >= "Q") {
$arMessage["APPROVED"] = "Y";
}
$arMessage["FORUM_ID"] = $NewFID;
$arMessage["POST_MESSAGE_HTML"] = "";
}
if ($NewTID != $TID) {
$arMessage["NEW_TOPIC"] = "N";
$arMessage["TOPIC_ID"] = $NewTID;
}
if (count($arMessage) > 0) {
$MID = CForumMessage::Update($res["ID"], $arMessage, true);
$res_log = $SendSubscribe == true ? GetMessage("F_MESSAGE_WAS_MOVED_TO_NEW") : GetMessage("F_MESSAGE_WAS_MOVED");
$res_log = str_replace(array("#ID#", "#TOPIC_TITLE#", "#TOPIC_ID#", "#NEW_TOPIC_TITLE#", "#NEW_TOPIC_ID#"), array($MID, $arTopic["TITLE"], $arTopic["ID"], $arNewTopic['TITLE'], $arNewTopic['ID']), $res_log);
$res["TITLE"] = $arNewTopic['TITLE'];
$res["TOPIC_ID"] = $arNewTopic['ID'];
$res["beforeTITLE"] = $arTopic["TITLE"];
$res["DESCRIPTION"] = $res_log;
CForumEventLog::Log("message", "move", $MID, serialize($res));
$db_res2 = CForumFiles::GetList(array(), array("FILE_MESSAGE_ID" => $res["ID"]));
if ($db_res2 && ($res2 = $db_res2->Fetch())) {
$arFiles = array();
do {
$arFiles[] = $res2["FILE_ID"];
} while ($res2 = $db_res2->Fetch());
CForumFiles::UpdateByID($arFiles, $arMessage);
}
if (IntVal($MID) <= 0) {
$arError[] = str_replace("##", $res["ID"], GetMessage("FMM_NO_MESSAGE_MOVE"));
break;
}
}
} while ($res = $db_res->Fetch());
}
}
if (count($arError) <= 0) {
$db_res = CForumMessage::GetList(array(), array("TOPIC_ID" => $TID), false, 1);
if (!($db_res && ($res = $db_res->Fetch()))) {
CForumTopic::Delete($TID);
} else {
CForumTopic::SetStat($TID);
}
$db_res = CForumMessage::GetList(array(), array("TOPIC_ID" => $NewTID), false, 1);
if (!($db_res && ($res = $db_res->Fetch()))) {
CForumTopic::Delete($NewTID);
} else {
CForumTopic::SetStat($NewTID);
}
CForumNew::SetStat($FID);
if ($NewFID != $FID) {
CForumNew::SetStat($NewFID);
}
}
if (count($arError) <= 0) {
$DB->Commit();
} else {
$DB->Rollback();
}
if (count($arError) > 0) {
$strErrorMessage .= implode(". \n", $arError) . ". \n";
} else {
$strOKMessage .= GetMessage("FMM_YES_MESSAGE_MOVE");
if ($SendSubscribe) {
foreach ($Message as $MID) {
CForumMessage::SendMailMessage($MID, array(), false, "NEW_FORUM_MESSAGE");
}
}
return true;
}
return false;
}