本文整理汇总了PHP中CBlog::GetBlogUserPostPerms方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlog::GetBlogUserPostPerms方法的具体用法?PHP CBlog::GetBlogUserPostPerms怎么用?PHP CBlog::GetBlogUserPostPerms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlog
的用法示例。
在下文中一共展示了CBlog::GetBlogUserPostPerms方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if ($arGroup["SITE_ID"] == SITE_ID) {
$arResult["Blog"] = $arBlog;
$arResult["urlToCurrentBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arParams["BLOG_URL"]));
} else {
unset($arBlog);
}
} else {
unset($arBlog);
}
} elseif (!empty($arOwnBlog)) {
$arBlog = $arOwnBlog;
}
if (!empty($arBlog)) {
if (IntVal($user_id) > 0) {
$perm = CBlog::GetBlogUserPostPerms($arBlog["ID"], $user_id);
if ($perm >= BLOG_PERMS_WRITE) {
$arResult["urlToDraft"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_DRAFT"], array("blog" => $arBlog["URL"]));
$arResult["urlToNewPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST_EDIT"], array("blog" => $arBlog["URL"], "post_id" => "new"));
if ($perm >= BLOG_PERMS_MODERATE) {
$arResult["urlToModeration"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MODERATION"], array("blog" => $arBlog["URL"]));
$dbPost = CBlogPost::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_READY), array("COUNT" => "ID"), false, array("ID", "BLOG_ID"));
if ($arPost = $dbPost->Fetch()) {
$arResult["CntToModerate"] = $arPost["ID"];
}
}
$dbPost = CBlogPost::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_DRAFT, "AUTHOR_ID" => $user_id), array("COUNT" => "ID"), false, array("ID", "BLOG_ID"));
if ($arPost = $dbPost->Fetch()) {
$arResult["CntToDraft"] = $arPost["ID"];
}
$arResult["SecondLine"] = "Y";
示例2: ShowError
if (empty($arResult["BLOG"])) {
ShowError(GetMessage("BLOG_BLOG_BLOG_NO_BLOG"));
CHTTP::SetStatus("404 Not Found");
return;
}
$arBlog = $arResult["BLOG"];
$tmpVal = COption::GetOptionInt("idea", "blog_group_id", false, SITE_ID);
if (intval($arBlog["GROUP_ID"]) > 0 && (!$tmpVal || $tmpVal != intval($arBlog["GROUP_ID"]))) {
COption::SetOptionInt("idea", "blog_group_id", $arBlog["GROUP_ID"], false, SITE_ID);
}
$arFilter = is_string($arParams["FILTER_NAME"]) && preg_match("/^[A-Za-z_][A-Za-z01-9_]*\$/i", $arParams["FILTER_NAME"]) ? $GLOBALS[$arParams["FILTER_NAME"]] : array();
$arFilter = is_array($arFilter) ? $arFilter : array();
$arResult["ERROR_MESSAGE"] = array();
$arResultNFCache = array("OK_MESSAGE" => array(), "ERROR_MESSAGE" => array());
$user_id = intval($USER->GetID());
$arResult["PostPerm"] = CBlog::GetBlogUserPostPerms($arResult["BLOG"]["ID"], $user_id);
$arUserGroups = $GLOBALS["USER"]->IsAuthorized() ? CBlogUser::GetUserGroups($user_id, $arParams["BLOG_URL"], "Y", BLOG_BY_USER_ID, "URL") : array(1);
sort($arUserGroups);
$cache_id = "blog_blog_message_" . serialize(array($arParams["BLOG_URL"], $arParams["RATING_TEMPLATE"], $arParams["SORT_BY1"] => $arParams["SORT_ORDER1"], $arParams["SORT_BY2"] => $arParams["SORT_ORDER2"], $arParams["IBLOCK_CATEGORIES"], $arParams["EXT_FILTER"], $arParams["PATH_TO_BLOG"], $arParams["POST_PROPERTY_LIST"], $arParams["DATE_TIME_FORMAT"], $arParams["NAV_TEMPLATE"], $arParams["GROUP_ID"], $arParams["NAME_TEMPLATE"], $arParams["SHOW_LOGIN"], $arParams["IMAGE_MAX_WIDTH"], $arParams["IMAGE_MAX_HEIGHT"], $arParams["ALLOW_POST_CODE"], $arParams["CATEGORY_ID"], CDBResult::NavStringForCache($arParams["MESSAGE_COUNT"]), $arUserGroups, $arResult["PostPerm"], $arResult["IDEA_MODERATOR"]));
if (!isset($_GET["PAGEN_1"]) || IntVal($_GET["PAGEN_1"]) < 1) {
$CACHE_TIME = $arParams["CACHE_TIME"];
$cache_path = "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/first_page/";
} else {
$CACHE_TIME = $arParams["CACHE_TIME_LONG"];
$cache_path = "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/pages/" . IntVal($_GET["PAGEN_1"]) . "/";
}
/********************************************************************
/Default params
********************************************************************/
/********************************************************************
Actions
示例3: trim
//chk
$arResult["VARIABLES"]["blog"] = $arParams["BLOG_URL"];
//Page navigation template
$arParams["NAV_TEMPLATE"] = trim($arParams["NAV_TEMPLATE"]);
$arParams["NAV_TEMPLATE"] = empty($arParams["NAV_TEMPLATE"]) ? "arrows" : $arParams["NAV_TEMPLATE"];
//Search
if ($this->__page == 'index') {
ob_start();
$APPLICATION->IncludeComponent("bitrix:idea.search", "", array(), $component);
$arResult["ACTIONS"]["SEARCH"] = array("HTML" => ob_get_contents());
ob_end_clean();
}
//Can Add Idea
if ($USER->IsAuthorized()) {
$arBlog = CBlog::GetByUrl($arParams["BLOG_URL"]);
if (CBlog::GetBlogUserPostPerms($arBlog["ID"], $USER->GetID()) >= BLOG_PERMS_PREMODERATE) {
$arResult["ACTIONS"]["ADD_IDEA"] = array("ICON" => "btn-new section-add", "TEXT" => GetMessage("IDEA_ADD_IDEA_TITLE"), "LINK" => $arResult["~PATH_TO_POST_ADD"]);
}
}
//Can Add category
if ($USER->IsAuthorized() && $arParams["IBLOCK_CATEGORIES"] > 0 && CIBlock::GetPermission($arParams["IBLOCK_CATEGORIES"], $USER->GetID()) >= "W") {
$arButtons = CIBlock::GetPanelButtons($arParams["IBLOCK_CATEGORIES"], 0, 0, array("SESSID" => false));
$arResult["ACTIONS"]["ADD_IDEA_CATEGORY"] = array("ICON" => "btn-new section-add", "TEXT" => GetMessage("IDEA_ADD_IDEA_CATEGORY_TITLE"), "LINK" => $arButtons["edit"]["add_section"]["ACTION"]);
}
//Menu
if ($USER->IsAuthorized()) {
$arResult["ACTIONS"]["MENU"] = array("TEXT" => GetMessage("IDEA_MENU_TITLE"), "MENU" => array());
//Own ideas
$arResult["ACTIONS"]["MENU"]["MENU"][] = array("TEXT" => GetMessage("IDEA_MY_IDEA_TITLE"), "ONCLICK" => "top.window.location.href='" . $arResult["~PATH_TO_USER_IDEAS"] . "';");
$arResult["ACTIONS"]["MENU"]["MENU"][] = array("SEPARATOR" => true);
//Own subscribes
示例4: foreach
if (IntVal($newID) > 0) {
CBlogPostCategory::DeleteByPostID($newID);
foreach ($CATEGORYtmp as $v) {
CBlogPostCategory::Add(array("BLOG_ID" => $arBlog["ID"], "POST_ID" => $newID, "CATEGORY_ID" => $v));
}
$DB->Query("UPDATE b_blog_image SET POST_ID=" . $newID . " WHERE BLOG_ID=" . $arBlog["ID"] . " AND POST_ID=0", true);
if (strlen($TRACKBACK) > 0) {
$arPingUrls = explode("\n", $TRACKBACK);
CBlogTrackback::SendPing($newID, $arPingUrls);
}
}
//move/copy post to another blog
if (IntVal($newID) > 0 && IntVal($_POST["move2blog"]) > 0 && $arParams["ALLOW_POST_MOVE"] == "Y") {
if ($arCopyBlog = CBlog::GetByID($_POST["move2blog"])) {
$copyPerms = BLOG_PERMS_DENY;
$copyPerms = CBlog::GetBlogUserPostPerms($arCopyBlog["ID"], $user_id);
if ($copyPerms >= BLOG_PERMS_PREMODERATE) {
$arCopyPost = CBlogPost::GetByID($arParams["ID"]);
$arCopyPost["BLOG_ID"] = $arCopyBlog["ID"];
unset($arCopyPost["ID"]);
unset($arCopyPost["ATTACH_IMG"]);
unset($arCopyPost["VIEWS"]);
$pathTemplate = htmlspecialcharsBack($arParams["PATH_TO_POST"]);
$pathTemplateEdit = htmlspecialcharsBack($arParams["PATH_TO_POST_EDIT"]);
$pathTemplateDraft = htmlspecialcharsBack($arParams["PATH_TO_DRAFT"]);
$pathTemplateBlog = htmlspecialcharsBack($arParams["PATH_TO_BLOG"]);
//take from new params
$pathTemplate = htmlspecialcharsBack($arParams["PATH_TO_BLOG_POST"]);
$pathTemplateEdit = htmlspecialcharsBack($arParams["PATH_TO_BLOG_POST_EDIT"]);
$pathTemplateDraft = htmlspecialcharsBack($arParams["PATH_TO_BLOG_DRAFT"]);
$pathTemplateBlog = htmlspecialcharsBack($arParams["PATH_TO_BLOG_BLOG"]);
示例5: BuildRSS
//.........这里部分代码省略.........
$atomID = "tag:" . htmlspecialcharsbx($serverName) . "," . date("Y-m-d") . ":" . $ID;
$rssText .= "<" . "?xml version=\"1.0\" encoding=\"" . $charset . "\"?" . ">\n\n";
$rssText .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\" xml:lang=\"" . $language . "\">\n";
$rssText .= " <title>" . $blogName . "</title>\n";
$rssText .= " <tagline>" . $blogURL . "</tagline>\n";
//$rssText .= " <link href=\"".$blogURL."\"/>";
$rssText .= " <id>" . $atomID . "</id>\n";
$rssText .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . $blogURL . "\" />\n";
$rssText .= " <copyright>Copyright (c) " . $blogURL . "</copyright>\n";
$rssText .= " <modified>" . $nowISO . "</modified>\n";
$rssText .= "\n";
}
$user_id = IntVal($GLOBALS["USER"]->GetID());
if ($bSoNet) {
$postPerm = BLOG_PERMS_DENY;
if (IntVal($arParams["SOCNET_GROUP_ID"]) > 0) {
if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "blog", "view_post")) {
$postPerm = BLOG_PERMS_READ;
}
if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "blog", "write_post")) {
$postPerm = BLOG_PERMS_WRITE;
}
if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "blog", "full_post", CSocNetUser::IsCurrentUserModuleAdmin()) || $GLOBALS["APPLICATION"]->GetGroupRight("blog") >= "W") {
$postPerm = BLOG_PERMS_FULL;
}
} else {
if ($user_id == $arParams["USER_ID"]) {
$postPerm = BLOG_PERMS_FULL;
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $arParams["USER_ID"], "blog", "view_post")) {
$postPerm = BLOG_PERMS_READ;
}
}
} else {
$postPerm = CBlog::GetBlogUserPostPerms($ID, IntVal($user_id));
}
if ($postPerm >= BLOG_PERMS_READ) {
$parser = new blogTextParser();
$arParserParams = array("imageWidth" => $arParams["IMAGE_MAX_WIDTH"], "imageHeight" => $arParams["IMAGE_MAX_HEIGHT"]);
if ($bSoNet) {
$arFilter = array("<=DATE_PUBLISH" => ConvertTimeStamp(false, "FULL", false), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "BLOG_ACTIVE" => "Y", "BLOG_GROUP_SITE_ID" => SITE_ID);
if (IntVal($arParams["SOCNET_GROUP_ID"]) > 0) {
$arFilter["SOCNET_GROUP_ID"] = $arParams["SOCNET_GROUP_ID"];
} else {
$arFilter["FOR_USER"] = $user_id;
$arFilter["AUTHOR_ID"] = $arParams["USER_ID"];
}
} else {
$arFilter = array("BLOG_ID" => $ID, "<=DATE_PUBLISH" => ConvertTimeStamp(false, "FULL", false), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "MICRO" => "N");
}
CTimeZone::Disable();
$dbPosts = CBlogPost::GetList(array("DATE_PUBLISH" => "DESC"), $arFilter, false, array("nTopCount" => $numPosts), array("ID", "TITLE", "DETAIL_TEXT", "DATE_PUBLISH", "AUTHOR_ID", "AUTHOR_NAME", "AUTHOR_LAST_NAME", "BLOG_USER_ALIAS", "DETAIL_TEXT_TYPE", "CODE", "PATH"));
CTimeZone::Enable();
while ($arPost = $dbPosts->Fetch()) {
if (!$bSoNet) {
$perms = CBlogPost::GetBlogUserPostPerms($arPost["ID"], $GLOBALS["USER"]->IsAuthorized() ? $GLOBALS["USER"]->GetID() : 0);
if ($perms < BLOG_PERMS_READ) {
continue;
}
}
//$title = htmlspecialcharsEx($arPost["TITLE"]);
$title = str_replace(array("&", "<", ">", "\""), array("&", "<", ">", """), $arPost["TITLE"]);
$res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost['ID'], "BLOG_ID" => $ID, "IS_COMMENT" => "N"));
while ($arImage = $res->Fetch()) {
$arImages[$arImage['ID']] = $arImage['FILE_ID'];
}
$arDate = ParseDateTime($arPost["DATE_PUBLISH"], CSite::GetDateFormat("FULL", $arGroup["SITE_ID"]));
示例6: array
$arParams["EDITOR_DEFAULT_HEIGHT"] = 300;
}
$arResult["UserID"] = $USER->GetID();
$arResult["allowHTML"] = COption::GetOptionString("blog", "allow_html", "N");
$arResult["allowVideo"] = COption::GetOptionString("blog", "allow_video", "Y");
$blogModulePermissions = $APPLICATION->GetGroupRight("blog");
$arParams["ALLOW_POST_CODE"] = $arParams["ALLOW_POST_CODE"] !== "N";
$arParams["USE_GOOGLE_CODE"] = $arParams["USE_GOOGLE_CODE"] === "Y";
if ($arParams["DISABLE_SONET_LOG"] != "Y") {
$arParams["DISABLE_SONET_LOG"] = "N";
}
$arBlog = CBlog::GetByUrl($arParams["BLOG_URL"]);
if (IntVal($arParams["ID"]) > 0) {
$arResult["perms"] = CBlogPost::GetBlogUserPostPerms($arParams["ID"], $arResult["UserID"]);
} else {
$arResult["perms"] = CBlog::GetBlogUserPostPerms($arBlog["ID"], $arResult["UserID"]);
}
if (!empty($arBlog) && $arBlog["ACTIVE"] == "Y" || $arResult["bSoNet"] && empty($arBlog)) {
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if ($arGroup["SITE_ID"] == SITE_ID || $arResult["bSoNet"] && empty($arBlog)) {
if ($arResult["allowHTML"] == "Y" && $arBlog["ALLOW_HTML"] == "Y") {
$arResult["allow_html"] = "Y";
}
$arResult["Blog"] = $arBlog;
//NavChain, Title & Prepare data
if (IntVal($arParams["ID"]) > 0 && ($arPost = CBlogPost::GetByID($arParams["ID"]))) {
$arPost = CBlogTools::htmlspecialcharsExArray($arPost);
$arResult["Post"] = $arPost;
if ($arParams["SET_TITLE"] == "Y") {
$APPLICATION->SetTitle(GetMessage("BLOG_POST_EDIT", array("#IDEA_TITLE#" => $arResult["Post"]["TITLE"])));
}