本文整理汇总了PHP中CForumNew::CanUserViewForum方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumNew::CanUserViewForum方法的具体用法?PHP CForumNew::CanUserViewForum怎么用?PHP CForumNew::CanUserViewForum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumNew
的用法示例。
在下文中一共展示了CForumNew::CanUserViewForum方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $arParams["USER_ID"], "forum", "newtopic", $bCurrentUserIsAdmin)) {
$arParams["PERMISSION"] = "M";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $arParams["USER_ID"], "forum", "answer", $bCurrentUserIsAdmin)) {
$arParams["PERMISSION"] = "I";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $arParams["USER_ID"], "forum", "view", $bCurrentUserIsAdmin)) {
$arParams["PERMISSION"] = "E";
}
}
}
if ($arParams["SHOW_VOTE"] == "Y") {
// A - NO ACCESS E - READ I - ANSWER
// M - NEW TOPIC Q - MODERATE U - EDIT Y - FULL_ACCESS
$arResult["VOTE_PERMISSION"] = $arParams['PERMISSION'] === 'A' ? 0 : ($arParams['PERMISSION'] === 'E' ? 1 : 2);
$arParams["SHOW_VOTE"] = $arResult["VOTE_PERMISSION"] <= 'A' ? "N" : "Y";
}
if (!CForumNew::CanUserViewForum($arParams["FID"], $USER->GetUserGroupArray(), $arParams["PERMISSION"])) {
ShowError(GetMessage("FORUM_SONET_NO_ACCESS"));
return false;
}
$arResult["CURRENT_PAGE"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_TOPIC"], array("UID" => $arParams["USER_ID"], "TID" => $arParams["TID"], "GID" => $arParams["SOCNET_GROUP_ID"], "FID" => $arParams["FID"]));
if (intVal($_REQUEST["PAGEN_" . $arParams["PAGEN"]]) > 1 && intVal($arParams["MID"]) <= 0) {
$arResult["CURRENT_PAGE"] = ForumAddPageParams($arResult["CURRENT_PAGE"], array("PAGEN_" . $arParams["PAGEN"] => intVal($_REQUEST["PAGEN_" . $arParams["PAGEN"]])));
}
/************** Message ********************************************/
if ($arParams["MID"] > 0) {
$res = CForumMessage::GetByIDEx($arParams["MID"], array("GET_TOPIC_INFO" => "Y"));
if (!(is_array($res) && $res["FORUM_ID"] == $arParams["FID"])) {
LocalRedirect($arResult["CURRENT_PAGE"]);
} elseif ($arParams["MODE"] == "GROUP" && $res["TOPIC_INFO"]["SOCNET_GROUP_ID"] == $arParams["SOCNET_GROUP_ID"] || $arParams["MODE"] != "GROUP" && $res["TOPIC_INFO"]["OWNER_ID"] == $arParams["USER_ID"]) {
$arResult["MESSAGE"] = $res;
$arParams["TID"] = $res["TOPIC_INFO"]["ID"];
示例2: intval
$arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]);
} else {
$arParams["CACHE_TIME"] = 0;
}
$arParams["SET_TITLE"] = $arParams["SET_TITLE"] == "N" ? "N" : "Y";
$arParams["SET_NAVIGATION"] = $arParams["SET_NAVIGATION"] == "N" ? "N" : "Y";
// $arParams["DISPLAY_PANEL"] = ($arParams["DISPLAY_PANEL"] == "Y" ? "Y" : "N");
/********************************************************************
/Input params
********************************************************************/
$arResult["FORUM"] = CForumNew::GetByID($arParams["FID"]);
if (empty($arResult["FORUM"])) {
CHTTP::SetStatus("404 Not Found");
ShowError(GetMessage("F_ERROR_FORUM_NOT_EXISTS"));
return false;
} elseif (!CForumNew::CanUserViewForum($arParams["FID"], $USER->GetUserGroupArray())) {
$APPLICATION->AuthForm(GetMessage("F_NO_FPERMS"));
return false;
} elseif (!array_key_exists(SITE_ID, CForumNew::GetSites($arParams["FID"])) && ($arParams["SHOW_FORUM_ANOTHER_SITE"] == "N" || !CForumUser::IsAdmin())) {
CHTTP::SetStatus("404 Not Found");
ShowError(GetMessage("F_ERROR_FORUM_NOT_EXISTS"));
return false;
}
/********************************************************************
Default values
********************************************************************/
$arParams["PERMISSION"] = $arResult["PERMISSION"] = ForumCurrUserPermissions($arParams["FID"]);
$arResult["Topics"] = array();
$arResult["TOPICS"] = array();
$arResult["URL"] = array("INDEX" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_INDEX"], array()), "~INDEX" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_INDEX"], array()), "TOPIC_LIST" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], array("FID" => $arParams["FID"])), "~TOPIC_LIST" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_LIST"], array("FID" => $arParams["FID"])), "TOPIC_NEW" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_TOPIC_NEW"], array("FID" => $arParams["FID"])), "~TOPIC_NEW" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_TOPIC_NEW"], array("FID" => $arParams["FID"])), "RSS" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_RSS"], array("TYPE" => "default", "MODE" => "forum", "IID" => $arParams["FID"])), "~RSS" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_RSS"], array("TYPE" => "default", "MODE" => "forum", "IID" => $arParams["FID"])), "RSS_DEFAULT" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_RSS"], array("TYPE" => "rss2", "MODE" => "forum", "IID" => $arParams["FID"])), "~RSS_DEFAULT" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_RSS"], array("TYPE" => "rss2", "MODE" => "forum", "IID" => $arParams["FID"])));
$arResult["CanUserAddTopic"] = CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID(), $arResult["FORUM"]);
示例3: str_replace
if ($oError) {
$arResult["ERROR_MESSAGE"] = $oError->GetString();
}
}
if ($bDialog) {
$arResult['JSPARAMS']['element_url'] = str_replace("#ACTION#", "VIEW", $arParams['ELEMENT_EDIT_URL']);
}
/********************************************************************
/ACTIONS
********************************************************************/
/********************************************************************
Data
********************************************************************/
/************** Forum subscribe ************************************/
if (!$bDialog && $arParams["USE_COMMENTS"] == "Y" && CModule::IncludeModule("forum")) {
$arParams["USE_COMMENTS"] = $arParams["FORUM_CAN_VIEW"] = CForumNew::CanUserViewForum($arParams["FORUM_ID"], $GLOBALS['USER']->GetUserGroupArray()) ? "Y" : "N";
if ($arParams["FORUM_CAN_VIEW"] == "Y" && $GLOBALS['USER']->IsAuthorized()) {
$bShowSubscribe = true;
$arUserSubscribe = array();
$cache_id = "/" . $arParams['IBLOCK_ID'] . "/forum_user_subscribe_" . intVal($currentUserID) . "_" . $arParams["FORUM_ID"];
if ($arParams["CACHE_TIME"] > 0 && $cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path_main)) {
$res = $cache->GetVars();
$arUserSubscribe = $res["arUserSubscribe"];
} else {
$db_res = CForumSubscribe::GetList(array(), array("USER_ID" => $currentUserID, "FORUM_ID" => $arParams["FORUM_ID"]));
$arUserSubscribe = array();
if ($db_res && ($res = $db_res->Fetch())) {
do {
$arUserSubscribe[] = $res;
} while ($res = $db_res->Fetch());
}
示例4: GetMessage
"code" => "404",
"title" => GetMessage("F_ERROR_TID_IS_LOST"));
}
}
if (empty($arResult["TOPIC"])):
elseif ($arResult["TOPIC"]["STATE"] == "L" && intVal($arResult["TOPIC"]["TOPIC_ID"]) > 0):
$res = CForumTopic::GetByIDEx($arResult["TOPIC"]["TOPIC_ID"], array("GET_FORUM_INFO" => "Y"));
if (empty($res)):
$arError = array(
"code" => "404",
"title" => GetMessage("F_ERROR_TID_IS_LOST"));
else:
$arResult["TOPIC"] = $res;
$arResult["FORUM"] = $res["FORUM_INFO"];
endif;
elseif (!CForumNew::CanUserViewForum($arResult["FORUM"]["ID"], $arUserGroups)):
$APPLICATION->AuthForm(GetMessage("F_FPERMS"));
elseif (!CForumTopic::CanUserViewTopic($arResult["TOPIC"]["ID"], $arUserGroups)):
// Topic is approve? For moderation forum.
$arError = array(
"code" => "tid_not_approved",
"title" => GetMessage("F_ERROR_TID_NOT_APPROVED"),
"link" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_LIST"],
array("FID" => $arParams["FID"])));
endif;
/********************************************************************
/Main Data & Permissions
********************************************************************/
if ($arError["code"] == "404"):
CHTTP::SetStatus("404 Not Found");
示例5: getmicrotime
if (CModule::IncludeModule("forum")) {
//*******************************************************
// Let's init $FID (forum id) with actual and coordinated value
if ($GLOBALS["SHOW_FORUM_DEBUG_INFO"]) {
$prexectime = getmicrotime();
}
$FID = IntVal($_REQUEST["FID"]);
$arForum = CForumNew::GetByID($FID);
ForumSetLastVisit();
if (!$arForum) {
LocalRedirect("index.php");
die;
}
define("FORUM_MODULE_PAGE", "LIST");
// Let's check if current user can can view this forum
if (!CForumNew::CanUserViewForum($FID, $USER->GetUserGroupArray())) {
$APPLICATION->AuthForm("Для входа в закрытый форум введите ваши логин и пароль");
}
// Let's init read labels
CForumNew::InitReadLabels($FID, $USER->GetUserGroupArray());
if ($GLOBALS["SHOW_FORUM_DEBUG_INFO"]) {
$arForumDebugInfo[] = "<br><font color=\"#FF0000\">Initializing Variables: " . Round(getmicrotime() - $prexectime, 3) . " sec</font>";
}
// ACTIONS: subscribe
if ($GLOBALS["SHOW_FORUM_DEBUG_INFO"]) {
$prexectime = getmicrotime();
}
$strErrorMessage = "";
$strOKMessage = "";
if ($_SERVER["REQUEST_METHOD"] == "GET" && $_GET["ACTION"] == "FORUM_SUBSCRIBE" && IntVal($FID) > 0) {
if (ForumSubscribeNewMessages($FID, 0, $strErrorMessage, $strOKMessage)) {