本文整理汇总了PHP中CBlogPost::GetBlogUserPostPerms方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogPost::GetBlogUserPostPerms方法的具体用法?PHP CBlogPost::GetBlogUserPostPerms怎么用?PHP CBlogPost::GetBlogUserPostPerms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogPost
的用法示例。
在下文中一共展示了CBlogPost::GetBlogUserPostPerms方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unset
if ($bIDbyCode) {
$arParams["ID"] = CBlogPost::GetID($arParams["ID"], $arBlog["ID"]);
}
$arPost = CBlogPost::GetByID($arParams["ID"]);
if (empty($arPost) && !$bIDbyCode) {
$arParams["ID"] = CBlogPost::GetID($arParams["ID"], $arBlog["ID"]);
$arPost = CBlogPost::GetByID($arParams["ID"]);
}
if (!empty($arPost) && $arPost["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
unset($arPost);
}
if (!empty($arPost) && $arBlog["ID"] == $arPost["BLOG_ID"]) {
CBlogPost::CounterInc($arParams["ID"]);
$arPost = CBlogTools::htmlspecialcharsExArray($arPost);
$arResult["Post"] = $arPost;
$arResult["PostPerm"] = CBlogPost::GetBlogUserPostPerms($arParams["ID"], $arResult["USER_ID"]);
if ($arPost["AUTHOR_ID"] == $arBlog["OWNER_ID"]) {
$arResult["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arPost["AUTHOR_ID"]));
} else {
$arOwnerBlog = CBlog::GetByOwnerID($arPost["AUTHOR_ID"], $arParams["GROUP_ID"]);
$arResult["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arOwnerBlog["URL"], "user_id" => $arPost["AUTHOR_ID"]));
}
$arResult["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($arResult["Post"]["ID"], $arResult["Post"]["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arPost["AUTHOR_ID"]));
if ($_GET["become_friend"] == "Y" && $arResult["PostPerm"] < BLOG_PERMS_READ) {
if ($USER->IsAuthorized()) {
$dbCandidate = CBlogCandidate::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "USER_ID" => $arResult["USER_ID"]));
if ($arCandidate = $dbCandidate->Fetch()) {
$arResult["MESSAGE"] = GetMessage("B_B_MES_REQUEST_ALREADY") . "<br />";
} else {
if (CBlogCandidate::Add(array("BLOG_ID" => $arBlog["ID"], "USER_ID" => $arResult["USER_ID"]))) {
$arResult["MESSAGE"] = GetMessage("B_B_MES_REQUEST_ADDED") . "<br />";
示例2: GetRSS
//.........这里部分代码省略.........
$arSettings["RSS"] .= "\t<pubDate>" . $arSettings["NOW"] . "</pubDate>\n";
$arSettings["RSS"] .= "\n";
} elseif ($arSettings["RSS_TYPE"] == "atom.03") {
$atomID = "tag:" . htmlspecialcharsbx($arSettings["SERVER_NAME"]) . "," . date("Y-m-d");
$arSettings["RSS"] .= "<" . "?xml version=\"1.0\" encoding=\"" . $arSettings["CHARSET"] . "\"?" . ">\n\n";
$arSettings["RSS"] .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\" xml:lang=\"" . $arSettings["LANGUAGE"] . "\">\n";
$arSettings["RSS"] .= " <title>" . $arSettings["BLOG_NAME"] . "</title>\n";
$arSettings["RSS"] .= " <tagline>" . $arSettings["BLOG_URL"] . "</tagline>\n";
$arSettings["RSS"] .= " <id>" . $atomID . "</id>\n";
$arSettings["RSS"] .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . $arSettings["BLOG_URL"] . "\" />\n";
$arSettings["RSS"] .= " <copyright>Copyright (c) " . $arSettings["SERVER_NAME"] . "</copyright>\n";
$arSettings["RSS"] .= " <modified>" . $arSettings["NOW_ISO"] . "</modified>\n";
$arSettings["RSS"] .= "\n";
}
$arParserParams = array("imageWidth" => $arPathTemplates["IMAGE_MAX_WIDTH"], "imageHeight" => $arPathTemplates["IMAGE_MAX_HEIGHT"]);
//Text Parser
$parser = new blogTextParser();
//SELECT
$arSelFields = array("ID", "TITLE", "DETAIL_TEXT", "DATE_PUBLISH", "AUTHOR_ID", "BLOG_USER_ALIAS", "BLOG_ID", "DETAIL_TEXT_TYPE", "BLOG_URL", "BLOG_OWNER_ID", "BLOG_SOCNET_GROUP_ID", "BLOG_GROUP_SITE_ID", "CODE", self::UFCategroryCodeField);
//WHERE
$arFilter = array("<=DATE_PUBLISH" => ConvertTimeStamp(false, "FULL", false), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "BLOG_ENABLE_RSS" => "Y", "MICRO" => "N");
if (intval($arSettings["BLOG_CODE"]) === $arSettings["BLOG_CODE"]) {
$arFilter["BLOG_ID"] = $arSettings["BLOG_CODE"];
} else {
$arFilter["BLOG_URL"] = $arSettings["BLOG_CODE"];
}
//Extend standart filter
$arFilter = array_merge($arFilter, $arFilterExt);
CTimeZone::Disable();
$dbPosts = CBlogPost::GetList(array("DATE_PUBLISH" => "DESC"), $arFilter, false, array("nTopCount" => $numPosts), $arSelFields);
CTimeZone::Enable();
while ($arPost = $dbPosts->Fetch()) {
//Can read
if (CBlogPost::GetBlogUserPostPerms($arPost["ID"], $arSettings["CURRENT_USER_ID"]) < BLOG_PERMS_READ) {
continue;
}
$arAuthorUser = $USER->GetByID($arPost["AUTHOR_ID"])->Fetch();
$author = CBlogUser::GetUserName($arPost["BLOG_USER_ALIAS"], $arAuthorUser["NAME"], $arAuthorUser["LAST_NAME"], $arAuthorUser["LOGIN"], $arAuthorUser["SECOND_NAME"]);
$title = str_replace(array("&", "<", ">", "\""), array("&", "<", ">", """), $author . ": " . $arPost["TITLE"]);
//Idea Images
$arImages = array();
$res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arPost["BLOG_ID"], "IS_COMMENT" => "N"));
while ($arImage = $res->Fetch()) {
$arImages[$arImage['ID']] = $arImage['FILE_ID'];
}
$arDate = ParseDateTime($arPost["DATE_PUBLISH"], CSite::GetDateFormat("FULL", $arPost["BLOG_GROUP_SITE_ID"]));
$date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
if (!empty($arPathTemplates)) {
$url = htmlspecialcharsbx("http://" . $arSettings["SERVER_NAME"] . CComponentEngine::MakePathFromTemplate($arPathTemplates["BLOG_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplates["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
} else {
$url = htmlspecialcharsbx("http://" . $arSettings["SERVER_NAME"] . CBlogPost::PreparePath(htmlspecialcharsbx($arPost["BLOG_URL"]), $arPost["ID"], $arPost["BLOG_GROUP_SITE_ID"]));
}
$category = "";
if (isset($arPost[self::UFCategroryCodeField]) && is_array($arSettings["CATEGORIES"][ToUpper($arPost[self::UFCategroryCodeField])])) {
$category = htmlspecialcharsbx($arSettings["CATEGORIES"][ToUpper($arPost[self::UFCategroryCodeField])]["NAME"]);
}
if (strlen($arPathTemplates["USER"]) > 0) {
$authorURL = htmlspecialcharsbx("http://" . $arSettings["SERVER_NAME"] . CComponentEngine::MakePathFromTemplate($arPathTemplates["USER"], array("user_id" => $arPost["AUTHOR_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
} else {
$authorURL = htmlspecialcharsbx("http://" . $arSettings["SERVER_NAME"] . CBlogUser::PreparePath($arPost["AUTHOR_ID"], $arPost["BLOG_GROUP_SITE_ID"]));
}
if ($arPost["DETAIL_TEXT_TYPE"] == "html") {
$IdeaText = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "Y", "NL2BR" => "N", "QUOTE" => "Y", "CODE" => "Y"), true, $arParserParams);
} else {
$IdeaText = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, false, true, $arParserParams);
}
示例3: intVal
$arParams["EDITOR_DEFAULT_HEIGHT"] = intVal($arParams["EDITOR_DEFAULT_HEIGHT"]);
if (IntVal($arParams["EDITOR_DEFAULT_HEIGHT"]) <= 0) {
$arParams["EDITOR_DEFAULT_HEIGHT"] = 300;
}
$user_id = $USER->GetID();
$arResult["UserID"] = $user_id;
$arResult["enable_trackback"] = COption::GetOptionString("blog", "enable_trackback", "Y");
$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";
$arParams["SEO_USE"] = $arParams["SEO_USE"] == "Y" ? "Y" : "N";
$arResult["preview"] = strlen($_POST["preview"]) > 0 ? "Y" : "N";
$arBlog = CBlog::GetByUrl($arParams["BLOG_URL"], $arParams["GROUP_ID"]);
if (IntVal($arParams["ID"]) > 0) {
$arResult["perms"] = CBlogPost::GetBlogUserPostPerms($arParams["ID"], $arResult["UserID"]);
} else {
$arResult["perms"] = CBlog::GetBlogUserPostPerms($arBlog["ID"], $arResult["UserID"]);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_REQUEST['mfi_mode']) && $_REQUEST['mfi_mode'] == "upload") {
CBlogImage::AddImageResizeHandler(array("width" => 400, "height" => 400));
}
if (!empty($arBlog) && $arBlog["ACTIVE"] == "Y") {
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if ($arGroup["SITE_ID"] == SITE_ID) {
$arResult["Blog"] = $arBlog;
$arResult["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"]));
if (IntVal($arParams["ID"]) > 0 && ($arPost = CBlogPost::GetByID($arParams["ID"]))) {
$arPost = CBlogTools::htmlspecialcharsExArray($arPost);
$arResult["Post"] = $arPost;
if ($arParams["SET_TITLE"] == "Y" && !$arParams["MICROBLOG"]) {
示例4: array
if (empty($arResult["FILE"])) {
$arError = array("code" => "EMPTY FILE", "title" => GetMessage("F_EMPTY_FID"));
} else {
if (intVal($arResult["FILE_INFO"]["POST_ID"]) > 0) {
if (empty($arResult['POST'])) {
$dbPost = CBlogPost::GetList(array(), array("ID" => $arResult["FILE_INFO"]["POST_ID"], "BLOG_ID" => $arResult["FILE_INFO"]["BLOG_ID"]), false, false, array("ID", "BLOG_ID", "BLOG_OWNER_ID", "BLOG_SOCNET_GROUP_ID", "BLOG_USE_SOCNET", "AUTHOR_ID"));
$arResult["POST"] = $dbPost->Fetch();
}
if (!empty($arResult['POST'])) {
if ($arResult["POST"]["BLOG_USE_SOCNET"] == "Y") {
if (!CModule::IncludeModule("socialnetwork")) {
return;
}
$arParams["PERMISSION"] = CBlogPost::GetSocNetPostPerms($arResult["POST"]["ID"]);
} else {
$arParams["PERMISSION"] = CBlogPost::GetBlogUserPostPerms($arResult["POST"]["ID"], $user_id);
}
}
}
}
if (empty($arError)) {
if (empty($arResult["POST"])) {
$arError = array("code" => "EMPTY POST", "title" => GetMessage("F_EMPTY_MID"));
} elseif ($arParams["PERMISSION"] < BLOG_PERMS_READ) {
$arError = array("code" => "NOT RIGHT", "title" => GetMessage("F_NOT_RIGHT"));
}
}
if (!empty($arError)) {
require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_after.php";
echo ShowError(!empty($arError["title"]) ? $arError["title"] : $arError["code"]);
require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog.php";
示例5: BuildRSSAll
//.........这里部分代码省略.........
$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 .= " <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";
}
$parser = new blogTextParser();
$arParserParams = array("imageWidth" => $arPathTemplates["IMAGE_MAX_WIDTH"], "imageHeight" => $arPathTemplates["IMAGE_MAX_HEIGHT"]);
$arFilter = array("<=DATE_PUBLISH" => ConvertTimeStamp(false, "FULL", false), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "BLOG_ENABLE_RSS" => "Y", "MICRO" => "N");
$arSelFields = array("ID", "TITLE", "DETAIL_TEXT", "DATE_PUBLISH", "AUTHOR_ID", "BLOG_USER_ALIAS", "BLOG_ID", "DETAIL_TEXT_TYPE", "BLOG_URL", "BLOG_OWNER_ID", "BLOG_SOCNET_GROUP_ID", "BLOG_GROUP_SITE_ID", "CODE", "PATH");
if (!empty($arGroup)) {
$arFilter["BLOG_GROUP_ID"] = $arGroup["ID"];
} elseif (count($arGroupID) > 0) {
$arFilter["BLOG_GROUP_ID"] = $arGroupID;
}
if (count($arAvBlog) > 0) {
$arFilter["BLOG_ID"] = $arAvBlog;
}
if ($siteID !== false) {
$arFilter["BLOG_GROUP_SITE_ID"] = $siteID;
}
if ($bUserSocNet == "Y") {
$arFilter["BLOG_USE_SOCNET"] = "Y";
$arFilter["FOR_USER"] = $user_id;
unset($arFilter["MICRO"]);
}
CTimeZone::Disable();
$dbPosts = CBlogPost::GetList(array("DATE_PUBLISH" => "DESC"), $arFilter, false, array("nTopCount" => $numPosts), $arSelFields);
CTimeZone::Enable();
while ($arPost = $dbPosts->Fetch()) {
$perms = CBlogPost::GetBlogUserPostPerms($arPost["ID"], $GLOBALS["USER"]->IsAuthorized() ? $GLOBALS["USER"]->GetID() : 0);
if ($perms < BLOG_PERMS_READ) {
continue;
}
$dbUser = CUser::GetByID($arPost["AUTHOR_ID"]);
$arUser = $dbUser->Fetch();
$author = CBlogUser::GetUserName($arPost["BLOG_USER_ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"], $arUser["SECOND_NAME"]);
$title = str_replace(array("&", "<", ">", "\""), array("&", "<", ">", """), $author . ": " . $arPost["TITLE"]);
$arImages = array();
$res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arPost["BLOG_ID"], "IS_COMMENT" => "N"));
while ($arImage = $res->Fetch()) {
$arImages[$arImage['ID']] = $arImage['FILE_ID'];
}
$arDate = ParseDateTime($arPost["DATE_PUBLISH"], CSite::GetDateFormat("FULL", $arPost["BLOG_GROUP_SITE_ID"]));
$date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
if (strlen($arPost["PATH"]) > 0) {
$url = htmlspecialcharsbx("http://" . $serverName . str_replace("#post_id#", CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), $arPost["PATH"]));
} elseif (!empty($arPathTemplates)) {
if (IntVal($arPost["BLOG_SOCNET_GROUP_ID"]) > 0 && strlen($arPathTemplates["GROUP_BLOG_POST"]) > 0) {
$url = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($arPathTemplates["GROUP_BLOG_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplates["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
} else {
$url = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($arPathTemplates["BLOG_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplates["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
}
} elseif (strLen($postTemplate) > 0) {
$url = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($postTemplate, array("blog" => $arPost["BLOG_URL"], "post_id" => $arPost["ID"], "user_id" => $arPost["BLOG_OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
} else {
$url = htmlspecialcharsbx("http://" . $serverName . CBlogPost::PreparePath(htmlspecialcharsbx($arPost["BLOG_URL"]), $arPost["ID"], $arPost["BLOG_GROUP_SITE_ID"]));
}
$category = htmlspecialcharsbx($arPost["CATEGORY_NAME"]);
if (strlen($arPathTemplates["USER"]) > 0) {
$authorURL = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($arPathTemplates["USER"], array("user_id" => $arPost["AUTHOR_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
} elseif (strLen($userTemplate) > 0) {
$authorURL = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($userTemplate, array("user_id" => $arPost["AUTHOR_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));