本文整理汇总了PHP中CForumNew::CanUserModerateForum方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumNew::CanUserModerateForum方法的具体用法?PHP CForumNew::CanUserModerateForum怎么用?PHP CForumNew::CanUserModerateForum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumNew
的用法示例。
在下文中一共展示了CForumNew::CanUserModerateForum方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowError
ShowError($res);
return false;
}
/********************************************************************
/Main Data & Permissions
********************************************************************/
/********************************************************************
Default params # 2
********************************************************************/
$arResult["MESSAGE_FIRST"] = array();
$arResult["MESSAGE_LIST"] = array();
$arResult["MESSAGE_VIEW"] = array();
$arResult["VIEW"] = "N";
$bVarsFromForm = false;
/************** Current User ***************************************/
$arResult["USER"] = array("INFO" => array(), "PERMISSION" => $arParams["PERMISSION"], "RIGHTS" => array("ADD_TOPIC" => CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID(), $arResult["FORUM"], $arParams["PERMISSION"]) ? "Y" : "N", "MODERATE" => CForumNew::CanUserModerateForum($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID(), $arParams["PERMISSION"]) == true ? "Y" : "N", "EDIT" => CForumNew::CanUserEditForum($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID(), $arParams["PERMISSION"]) ? "Y" : "N", "ADD_MESSAGE" => CForumMessage::CanUserAddMessage($arParams["TID"], $USER->GetUserGroupArray(), $USER->GetID(), $arParams["PERMISSION"]) ? "Y" : "N"), "SUBSCRIBE" => array(), "SHOW_NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
// to avoid forum module permissions extension for admin
if ($arParams["PERMISSION"] <= "E") {
$arResult["USER"]["RIGHTS"] = array("ADD_TOPIC" => "N", "MODERATE" => "N", "EDIT" => "N", "ADD_MESSAGE" => "N");
}
if ($USER->IsAuthorized()) {
$arResult["USER"]["INFO"] = CForumUser::GetByUSER_ID($USER->GetParam("USER_ID"));
$arResult["USER"]["SHOW_NAME"] = $_SESSION["FORUM"]["SHOW_NAME"];
$arResult["USER"]["RANK"] = CForumUser::GetUserRank($USER->GetParam("USER_ID"));
$db_res = CForumSubscribe::GetList(array(), array("USER_ID" => $USER->GetID(), "FORUM_ID" => $arParams["FID"], "TOPIC_ID" => $arParams["TID"], "SITE_ID" => SITE_ID));
if ($db_res && ($res = $db_res->Fetch())) {
$arResult["USER"]["SUBSCRIBE"][$res["ID"]] = $res;
}
}
/*******************************************************************/
$arResult["PANELS"] = array("MODERATE" => $arResult["USER"]["RIGHTS"]["MODERATE"], "DELETE" => $arResult["USER"]["RIGHTS"]["EDIT"], "SUPPORT" => IsModuleInstalled("support") && $APPLICATION->GetGroupRight("forum") >= "W" ? "Y" : "N", "EDIT" => $arResult["USER"]["RIGHTS"]["EDIT"], "STATISTIC" => IsModuleInstalled("statistic") && $APPLICATION->GetGroupRight("statistic") > "D" ? "Y" : "N", "MAIN" => $APPLICATION->GetGroupRight("main") > "D" ? "Y" : "N", "MAIL" => $APPLICATION->GetGroupRight("mail") > "R" ? "Y" : "N");
示例2: ShowError
/Main Params
********************************************************************/
if (empty($arResult["FORUM"])) {
ShowError(str_replace("#FORUM_ID#", $arParams["FORUM_ID"], GetMessage("F_ERR_FID_IS_NOT_EXIST")));
return false;
} elseif (empty($arResult["ELEMENT"])) {
ShowError(str_replace("#ELEMENT_ID#", $arParams["ELEMENT_ID"], GetMessage("F_ERR_EID_IS_NOT_EXIST")));
return false;
} elseif ($arResult["USER"]["PERMISSION"] <= "A") {
return false;
}
/********************************************************************
Default values
********************************************************************/
$arResult["FORUM_TOPIC_ID"] = intval($arResult["ELEMENT"]["PROPERTY_FORUM_TOPIC_ID_VALUE"]);
$arResult["USER"]["RIGHTS"] = array("ADD_TOPIC" => CForumTopic::CanUserAddTopic($arParams["FORUM_ID"], $arResult["USER"]["GROUPS"], $arResult["USER"]["ID"], $arResult["FORUM"]) ? "Y" : "N", "MODERATE" => CForumNew::CanUserModerateForum($arParams["FORUM_ID"], $arResult["USER"]["GROUPS"], $arResult["USER"]["ID"]) == true ? "Y" : "N", "EDIT" => CForumNew::CanUserEditForum($arParams["FORUM_ID"], $arResult["USER"]["GROUPS"], $arResult["USER"]["ID"]) ? "Y" : "N", "ADD_MESSAGE" => CForumMessage::CanUserAddMessage($arResult["FORUM_TOPIC_ID"], $arResult["USER"]["GROUPS"], $arResult["USER"]["ID"]) ? "Y" : "N");
if ($USER->IsAuthorized()) {
$arResult["USER"]["SHOWED_NAME"] = $USER->GetLogin();
if ($_SESSION["FORUM"]["SHOW_NAME"] == "Y") {
$arResult["USER"]["SHOWED_NAME"] = CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $USER->GetFirstName(), "LAST_NAME" => $USER->GetLastName(), "SECOND_NAME" => $USER->GetSecondName(), "LOGIN" => $USER->GetLogin()), true, false);
}
}
$arResult["PANELS"] = array("MODERATE" => $arResult["USER"]["RIGHTS"]["MODERATE"], "DELETE" => $arResult["USER"]["RIGHTS"]["EDIT"]);
$arResult["SHOW_PANEL"] = in_array("Y", $arResult["PANELS"]) ? "Y" : "N";
// PARSER
$parser = new forumTextParser(LANGUAGE_ID);
$parser->image_params["width"] = $arParams["IMAGE_SIZE"];
$parser->image_params["height"] = $arParams["IMAGE_SIZE"];
$arResult["PARSER"] = $parser;
// FORUM
$arAllow = forumTextParser::GetFeatures($arResult["FORUM"]);
示例3: elseif
return false;
elseif (empty($arResult["ELEMENT"])):
ShowError(str_replace("#ELEMENT_ID#", $arParams["ELEMENT_ID"], GetMessage("F_ERR_EID_IS_NOT_EXIST")));
return false;
elseif ($arResult["USER"]["PERMISSION"] <= "A"):
return false;
endif;
/********************************************************************
Default values
********************************************************************/
$arResult["FORUM_TOPIC_ID"] = intval($arResult["ELEMENT"]["PROPERTY_FORUM_TOPIC_ID_VALUE"]);
$arResult["USER"]["RIGHTS"] = array(
"ADD_TOPIC" => CForumTopic::CanUserAddTopic($arParams["FORUM_ID"], $arResult["USER"]["GROUPS"], $arResult["USER"]["ID"], $arResult["FORUM"] ) ? "Y" : "N",
"MODERATE" => CForumNew::CanUserModerateForum($arParams["FORUM_ID"], $arResult["USER"]["GROUPS"], $arResult["USER"]["ID"]) == true ? "Y" : "N",
"EDIT" => CForumNew::CanUserEditForum($arParams["FORUM_ID"], $arResult["USER"]["GROUPS"], $arResult["USER"]["ID"]) ? "Y" : "N",
"ADD_MESSAGE" => CForumMessage::CanUserAddMessage($arResult["FORUM_TOPIC_ID"], $arResult["USER"]["GROUPS"], $arResult["USER"]["ID"]) ? "Y" : "N");
if ($USER->IsAuthorized())
{
$arResult["USER"]["SHOWED_NAME"] = $USER->GetLogin();
if ($_SESSION["FORUM"]["SHOW_NAME"] == "Y")
{
$arResult["USER"]["SHOWED_NAME"] = CUser::FormatName(
$arParams["NAME_TEMPLATE"],
array(
"NAME" => $USER->GetFirstName(),
"LAST_NAME" => $USER->GetLastName(),
"SECOND_NAME" => $USER->GetSecondName(),
"LOGIN" => $USER->GetLogin()),
示例4: __deprecated_Add
//.........这里部分代码省略.........
while ($arMember = $rsMembers->Fetch()) {
if ($arMember["TYPE"] == "A") {
$arTask["ACCOMPLICES"][] = $arMember["USER_ID"];
} elseif ($arMember["TYPE"] == "U") {
$arTask["AUDITORS"][] = $arMember["USER_ID"];
}
}
$arEmailUserIDs = array($arTask["RESPONSIBLE_ID"], $arTask["CREATED_BY"]);
$arEmailUserIDs = array_unique(array_merge($arEmailUserIDs, $arTask["ACCOMPLICES"], $arTask["AUDITORS"]));
$currentUserPos = array_search($givenUserId, $arEmailUserIDs);
if ($currentUserPos !== false) {
unset($arEmailUserIDs[$currentUserPos]);
}
$parser = new CTextParser();
$parser->imageWidth = $imageWidth;
$parser->imageHeight = $imageHeight;
$parser->smiles = $arSmiles;
$parser->allow = array("HTML" => $arForum["ALLOW_HTML"], "ANCHOR" => $arForum["ALLOW_ANCHOR"], "BIU" => $arForum["ALLOW_BIU"], "IMG" => "N", "VIDEO" => "N", "LIST" => $arForum["ALLOW_LIST"], "QUOTE" => $arForum["ALLOW_QUOTE"], "CODE" => $arForum["ALLOW_CODE"], "FONT" => $arForum["ALLOW_FONT"], "SMILES" => "N", "UPLOAD" => $arForum["ALLOW_UPLOAD"], "NL2BR" => $arForum["ALLOW_NL2BR"], "TABLE" => "Y");
$arAllow = NULL;
$MESSAGE = HTMLToTxt($parser->convertText($commentText, $arAllow));
// remove [ url] for socialnetwork log
$MESSAGE = preg_replace("/(\\s\\[\\s(http:\\/\\/|https:\\/\\/|ftp:\\/\\/))(.*?)(\\s\\])/is", "", $MESSAGE);
$parser->allow = array("HTML" => 'Y', "ANCHOR" => 'Y', "BIU" => 'Y', "IMG" => "Y", "VIDEO" => "Y", "LIST" => 'N', "QUOTE" => 'Y', "CODE" => 'Y', "FONT" => 'Y', "SMILES" => "N", "UPLOAD" => 'N', "NL2BR" => 'N', "TABLE" => "Y");
$message_notify = $parser->convertText($commentText);
$arRecipientsIDs = CTaskNotifications::GetRecipientsIDs($arTask);
// Instant Messages
if (IsModuleInstalled("im") && CModule::IncludeModule("im") && sizeof($arRecipientsIDs)) {
// this entire class is deprecated. disable edit message, add only here
if ($MESSAGE_TYPE != 'EDIT') {
CTaskComments::sendAddMessage(array('ID' => $MID, 'POST_MESSAGE' => $message_notify), $arTask, $givenUserId, $arRecipientsIDs, array());
}
}
$strURL = !empty($backPage) ? $backPage : $GLOBALS['APPLICATION']->GetCurPageParam("", array("IFRAME", "MID", "SEF_APPLICATION_CUR_PAGE_URL", BX_AJAX_PARAM_ID, "result"));
$strURL = ForumAddPageParams($strURL, array("MID" => $MID, "result" => $arForum["MODERATION"] != "Y" || CForumNew::CanUserModerateForum($forumId, $arUserGroupArray) ? "reply" : "not_approved"), false, false);
$outStrUrl = $strURL;
// sonet log
if (CModule::IncludeModule("socialnetwork")) {
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "tasks", "SOURCE_ID" => $arTask["ID"]), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID", "TMP_ID"));
if ($arRes = $dbRes->Fetch()) {
$log_id = $arRes["TMP_ID"];
$entity_type = $arRes["ENTITY_TYPE"];
$entity_id = $arRes["ENTITY_ID"];
} else {
$entity_type = $arTask["GROUP_ID"] ? SONET_ENTITY_GROUP : SONET_ENTITY_USER;
$entity_id = $arTask["GROUP_ID"] ? $arTask["GROUP_ID"] : $arTask["CREATED_BY"];
$rsUser = CUser::GetByID($arTask["CREATED_BY"]);
if ($arUser = $rsUser->Fetch()) {
$arSoFields = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "tasks", "LOG_DATE" => $arTask["CREATED_DATE"], "TITLE_TEMPLATE" => "#TITLE#", "TITLE" => htmlspecialcharsBack($arTask["~TITLE"]), "MESSAGE" => "", "TEXT_MESSAGE" => $strMsgNewTask, "MODULE_ID" => "tasks", "CALLBACK_FUNC" => false, "SOURCE_ID" => $arTask["ID"], "ENABLE_COMMENTS" => "Y", "USER_ID" => $arTask["CREATED_BY"], "URL" => CTaskNotifications::GetNotificationPath($arUser, $arTask["ID"]), "PARAMS" => serialize(array("TYPE" => "create")));
$log_id = CSocNetLog::Add($arSoFields, false);
if (intval($log_id) > 0) {
CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
$arRights = CTaskNotifications::__UserIDs2Rights(CTaskNotifications::GetRecipientsIDs($arTask, false));
if ($arTask["GROUP_ID"]) {
$arRights[] = "S" . SONET_ENTITY_GROUP . $arTask["GROUP_ID"];
}
CSocNetLogRights::Add($log_id, $arRights);
}
}
}
if (intval($log_id) > 0) {
$sText = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"];
CSocNetLog::Update($log_id, array('PARAMS' => serialize(array('TYPE' => 'comment'))));
$arFieldsForSocnet = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "tasks_comment", "MESSAGE" => $sText, "TEXT_MESSAGE" => $parser->convert4mail($sText), "URL" => str_replace("?IFRAME=Y", "", str_replace("&IFRAME=Y", "", str_replace("IFRAME=Y&", "", $strURL))), "MODULE_ID" => "tasks", "SOURCE_ID" => $MID, "LOG_ID" => $log_id, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => $MID);
if ($MESSAGE_TYPE == "EDIT") {
$dbRes = CSocNetLogComments::GetList(array("ID" => "DESC"), array("EVENT_ID" => array("tasks_comment"), "SOURCE_ID" => $MID), false, false, array("ID"));
while ($arRes = $dbRes->Fetch()) {
示例5: __deprecated_Add
//.........这里部分代码省略.........
$NOTIFY_MESSAGE_TITLE_TEMPLATE = '';
$messageUrl = '';
if (strlen($pathTemplate) > 0) {
$groupId = 0;
if (isset($arTask['GROUP_ID'])) {
$groupId = (int) $arTask['GROUP_ID'];
}
$messageUrl = $urlPrefixForUser . CComponentEngine::MakePathFromTemplate($pathTemplate, array("user_id" => $userID, "task_id" => $arTask["ID"], "action" => "view", "USER_ID" => $userID, "TASK_ID" => $arTask["ID"], "ACTION" => "view", 'GROUP_ID' => $groupId, 'group_id' => $groupId));
if ($pageNumber > 1) {
$messageUrl .= (strpos($messageUrl, "?") === false ? "?" : "&") . "MID=" . $MID;
}
$NOTIFY_MESSAGE_TITLE_TEMPLATE = '[URL=' . $messageUrl . "#message" . $MID . ']' . $arTask["~TITLE"] . '[/URL]';
} else {
$NOTIFY_MESSAGE_TITLE_TEMPLATE = $arTask["~TITLE"];
}
$MESSAGE_SITE = trim(htmlspecialcharsbx(strip_tags(str_replace(array("\r\n", "\n", "\r"), ' ', htmlspecialcharsback($message_notify)))));
$MESSAGE_EMAIL = $MESSAGE_SITE;
// full message to email
if (strlen($MESSAGE_SITE) >= 100) {
$dot = '...';
$MESSAGE_SITE = substr($MESSAGE_SITE, 0, 99);
if (($lastLinkPosition = strrpos($MESSAGE_SITE, 'http://')) !== false || ($lastLinkPosition = strrpos($MESSAGE_SITE, 'https://')) !== false || ($lastLinkPosition = strrpos($MESSAGE_SITE, 'ftp://')) !== false || ($lastLinkPosition = strrpos($MESSAGE_SITE, 'ftps://')) !== false) {
if (strpos($MESSAGE_SITE, ' ', $lastLinkPosition) === false) {
$MESSAGE_SITE = substr($MESSAGE_SITE, 0, $lastLinkPosition);
}
}
$MESSAGE_SITE .= $dot;
}
$arMessageFields = array("TO_USER_ID" => $userID, "FROM_USER_ID" => $givenUserId, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "tasks", "NOTIFY_EVENT" => "comment", "NOTIFY_MESSAGE" => str_replace(array("#TASK_TITLE#", "#TASK_COMMENT_TEXT#"), array($NOTIFY_MESSAGE_TITLE_TEMPLATE, '[COLOR=#000000]' . $MESSAGE_SITE . '[/COLOR]'), $MESSAGE_TYPE != "EDIT" ? $strMsgAddComment : $strMsgEditComment), "NOTIFY_MESSAGE_OUT" => str_replace(array("#TASK_TITLE#", "#TASK_COMMENT_TEXT#"), array($arTask["~TITLE"], $MESSAGE_EMAIL . ' #BR# ' . $messageUrl . "#message" . $MID . ' '), $MESSAGE_TYPE != "EDIT" ? $strMsgAddComment : $strMsgEditComment));
CIMNotify::Add($arMessageFields);
}
}
$strURL = !empty($backPage) ? $backPage : $GLOBALS['APPLICATION']->GetCurPageParam("", array("IFRAME", "MID", "SEF_APPLICATION_CUR_PAGE_URL", BX_AJAX_PARAM_ID, "result"));
$strURL = ForumAddPageParams($strURL, array("MID" => $MID, "result" => $arForum["MODERATION"] != "Y" || CForumNew::CanUserModerateForum($forumId, $arUserGroupArray) ? "reply" : "not_approved"), false, false);
$outStrUrl = $strURL;
// sonet log
if (CModule::IncludeModule("socialnetwork")) {
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "tasks", "SOURCE_ID" => $arTask["ID"]), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID", "TMP_ID"));
if ($arRes = $dbRes->Fetch()) {
$log_id = $arRes["TMP_ID"];
$entity_type = $arRes["ENTITY_TYPE"];
$entity_id = $arRes["ENTITY_ID"];
} else {
$entity_type = $arTask["GROUP_ID"] ? SONET_ENTITY_GROUP : SONET_ENTITY_USER;
$entity_id = $arTask["GROUP_ID"] ? $arTask["GROUP_ID"] : $arTask["CREATED_BY"];
$rsUser = CUser::GetByID($arTask["CREATED_BY"]);
if ($arUser = $rsUser->Fetch()) {
$arSoFields = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "tasks", "LOG_DATE" => $arTask["CREATED_DATE"], "TITLE_TEMPLATE" => "#TITLE#", "TITLE" => htmlspecialcharsBack($arTask["~TITLE"]), "MESSAGE" => "", "TEXT_MESSAGE" => $strMsgNewTask, "MODULE_ID" => "tasks", "CALLBACK_FUNC" => false, "SOURCE_ID" => $arTask["ID"], "ENABLE_COMMENTS" => "Y", "USER_ID" => $arTask["CREATED_BY"], "URL" => CTaskNotifications::GetNotificationPath($arUser, $arTask["ID"]), "PARAMS" => serialize(array("TYPE" => "create")));
$log_id = CSocNetLog::Add($arSoFields, false);
if (intval($log_id) > 0) {
CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
$arRights = CTaskNotifications::__UserIDs2Rights(CTaskNotifications::GetRecipientsIDs($arTask, false));
if ($arTask["GROUP_ID"]) {
$arRights[] = "S" . SONET_ENTITY_GROUP . $arTask["GROUP_ID"];
}
CSocNetLogRights::Add($log_id, $arRights);
}
}
}
if (intval($log_id) > 0) {
$sText = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"];
CSocNetLog::Update($log_id, array('PARAMS' => serialize(array('TYPE' => 'comment'))));
$arFieldsForSocnet = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "tasks_comment", "MESSAGE" => $sText, "TEXT_MESSAGE" => $parser->convert4mail($sText), "URL" => str_replace("?IFRAME=Y", "", str_replace("&IFRAME=Y", "", str_replace("IFRAME=Y&", "", $strURL))), "MODULE_ID" => "tasks", "SOURCE_ID" => $MID, "LOG_ID" => $log_id, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => $MID);
if ($MESSAGE_TYPE == "EDIT") {
$dbRes = CSocNetLogComments::GetList(array("ID" => "DESC"), array("EVENT_ID" => array("tasks_comment"), "SOURCE_ID" => $MID), false, false, array("ID"));
while ($arRes = $dbRes->Fetch()) {
示例6: foreach
$arResult["TOPIC"][$key] = $parser->wrap_long_words($arResult["TOPIC"][$key]);
endforeach;
$arResult["TOPIC"]["iLAST_TOPIC_MESSAGE"] = "";
/************** Forum **********************************************/
foreach ($arResult["FORUM"] as $key => $val):
$arResult["FORUM"]["~".$key] = $val;
$arResult["FORUM"][$key] = htmlspecialcharsEx($val);
endforeach;
if ($arParams["SHOW_FIRST_POST"] == "N"):
$arParams["SHOW_FIRST_POST"] = ($arResult["FORUM"]["ALLOW_TOPIC_TITLED"] == "Y" ? "Y" : "N");
endif;
/************** Current User ***************************************/
$arResult["USER"]["SHOW_NAME"] = $GLOBALS["FORUM_STATUS_NAME"]["guest"];
$arResult["USER"]["RIGHTS"] = array(
"ADD_TOPIC" => CForumTopic::CanUserAddTopic($arParams["FID"], $arUserGroups, $USER->GetID(), $arResult["FORUM"]) ? "Y" : "N",
"MODERATE" => (CForumNew::CanUserModerateForum($arParams["FID"], $arUserGroups, $USER->GetID()) == true ? "Y" : "N"),
"EDIT" => CForumNew::CanUserEditForum($arParams["FID"], $arUserGroups, $USER->GetID()) ? "Y" : "N",
"ADD_MESSAGE" => CForumMessage::CanUserAddMessage($arParams["TID"], $arUserGroups, $USER->GetID()) ? "Y" : "N");
if ($USER->IsAuthorized()):
$arResult["USER"]["INFO"] = CForumUser::GetByUSER_ID($USER->GetParam("USER_ID"));
$arResult["USER"]["SHOW_NAME"] = $_SESSION["FORUM"]["SHOW_NAME"];
$arResult["USER"]["RANK"] = CForumUser::GetUserRank($USER->GetParam("USER_ID"), LANGUAGE_ID);
$arFields = array("USER_ID" => $USER->GetID(), "FORUM_ID" => $arParams["FID"], "TOPIC_ID" => $arParams["TID"], "SITE_ID" => SITE_ID);
$db_res = CForumSubscribe::GetList(array(), $arFields);
if ($db_res && $res = $db_res->Fetch())
$arResult["USER"]["SUBSCRIBE"][$res["ID"]] = $res;
$arResult["USER"]["RIGHTS"]["EDIT_MESSAGE"] = ($arResult["USER"]["RIGHTS"]["EDIT"] != "Y" ? $arResult["USER"]["RIGHTS"]["ADD_MESSAGE"] : "N");
else:
$arResult["USER"]["RIGHTS"]["EDIT_MESSAGE"] = "N";
endif;
$arResult["USER"]["RIGHTS"]["EDIT_OWN_POST"] = COption::GetOptionString("forum", "USER_EDIT_OWN_POST", "N");
示例7: foreach
if (!is_array($val)) {
$arResult["TOPIC"][$key] = $parser->wrap_long_words($arResult["TOPIC"][$key]);
}
}
$arResult["TOPIC"]["iLAST_TOPIC_MESSAGE"] = "";
/************** Forum **********************************************/
foreach ($arResult["FORUM"] as $key => $val) {
$arResult["FORUM"]["~" . $key] = $val;
$arResult["FORUM"][$key] = htmlspecialcharsEx($val);
}
if ($arParams["SHOW_FIRST_POST"] == "N") {
$arParams["SHOW_FIRST_POST"] = $arResult["FORUM"]["ALLOW_TOPIC_TITLED"] == "Y" ? "Y" : "N";
}
/************** Current User ***************************************/
$arResult["USER"]["SHOW_NAME"] = $GLOBALS["FORUM_STATUS_NAME"]["guest"];
$arResult["USER"]["RIGHTS"] = array("ADD_TOPIC" => CForumTopic::CanUserAddTopic($arParams["FID"], $arUserGroups, $USER->GetID(), $arResult["FORUM"]) ? "Y" : "N", "MODERATE" => CForumNew::CanUserModerateForum($arParams["FID"], $arUserGroups, $USER->GetID()) == true ? "Y" : "N", "EDIT" => CForumNew::CanUserEditForum($arParams["FID"], $arUserGroups, $USER->GetID()) ? "Y" : "N", "ADD_MESSAGE" => CForumMessage::CanUserAddMessage($arParams["TID"], $arUserGroups, $USER->GetID()) ? "Y" : "N");
if ($USER->IsAuthorized()) {
$arResult["USER"]["INFO"] = CForumUser::GetByUSER_ID($USER->GetParam("USER_ID"));
$arResult["USER"]["SHOW_NAME"] = $_SESSION["FORUM"]["SHOW_NAME"];
$arResult["USER"]["RANK"] = CForumUser::GetUserRank($USER->GetParam("USER_ID"), LANGUAGE_ID);
$arFields = array("USER_ID" => $USER->GetID(), "FORUM_ID" => $arParams["FID"], "TOPIC_ID" => $arParams["TID"], "SITE_ID" => SITE_ID);
$db_res = CForumSubscribe::GetList(array(), $arFields);
if ($db_res && ($res = $db_res->Fetch())) {
$arResult["USER"]["SUBSCRIBE"][$res["ID"]] = $res;
}
$arResult["USER"]["RIGHTS"]["EDIT_MESSAGE"] = $arResult["USER"]["RIGHTS"]["EDIT"] != "Y" ? $arResult["USER"]["RIGHTS"]["ADD_MESSAGE"] : "N";
} else {
$arResult["USER"]["RIGHTS"]["EDIT_MESSAGE"] = "N";
}
$arResult["USER"]["RIGHTS"]["EDIT_OWN_POST"] = COption::GetOptionString("forum", "USER_EDIT_OWN_POST", "N");
/************** Edit panels info ***********************************/
示例8: GetMessage
$TID = $TOPIC_ID;
}
if ($FORUM_TOPIC_ID > 0) {
$TID = $FORUM_TOPIC_ID;
}
}
$strOKMessage = GetMessage("COMM_COMMENT_OK");
$arResult["FORUM_TOPIC_ID"] = intVal($FORUM_TOPIC_ID);
ForumClearComponentCache($componentName);
// SUBSCRIBE
if ($_REQUEST["TOPIC_SUBSCRIBE"] == "Y") {
ForumSubscribeNewMessagesEx($arParams["FORUM_ID"], $FORUM_TOPIC_ID, "N", $strErrorMessage, $strOKMessage);
BXClearCache(true, "/bitrix/forum/user/" . $GLOBALS["USER"]->GetID() . "/subscribe/");
}
$strURL = !empty($_REQUEST["back_page"]) ? $_REQUEST["back_page"] : $APPLICATION->GetCurPageParam("", array("MID", "SEF_APPLICATION_CUR_PAGE_URL", BX_AJAX_PARAM_ID, "result"));
$bNotModerated = $arResult["FORUM"]["MODERATION"] != "Y" || CForumNew::CanUserModerateForum($arParams["FORUM_ID"], $USER->GetUserGroupArray());
$strURL = ForumAddPageParams($strURL, array("MID" => $MID, "result" => $bNotModerated ? "reply" : "not_approved"));
$strURL .= $bNotModerated ? "#message" . $MID : "#reviewnote";
if ($arParams["NO_REDIRECT_AFTER_SUBMIT"] != "Y") {
LocalRedirect($strURL);
} else {
$arResult['RESULT'] = $MID;
$strOKMessage = $bNotModerated ? GetMessage("COMM_COMMENT_OK") : GetMessage("COMM_COMMENT_OK_AND_NOT_APPROVED");
}
}
} elseif ($_REQUEST["save_product_review"] == "Y") {
$arParams['SHOW_MINIMIZED'] = 'N';
$arAllow["SMILES"] = $_POST["REVIEW_USE_SMILES"] != "Y" ? "N" : $arResult["FORUM"]["ALLOW_SMILES"];
$arResult["MESSAGE_VIEW"] = array("POST_MESSAGE_TEXT" => $_POST["REVIEW_TEXT"], "AUTHOR_NAME" => htmlspecialcharsEx($arResult["USER"]["SHOWED_NAME"]), "AUTHOR_ID" => intVal($USER->GetID()), "AUTHOR_URL" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $USER->GetID())), "POST_DATE" => CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], time() + CTimeZone::GetOffset()), "FILES" => array());
$arFields = array("FORUM_ID" => intVal($arParams["FORUM_ID"]), "TOPIC_ID" => 0, "MESSAGE_ID" => 0, "USER_ID" => intVal($GLOBALS["USER"]->GetID()));
$arFiles = array();