本文整理汇总了PHP中CForumTopic::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumTopic::GetByID方法的具体用法?PHP CForumTopic::GetByID怎么用?PHP CForumTopic::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumTopic
的用法示例。
在下文中一共展示了CForumTopic::GetByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkParams
protected static function checkParams($arMessage = array(), &$arTopic, &$arForum)
{
if (\Freetrix\Main\Loader::includeModule('forum')) {
$arTopic = !empty($arTopic) ? $arTopic : \CForumTopic::GetByID($arMessage["TOPIC_ID"]);
if (empty($arTopic)) {
return false;
}
$arSitemaps = SitemapForumTable::getSitemapsByEntityId($arTopic["FORUM_ID"]);
if (!empty($arSitemaps) && ($arForum = \CForumNew::GetByIDEx($arTopic["FORUM_ID"])) && $arForum) {
$arForum["PATH2FORUM_MESSAGE"] = \CForumNew::GetSites($arTopic["FORUM_ID"]);
$date = MakeTimeStamp($arTopic['LAST_POST_DATE']);
$result = array();
foreach ($arSitemaps as $arSitemap) {
$path = $arForum["PATH2FORUM_MESSAGE"][$arSitemap["SITE_ID"]];
if (!empty($path)) {
$arSitemap["fileName"] = str_replace("#FORUM_ID#", $arForum["ID"], $arSitemap['SITEMAP_FILE_FORUM']);
$arSitemap["url"] = \CForumNew::PreparePath2Message($path, array("FORUM_ID" => $arForum["ID"], "TOPIC_ID" => $arTopic["ID"], "TITLE_SEO" => $arTopic["TITLE_SEO"], "MESSAGE_ID" => "s", "SOCNET_GROUP_ID" => $arTopic["SOCNET_GROUP_ID"], "OWNER_ID" => $arTopic["OWNER_ID"], "PARAM1" => $arTopic["PARAM1"], "PARAM2" => $arTopic["PARAM2"]));
$arSitemap["date"] = $date;
$result[] = $arSitemap;
}
}
return empty($result) ? false : $result;
}
}
return false;
}
示例2: 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" => "")));
}
}
}
示例3: GetAdminListViewHTML
public static function GetAdminListViewHTML($arProperty, $value, $strHTMLControlName)
{
static $cache = array();
if (CModule::IncludeModule("forum")) {
$value["VALUE"] = intval($value["VALUE"]);
if ($value["VALUE"] <= 0) {
$value["VALUE"] = '';
$res = '';
} else {
if (!array_key_exists($value["VALUE"], $cache)) {
$cache[$value["VALUE"]] = CForumTopic::GetByID($value["VALUE"]);
}
$arTopic = $cache[$value["VALUE"]];
$res = !empty($arTopic) ? "[" . $value["VALUE"] . "] (" . htmlspecialcharsEx($arTopic["TITLE"]) . ")" : $value["VALUE"];
}
return $res;
}
return '';
}
示例4: CanUserAddMessage
/**
* <p>Всесторонне проверяет, может ли пользователь с кодом <i>iUserID</i>, входящий в группы <i>arUserGroups</i>, добавить новое сообщение в тему <i>TID</i>.</p>
*
*
*
*
* @param int $TID Код темы, в которую пользователь хочет добавить сообщение.
*
*
*
* @param array $arUserGroups Массив групп, в которые входит пользователь. Для текущего
* пользователя он возвращается методом $USER->GetUserGroupArray()
*
*
*
* @param int $iUserID Код пользователя. Для текущего пользователя он возвращается
* методом $USER->GetID()
*
*
*
* @return bool
*
*
* <h4>Example</h4>
* <pre>
* <?
* if (CForumMessage::CanUserAddMessage($TID, $USER->GetUserGroupArray(), $USER->GetID()))
* {
* echo "You can add message!";
* }
* ?>
* </pre>
*
*
*
* <h4>See Also</h4>
* <ul> <li> <a
* href="http://dev.1c-bitrix.ru/api_help/forum/developer/cforummessage/canuserupdatemessage.php">CForumMessage::CanUserUpdateMessage</a>
* </li> <li> <a
* href="http://dev.1c-bitrix.ru/api_help/forum/developer/cforummessage/canuserdeletemessage.php">CForumMessage::CanUserDeleteMessage</a>
* </li> </ul><a name="examples"></a>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/forum/developer/cforummessage/canuseraddmessage.php
* @author Bitrix
*/
public static function CanUserAddMessage($TID, $arUserGroups, $iUserID = 0, $ExternalPermission = false)
{
$TID = intVal($TID);
$arTopic = CForumTopic::GetByID($TID);
if ($arTopic)
{
if (!CForumUser::IsLocked($iUserID)):
$strPerms = ($ExternalPermission == false ? CForumNew::GetUserPermission($arTopic["FORUM_ID"], $arUserGroups) : $ExternalPermission);
else:
$strPerms = CForumNew::GetPermissionUserDefault($arTopic["FORUM_ID"], $arUserGroups);
endif;
if ($strPerms >= "Y")
return true;
elseif ($strPerms < "I")
return false;
$arForum = CForumNew::GetByID($arTopic["FORUM_ID"]);
if ($arForum["ACTIVE"] != "Y")
return False;
return ($strPerms < "U" && ($arTopic["STATE"] != "Y") ? false : true);
}
return False;
}
示例5: CanUserAddMessage
function CanUserAddMessage($TID, $arUserGroups, $iUserID = 0, $ExternalPermission = false)
{
$TID = intVal($TID);
$arTopic = $TID > 0 ? CForumTopic::GetByID($TID) : false;
if ($arTopic) {
if (!CForumUser::IsLocked($iUserID)) {
$strPerms = $ExternalPermission == false ? CForumNew::GetUserPermission($arTopic["FORUM_ID"], $arUserGroups) : $ExternalPermission;
} else {
$strPerms = CForumNew::GetPermissionUserDefault($arTopic["FORUM_ID"], $arUserGroups);
}
if ($strPerms >= "Y") {
return true;
} elseif ($strPerms < "I") {
return false;
}
$arForum = CForumNew::GetByID($arTopic["FORUM_ID"]);
if ($arForum["ACTIVE"] != "Y") {
return False;
}
return $strPerms < "U" && $arTopic["STATE"] != "Y" ? false : true;
}
return False;
}
示例6: GetEventInfo
public static function GetEventInfo($row, $arParams)
{
if (CModule::IncludeModule('forum'))
{
$DESCRIPTION = unserialize($row['DESCRIPTION']);
$site_id = ($row['SITE_ID'] == "s1") ? "" : "site_".$row['SITE_ID']."/";
// messages
if (strpos($row['AUDIT_TYPE_ID'], "MESSAGE"))
{
$MID = $row['ITEM_ID'];
$TID = $DESCRIPTION['TOPIC_ID'];
$FID = $DESCRIPTION['FORUM_ID'];
if ($arMessage = CForumMessage::GetByID($MID))
$sPath = SITE_DIR.CComponentEngine::MakePathFromTemplate($arParams['FORUM_MESSAGE_PATH'], array("FORUM_ID" => $FID, "TOPIC_ID" => $TID, "MESSAGE_ID" => $MID, "SITE_ID" => $site_id));
else
if ($arTopic = CForumTopic::GetByID($TID))
$sPath = SITE_DIR.CComponentEngine::MakePathFromTemplate($arParams['FORUM_TOPIC_PATH'], array("FORUM_ID" => $FID, "TOPIC_ID" => $TID, "SITE_ID" => $site_id));
switch($row['AUDIT_TYPE_ID'])
{
case "FORUM_MESSAGE_APPROVE":
$EventPrint = GetMessage("LOG_FORUM_MESSAGE_APPROVE");
break;
case "FORUM_MESSAGE_UNAPPROVE":
$EventPrint = GetMessage("LOG_FORUM_MESSAGE_UNAPPROVE");
break;
case "FORUM_MESSAGE_MOVE":
$EventPrint = GetMessage("LOG_FORUM_MESSAGE_MOVE");
break;
case "FORUM_MESSAGE_EDIT":
$EventPrint = GetMessage("LOG_FORUM_MESSAGE_EDIT");
break;
case "FORUM_MESSAGE_DELETE":
$EventPrint = GetMessage("LOG_FORUM_MESSAGE_DELETE");
break;
}
}
else
// topics
{
$TID = $row["ITEM_ID"];
$FID = $DESCRIPTION['FORUM_ID'];
if ($arTopic = CForumTopic::GetByID($TID))
$sPath = SITE_DIR.CComponentEngine::MakePathFromTemplate($arParams['FORUM_TOPIC_PATH'], array("FORUM_ID" => $FID, "TOPIC_ID" => $TID, "SITE_ID" => $site_id));
switch($row['AUDIT_TYPE_ID'])
{
case "FORUM_TOPIC_APPROVE":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_APPROVE");
break;
case "FORUM_TOPIC_UNAPPROVE":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_UNAPPROVE");
break;
case "FORUM_TOPIC_STICK":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_STICK");
break;
case "FORUM_TOPIC_UNSTICK":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_UNSTICK");
break;
case "FORUM_TOPIC_OPEN":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_OPEN");
break;
case "FORUM_TOPIC_CLOSE":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_CLOSE");
break;
case "FORUM_TOPIC_DELETE":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_DELETE");
break;
case "FORUM_TOPIC_MOVE":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_MOVE", array("#FORUM#" => $DESCRIPTION["FORUM_TITLE"]));
break;
case "FORUM_TOPIC_EDIT":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_EDIT");
break;
}
}
if($arForum = CForumNew::GetByID($FID))
{
$ForumPageURL = SITE_DIR.CComponentEngine::MakePathFromTemplate($arParams['FORUM_PATH'], array("FORUM_ID" => $FID, "SITE_ID" => $site_id));
$resForum = "<a href =".$ForumPageURL.">".$arForum["NAME"]."</a>";
}
else
{
$resForum = GetMessage("LOG_FORUM");
}
}
return array(
"eventType" => $EventPrint,
"eventName" => $DESCRIPTION['TITLE'],
"eventURL" => $sPath,
"pageURL" => $resForum
);
}
示例7: urldecode
return;
}
$arParams['ELEMENT_NAME'] = urldecode($arParams['ELEMENT_NAME']);
$arFilter = array('IBLOCK_ID' => $arParams['IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N');
if (!CWikiSocnet::isEnabledSocnet() || empty($arParams['SOCNET_GROUP_ID'])) {
$arFilter['IBLOCK_LID'] = SITE_ID;
$arFilter['IBLOCK_TYPE'] = $arParams['IBLOCK_TYPE'];
}
if (empty($arParams['ELEMENT_NAME'])) {
$arParams['ELEMENT_NAME'] = CWiki::GetDefaultPage($arParams['IBLOCK_ID']);
}
$arResult['ELEMENT'] = CWiki::GetElementByName($arParams['ELEMENT_NAME'], $arFilter);
if (!empty($arParams['ELEMENT_NAME']) && $arResult['ELEMENT'] != false) {
$arParams['ELEMENT_ID'] = $arResult['ELEMENT']['ID'];
if (CWikiSocnet::isEnabledSocnet() && !empty($arParams['SOCNET_GROUP_ID']) && array_key_exists('FORUM_TOPIC_ID', $arResult['ELEMENT']) && intval($arResult['ELEMENT']['FORUM_TOPIC_ID']) > 0 && CModule::IncludeModule("forum")) {
$arForumTopic = CForumTopic::GetByID($arResult['ELEMENT']['FORUM_TOPIC_ID']);
if ($arForumTopic) {
$arParams['FORUM_ID'] = $arForumTopic['FORUM_ID'];
}
}
} else {
return;
}
//$arResult['TOPLINKS'] = CWikiUtils::getRightsLinks('discussion', $arParams);
$arResult['CACHE_TYPE'] = $arParams['CACHE_TYPE'];
$arResult['CACHE_TIME'] = $arParams['CACHE_TIME'];
$arResult['MESSAGES_PER_PAGE'] = $arParams['MESSAGES_PER_PAGE'];
$arResult['USE_CAPTCHA'] = $arParams['USE_CAPTCHA'];
$arResult['PATH_TO_SMILE'] = $arParams['PATH_TO_SMILE'];
$arResult['URL_TEMPLATES_READ'] = $arParams['URL_TEMPLATES_READ'];
$arResult['SHOW_LINK_TO_FORUM'] = $arParams['SHOW_LINK_TO_FORUM'] == 'Y' ? 'Y' : 'N';
示例8: elseif
if (isset($task["DocumentState"]["STATE_NAME"]) && array_key_exists($task["DocumentState"]["STATE_NAME"], $arStatusMappings)) {
$newTask["STATUS"] = $arStatusMappings[$task["DocumentState"]["STATE_NAME"]];
} elseif ($newTask["STATUS"] == 1 && $newTask["RESPONSIBLE_ID"] == $newTask["CREATED_BY"]) {
$newTask["STATUS"] = 2;
} elseif ($newTask["STATUS"] == 4 && $newTask["RESPONSIBLE_ID"] == $newTask["CREATED_BY"]) {
$newTask["STATUS"] = 5;
}
if (is_array($task["PROPERTY_TaskFiles"]) && sizeof($task["PROPERTY_TaskFiles"]) > 0) {
$newTask["FILES"] = $task["PROPERTY_TaskFiles"];
}
if (is_array($task["PROPERTY_TaskTrackers"]) && sizeof($task["PROPERTY_TaskTrackers"]) > 0) {
$newTask["AUDITORS"] = $task["PROPERTY_TaskTrackers"];
}
if (intval($task["PROPERTY_FORUM_TOPIC_ID"]) > 0) {
if (CModule::IncludeModule("forum")) {
$arTopic = CForumTopic::GetByID(intval($task["PROPERTY_FORUM_TOPIC_ID"]));
if ($arTopic) {
$newTask["FORUM_TOPIC_ID"] = intval($task["PROPERTY_FORUM_TOPIC_ID"]);
}
}
}
if ($task["TaskType"] == "group") {
$newTask["GROUP_ID"] = $task["OwnerId"];
}
$rsTaskSections = CIBlockElement::GetElementGroups($task["ID"]);
$arSections = array();
while ($section = $rsTaskSections->Fetch()) {
if ($task["TaskType"] == "group" && $section["ID"] != $task["ROOT_SECTION_ID"] || $task["TaskType"] != "group" && $section["XML_ID"] != "users_tasks") {
$arSections[] = $section["NAME"];
}
}
示例9: 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);
}
}
}
}
}
示例10: unset
if (intVal($arFields["SORT"]) == 100) {
CForumEventLog::Log("topic", "stick", $res["ID"], $res);
} else {
CForumEventLog::Log("topic", "unstick", $res["ID"], $res);
}
unset($arFields["SORT"]);
}
if (!empty($arFields)) {
foreach ($arFields as $key => $val) {
if ($arFields[$key] != $arTopic[$key]) {
$res_log[$key] = $arFields[$key];
$res_log["before" . $key] = $arTopic[$key];
}
}
if (!empty($res_log)) {
$arTopic = CForumTopic::GetByID($TID);
$res_log['FORUM_ID'] = $arTopic['FORUM_ID'];
CForumEventLog::Log("topic", "edit", $TID, serialize($res_log));
}
}
}
}
}
/*******************************************************************/
if ($arID = $lAdmin->GroupAction()) {
$sError = "";
$sOk = "";
if (!check_bitrix_sessid()) {
} elseif ($_REQUEST['action'] == "move" && intVal($_REQUEST['move_to']) <= 0) {
$lAdmin->AddFilterError(GetMessage("FM_WRONG_FORUM_ID"));
} else {
示例11: array_intersect
$arParams["SHOW_VOTE"] = "N";
}
$res = array_intersect($USER->GetUserGroupArray(), $arParams["VOTE_GROUP_ID"]);
$arParams["SHOW_VOTE"] = empty($res) ? "N" : $arParams["SHOW_VOTE"];
}
/********************************************************************
Data
********************************************************************/
if ($arParams["MESSAGE_TYPE"] == "EDIT") {
$arMessage = CForumMessage::GetByIDEx($arParams["MID"], array("GET_FORUM_INFO" => "N", "GET_TOPIC_INFO" => "Y", "FILTER" => "N"));
if (empty($arMessage)) {
ShowError(GetMessage("F_ERROR_MESSAGE_NOT_FOUND"));
return 0;
}
$arResult["TOPIC"] = $arMessage["TOPIC_INFO"];
$arResult["TOPIC_FILTER"] = CForumTopic::GetByID($arMessage["TOPIC_ID"]);
$arResult["MESSAGE"] = $arMessage;
$arResult["MESSAGE"]["FILES"] = array();
$db_res = CForumFiles::GetList(array(), array("MESSAGE_ID" => $arParams["MID"]));
if ($db_res && ($res = $db_res->Fetch())) {
do {
$arResult["MESSAGE"]["FILES"][$res["FILE_ID"]] = $res;
} while ($res = $db_res->Fetch());
}
if ($arParams["SHOW_VOTE"] == "Y" && $arMessage["PARAM1"] == "VT" && intVal($arMessage["PARAM2"]) > 0) {
$db_vote = CVote::GetByID(intVal($arMessage["PARAM2"]));
if ($db_vote && ($arVote = $db_vote->GetNext())) {
$arResult['DATE_END'] = $arVote['DATE_END'];
}
$db_res = CVoteQuestion::GetListEx(array("ID" => "ASC"), array("CHANNEL_ID" => $arParams["VOTE_CHANNEL_ID"], "VOTE_ID" => $arMessage["PARAM2"]));
if ($db_res && ($res = $db_res->Fetch())) {
示例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: OnGetRatingContentOwner
function OnGetRatingContentOwner($arParams)
{
if ($arParams['ENTITY_TYPE_ID'] == 'FORUM_TOPIC') {
$arTopic = CForumTopic::GetByID(IntVal($arParams['ENTITY_ID']));
return $arTopic['USER_START_ID'];
} elseif ($arParams['ENTITY_TYPE_ID'] == 'FORUM_POST') {
$arMessage = CForumMessage::GetByID(IntVal($arParams['ENTITY_ID']));
return $arMessage['AUTHOR_ID'];
}
return false;
}
示例14: unset
$rsUser = CUser::GetByID($arParams['USER_ID']);
if (!(is_object($rsUser) && ($arUser = $rsUser->GetNext()))) {
return false;
}
$arResult['USER'] = $arUser;
unset($rsUser, $arUser);
$rsTask = CTasks::GetByID($arParams['TASK_ID']);
if (!(is_object($rsTask) && ($arTask = $rsTask->Fetch()))) {
if ($arParams['SHOW_TEMPLATE'] === 'Y' && $arParams['RENDER_FORMAT'] === 'HTML') {
ShowError(str_replace('#TASK_ID#', (int) $arParams['TASK_ID'], GetMessage('MB_TASKS_TASK_DETAIL_TASK_NOT_ACCESSIBLE')));
}
return false;
}
$arResult['FORUM_ID'] = false;
if ($arTask['FORUM_TOPIC_ID']) {
$arTopic = CForumTopic::GetByID($arTask['FORUM_TOPIC_ID']);
if ($arTopic) {
$arResult['FORUM_ID'] = (int) $arTopic['FORUM_ID'];
}
unset($arTopic);
}
if ($arResult['FORUM_ID'] === false) {
try {
$arResult['FORUM_ID'] = CTasksTools::GetForumIdForIntranet();
} catch (Exception $e) {
// nothing to do here
}
}
if ($arResult['FORUM_ID'] > 0) {
__checkForum($arResult['FORUM_ID']);
}
示例15: AddComment_Review_CheckIBlock_Forum
function AddComment_Review_CheckIBlock_Forum($arElement)
{
if (!CModule::IncludeModule("iblock")) {
return false;
}
if (!CModule::IncludeModule("forum")) {
return false;
}
$needProperty = array();
$ELEMENT_IBLOCK_ID = intVal($arElement["IBLOCK_ID"]);
$ELEMENT_NAME = Trim($arElement["~NAME"]);
$ELEMENT_FORUM_TOPIC_ID = intVal($arElement["PROPERTY_FORUM_TOPIC_ID_VALUE"]);
$ELEMENT_FORUM_MESSAGE_CNT = intVal($arElement["PROPERTY_FORUM_MESSAGE_CNT_VALUE"]);
if ($ELEMENT_FORUM_TOPIC_ID <= 0) {
$db_res = CIBlockElement::GetProperty($ELEMENT_IBLOCK_ID, $arElement["ID"], false, false, array("CODE" => "FORUM_TOPIC_ID"));
if (!($db_res && ($res = $db_res->Fetch()))) {
$needProperty[] = "FORUM_TOPIC_ID";
}
}
if ($ELEMENT_FORUM_MESSAGE_CNT <= 0) {
$db_res = CIBlockElement::GetProperty($ELEMENT_IBLOCK_ID, $arElement["ID"], false, false, array("CODE" => "FORUM_MESSAGE_CNT"));
if (!($db_res && ($res = $db_res->Fetch()))) {
$needProperty[] = "FORUM_MESSAGE_CNT";
}
}
if (!empty($needProperty)) {
$obProperty = new CIBlockProperty();
$res = true;
foreach ($needProperty as $nameProperty) {
$sName = trim($nameProperty == "FORUM_TOPIC_ID" ? GetMessage("F_FORUM_TOPIC_ID") : GetMessage("F_FORUM_MESSAGE_CNT"));
$sName = empty($sName) ? $nameProperty : $sName;
$res = $obProperty->Add(array("IBLOCK_ID" => $ELEMENT_IBLOCK_ID, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => $sName, "CODE" => $nameProperty));
}
}
// Set NULL for topic_id if it was deleted
if ($ELEMENT_FORUM_TOPIC_ID > 0) {
$arTopic = CForumTopic::GetByID($ELEMENT_FORUM_TOPIC_ID);
if (!$arTopic || !is_array($arTopic) || count($arTopic) <= 0) {
CIBlockElement::SetPropertyValues($arElement["ID"], $ELEMENT_IBLOCK_ID, 0, "FORUM_TOPIC_ID");
$ELEMENT_FORUM_TOPIC_ID = 0;
}
}
return true;
}