当前位置: 首页>>代码示例>>PHP>>正文


PHP CForumTopic::CanUserAddTopic方法代码示例

本文整理汇总了PHP中CForumTopic::CanUserAddTopic方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumTopic::CanUserAddTopic方法的具体用法?PHP CForumTopic::CanUserAddTopic怎么用?PHP CForumTopic::CanUserAddTopic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CForumTopic的用法示例。


在下文中一共展示了CForumTopic::CanUserAddTopic方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例2: GetMessage

	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;
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(),
开发者ID:akniyev,项目名称:arteva.ru,代码行数:31,代码来源:component.php

示例3: elseif

} 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"]);
$arResult["ERROR_MESSAGE"] = "";
$arResult["OK_MESSAGE"] = "";
$parser = new forumTextParser(false, false, false, "light");
$parser->MaxStringLen = $arParams["WORD_LENGTH"];
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    $arResult["TID"] = empty($_POST["TID_ARRAY"]) ? $_POST["TID"] : $_POST["TID_ARRAY"];
}
if (empty($arResult["TID"])) {
    $arResult["TID"] = empty($_REQUEST["TID_ARRAY"]) ? $_REQUEST["TID"] : $_REQUEST["TID_ARRAY"];
}
$ACTION = $_REQUEST["ACTION"];
$arResult["NOTIFICATIONS"] = array("not_approve" => GetMessage("F_TOPIC_NOT_APPROVED"), "tid_not_approved" => GetMessage("F_TOPIC_NOT_APPROVED"), "tid_is_lost" => GetMessage("F_TOPIC_IS_LOST"), "del_topic" => GetMessage("F_TOPIC_IS_DEL"), "delele" => GetMessage("F_TOPICS_IS_DEL"), "stick" => GetMessage("F_TOPICS_IS_PINNED"), "unstick" => GetMessage("F_TOPICS_IS_UNPINNED"), "open" => GetMessage("F_TOPICS_IS_OPENED"), "close" => GetMessage("F_TOPICS_IS_CLOSED"));
if (!empty($_REQUEST["result"]) && array_key_exists($_REQUEST["result"], $arResult["NOTIFICATIONS"])) {
    $arResult["OK_MESSAGE"] = $arResult["NOTIFICATIONS"][$_REQUEST["result"]];
}
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php

示例4: while

                if ($db_res && ($res = $db_res->Fetch())) {
                    do {
                        if (is_set($arResult["~QUESTIONS"], $res["QUESTION_ID"])) {
                            $arResult["~QUESTIONS"][$res["QUESTION_ID"]]["ANSWERS"][$res["ID"]] = $res;
                        }
                    } while ($res = $db_res->Fetch());
                }
            }
            $arResult["QUESTIONS"] = $arResult["~QUESTIONS"];
        }
    } else {
        $arError[] = array("id" => "mid_is_lost", "text" => GetMessage("F_MID_IS_LOST"));
    }
}
/************** Permission *****************************************/
if ($arParams["MESSAGE_TYPE"] == "NEW" && !CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID(), false, $arParams["PERMISSION"])) {
    $arError[] = array("id" => "acces denied", "text" => GetMessage("F_NO_NPERMS"));
} elseif ($arParams["MESSAGE_TYPE"] == "EDIT" && !CForumMessage::CanUserUpdateMessage($arParams["MID"], $USER->GetUserGroupArray(), $USER->GetID(), $arParams["PERMISSION"])) {
    $arError[] = array("id" => "acces denied", "text" => GetMessage("F_NO_EPERMS"));
}
/************** Fatal Errors ***************************************/
if (!empty($arError)) {
    $e = new CAdminException($arError);
    $res = $e->GetString();
    ShowError($res);
    return false;
}
/*******************************************************************/
$strErrorMessage = "";
$strOKMessage = "";
$bVarsFromForm = false;
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例5: 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"]);
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例6: while

                                $arResult["~QUESTIONS"][$res["QUESTION_ID"]]["ANSWERS"][$res["ID"]] = $res;
                            }
                        } while ($res = $db_res->Fetch());
                    }
                }
                $arResult["QUESTIONS"] = $arResult["~QUESTIONS"];
            }
        }
    }
} else {
    $arResult["FORUM"] = CForumNew::GetByID($arParams["FID"]);
    if (empty($arResult["FORUM"])) {
        $arError = array("code" => "fid_is_lost", "title" => GetMessage("F_FID_IS_LOST"), "link" => $arResult["index"]);
    }
}
if (empty($arError) && ($arParams["MESSAGE_TYPE"] == "NEW" && !CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID())) || $arParams["MESSAGE_TYPE"] == "EDIT" && !CForumMessage::CanUserUpdateMessage($arParams["MID"], $USER->GetUserGroupArray(), $USER->GetID())) {
    $arError = array("code" => "rightsn_new", "title" => $arParams["MESSAGE_TYPE"] == "NEW" ? GetMessage("F_NO_NPERMS") : GetMessage("F_NO_EPERMS"), "link" => $arResult["index"]);
}
if (!empty($arError)) {
    if ($arParams["AJAX_CALL"] == "Y") {
        $res = array("error" => $arError, "note" => $arNote, "id" => $arParams["MID"], "post" => ShowError($arError["title"]));
        if ($_REQUEST["CONVERT_DATA"] == "Y") {
            array_walk($res, "htmlspecialcharsEx");
        }
        $APPLICATION->RestartBuffer();
        echo CUtil::PhpToJSObject($res);
        die;
    }
    ShowError($arError["title"]);
    return false;
}
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例7: array

$arResult["TOPIC"] = array();
$arResult["MESSAGE"] = array("AUTHOR_ID" => $USER->GetParam("USER_ID"), "USE_SMILES" => "Y", "AUTHOR_NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"], "AUTHOR_EMAIL" => "", "POST_MESSAGE" => "", "EDITOR_NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"], "EDITOR_EMAIL" => "quest@guest.com", "EDIT_REASON" => "", "FILES" => array());
$arResult["TOPIC"] = array("TITLE" => "", "TAGS" => "", "DESCRIPTION" => "", "ICON_ID" => "");
$arResult["QUESTIONS"] = array();
$arResult["~QUESTIONS"] = array();
$arResult['DATE_END'] = GetTime(time() + 30 * 86400);
/********************************************************************
				/Default params
********************************************************************/
$bShowForm = false;
if ($arParams["MESSAGE_TYPE"] == "REPLY" && $arParams["TID"] > 0) {
    $bShowForm = CForumMessage::CanUserAddMessage($arParams["TID"], $USER->GetUserGroupArray(), $USER->GetID());
} elseif ($arParams["MESSAGE_TYPE"] == "EDIT" && $arParams["MID"] > 0) {
    $bShowForm = CForumMessage::CanUserUpdateMessage($arParams["MID"], $USER->GetUserGroupArray(), intVal($USER->GetID()));
} elseif ($arParams["MESSAGE_TYPE"] == "NEW" && $arParams["FID"] > 0) {
    $bShowForm = CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID());
}
if (!$bShowForm) {
    return 0;
}
if ($arParams["SHOW_VOTE"] == "Y") {
    CModule::IncludeModule("vote");
    $permission = isset($arParams['PERMISSION']) && intval($arParams['PERMISSION'] > 0 || $arParams['PERMISSION'] === 0) ? intval($arParams['PERMISSION']) : CVoteChannel::GetGroupPermission($arParams["VOTE_CHANNEL_ID"]);
    if ($permission < 2) {
        $arParams["SHOW_VOTE"] = "N";
    }
    $res = array_intersect($USER->GetUserGroupArray(), $arParams["VOTE_GROUP_ID"]);
    $arParams["SHOW_VOTE"] = empty($res) ? "N" : $arParams["SHOW_VOTE"];
}
/********************************************************************
				Data
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例8: LocalRedirect

 if ($MESSAGE_TYPE == "EDIT") {
     $arMessage = CForumMessage::GetByID($MID);
     if (!$arMessage) {
         LocalRedirect("index.php");
         die;
     }
     $FID = IntVal($arMessage["FORUM_ID"]);
     $TID = IntVal($arMessage["TOPIC_ID"]);
 }
 $arForum = CForumNew::GetByID($FID);
 ForumSetLastVisit();
 if (!$arForum) {
     LocalRedirect("index.php");
     die;
 }
 if ($MESSAGE_TYPE == "NEW" && !CForumTopic::CanUserAddTopic($FID, $USER->GetUserGroupArray(), $USER->GetID())) {
     $APPLICATION->AuthForm(GetMessage("FNT_NO_NPERMS"));
 }
 if ($MESSAGE_TYPE == "EDIT" && !CForumMessage::CanUserUpdateMessage($MID, $USER->GetUserGroupArray(), IntVal($USER->GetID()))) {
     $APPLICATION->AuthForm(GetMessage("FNT_NO_EPERMS"));
 }
 if ($GLOBALS["SHOW_FORUM_DEBUG_INFO"]) {
     $arForumDebugInfo[] = "<br><font color=\"#FF0000\">Initializing Variables: " . Round(getmicrotime() - $prexectime, 3) . " sec</font>";
 }
 if ($GLOBALS["SHOW_FORUM_DEBUG_INFO"]) {
     $prexectime = getmicrotime();
 }
 $strErrorMessage = "";
 $strOKMessage = "";
 $bVarsFromForm = false;
 $View = false;
开发者ID:,项目名称:,代码行数:31,代码来源:

示例9: foreach

	if (!is_array($val))
		$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;
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:component.php

示例10: 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 ***********************************/
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例11: ForumAddMessage

function ForumAddMessage($MESSAGE_TYPE, $FID, $TID, $MID, $arFieldsG, &$strErrorMessage, &$strOKMessage, $iFileSize = false, $captcha_word = "", $captcha_sid = 0, $captcha_code = "")
{
    global $USER, $DB, $APPLICATION;
    $APPLICATION->ResetException();
    $aMsg = array();
    $bUpdateTopic = False;
    $bAddEditNote = $MESSAGE_TYPE == "EDIT";
    $arParams = array("PERMISSION" => false);
    $arUserGroups = $USER->GetUserGroupArray();
    // ************ External Permission *********************************
    if (!empty($arFieldsG["PERMISSION_EXTERNAL"])) {
        $arParams["PERMISSION"] = CForumNew::GetUserPermission($FID, $arUserGroups);
        $arParams["PERMISSION"] = $arParams["PERMISSION"] < "Q" ? $arFieldsG["PERMISSION_EXTERNAL"] : $arParams["PERMISSION"];
        unset($arFieldsG["PERMISSION_EXTERNAL"]);
    } elseif (!empty($arFieldsG["SONET_PERMS"])) {
        $arParams["PERMISSION"] = CForumNew::GetUserPermission($FID, $arUserGroups);
        if ($arParams["PERMISSION"] < "Q") {
            if ($arFieldsG["SONET_PERMS"]["bCanFull"] === true) {
                $arParams["PERMISSION"] = "Y";
            } elseif ($arFieldsG["SONET_PERMS"]["bCanNew"] === true) {
                $arParams["PERMISSION"] = "M";
            } elseif ($arFieldsG["SONET_PERMS"]["bCanWrite"] === true) {
                $arParams["PERMISSION"] = "I";
            } else {
                $arParams["PERMISSION"] = "A";
            }
        }
        unset($arFieldsG["SONET_PERMS"]);
    }
    $DB->StartTransaction();
    if (!in_array($MESSAGE_TYPE, array("NEW", "EDIT", "REPLY"))) {
        $aMsg[] = array("id" => "MESSAGE_TYPE", "text" => GetMessage("ADDMES_NO_TYPE") . ".");
    }
    $MID = intval($MID);
    $TID = intval($TID);
    $FID = intval($FID);
    $arFieldsG["EDIT_ADD_REASON"] = $arFieldsG["EDIT_ADD_REASON"] == "Y" ? "Y" : "N";
    if ($MID > 0) {
        $arMessage = CForumMessage::GetByID($MID, array("FILTER" => "N"));
        if ($arMessage) {
            $TID = IntVal($arMessage["TOPIC_ID"]);
            $FID = IntVal($arMessage["FORUM_ID"]);
        }
    }
    $arTopic = array();
    if ($TID > 0) {
        $arTopic = CForumTopic::GetByID($TID);
        if ($arTopic) {
            $FID = IntVal($arTopic["FORUM_ID"]);
        }
    }
    $arForum = CForumNew::GetByID($FID);
    //************************* Input params **************************************************************************
    if ($MESSAGE_TYPE == "NEW" && !CForumTopic::CanUserAddTopic($FID, $arUserGroups, $USER->GetID(), $arForum, $arParams["PERMISSION"])) {
        $aMsg[] = array("id" => "PERMISSION", "text" => GetMessage("ADDMESS_NO_PERMS2NEW") . ".");
    } elseif ($MESSAGE_TYPE == "EDIT" && !CForumMessage::CanUserUpdateMessage($MID, $arUserGroups, $USER->GetID(), $arParams["PERMISSION"])) {
        $aMsg[] = array("id" => "PERMISSION", "text" => GetMessage("ADDMESS_NO_PERMS2EDIT") . ".");
    } elseif ($MESSAGE_TYPE == "REPLY" && !CForumMessage::CanUserAddMessage($TID, $arUserGroups, $USER->GetID(), $arParams["PERMISSION"])) {
        $aMsg[] = array("id" => "PERMISSION", "text" => GetMessage("ADDMESS_NO_PERMS2REPLY") . ".");
    }
    if ($MESSAGE_TYPE == "NEW" || $MESSAGE_TYPE == "EDIT" && array_intersect_key($arFieldsG, array("TITLE" => "", "DESCRIPTION" => "", "ICON" => "", "TAGS" => "", "OWNER_ID" => "", "SOCNET_GROUP_ID" => "")) && CForumTopic::CanUserUpdateTopic($TID, $arUserGroups, $USER->GetID(), $arParams["PERMISSION"])) {
        $bUpdateTopic = True;
    }
    if ($MESSAGE_TYPE == "EDIT" && (ForumCurrUserPermissions($FID, $arParams) > "Q" && $arFieldsG["EDIT_ADD_REASON"] == "N")) {
        $bAddEditNote = false;
    }
    //*************************!CAPTCHA********************************************************************************
    if (!$USER->IsAuthorized() && $arForum["USE_CAPTCHA"] == "Y") {
        include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/captcha.php";
        $cpt = new CCaptcha();
        if (strlen($captcha_code) > 0) {
            $captchaPass = COption::GetOptionString("main", "captcha_password", "");
            if (!$cpt->CheckCodeCrypt($captcha_word, $captcha_code, $captchaPass)) {
                $aMsg[] = array("id" => "CAPTCHA", "text" => GetMessage("FORUM_POSTM_CAPTCHA") . ".");
            }
        } else {
            if (!$cpt->CheckCode($captcha_word, $captcha_sid)) {
                $aMsg[] = array("id" => "CAPTCHA", "text" => GetMessage("FORUM_POSTM_CAPTCHA") . ".");
            }
        }
    }
    //*************************!CAPTCHA********************************************************************************
    $arFieldsG["POST_MESSAGE"] = trim($arFieldsG["POST_MESSAGE"]);
    if (empty($arFieldsG["POST_MESSAGE"])) {
        $aMsg[] = array("id" => "POST_MESSAGE", "text" => GetMessage("ADDMESS_INPUT_MESSAGE") . ".");
    }
    if ($bUpdateTopic && is_set($arFieldsG, "TITLE")) {
        $arFieldsG["TITLE"] = trim($arFieldsG["TITLE"]);
        if (empty($arFieldsG["TITLE"])) {
            $aMsg[] = array("id" => "TITLE", "text" => GetMessage("ADDMESS_INPUT_TITLE") . ".");
        }
    }
    //*************************!QUOTA**********************************************************************************
    /*	if (empty($aMsg))
    	{
    		$quota = new CDiskQuota();
    		if ($MESSAGE_TYPE=="EDIT")
    		{
    			if (!$quota->checkDiskQuota(strLen($arFieldsG["POST_MESSAGE"]) - strLen($arMessage["POST_MESSAGE"])))
    			{
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:include.php

示例12: GetMessage

            include $_SERVER["DOCUMENT_ROOT"] . $strJSPath;
        }
        ?>
</script><?php 
    }
    ?>
<br>
	<table width="100%" border="0">
		<tr>
			<td align="left">
				<?php 
    echo $db_Message->NavPrint(GetMessage("FR_MESS"));
    ?>
			</td>
			<?php 
    if (CForumTopic::CanUserAddTopic($FID, $USER->GetUserGroupArray(), $USER->GetID())) {
        ?>
				<form action='new_topic.php' method='GET'><td align='right'>
				<input type='hidden' name='FID' value='<?php 
        echo $FID;
        ?>
'>
				<input type='submit' value='<?php 
        echo GetMessage('FR_CREATE_NEW_TOPIC');
        ?>
' title='<?php 
        echo GetMessage('FR_CREATE_NEW_TOPIC1');
        ?>
' class='forumnewtopic_button'>
				</td></form>
			<?php 
开发者ID:,项目名称:,代码行数:31,代码来源:


注:本文中的CForumTopic::CanUserAddTopic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。