本文整理汇总了PHP中CForumMessage::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumMessage::GetList方法的具体用法?PHP CForumMessage::GetList怎么用?PHP CForumMessage::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumMessage
的用法示例。
在下文中一共展示了CForumMessage::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateIBlockProperty
public static function updateIBlockProperty($ID, $TYPE, $arMessage, $arTopic = array())
{
if ($ID > 0 && $arMessage["PARAM1"] != "IB" && IsModuleInstalled("iblock")) {
$arTopic = empty($arTopic) ? CForumTopic::GetByID($arMessage["TOPIC_ID"]) : $arTopic;
if (!empty($arTopic) && $arTopic["XML_ID"] == "IBLOCK_" . $arMessage["PARAM2"] && CModule::IncludeModule("iblock")) {
CIBlockElement::SetPropertyValuesEx($arMessage["PARAM2"], 0, array("FORUM_MESSAGE_CNT" => array("VALUE" => CForumMessage::GetList(array(), array("TOPIC_ID" => $arMessage["TOPIC_ID"], "APPROVED" => "Y", "!PARAM1" => "IB"), true), "DESCRIPTION" => "")));
}
}
}
示例2: OnPrepareComments
function OnPrepareComments()
{
$arResult =& $this->component->arResult;
$arParams =& $this->component->arParams;
$arMessages =& $arResult['MESSAGES'];
$arResult['UFS'] = array();
if (!empty($arMessages) && !empty($arResult["USER_FIELDS"])) {
$res = array_keys($arMessages);
$arFilter = array("FORUM_ID" => $arParams["FORUM_ID"], "TOPIC_ID" => $arResult["FORUM_TOPIC_ID"], "APPROVED_AND_MINE" => $GLOBALS["USER"]->GetId(), ">ID" => intVal(min($res)) - 1, "<ID" => intVal(max($res)) + 1);
if ($arResult["USER"]["RIGHTS"]["MODERATE"] == "Y") {
unset($arFilter["APPROVED_AND_MINE"]);
}
$db_res = CForumMessage::GetList(array("ID" => "ASC"), $arFilter, false, 0, array("SELECT" => array_keys($arResult["USER_FIELDS"])));
if ($db_res && ($res = $db_res->Fetch())) {
do {
$arResult['UFS'][$res["ID"]] = array_intersect_key($res, $arResult["USER_FIELDS"]);
} while ($res = $db_res->Fetch());
}
}
}
示例3: ForumActions
function ForumActions($action, $arFields, &$strErrorMessage, &$strOKMessage)
{
$result = false;
$sError = "";
$sNote = "";
if (empty($action)) {
$sError = GetMessage("FORUM_NO_ACTION");
} else {
switch ($action) {
case "REPLY":
$result = ForumAddMessage("REPLY", $arFields["FID"], $arFields["TID"], 0, $arFields, $sError, $sNote, false, $arFields["captcha_word"], 0, $arFields["captcha_code"], $arFields["NAME_TEMPLATE"]);
break;
case "DEL":
$result = ForumDeleteMessage($arFields["MID"], $sError, $sNote, $arFields);
break;
case "SHOW":
case "HIDE":
$result = ForumModerateMessage($arFields["MID"], $action, $sError, $sNote, $arFields);
break;
case "VOTE4USER":
$result = ForumVote4User($arFields["UID"], $arFields["VOTES"], $arFields["VOTE"], $sError, $sNote, $arFields);
break;
case "FORUM_MESSAGE2SUPPORT":
$result = ForumMoveMessage2Support($arFields["MID"], $sError, $sNote, $arFields);
break;
case "FORUM_SUBSCRIBE":
case "TOPIC_SUBSCRIBE":
case "FORUM_SUBSCRIBE_TOPICS":
$result = ForumSubscribeNewMessagesEx($arFields["FID"], $arFields["TID"], $arFields["NEW_TOPIC_ONLY"], $sError, $sNote);
break;
case "SET_ORDINARY":
case "SET_TOP":
case "ORDINARY":
case "TOP":
if ($action == "SET_ORDINARY") {
$action = "ORDINARY";
} elseif ($action == "SET_TOP") {
$action = "TOP";
}
$result = ForumTopOrdinaryTopic($arFields["TID"], $action, $sError, $sNote, $arFields);
break;
case "DEL_TOPIC":
$result = ForumDeleteTopic($arFields["TID"], $sError, $sNote, $arFields);
break;
case "OPEN":
case "CLOSE":
case "STATE_Y":
case "STATE_N":
if ($action == "STATE_Y") {
$action = "OPEN";
} elseif ($action == "STATE_N") {
$action = "CLOSE";
}
$result = ForumOpenCloseTopic($arFields["TID"], $action, $sError, $sNote, $arFields);
break;
case "SHOW_TOPIC":
case "HIDE_TOPIC":
$db_res = CForumMessage::GetList(array(), array("TOPIC_ID" => $arFields["TID"], "APPROVED" => $action == "HIDE_TOPIC" ? "Y" : "N"));
$message = array();
if ($db_res && ($res = $db_res->Fetch())) {
do {
$message[] = $res["ID"];
} while ($res = $db_res->Fetch());
}
if (!empty($message)) {
$s = "";
$result = ForumModerateMessage($message, $action == "HIDE_TOPIC" ? "HIDE" : "SHOW", $sError, $s, $arFields);
} else {
$result = true;
}
CForumEventLog::Log("topic", $action == "HIDE_TOPIC" ? "unapprove" : "approve", $arFields["TID"], serialize(CForumTopic::GetByID($arFields["TID"])));
break;
case "SPAM_TOPIC":
$result = ForumSpamTopic($arFields["TID"], $sError, $sNote, $arFields);
break;
case "SPAM":
$result = ForumSpamMessage($arFields["MID"], $sError, $sNote, $arFields);
break;
default:
$sError = GetMessage("FORUM_NO_ACTION") . " (" . htmlspecialcharsbx($action) . ")";
break;
}
}
$strErrorMessage = $sError;
$strOKMessage = $sNote;
return $result;
}
示例4: while
$res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["GOOD"] = 0;
$res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["MARKED"] = 0;
while ($report = $dbres->Fetch()) {
if ($report["MARK"] != "X") {
$res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["MARKED"]++;
}
if ($report["MARK"] == "G") {
$res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["GOOD"]++;
}
$res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["COUNT"]++;
$report["DATE_TO"] = MakeTimeStamp($report["DATE_TO"], $datefomat);
$report["DATE_FROM"] = MakeTimeStamp($report["DATE_FROM"], $datefomat);
$report["FOR_JS"] = CTimeManReportFull::__getReportJSDraw(array("PERIOD_DATE_FROM" => $_POST["ts"], "REPORT_DATE_FROM" => $report['DATE_FROM'], "REPORT_DATE_TO" => $report['DATE_TO']));
$report["COMMENTS_COUNT"] = 0;
if ($report['FORUM_TOPIC_ID'] && CModule::IncludeModule("forum")) {
$count = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $report['FORUM_TOPIC_ID']), true);
$report["COMMENTS_COUNT"] = $count;
}
$res["USERS"][$arRes['ID']]["FULL_REPORT"][] = $report;
}
if ($arRes['ID'] == $USER->GetID() && !CTimeMan::IsAdmin()) {
$res["USERS"][$arRes['ID']]["CAN_EDIT_TIME"] = "N";
} else {
$res["USERS"][$arRes['ID']]["CAN_EDIT_TIME"] = "Y";
}
$tm_user = new CUserReportFull($arRes["ID"]);
$res["USERS"][$arRes['ID']]["SETTINGS"] = $tm_user->GetSettings(true);
}
if (count($arSections) > 0) {
$arSubordination = CIntranetUtils::GetSubordinateDepartments($USER->GetID(), true);
$arChains = array();
示例5: array
// activation rating
CRatingsComponentsMain::GetShowRating($arParams);
$arDefaultUrlTemplates404 = array('index' => 'index.php', 'post' => '#wiki_name#/', 'category' => '#wiki_name#/', 'discussion' => '#wiki_name#/discussion/', 'categories' => 'categories/', 'search' => 'search/', 'post_edit' => '#wiki_name#/edit/', 'history' => '#wiki_name#/history/', 'history_diff' => '#wiki_name#/history/diff/', 'comment' => 'comment/#message_id#/');
$arDefaultVariableAliases404 = array();
$arDefaultVariableAliases = array();
$componentPage = '';
$arComponentVariables = array('wiki_name', 'oper', 'message_id', 'title');
if ($arParams['SEF_MODE'] == 'Y') {
$arVariables = array();
$arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams['SEF_URL_TEMPLATES']);
$arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams['VARIABLE_ALIASES']);
$componentPage = CComponentEngine::ParseComponentPath($arParams['SEF_FOLDER'], $arUrlTemplates, $arVariables);
//message on like on comment lead here
if ($componentPage == "comment") {
CModule::IncludeModule('forum');
$dbMessage = CForumMessage::GetList(array(), array('ID' => intval($arVariables["message_id"])));
if ($arMessage = $dbMessage->Fetch()) {
$elementID = intval($arMessage['PARAM2']);
if ($elementID > 0) {
$dbElement = CIBlockElement::GetList(array(), array('ID' => $elementID));
}
if ($dbElement && ($arElement = $dbElement->Fetch())) {
if ($arElement['IBLOCK_ID'] == $arParams['IBLOCK_ID']) {
$redirectPath = $arParams['SEF_FOLDER'];
$redirectPath .= CComponentEngine::MakePathFromTemplate($arParams["SEF_URL_TEMPLATES"]['post'], array("wiki_name" => rawurlencode($arElement['NAME'])));
$redirectPath .= "?MID=" . $arVariables["message_id"] . "#message" . $arVariables["message_id"];
LocalRedirect($redirectPath);
}
}
}
}
示例6: array
if (empty($arError))
{
$strErrorMessage = "";
switch ($action)
{
case "DEL":
ForumDeleteMessageArray($message, $strErrorMessage, $strOKMessage);
break;
case "SHOW":
case "HIDE":
ForumModerateMessageArray($message, $action, $strErrorMessage, $strOKMessage);
break;
}
if (empty($strErrorMessage))
{
$res = CForumMessage::GetList(array("ID" => "ASC"), array("APPROVED" => "N"));
if ($res <= 0)
LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], array("FID" => $arParams["FID"])));
else
LocalRedirect($arResult["URL"]["MODERATE_MESSAGE"]);
}
else
$arError[] = array("id" => "bad_action", "text" => $strErrorMessage);
}
if (!empty($arError)):
$e = new CAdminException(array_reverse($arError));
$GLOBALS["APPLICATION"]->ThrowException($e);
$err = $GLOBALS['APPLICATION']->GetException();
$arResult["ERROR_MESSAGE"] .= $err->GetString();
endif;
$arResult["OK_MESSAGE"] = $strOKMessage;
示例7: AddComment_Wiki
static function AddComment_Wiki($arFields)
{
if (!CModule::IncludeModule('iblock')) {
return false;
}
if (!CModule::IncludeModule('socialnetwork')) {
return false;
}
$ufFileID = array();
$ufDocID = array();
$dbResult = CSocNetLog::GetList(array('ID' => 'DESC'), array('TMP_ID' => $arFields['LOG_ID']), false, false, array('ID', 'SOURCE_ID', 'PARAMS', 'URL'));
$bFound = false;
if ($arLog = $dbResult->Fetch()) {
if (strlen($arLog['PARAMS']) > 0) {
$arFieldsParams = explode('&', $arLog['PARAMS']);
if (is_array($arFieldsParams) && count($arFieldsParams) > 0) {
foreach ($arFieldsParams as $tmp) {
list($key, $value) = explode('=', $tmp);
if ($key == 'forum_id') {
$FORUM_ID = intval($value);
break;
}
}
}
}
if ($FORUM_ID > 0 && intval($arLog['SOURCE_ID']) > 0) {
$bFound = true;
}
}
if ($bFound) {
$arElement = false;
$arFilter = array('ID' => $arLog['SOURCE_ID']);
$arSelectedFields = array('IBLOCK_ID', 'ID', 'NAME', 'TAGS', 'CODE', 'IBLOCK_SECTION_ID', 'DETAIL_PAGE_URL', 'CREATED_BY', 'PREVIEW_PICTURE', 'PREVIEW_TEXT', '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;
}
if ($arElement) {
// check iblock properties
CSocNetLogTools::AddComment_Review_CheckIBlock($arElement);
$dbMessage = CForumMessage::GetList(array(), array('PARAM2' => $arElement['ID']));
if (!($arMessage = $dbMessage->Fetch())) {
// Add Topic and Root Message
$TOPIC_ID = CSocNetLogTools::AddComment_Review_CreateRoot($arElement, $FORUM_ID, false);
$bNewTopic = true;
} else {
$TOPIC_ID = $arMessage['TOPIC_ID'];
}
if (intval($TOPIC_ID) > 0) {
// Add comment
$messageID = false;
$arFieldsMessage = array('POST_MESSAGE' => $arFields['TEXT_MESSAGE'], 'USE_SMILES' => 'Y', 'PARAM2' => $arElement['ID'], 'APPROVED' => 'Y');
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("SONET_COMMENT", $arTmp);
if (is_array($arTmp)) {
if (array_key_exists("UF_SONET_COM_DOC", $arTmp)) {
$GLOBALS["UF_FORUM_MESSAGE_DOC"] = $arTmp["UF_SONET_COM_DOC"];
} elseif (array_key_exists("UF_SONET_COM_FILE", $arTmp)) {
$arFieldsMessage["FILES"] = array();
foreach ($arTmp["UF_SONET_COM_FILE"] as $file_id) {
$arFieldsMessage["FILES"][] = array("FILE_ID" => $file_id);
}
}
}
$messageID = ForumAddMessage('REPLY', $FORUM_ID, $TOPIC_ID, 0, $arFieldsMessage, $sError, $sNote);
if (!$messageID) {
$strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
} else {
$dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $messageID));
while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {
$ufFileID[] = $arAddedMessageFiles["FILE_ID"];
}
$ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $messageID, LANGUAGE_ID);
CSocNetLogTools::AddComment_Review_UpdateElement($arElement, $TOPIC_ID, $bNewTopic);
$userID = $GLOBALS["USER"]->GetID();
if (CModule::IncludeModule("im") && intval($arElement["CREATED_BY"]) > 0 && $arElement["CREATED_BY"] != $userID) {
$rsUnFollower = CSocNetLogFollow::GetList(array("USER_ID" => $arElement["CREATED_BY"], "CODE" => "L" . $arLog["ID"], "TYPE" => "N"), array("USER_ID"));
$arUnFollower = $rsUnFollower->Fetch();
if (!$arUnFollower) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arElement["CREATED_BY"], "FROM_USER_ID" => $userID, "LOG_ID" => $arLog["ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "wiki", "NOTIFY_EVENT" => "comment");
$arParams["TITLE"] = str_replace(array("\r\n", "\n"), " ", $arElement["NAME"]);
$arParams["TITLE"] = TruncateText($arParams["TITLE"], 100);
$arParams["TITLE_OUT"] = TruncateText($arParams["TITLE"], 255);
$arTmp = CSocNetLogTools::ProcessPath(array("ELEMENT_URL" => $arLog["URL"]), $arElement["CREATED_BY"]);
$serverName = $arTmp["SERVER_NAME"];
$url = $arTmp["URLS"]["ELEMENT_URL"];
$arMessageFields["NOTIFY_TAG"] = "WIKI|COMMENT|" . $arElement['ID'];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("WIKI_SONET_FROM_LOG_IM_COMMENT", array("#title#" => strlen($url) > 0 ? "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>" : htmlspecialcharsbx($arParams["TITLE"])));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("WIKI_SONET_FROM_LOG_IM_COMMENT", array("#title#" => htmlspecialcharsbx($arParams["TITLE"]))) . (strlen($url) > 0 ? " (" . $serverName . $url . ")" : "") . "#BR##BR#" . $arFields["TEXT_MESSAGE"];
CIMNotify::Add($arMessageFields);
}
}
}
} else {
$strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
}
} else {
$strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
}
} else {
$strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
//.........这里部分代码省略.........
示例8: GetMessageCount
function GetMessageCount($forumID, $topicID, $approved = null)
{
global $CACHE_MANAGER;
static $arCacheCount = array();
static $obCache = null;
static $cacheLabel = 'forum_msg_count';
static $notCached = 0;
static $TTL = 3600000;
if ($approved === true) {
$approved = "Y";
}
if ($approved === false) {
$approved = "N";
}
if ($approved === null) {
$approved = "A";
}
if ($approved !== "Y" && $approved !== "N" && $approved !== "A") {
return false;
}
if (isset($arCacheCount[$forumID][$topicID][$approved])) {
return $arCacheCount[$forumID][$topicID][$approved];
}
if ($obCache === null) {
$obCache = new CPHPCache();
}
$cacheID = md5($cacheLabel . $forumID);
$cachePath = str_replace(array(":", "//"), "/", "/" . SITE_ID . "/" . $cacheLabel . "/");
if ($obCache->InitCache($TTL, $cacheID, $cachePath)) {
$resCache = $obCache->GetVars();
if (is_array($resCache['messages'])) {
$arCacheCount[$forumID] = $resCache['messages'];
}
}
if (isset($arCacheCount[$forumID][$topicID][$approved])) {
return $arCacheCount[$forumID][$topicID][$approved];
} else {
$bCount = true;
if ($approved === "N" || $approved === "Y") {
$bCount = "cnt_not_approved";
}
if (intval($topicID) > 0 || $topicID === 0) {
$arFilter = array("TOPIC_ID" => $topicID);
} else {
$arRes = CForumTopic::GetByID($topicID);
if ($arRes) {
$arFilter = array("TOPIC_ID" => $arRes['ID']);
} else {
return false;
}
}
$count = CForumMessage::GetList(null, $arFilter, $bCount);
$result = 0;
if ($approved === "N") {
$result = intval($count['CNT_NOT_APPROVED']);
} elseif ($approved === "Y") {
$result = $count['CNT'] - $count['CNT_NOT_APPROVED'];
} else {
$result = intval($count);
}
$notCached++;
}
$arCacheCount[$forumID][$topicID][$approved] = $result;
if ($notCached > 2) {
$obCache->StartDataCache($TTL, $cacheID, $cachePath);
CForumCacheManager::SetTag($cachePath, $cacheLabel . $forumID);
$obCache->EndDataCache(array("messages" => $arCacheCount[$forumID]));
$notCached = 0;
}
return $result;
}
示例9: SetStat
function SetStat($ID = 0, $arParams = array())
{
global $DB;
$ID = intVal($ID);
if ($ID <= 0) {
return false;
}
$arParams = is_array($arParams) ? $arParams : array();
$arMessage = is_array($arParams["MESSAGE"]) ? $arParams["MESSAGE"] : array();
if ($arMessage["FORUM_ID"] != $ID) {
$arMessage = array();
}
$arForum = CForumNew::GetByID($ID);
$arParams["ACTION"] = $arParams["ACTION"] == "DECREMENT" || $arParams["ACTION"] == "UPDATE" ? $arParams["ACTION"] : "INCREMENT";
$arParams["POSTS"] = intVal($arParams["POSTS"] > 0 ? $arParams["POSTS"] : 1);
$arFields = array();
if (empty($arMessage)) {
// full recount
} elseif ($arParams["ACTION"] == "INCREMENT") {
if ($arMessage["ID"] > $arForum["ABS_LAST_MESSAGE_ID"]) {
$arFields["ABS_LAST_POSTER_ID"] = intVal($arMessage["AUTHOR_ID"]) > 0 ? $arMessage["AUTHOR_ID"] : false;
$arFields["ABS_LAST_POSTER_NAME"] = $arMessage["AUTHOR_NAME"];
$arFields["ABS_LAST_POST_DATE"] = $arMessage["POST_DATE"];
$arFields["ABS_LAST_MESSAGE_ID"] = $arMessage["ID"];
if ($arMessage["APPROVED"] == "Y") {
$arFields["LAST_POSTER_ID"] = $arFields["ABS_LAST_POSTER_ID"];
$arFields["LAST_POSTER_NAME"] = $arFields["ABS_LAST_POSTER_NAME"];
$arFields["LAST_POST_DATE"] = $arFields["ABS_LAST_POST_DATE"];
$arFields["LAST_MESSAGE_ID"] = $arFields["ABS_LAST_MESSAGE_ID"];
}
}
if ($arMessage["APPROVED"] == "Y") {
$arFields["=POSTS"] = "POSTS+1";
if ($arMessage["NEW_TOPIC"] == "Y") {
$arFields["=TOPICS"] = "TOPICS+1";
}
} else {
$arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED+1";
}
} elseif ($arMessage["ID"] > $arForum["ABS_LAST_MESSAGE_ID"]) {
// full recount
} elseif ($arParams["ACTION"] == "DECREMENT" && ($arMessage["ID"] == $arForum["ABS_LAST_MESSAGE_ID"] || $arMessage["ID"] == $arForum["LAST_MESSAGE_ID"])) {
// full recount
} elseif ($arParams["ACTION"] == "DECREMENT") {
if ($arMessage["APPROVED"] == "Y") {
$arFields["=POSTS"] = "POSTS-1";
if ($arMessage["NEW_TOPIC"] == "Y") {
$arFields["=TOPICS"] = "TOPICS-1";
}
} else {
$arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED-1";
}
} elseif ($arParams["ACTION"] == "UPDATE") {
if ($arMessage["APPROVED"] == "Y") {
if ($arMessage["ID"] > $arForum["LAST_MESSAGE_ID"]) {
$arFields["LAST_POSTER_ID"] = intVal($arMessage["AUTHOR_ID"]) > 0 ? $arMessage["AUTHOR_ID"] : false;
$arFields["LAST_POSTER_NAME"] = $arMessage["AUTHOR_NAME"];
$arFields["LAST_POST_DATE"] = $arMessage["POST_DATE"];
$arFields["LAST_MESSAGE_ID"] = $arMessage["ID"];
}
$arFields["=POSTS"] = "POSTS+1";
$arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED-1";
if ($arMessage["NEW_TOPIC"] == "Y") {
$arFields["=TOPICS"] = "TOPICS+1";
}
} elseif ($arMessage["ID"] != $arForum["LAST_MESSAGE_ID"]) {
$arFields["=POSTS"] = "POSTS-1";
$arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED+1";
if ($arMessage["NEW_TOPIC"] == "Y") {
$arFields["=TOPICS"] = "TOPICS-1";
}
}
}
if (empty($arFields)) {
$res = CForumMessage::GetList(array(), array("FORUM_ID" => $ID), "cnt_not_approved");
$res = is_array($res) ? $res : array();
$res["CNT"] = intVal($res["CNT"]) - intVal($res["CNT_NOT_APPROVED"]);
$res["CNT"] = $res["CNT"] > 0 ? $res["CNT"] : 0;
$arFields = array("TOPICS" => CForumTopic::GetList(array(), array("FORUM_ID" => $ID, "APPROVED" => "Y"), true), "POSTS" => $res["CNT"], "LAST_POSTER_ID" => false, "LAST_POSTER_NAME" => false, "LAST_POST_DATE" => false, "LAST_MESSAGE_ID" => intVal($res["LAST_MESSAGE_ID"]), "POSTS_UNAPPROVED" => intVal($res["CNT_NOT_APPROVED"]), "ABS_LAST_POSTER_ID" => false, "ABS_LAST_POSTER_NAME" => false, "ABS_LAST_POST_DATE" => false, "ABS_LAST_MESSAGE_ID" => intVal($res["ABS_LAST_MESSAGE_ID"]));
if ($arFields["ABS_LAST_MESSAGE_ID"] > 0) {
$res = CForumMessage::GetByID($arFields["ABS_LAST_MESSAGE_ID"], array("FILTER" => "N"));
$arFields["ABS_LAST_POSTER_ID"] = intVal($res["AUTHOR_ID"]) > 0 ? $res["AUTHOR_ID"] : false;
$arFields["ABS_LAST_POSTER_NAME"] = $res["AUTHOR_NAME"];
$arFields["ABS_LAST_POST_DATE"] = $res["POST_DATE"];
if (intVal($arFields["LAST_MESSAGE_ID"]) > 0) {
if ($arFields["LAST_MESSAGE_ID"] < $arFields["ABS_LAST_MESSAGE_ID"]) {
$res = CForumMessage::GetByID($arFields["LAST_MESSAGE_ID"], array("FILTER" => "N"));
}
$arFields["LAST_POSTER_ID"] = intVal($res["AUTHOR_ID"]) > 0 ? $res["AUTHOR_ID"] : false;
$arFields["LAST_POSTER_NAME"] = $res["AUTHOR_NAME"];
$arFields["LAST_POST_DATE"] = $res["POST_DATE"];
}
}
}
if (!CForumNew::CheckFields("UPDATE", $arFields)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_forum", $arFields);
if (!empty($arFields)) {
$res = array();
//.........这里部分代码省略.........
示例10: QueryFirstUnread
public static function QueryFirstUnread($arFilter)
{
$db_res = CForumMessage::GetList(array("ID" => "ASC"), $arFilter, false, 1);
return $db_res;
}
示例11: while
} while ($res = $db_res->Fetch());
switch ($ACTION) {
case "SET_TOP":
case "SET_ORDINARY":
case "TOP":
case "ORDINARY":
$ACTION = $ACTION == "SET_ORDINARY" ? "ORDINARY" : ($ACTION == "SET_TOP" ? "TOP" : $ACTION);
$sort = $ACTION == "TOP" ? "150" : "100";
$result = ForumTopOrdinaryTopic($arTopic, $ACTION, $strErrorMessage, $strOkMessage, array("PERMISSION" => $arParams["PERMISSION"]));
break;
case "DEL_TOPIC":
case "DELETE":
$arLogID = array();
foreach ($arTopic as $topic_id_tmp) {
// delete message log records
$dbForumMessage = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $topic_id_tmp));
while ($arForumMessage = $dbForumMessage->Fetch()) {
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "forum", "SOURCE_ID" => $arForumMessage["ID"]), false, false, array("ID", "PARAMS"));
while ($arRes = $dbRes->Fetch()) {
$arLogID[] = $arRes["ID"];
}
}
}
$result = ForumDeleteTopic($arTopic, $strErrorMessage, $strOkMessage, array("PERMISSION" => $arParams["PERMISSION"]));
if ($result) {
foreach ($arLogID as $log_id) {
CSocNetLog::Delete($log_id);
}
}
break;
case "STATE_Y":
示例12: OnBeforeMessageAddHandler
/**
* Checking forum comment for spam - part 1 - checking itself
* @param &array Comment fields to check
* @return null|boolean NULL when success or FALSE when spam detected
*/
function OnBeforeMessageAddHandler(&$arFields)
{
// works
global $APPLICATION, $USER;
$ct_status = COption::GetOptionString('cleantalk.antispam', 'status', '0');
$ct_comment_forum = COption::GetOptionString('cleantalk.antispam', 'form_comment_forum', '0');
if ($ct_status == 1 && $ct_comment_forum == 1) {
if ($USER->IsAdmin()) {
return;
}
// Skip authorized user with more than 5 approved messages
if ($USER->IsAuthorized()) {
$approved_messages = CForumMessage::GetList(array('ID' => 'ASC'), array('AUTHOR_ID' => $arFields['AUTHOR_ID'], 'APPROVED' => 'Y'), TRUE);
if (intval($approved_messages) > 5) {
return;
}
}
$aComment = array();
$aComment['type'] = 'comment';
$aComment['sender_email'] = isset($arFields['AUTHOR_EMAIL']) ? $arFields['AUTHOR_EMAIL'] : '';
$aComment['sender_nickname'] = isset($arFields['AUTHOR_NAME']) ? $arFields['AUTHOR_NAME'] : '';
$aComment['message_title'] = '';
$aComment['message_body'] = isset($arFields['POST_MESSAGE']) ? $arFields['POST_MESSAGE'] : '';
$aComment['example_title'] = '';
$aComment['example_body'] = '';
$aComment['example_comments'] = '';
if (COption::GetOptionString('cleantalk.antispam', 'form_send_example', '0') == 1) {
$arTopic = CForumTopic::GetByID($arFields['TOPIC_ID']);
if (is_array($arTopic)) {
$aComment['example_title'] = $arTopic['TITLE'];
// Messages contains both topic bodies and comment bodies
// First find topic body
$db_res = CForumMessage::GetList(array('ID' => 'ASC'), array('TOPIC_ID' => $arFields['TOPIC_ID'], 'NEW_TOPIC' => 'Y', 'APPROVED' => 'Y'), FALSE, 1);
$ar_res = $db_res->Fetch();
if ($ar_res) {
$aComment['example_body'] = $ar_res['POST_MESSAGE'];
}
// Second find last 10 approved comment bodies
$comments = array();
$db_res = CForumMessage::GetList(array('POST_DATE' => 'DESC'), array('TOPIC_ID' => $arFields['TOPIC_ID'], 'NEW_TOPIC' => 'N', 'APPROVED' => 'Y'), FALSE, 10);
while ($ar_res = $db_res->Fetch()) {
$aComment['example_comments'] .= $ar_res['POST_MESSAGE'] . "\n\n";
}
}
}
$aResult = self::CheckAllBefore($aComment, TRUE);
if (isset($aResult) && is_array($aResult)) {
if ($aResult['errno'] == 0) {
if ($aResult['allow'] == 1) {
// Not spammer - just return;
return;
} else {
if ($aResult['stop_queue'] == 1) {
// Spammer and stop_queue - return false and throw
if (preg_match('//u', $aResult['ct_result_comment'])) {
$err_str = preg_replace('/^[^\\*]*?\\*\\*\\*|\\*\\*\\*[^\\*]*?$/iu', '', $aResult['ct_result_comment']);
$err_str = preg_replace('/<[^<>]*>/iu', '', $err_str);
} else {
$err_str = preg_replace('/^[^\\*]*?\\*\\*\\*|\\*\\*\\*[^\\*]*?$/i', '', $aResult['ct_result_comment']);
$err_str = preg_replace('/<[^<>]*>/i', '', $err_str);
}
$APPLICATION->ThrowException($err_str);
return FALSE;
} else {
// Spammer and NOT stop_queue - to manual approvement
// It works!
$arFields['APPROVED'] = 'N';
return;
}
}
}
}
}
}
示例13: array
"~RSS_DEFAULT" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_RSS"], array("TYPE" => "rss2", "MODE" => "topic", "IID" => $arParams["TID"])),
"RSS_DEFAULT" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_RSS"], array("TYPE" => "rss2", "MODE" => "topic", "IID" => $arParams["TID"])));
$arResult["ERROR_MESSAGE"] = $strErrorMessage;
$arResult["OK_MESSAGE"] = $strOKMessage;
$arResult["PARSER"] = $parser;
$arResult["FILES"] = array();
$arResult["MESSAGE_FILES"] = array();
/************** Message List ***************************************/
$arAllow = forumTextParser::GetFeatures($arResult["FORUM"]);
// LAST MESSAGE
$arResult["TOPIC"]["iLAST_TOPIC_MESSAGE"] = 0;
if ($arResult["USER"]["RIGHTS"]["EDIT"] != "Y" && $USER->IsAuthorized() && COption::GetOptionString("forum", "USER_EDIT_OWN_POST", "N") != "Y"):
if ($arResult["FORUM"]["MODERATION"] == "Y"):
$db_res = CForumMessage::GetList(array("ID" => "DESC"), array("TOPIC_ID" => $arParams["TID"], "APPROVED" => "N",
">ID" => $arResult["TOPIC"]["LAST_MESSAGE_ID"]), false, 1);
if ($db_res && $res = $db_res->Fetch()):
$arResult["TOPIC"]["iLAST_TOPIC_MESSAGE"] = intVal($res["ID"]);
endif;
endif;
if ($arResult["TOPIC"]["iLAST_TOPIC_MESSAGE"] <= 0):
$arResult["TOPIC"]["iLAST_TOPIC_MESSAGE"] = $arResult["TOPIC"]["LAST_MESSAGE_ID"];
endif;
endif;
// NUMBER CURRENT PAGE
$iNumPage = ($arParams["MID"] > 0 ? CForumMessage::GetMessagePage($arParams["MID"], $arParams["MESSAGES_PER_PAGE"], $arUserGroups, $arParams["TID"]) : 0);
// Create filter and additional fields for message select
$arFilter = array("TOPIC_ID" => $arParams["TID"]);
if ($arResult["USER"]["RIGHTS"]["MODERATE"] != "Y") {$arFilter["APPROVED"] = "Y";}
if ($USER->IsAuthorized()) {$arFilter["POINTS_TO_AUTHOR_ID"] = $USER->GetID();}
/*******************************************************************/
示例14: GetDataFromRatingEntity
function GetDataFromRatingEntity($rating_entity_type_id, $rating_entity_id, $bCheckRights = true)
{
$rating_entity_type_id = preg_replace("/[^a-z0-9_-]/i", "", $rating_entity_type_id);
$rating_entity_id = intval($rating_entity_id);
if (strlen($rating_entity_type_id) <= 0) {
return false;
}
if ($rating_entity_id <= 0) {
return false;
}
switch ($rating_entity_type_id) {
case "BLOG_POST":
$log_type = "log";
$log_event_id = array("blog_post", "blog_post_important");
break;
case "BLOG_COMMENT":
$log_type = "comment";
$log_event_id = array("blog_comment", "photo_comment");
break;
case "FORUM_TOPIC":
$log_type = "log";
$log_event_id = array("forum");
if (CModule::IncludeModule("forum")) {
$dbForumMessage = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $rating_entity_id), false, 1);
if ($arForumMessage = $dbForumMessage->Fetch()) {
$rating_entity_id = $arForumMessage["ID"];
}
}
break;
case "FORUM_POST":
$log_type = "comment";
$log_event_id = array("forum", "photo_comment", "files_comment", "commondocs_comment", "tasks_comment", "wiki_comment", "news_comment", "lists_new_element_comment");
break;
case "IBLOCK_ELEMENT":
$log_type = "log";
$log_event_id = array("photo_photo", "files", "commondocs", "wiki");
break;
case "INTRANET_NEW_USER":
$log_type = "log";
$log_event_id = array("intranet_new_user");
break;
case "INTRANET_NEW_USER_COMMENT":
$log_type = "comment";
$log_event_id = array("intranet_new_user_comment");
break;
case "BITRIX24_NEW_USER":
$log_type = "log";
$log_event_id = array("bitrix24_new_user");
break;
case "BITRIX24_NEW_USER_COMMENT":
$log_type = "comment";
$log_event_id = array("bitrix24_new_user_comment");
break;
case "VOTING":
$log_type = "log";
$log_event_id = array("blog_post", "blog_post_important");
if (CModule::IncludeModule("blog")) {
$rsBlogPost = CBlogPost::GetList(array("ID" => "DESC"), array("UF_BLOG_POST_VOTE" => $rating_entity_id), false, array("nTopCount" => 1), array("ID"));
if ($arBlogPost = $rsBlogPost->Fetch()) {
$rating_entity_id = $arBlogPost["ID"];
}
}
break;
case "LISTS_NEW_ELEMENT":
$log_type = "log";
$log_event_id = array("lists_new_element");
break;
case "LOG_ENTRY":
$log_type = "log_entry";
break;
case "LOG_COMMENT":
$log_type = "log_comment";
break;
default:
}
if ($log_type == "log") {
$rsLogSrc = CSocNetLog::GetList(array(), array("EVENT_ID" => $log_event_id, "SOURCE_ID" => $rating_entity_id), false, false, array("ID"), array("CHECK_RIGHTS" => $bCheckRights ? "Y" : "N", "USE_SUBSCRIBE" => "N"));
if ($arLogSrc = $rsLogSrc->Fetch()) {
$log_id = $arLogSrc["ID"];
}
} elseif ($log_type == "log_entry") {
$rsLogSrc = CSocNetLog::GetList(array(), array("ID" => $rating_entity_id), false, false, array("ID"), array("CHECK_RIGHTS" => $bCheckRights ? "Y" : "N", "USE_SUBSCRIBE" => "N"));
if ($arLogSrc = $rsLogSrc->Fetch()) {
$log_id = $arLogSrc["ID"];
}
} elseif ($log_type == "comment") {
$rsLogCommentSrc = CSocNetLogComments::GetList(array(), array("EVENT_ID" => $log_event_id, "SOURCE_ID" => $rating_entity_id), false, false, array("ID", "LOG_ID"), array("CHECK_RIGHTS" => $bCheckRights ? "Y" : "N", "USE_SUBSCRIBE" => "N"));
if ($arLogCommentSrc = $rsLogCommentSrc->Fetch()) {
$log_id = $arLogCommentSrc["LOG_ID"];
$log_comment_id = $arLogCommentSrc["ID"];
}
} elseif ($log_type == "log_comment") {
$rsLogCommentSrc = CSocNetLogComments::GetList(array(), array("ID" => $rating_entity_id), false, false, array("ID", "LOG_ID"), array("CHECK_RIGHTS" => $bCheckRights ? "Y" : "N", "USE_SUBSCRIBE" => "N"));
if ($arLogCommentSrc = $rsLogCommentSrc->Fetch()) {
$log_id = $arLogCommentSrc["LOG_ID"];
$log_comment_id = $arLogCommentSrc["ID"];
}
}
if ($log_id > 0) {
$arResult = array("LOG_ID" => $log_id);
//.........这里部分代码省略.........
示例15: 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");
//.........这里部分代码省略.........