本文整理汇总了PHP中CForumTopic::CanUserUpdateTopic方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumTopic::CanUserUpdateTopic方法的具体用法?PHP CForumTopic::CanUserUpdateTopic怎么用?PHP CForumTopic::CanUserUpdateTopic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumTopic
的用法示例。
在下文中一共展示了CForumTopic::CanUserUpdateTopic方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
}
if (!empty($sError)) {
$lAdmin->AddFilterError($sError);
}
}
$rsData = CForumTopic::GetListEx(array($by => $order), $arFilter, false, 0, array("NoFilter" => true));
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("FM_TOPICS")));
/*******************************************************************/
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "TITLE", "content" => GetMessage("FM_TITLE_NAME"), "sort" => "TITLE", "default" => true), array("id" => "DESCRIPTION", "content" => GetMessage("FM_TITLE_DESCRIPTION"), "sort" => "DESCRIPTION", "default" => false), array("id" => "STATE", "content" => GetMessage("FM_TITLE_STATE"), "sort" => "STATE", "default" => true), array("id" => "APPROVED", "content" => GetMessage("FM_TITLE_APPROVED"), "sort" => "APPROVED", "default" => true), array("id" => "SORT", "content" => GetMessage("FM_TITLE_SORT"), "sort" => "SORT", "default" => true), array("id" => "USER_START_NAME", "content" => GetMessage("FM_TITLE_AUTHOR"), "sort" => "USER_START_NAME", "default" => true), array("id" => "START_DATE", "content" => GetMessage("FM_TITLE_DATE_CREATE"), "sort" => "START_DATE", "default" => true), array("id" => "POSTS", "content" => GetMessage("FM_TITLE_MESSAGES"), "sort" => "POSTS", "default" => false), array("id" => "VIEWS", "content" => GetMessage("FM_TITLE_VIEWS"), "sort" => "VIEWS", "default" => false), array("id" => "FORUM_ID", "content" => GetMessage("FM_TITLE_FORUM"), "sort" => "FORUM_NAME", "default" => true), array("id" => "LAST_POST_DATE", "content" => GetMessage("FM_TITLE_LAST_MESSAGE"), "sort" => "LAST_POST_DATE", "default" => false)));
/*******************************************************************/
while ($res = $rsData->NavNext(true, "t_")) {
$row =& $lAdmin->AddRow($t_ID, $res);
$bCanUpdateForum = CForumTopic::CanUserUpdateTopic($t_ID, $USER->GetUserGroupArray(), $USER->GetID());
$bCanDeleteForum = CForumTopic::CanUserDeleteTopic($t_ID, $USER->GetUserGroupArray(), $USER->GetID());
$row->bReadOnly = !$bCanUpdateForum || !$bCanDeleteForum ? true : false;
$row->AddField("ID", $t_ID);
$row->AddInputField("TITLE", array("size" => "35"));
$row->AddInputField("DESCRIPTION", array("size" => "35"));
if ($t_STATE != "L") {
$row->AddSelectField("STATE", array("Y" => GetMessage("F_OPEN"), "N" => GetMessage("F_CLOSE")));
} else {
$row->AddField("STATE", "Link");
}
$row->AddSelectField("APPROVED", array("Y" => GetMessage("F_SHOW"), "N" => GetMessage("F_HIDE")));
$row->AddSelectField("SORT", array("100" => GetMessage("F_PINN"), "150" => GetMessage("F_UNPINN")));
$row->AddInputField("USER_START_NAME", array("size" => "20"));
$row->AddInputField("START_DATE", array("size" => "16"));
$row->AddField("POSTS", $t_POSTS);
示例2: ForumPrintIconsList
}
$res["ANSWERS"][] = $resa;
}
}
if (empty($res["ANSWERS"]) && empty($res["QUESTION"]) && empty($res["ID"])) {
continue;
}
$arResult["QUESTIONS"][] = $res;
}
}
}
/*******************************************************************/
if (($arParams["MESSAGE_TYPE"] == "NEW" || $arParams["MESSAGE_TYPE"] == "REPLY") && $arResult["IsAuthorized"] == "N" || $arParams["MESSAGE_TYPE"] == "EDIT" && intVal($arResult["MESSAGE"]["AUTHOR_ID"]) <= 0) {
$arResult["SHOW_PANEL_GUEST"] = "Y";
}
if ($arParams["MESSAGE_TYPE"] == "NEW" || $arParams["MESSAGE_TYPE"] == "EDIT" && CForumTopic::CanUserUpdateTopic($arParams["TID"], $USER->GetUserGroupArray(), $USER->GetID())) {
$arResult["SHOW_PANEL_NEW_TOPIC"] = "Y";
$arResult["ForumPrintIconsList"] = ForumPrintIconsList(7, "ICON_ID", $arResult["TOPIC"]["ICON_ID"], GetMessage("FPF_NO_ICON"), LANGUAGE_ID, $arParams["PATH_TO_ICON"], $arParams["CACHE_TIME"]);
if ($arParams["SHOW_VOTE"] == "Y") {
$arResult["SHOW_PANEL_VOTE"] = "Y";
}
}
if ($arParams["FORUM"]["ALLOW_SMILES"] == "Y") {
$arResult["ForumPrintSmilesList"] = ForumPrintSmilesList($arParams["SMILE_TABLE_COLS"], LANGUAGE_ID, $arParams["PATH_TO_SMILE"], $arParams["CACHE_TIME"]);
$arResult["SMILES"] = CForumSmile::GetByType("S", LANGUAGE_ID);
}
if ($arResult["SHOW_SUBSCRIBE"] == "Y") {
$arFields = array("USER_ID" => $USER->GetID(), "FORUM_ID" => $arParams["FID"], "SITE_ID" => SITE_ID);
$db_res = CForumSubscribe::GetList(array(), $arFields);
$arResult["TOPIC_SUBSCRIBE"] = "N";
$arResult["FORUM_SUBSCRIBE"] = "N";
示例3: intVal
}
if (empty($res["ANSWERS"]) && empty($res["QUESTION"]) && empty($res["ID"]))
continue;
$arResult["QUESTIONS"][] = $res;
}
}
}
/*******************************************************************/
if (($arParams["MESSAGE_TYPE"]=="NEW" || $arParams["MESSAGE_TYPE"]=="REPLY") && $arResult["IsAuthorized"] == "N" ||
$arParams["MESSAGE_TYPE"]=="EDIT" && intVal($arResult["MESSAGE"]["AUTHOR_ID"]) <= 0)
{
$arResult["SHOW_PANEL_GUEST"] = "Y";
}
if ($arParams["MESSAGE_TYPE"]=="NEW" || $arParams["MESSAGE_TYPE"]=="EDIT" &&
CForumTopic::CanUserUpdateTopic($arParams["TID"], $USER->GetUserGroupArray(), $USER->GetID()))
{
$arResult["SHOW_PANEL_NEW_TOPIC"] = "Y";
$arResult["ForumPrintIconsList"] = ForumPrintIconsList(7, "ICON_ID", $arResult["TOPIC"]["ICON_ID"], GetMessage("FPF_NO_ICON"),
LANGUAGE_ID, $arParams["PATH_TO_ICON"], $arParams["CACHE_TIME"]);
if ($arParams["SHOW_VOTE"] == "Y")
{
$arResult["SHOW_PANEL_VOTE"] = "Y";
}
}
if ($arParams["FORUM"]["ALLOW_SMILES"]=="Y")
{
$arResult["ForumPrintSmilesList"] = ForumPrintSmilesList($arParams["SMILE_TABLE_COLS"], LANGUAGE_ID,
$arParams["PATH_TO_SMILE"], $arParams["CACHE_TIME"]);
$arResult["SMILES"] = CForumSmile::GetByType("S", LANGUAGE_ID);
示例4: ForumTopOrdinaryTopic
function ForumTopOrdinaryTopic($topic, $TYPE, &$strErrorMessage, &$strOKMessage, $arAddParams = array())
{
global $USER;
$arError = array();
$arOk = array();
$arFields = array("SORT" => $TYPE == "TOP" ? 100 : 150);
$arAddParams = !is_array($arAddParams) ? array($arAddParams) : $arAddParams;
$arAddParams["PERMISSION"] = !empty($arAddParams["PERMISSION"]) ? $arAddParams["PERMISSION"] : false;
$topic = ForumDataToArray($topic);
$forumID = 0;
if (empty($topic)) {
$arError[] = GetMessage("TOTOP_NO_TOPIC");
} else {
if (!CForumUser::IsAdmin() && !$arAddParams["PERMISSION"]) {
$db_res = CForumTopic::GetListEx(array(), array("@ID" => implode(",", $topic), "PERMISSION_STRONG" => true));
} else {
$db_res = CForumTopic::GetListEx(array(), array("@ID" => implode(",", $topic)));
}
if ($db_res && ($res = $db_res->Fetch())) {
do {
if ($arAddParams["PERMISSION"] && !CForumTopic::CanUserUpdateTopic($res["ID"], $USER->GetUserGroupArray(), $USER->GetID(), $arAddParams["PERMISSION"])) {
$arError[] = GetMessage("FMT_NO_PERMS_MODERATE") . " (TID=" . intVal($res["ID"]) . ")";
continue;
}
$ID = CForumTopic::Update($res["ID"], $arFields, True);
if (IntVal($ID) <= 0) {
if ($TYPE == "TOP") {
$arError[] = GetMessage("TOTOP_ERROR_TOP") . " (TID=" . intVal($res["ID"]) . ")";
} else {
$arError[] = GetMessage("TOTOP_ERROR_TOP1") . " (TID=" . intVal($res["ID"]) . ")";
}
} else {
$forumID = $res['FORUM_ID'];
$arTopic["SORT"] = $arFields["SORT"];
$res = serialize($res);
if ($TYPE == "TOP") {
$arOk[] = GetMessage("TOTOP_SUCCESS_TOP") . " (TID=" . intVal($res["ID"]) . ")";
CForumEventLog::Log("topic", "stick", $ID, $res);
} else {
$arOk[] = GetMessage("TOTOP_SUCCESS_TOP1") . " (TID=" . intVal($res["ID"]) . ")";
CForumEventLog::Log("topic", "unstick", $ID, $res);
}
}
} while ($res = $db_res->Fetch());
if (intval($forumID) > 0) {
CForumCacheManager::ClearTag("F", $forumID);
}
} else {
$arError[] = GetMessage("FMT_NO_PERMS_EDIT");
}
}
if (count($arError) > 0) {
$strErrorMessage .= implode(".\n", $arError) . ".\n";
}
if (count($arOk) > 0) {
$strOKMessage .= implode(".\n", $arOk) . ".\n";
}
if (empty($arError)) {
return true;
} else {
return false;
}
}
示例5: array
}
}
if (empty($res["ANSWERS"]) && empty($res["QUESTION"]) && empty($res["ID"])) {
continue;
}
$arResult["QUESTIONS"][] = $res;
}
}
//************* Page info ******************************************/
$arResult["INFO"] = array("HEADER" => $arParams["MESSAGE_TYPE"] == "NEW" ? GetMessage("FPF_CREATE") : GetMessage("FPF_EDIT"), "SUBMIT" => $arParams["MESSAGE_TYPE"] == "NEW" ? GetMessage("FPF_SEND") : GetMessage("FPF_EDIT"), "ICONS_LIST" => "", "SMILES_LIST" => "");
if ($arParams["MESSAGE_TYPE"] == "REPLY") {
$arResult["INFO"]["HEADER"] = GetMessage("FPF_REPLY");
$arResult["INFO"]["SUBMIT"] = GetMessage("FPF_REPLY");
}
//************* Panels *********************************************/
$arResult["SHOW_PANEL"] = array("GUEST" => $arParams["MESSAGE_TYPE"] != "EDIT" && !$USER->IsAuthorized() || $arParams["MESSAGE_TYPE"] == "EDIT" && $arResult["DATA"]["AUTHOR_ID"] <= 0 ? "Y" : "N", "TOPIC" => $arParams["MESSAGE_TYPE"] == "NEW" || $arParams["MESSAGE_TYPE"] == "EDIT" && $arResult["MESSAGE"]["NEW_TOPIC"] == "Y" && CForumTopic::CanUserUpdateTopic($arParams["TID"], $USER->GetUserGroupArray(), $USER->GetID(), $arParams["PERMISSION"]) ? "Y" : "N", "SUBSCRIBE" => "N", "ATTACH" => in_array($arResult["FORUM"]["ALLOW_UPLOAD"], array("Y", "F", "A")) ? "Y" : "N", "CAPTCHA" => !$USER->IsAuthorized() && $arResult["FORUM"]["USE_CAPTCHA"] == "Y" ? "Y" : "N", "CLOSE_ALL" => $arResult["FORUM"]["ALLOW_BIU"] == "Y" || $arResult["FORUM"]["ALLOW_FONT"] == "Y" || $arResult["FORUM"]["ALLOW_ANCHOR"] == "Y" || $arResult["FORUM"]["ALLOW_IMG"] == "Y" || $arResult["FORUM"]["ALLOW_QUOTE"] == "Y" || $arResult["FORUM"]["ALLOW_CODE"] == "Y" || $arResult["FORUM"]["ALLOW_LIST"] == "Y" ? "Y" : "N", "TRANSLIT" => LANGUAGE_ID == "ru" ? "Y" : "N", "EDIT_INFO" => $arParams["MESSAGE_TYPE"] == "EDIT" ? "Y" : "N", "EDIT_INFO_FOR_GUEST" => !$USER->IsAuthorized() ? "Y" : "N", "EDIT_INFO_ASK" => $USER->IsAdmin() ? "Y" : "N", "TAGS" => "Y", "VOTE" => $arParams["SHOW_VOTE"] == "Y" && ($arParams["MESSAGE_TYPE"] == "NEW" || $arParams["MESSAGE_TYPE"] == "EDIT" && CForumTopic::CanUserUpdateTopic($arParams["TID"], $USER->GetUserGroupArray(), $USER->GetID(), $arParams["PERMISSION"])) ? "Y" : "N");
if ($arResult["SHOW_PANEL"]["GUEST"] == "Y") {
$arResult["DATA"]["AUTHOR_NAME"] = !empty($arResult["DATA"]["AUTHOR_NAME"]) ? $arResult["DATA"]["AUTHOR_NAME"] : GetMessage("FPF_GUEST");
}
if ($arResult["SHOW_PANEL"]["TOPIC"] == "Y") {
$arResult["ICONS_LIST"] = ForumPrintIconsList(7, "ICON_ID", $arResult["DATA"]["ICON_ID"], GetMessage("FPF_NO_ICON"), LANGUAGE_ID, $arParams["PATH_TO_ICON"], $arParams["CACHE_TIME"]);
}
if ($arResult["FORUM"]["ALLOW_SMILES"] == "Y") {
$arResult["SMILES_LIST"] = ForumPrintSmilesList($arParams["SMILE_TABLE_COLS"], LANGUAGE_ID, $arParams["PATH_TO_SMILE"], $arParams["CACHE_TIME"]);
$arResult["SMILES"] = CForumSmile::GetByType("S", LANGUAGE_ID);
}
$arResult["SHOW_SUBSCRIBE"] = "N";
if ($arResult["SHOW_PANEL"]["ATTACH"] == "Y") {
foreach ($arResult["DATA"]["FILES"] as $key => $val) {
if (intval($val) > 0) {
$arResult["DATA"]["FILES"][$key] = CFile::GetFileArray($key);