本文整理匯總了PHP中CBlogPost::GetList方法的典型用法代碼示例。如果您正苦於以下問題:PHP CBlogPost::GetList方法的具體用法?PHP CBlogPost::GetList怎麽用?PHP CBlogPost::GetList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CBlogPost
的用法示例。
在下文中一共展示了CBlogPost::GetList方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: UnBind
public function UnBind()
{
if(!$this->IsAvailable())
return false;
//Comment doesn't exists
$arComment = $this->Get();
if(!$arComment)
return false;
$arIdea = CBlogPost::GetList(array(), array("ID" => $arComment["POST_ID"]), false, false, array("ID", CIdeaManagment::UFAnswerIdField))->Fetch();
if($arIdea)
{
if(!is_array($arIdea[CIdeaManagment::UFAnswerIdField]))
$arIdea[CIdeaManagment::UFAnswerIdField] = array();
$arIdea[CIdeaManagment::UFAnswerIdField] = array_unique($arIdea[CIdeaManagment::UFAnswerIdField]);
$key = array_search($arComment["ID"], $arIdea[CIdeaManagment::UFAnswerIdField]);
if(is_numeric($key))
{
unset($arIdea[CIdeaManagment::UFAnswerIdField][$key], $arIdea["ID"]);
return CBlogPost::Update($arComment["POST_ID"], $arIdea)>0;
}
}
return false;
}
示例2: __AutoSetPerms
function __AutoSetPerms($ID)
{
$ID = IntVal($ID);
$arGroupPerms = CBlogUserGroupPerms::GetByID($ID);
if (IntVal($arGroupPerms["POST_ID"]) == 0) {
$dbBlogPosts = CBlogPost::GetList(array(), array("BLOG_ID" => $arGroupPerms["BLOG_ID"]), false, false, array("ID"));
while ($arBlogPosts = $dbBlogPosts->Fetch()) {
$dbGroupPerms1 = CBlogUserGroupPerms::GetList(array(), array("BLOG_ID" => $arGroupPerms["BLOG_ID"], "USER_GROUP_ID" => $arGroupPerms["USER_GROUP_ID"], "PERMS_TYPE" => $arGroupPerms["PERMS_TYPE"], "POST_ID" => $arBlogPosts["ID"]), false, false, array("ID", "AUTOSET", "PERMS"));
if ($arGroupPerms1 = $dbGroupPerms1->Fetch()) {
if ($arGroupPerms1["AUTOSET"] == "Y" && $arGroupPerms["PERMS"] != $arGroupPerms1["PERMS"]) {
CBlogUserGroupPerms::Update($arGroupPerms1["ID"], array("PERMS" => $arGroupPerms["PERMS"]));
}
} else {
CBlogUserGroupPerms::Add(array("BLOG_ID" => $arGroupPerms["BLOG_ID"], "USER_GROUP_ID" => $arGroupPerms["USER_GROUP_ID"], "PERMS_TYPE" => $arGroupPerms["PERMS_TYPE"], "POST_ID" => $arBlogPosts["ID"], "PERMS" => $arGroupPerms["PERMS"], "AUTOSET" => "Y"));
}
}
}
}
示例3: prepareData
protected function prepareData()
{
if (strlen(trim($this->arParams["NAME_TEMPLATE"])) <= 0) {
$this->arParams["NAME_TEMPLATE"] = \CSite::GetNameFormat();
}
$dbPost = \CBlogPost::GetList(array(), array("ID" => $this->arParams["postId"]), false, false, array("ID", "BLOG_ID", "PUBLISH_STATUS", "TITLE", "AUTHOR", "ENABLE_COMMENTS", "NUM_COMMENTS", "VIEWS", "CODE", "MICRO", "DETAIL_TEXT", "DATE_PUBLISH", "CATEGORY_ID", "HAS_SOCNET_ALL", "HAS_TAGS", "HAS_IMAGES", "HAS_PROPS", "HAS_COMMENT_IMAGES"));
if ($arPost = $dbPost->Fetch()) {
if (strlen($arPost['TITLE']) > 30) {
$arPost['TITLE'] = substr($arPost['TITLE'], 0, 30) . "...";
}
$this->arResult['POST'] = $arPost;
$this->arResult['POST']['PUBLISH_STATUS_DESCRIPTION'] = Loc::getMessage('BLOG_POST_PUBLISH_STATUS_' . $arPost['PUBLISH_STATUS']);
$this->arResult['POST']['AUTHOR_FORMATTED_NAME'] = \CUser::FormatName($this->arParams['NAME_TEMPLATE'], array('LOGIN' => $this->arResult['POST']['LOGIN'], 'NAME' => $this->arResult['POST']['NAME'], 'LAST_NAME' => $this->arResult['POST']['LAST_NAME']), true, false);
$this->arResult["POST"]['AUTHOR_PROFILE'] = \CComponentEngine::MakePathFromTemplate($this->arParams["PATH_TO_USER_PROFILE"], array("user_id" => $this->arResult['POST']['AUTHOR']));
$this->arResult["POST"]['AUTHOR_UNIQID'] = 'u_' . $this->randString();
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS['CACHE_MANAGER']->RegisterTag('blog_post_' . $this->arParams['postId']);
}
}
}
示例4: array
//@::Idea| If moderator the display hidden posts
if ($arResult["IDEA_MODERATOR"]) {
$arFilter["PUBLISH_STATUS"] = array(BLOG_PUBLISH_STATUS_PUBLISH, BLOG_PUBLISH_STATUS_READY, BLOG_PUBLISH_STATUS_DRAFT);
} else {
$arFilter["PUBLISH_STATUS"] = BLOG_PUBLISH_STATUS_PUBLISH;
}
$arFilter["BLOG_ID"] = $arBlog["ID"];
if (IntVal($arParams["CATEGORY_ID"]) > 0) {
$arFilter["CATEGORY_ID_F"] = $arParams["CATEGORY_ID"];
if ($arParams["SET_TITLE"] == "Y") {
$arCat = CBlogCategory::GetByID($arFilter["CATEGORY_ID_F"]);
$arResult["title"]["category"] = CBlogTools::htmlspecialcharsExArray($arCat);
}
}
$arResult["filter"] = $arFilter;
$dbPost = CBlogPost::GetList($SORT, array_merge($arParams["EXT_FILTER"], $arFilter), false, array("bDescPageNumbering" => true, "nPageSize" => $arParams["MESSAGE_COUNT"], "bShowAll" => false), array("ID", "TITLE", "BLOG_ID", "AUTHOR_ID", "PREVIEW_TEXT", "PREVIEW_TEXT_TYPE", "DETAIL_TEXT", "DETAIL_TEXT_TYPE", "DATE_CREATE", "DATE_PUBLISH", "KEYWORDS", "PUBLISH_STATUS", "ATRIBUTE", "ATTACH_IMG", "ENABLE_TRACKBACK", "ENABLE_COMMENTS", "VIEWS", "NUM_COMMENTS", "CODE", "MICRO", "CATEGORY_ID"));
$arResult["NAV_STRING"] = $dbPost->GetPageNavStringEx($navComponentObject, GetMessage("MESSAGE_COUNT"), $arParams["NAV_TEMPLATE"], false, $this->__component->__parent ? $this->__component->__parent : $this->__component);
$arResult["NAV_CACHED_DATA"] = $navComponentObject->GetTemplateCachedData();
$arResult["POST"] = array();
$arResult["IDS"] = array();
$p = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
$arParserParams = array("imageWidth" => $arParams["IMAGE_MAX_WIDTH"], "imageHeight" => $arParams["IMAGE_MAX_HEIGHT"]);
while ($CurPost = $dbPost->GetNext()) {
$CurPost["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($CurPost["ID"], $CurPost["CODE"], $arParams["ALLOW_POST_CODE"])));
$CurPost["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $CurPost["AUTHOR_ID"]));
$arImages = array();
$res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $CurPost['ID'], "BLOG_ID" => $arBlog['ID']));
while ($arImage = $res->Fetch()) {
$arImages[$arImage['ID']] = $arImage['FILE_ID'];
}
if ($CurPost["DETAIL_TEXT_TYPE"] == "html" && COption::GetOptionString("blog", "allow_html", "N") == "Y") {
示例5: array
$arBlogPostId = array();
foreach ($arBlogPostFields as $BlogPostFields) {
$arBlogPostId[] = CBlogPost::Add($BlogPostFields);
}
foreach ($arBlogPostId as $key => $BlogPostId) {
if (!is_array($categoryID[$key])) {
continue;
}
foreach ($categoryID[$key] as $v) {
CBlogPostCategory::Add(array("BLOG_ID" => $blogID, "POST_ID" => $BlogPostId, "CATEGORY_ID" => $v));
}
}
//Post Comments
$arBlogCommentFields = array();
$arBlogCommentFields[] = array("TITLE" => '', "POST_TEXT" => GetMessage("IDEA_BLOG_DEMO_COMMENT_BODY_1"), "BLOG_ID" => $blogID, "POST_ID" => $arBlogPostId[0], "PARENT_ID" => 0, "AUTHOR_ID" => 1, "DATE_CREATE" => ConvertTimeStamp(false, "FULL"), "AUTHOR_IP" => "192.168.0.108", "PATH" => "/services/idea/#post_id#/?commentId=#comment_id###comment_id#");
$arBlogCommentFields[] = array("TITLE" => '', "POST_TEXT" => GetMessage("IDEA_BLOG_DEMO_COMMENT_BODY_2"), "BLOG_ID" => $blogID, "POST_ID" => $arBlogPostId[0], "PARENT_ID" => 0, "AUTHOR_ID" => 1, "DATE_CREATE" => ConvertTimeStamp(false, "FULL"), "AUTHOR_IP" => "192.168.0.108", "PATH" => "/services/idea/#post_id#/?commentId=#comment_id###comment_id#");
$arCommentId = array();
foreach ($arBlogCommentFields as $BlogCommentFields) {
$arCommentId[] = CBlogComment::Add($BlogCommentFields);
}
if ($arBlogPost = CBlogPost::GetList(array(), array("BLOG_ID" => $blogID, "ID" => $arBlogPostId[0]), false, false, array("ID", CIdeaManagment::UFAnswerIdField, CIdeaManagment::UFStatusField))->Fetch()) {
//if Empty value make an array
if (!is_array($arBlogPost[CIdeaManagment::UFAnswerIdField])) {
$arBlogPost[CIdeaManagment::UFAnswerIdField] = array();
}
$arBlogPost[CIdeaManagment::UFAnswerIdField][] = $arCommentId[1];
unset($arBlogPost["ID"]);
CBlogPost::Update($arBlogPostId[0], $arBlogPost);
}
//Replace in file
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/services/idea/index.php", array("IDEA_BLOG_CODE" => $IdeaBlogUrl, "IDEA_BIND_STATUS_DEFAULT" => $arUFIdByName["NEW"]));
示例6: GetRSS
public function GetRSS($BlogCode, $type = "rss2.0", $numPosts = 10, $siteID = SITE_ID, $arPathTemplates = array(), $arFilterExt = array())
{
if (!$this->IsAvailable()) {
return false;
}
global $USER;
//Post CNT
$numPosts = IntVal($numPosts);
//RSS type
$type = ToLower(preg_replace("/[^a-zA-Z0-9.]/is", "", $type));
if (!in_array($type, array("rss2.0", "atom.03", "rss.92"))) {
$type = "rss.92";
}
//Prepare Extended filter
if (!is_array($arFilterExt)) {
$arFilterExt = array();
}
$arSettings = array("BLOG_CODE" => $BlogCode, "NOW" => date("r"), "NOW_ISO" => date("Y-m-d\\TH:i:s") . substr(date("O"), 0, 3) . ":" . substr(date("O"), -2, 2), "SERVER_NAME" => "", "CHARSET" => "", "LANGUAGE" => "", "RSS" => "", "RSS_TYPE" => $type, "CURRENT_USER_ID" => $USER->IsAuthorized() ? $USER->GetID() : 0, "CATEGORIES" => CIdeaManagment::getInstance()->Idea()->GetCategoryList());
//Get Settings if possible
if ($arSite = CSite::GetList($s = "sort", $o = "asc", array("LID" => SITE_ID))->Fetch()) {
$arSettings["SERVER_NAME"] = $arSite["SERVER_NAME"];
$arSettings["CHARSET"] = $arSite["CHARSET"];
$arSettings["LANGUAGE"] = $arSite["LANGUAGE_ID"];
}
//Get Server Name
if (strlen($arSettings["SERVER_NAME"]) == 0) {
if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
$arSettings["SERVER_NAME"] = SITE_SERVER_NAME;
} else {
$arSettings["SERVER_NAME"] = COption::GetOptionString("main", "server_name", "");
}
}
//Get Site Charset
if (strlen($arSettings["CHARSET"]) == 0) {
if (defined("SITE_CHARSET") && strlen(SITE_CHARSET) > 0) {
$arSettings["CHARSET"] = SITE_CHARSET;
} else {
$arSettings["CHARSET"] = "windows-1251";
}
}
$arSettings["BLOG_URL"] = "http://" . $arSettings["SERVER_NAME"];
if (!empty($arPathTemplates) && strlen($arPathTemplates["INDEX"]) > 0) {
$arSettings["BLOG_URL"] .= $arPathTemplates["INDEX"];
}
if (!empty($arPathTemplates) && strlen($arPathTemplates["CUSTOM_TITLE"]) > 0) {
$arSettings["BLOG_NAME"] = htmlspecialcharsbx($arPathTemplates["CUSTOM_TITLE"]);
} else {
$arSettings["BLOG_NAME"] = "\"" . htmlspecialcharsbx($arSite["NAME"]) . "\" (" . $arSettings["SERVER_NAME"] . ")";
}
//Prepare Head Type part
if ($arSettings["RSS_TYPE"] == "rss.92") {
$arSettings["RSS"] .= "<" . "?xml version=\"1.0\" encoding=\"" . $arSettings["CHARSET"] . "\"?" . ">\n\n";
$arSettings["RSS"] .= "<rss version=\".92\">\n";
$arSettings["RSS"] .= " <channel>\n";
$arSettings["RSS"] .= "\t<title>" . $arSettings["BLOG_NAME"] . "</title>\n";
$arSettings["RSS"] .= "\t<link>" . $arSettings["BLOG_URL"] . "</link>\n";
$arSettings["RSS"] .= "\t<guid>" . $arSettings["BLOG_URL"] . "</guid>\n";
$arSettings["RSS"] .= "\t<language>" . $arSettings["LANGUAGE"] . "</language>\n";
$arSettings["RSS"] .= "\t<docs>http://backend.userland.com/rss092</docs>\n";
$arSettings["RSS"] .= "\n";
} elseif ($arSettings["RSS_TYPE"] == "rss2.0") {
$arSettings["RSS"] .= "<" . "?xml version=\"1.0\" encoding=\"" . $arSettings["CHARSET"] . "\"?" . ">\n\n";
$arSettings["RSS"] .= "<rss version=\"2.0\">\n";
$arSettings["RSS"] .= " <channel>\n";
$arSettings["RSS"] .= "\t<title>" . $arSettings["BLOG_NAME"] . "</title>\n";
$arSettings["RSS"] .= "\t<description>" . $arSettings["BLOG_NAME"] . "</description>\n";
$arSettings["RSS"] .= "\t<link>" . $arSettings["BLOG_URL"] . "</link>\n";
$arSettings["RSS"] .= "\t<language>" . $arSettings["LANGUAGE"] . "</language>\n";
$arSettings["RSS"] .= "\t<docs>http://backend.userland.com/rss2</docs>\n";
$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();
//.........這裏部分代碼省略.........
示例7: GetDataFromRatingEntity
function GetDataFromRatingEntity($rating_entity_type_id, $rating_entity_id, $bCheckRights = true)
{
$rating_entity_type_id = preg_replace("/[^a-z0-9_-]/i", "", $rating_entity_type_id);
$rating_entity_id = intval($rating_entity_id);
if (strlen($rating_entity_type_id) <= 0) {
return false;
}
if ($rating_entity_id <= 0) {
return false;
}
switch ($rating_entity_type_id) {
case "BLOG_POST":
$log_type = "log";
$log_event_id = array("blog_post", "blog_post_important");
break;
case "BLOG_COMMENT":
$log_type = "comment";
$log_event_id = array("blog_comment", "photo_comment");
break;
case "FORUM_TOPIC":
$log_type = "log";
$log_event_id = array("forum");
if (CModule::IncludeModule("forum")) {
$dbForumMessage = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $rating_entity_id), false, 1);
if ($arForumMessage = $dbForumMessage->Fetch()) {
$rating_entity_id = $arForumMessage["ID"];
}
}
break;
case "FORUM_POST":
$log_type = "comment";
$log_event_id = array("forum", "photo_comment", "files_comment", "commondocs_comment", "tasks_comment", "wiki_comment", "news_comment", "lists_new_element_comment");
break;
case "IBLOCK_ELEMENT":
$log_type = "log";
$log_event_id = array("photo_photo", "files", "commondocs", "wiki");
break;
case "INTRANET_NEW_USER":
$log_type = "log";
$log_event_id = array("intranet_new_user");
break;
case "INTRANET_NEW_USER_COMMENT":
$log_type = "comment";
$log_event_id = array("intranet_new_user_comment");
break;
case "BITRIX24_NEW_USER":
$log_type = "log";
$log_event_id = array("bitrix24_new_user");
break;
case "BITRIX24_NEW_USER_COMMENT":
$log_type = "comment";
$log_event_id = array("bitrix24_new_user_comment");
break;
case "VOTING":
$log_type = "log";
$log_event_id = array("blog_post", "blog_post_important");
if (CModule::IncludeModule("blog")) {
$rsBlogPost = CBlogPost::GetList(array("ID" => "DESC"), array("UF_BLOG_POST_VOTE" => $rating_entity_id), false, array("nTopCount" => 1), array("ID"));
if ($arBlogPost = $rsBlogPost->Fetch()) {
$rating_entity_id = $arBlogPost["ID"];
}
}
break;
case "LISTS_NEW_ELEMENT":
$log_type = "log";
$log_event_id = array("lists_new_element");
break;
case "LOG_ENTRY":
$log_type = "log_entry";
break;
case "LOG_COMMENT":
$log_type = "log_comment";
break;
default:
}
if ($log_type == "log") {
$rsLogSrc = CSocNetLog::GetList(array(), array("EVENT_ID" => $log_event_id, "SOURCE_ID" => $rating_entity_id), false, false, array("ID"), array("CHECK_RIGHTS" => $bCheckRights ? "Y" : "N", "USE_SUBSCRIBE" => "N"));
if ($arLogSrc = $rsLogSrc->Fetch()) {
$log_id = $arLogSrc["ID"];
}
} elseif ($log_type == "log_entry") {
$rsLogSrc = CSocNetLog::GetList(array(), array("ID" => $rating_entity_id), false, false, array("ID"), array("CHECK_RIGHTS" => $bCheckRights ? "Y" : "N", "USE_SUBSCRIBE" => "N"));
if ($arLogSrc = $rsLogSrc->Fetch()) {
$log_id = $arLogSrc["ID"];
}
} elseif ($log_type == "comment") {
$rsLogCommentSrc = CSocNetLogComments::GetList(array(), array("EVENT_ID" => $log_event_id, "SOURCE_ID" => $rating_entity_id), false, false, array("ID", "LOG_ID"), array("CHECK_RIGHTS" => $bCheckRights ? "Y" : "N", "USE_SUBSCRIBE" => "N"));
if ($arLogCommentSrc = $rsLogCommentSrc->Fetch()) {
$log_id = $arLogCommentSrc["LOG_ID"];
$log_comment_id = $arLogCommentSrc["ID"];
}
} elseif ($log_type == "log_comment") {
$rsLogCommentSrc = CSocNetLogComments::GetList(array(), array("ID" => $rating_entity_id), false, false, array("ID", "LOG_ID"), array("CHECK_RIGHTS" => $bCheckRights ? "Y" : "N", "USE_SUBSCRIBE" => "N"));
if ($arLogCommentSrc = $rsLogCommentSrc->Fetch()) {
$log_id = $arLogCommentSrc["LOG_ID"];
$log_comment_id = $arLogCommentSrc["ID"];
}
}
if ($log_id > 0) {
$arResult = array("LOG_ID" => $log_id);
//.........這裏部分代碼省略.........
示例8: array
//@::Idea| If moderator the display hidden posts
if ($arResult["IDEA_MODERATOR"]) {
$arFilter["PUBLISH_STATUS"] = array(BLOG_PUBLISH_STATUS_PUBLISH, BLOG_PUBLISH_STATUS_READY, BLOG_PUBLISH_STATUS_DRAFT);
} else {
$arFilter["PUBLISH_STATUS"] = BLOG_PUBLISH_STATUS_PUBLISH;
}
$arFilter["BLOG_ID"] = $arBlog["ID"];
if (IntVal($arParams["CATEGORY_ID"]) > 0) {
$arFilter["CATEGORY_ID_F"] = $arParams["CATEGORY_ID"];
if ($arParams["SET_TITLE"] == "Y") {
$arCat = CBlogCategory::GetByID($arFilter["CATEGORY_ID_F"]);
$arResult["title"]["category"] = CBlogTools::htmlspecialcharsExArray($arCat);
}
}
$arResult["filter"] = $arFilter;
$dbPost = CBlogPost::GetList($SORT, array_merge($arParams["EXT_FILTER"], $arFilter), false, array("bDescPageNumbering" => true, "nPageSize" => $arParams["MESSAGE_COUNT"], "bShowAll" => false), array());
$arResult["NAV_STRING"] = $dbPost->GetPageNavString(GetMessage("MESSAGE_COUNT"), $arParams["NAV_TEMPLATE"]);
$arResult["POST"] = array();
$arResult["IDS"] = array();
$p = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
$arParserParams = array("imageWidth" => $arParams["IMAGE_MAX_WIDTH"], "imageHeight" => $arParams["IMAGE_MAX_HEIGHT"]);
while ($CurPost = $dbPost->GetNext()) {
$CurPost["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($CurPost["ID"], $CurPost["CODE"], $arParams["ALLOW_POST_CODE"])));
$CurPost["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $CurPost["AUTHOR_ID"]));
$arImages = array();
$res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $CurPost['ID'], "BLOG_ID" => $arBlog['ID']));
while ($arImage = $res->Fetch()) {
$arImages[$arImage['ID']] = $arImage['FILE_ID'];
}
if ($CurPost["DETAIL_TEXT_TYPE"] == "html" && COption::GetOptionString("blog", "allow_html", "N") == "Y") {
$arAllow = array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "QUOTE" => "Y", "CODE" => "Y");
示例9: trim
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (strlen($arResult["VARIABLES"]["post_id"]) > 0) {
CModule::IncludeModule("blog");
$postID = trim($arResult["VARIABLES"]["post_id"]);
if (!is_numeric($postID) || strlen(IntVal($postID)) != strlen($postID)) {
$postID = preg_replace("/[^a-zA-Z0-9_-]/is", "", Trim($postID));
$arFilter = array("CODE" => $postID);
} else {
$arFilter = array("ID" => IntVal($postID));
}
if (strlen($arResult["PATH_TO_USER_BLOG_POST"]) <= 0) {
$arResult["PATH_TO_USER_BLOG_POST"] = "/company/personal/user/#user_id#/blog/#post_id#/";
}
$dbPost = CBlogPost::GetList(array(), $arFilter, false, false, array("ID", "AUTHOR_ID"));
if ($arPost = $dbPost->Fetch()) {
LocalRedirect(CComponentEngine::MakePathFromTemplate($arResult["PATH_TO_USER_BLOG_POST"], array("post_id" => $arPost["ID"], "user_id" => $arPost["AUTHOR_ID"])));
die;
}
}
示例10: array
}
}
}
}
if (StrLen($errorMessage) > 0) {
$arResult["ERROR_MESSAGE"][] = $errorMessage;
}
if (StrLen($okMessage) > 0) {
$arResult["OK_MESSAGE"][] = $okMessage;
}
$arResult["POST"] = array();
$p = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
$arParserParams = array("imageWidth" => $arParams["IMAGE_MAX_WIDTH"], "imageHeight" => $arParams["IMAGE_MAX_HEIGHT"]);
$arPostColl1 = array();
$arPostColl2 = array();
$dbPost = CBlogPost::GetList(array("DATE_PUBLISH" => "DESC"), array("BLOG_ID" => $arBlog["ID"], "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_READY), false, false, array("ID", "BLOG_ID", "TITLE", "DATE_PUBLISH", "AUTHOR_ID", "DETAIL_TEXT", "BLOG_ACTIVE", "BLOG_URL", "BLOG_GROUP_ID", "BLOG_GROUP_SITE_ID", "AUTHOR_ID", "BLOG_OWNER_ID", "VIEWS", "NUM_COMMENTS", "ATTACH_IMG", "BLOG_SOCNET_GROUP_ID", "DETAIL_TEXT_TYPE", "CATEGORY_ID"));
while ($arPost = $dbPost->Fetch()) {
$arPost = CBlogTools::htmlspecialcharsExArray($arPost);
$arPost["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arPost["AUTHOR_ID"]));
if ($arPost["AUTHOR_ID"] == $arBlog["OWNER_ID"]) {
$arPost["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arPost["AUTHOR_ID"]));
} else {
if ($arOwnerBlog = CBlog::GetByOwnerID($arPost["AUTHOR_ID"], $arParams["GROUP_ID"])) {
$arPost["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arOwnerBlog["URL"], "user_id" => $arPost["AUTHOR_ID"]));
}
}
$arPost["BlogUser"] = CBlogUser::GetByID($arPost["AUTHOR_ID"], BLOG_BY_USER_ID);
$arPost["BlogUser"] = CBlogTools::htmlspecialcharsExArray($arPost["BlogUser"]);
$arPost["BlogUser"]["AVATAR_file"] = CFile::GetFileArray($arPost["BlogUser"]["AVATAR"]);
if ($arPost["BlogUser"]["AVATAR_file"] !== false) {
$arPost["BlogUser"]["Avatar_resized"] = CFile::ResizeImageGet($arPost["BlogUser"]["AVATAR_file"], array("width" => 100, "height" => 100), BX_RESIZE_IMAGE_EXACT, false);
示例11: GetSocNetPostPerms
public static function GetSocNetPostPerms($postId = 0, $bNeedFull = false, $userId = false, $postAuthor = 0)
{
if (!$userId) {
$userId = IntVal($GLOBALS["USER"]->GetID());
$bByUserId = false;
} else {
$userId = IntVal($userId);
$bByUserId = true;
}
$postId = IntVal($postId);
if ($postId <= 0) {
return false;
}
$cId = md5(serialize(func_get_args()));
if (isset($GLOBALS["BLOG_BP_SOCNETPOSTPERMS"]) && !empty($GLOBALS["BLOG_BP_SOCNETPOSTPERMS"][$cId])) {
return $GLOBALS["BLOG_BP_SOCNETPOSTPERMS"][$cId];
}
if (!CModule::IncludeModule("socialnetwork")) {
return false;
}
$perms = BLOG_PERMS_DENY;
$arAvailPerms = array_keys($GLOBALS["AR_BLOG_PERMS"]);
if (!$bByUserId) {
$blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
if ($blogModulePermissions >= "W" || CSocNetUser::IsCurrentUserModuleAdmin()) {
$perms = $arAvailPerms[count($arAvailPerms) - 1];
}
} else {
if (CSocNetUser::IsUserModuleAdmin($userId)) {
$perms = $arAvailPerms[count($arAvailPerms) - 1];
}
}
if (IntVal($postAuthor) <= 0) {
$dbPost = CBlogPost::GetList(array(), array("ID" => $postId), false, false, array("ID", "AUTHOR_ID"));
$arPost = $dbPost->Fetch();
} else {
$arPost["AUTHOR_ID"] = $postAuthor;
}
if ($arPost["AUTHOR_ID"] == $userId) {
$perms = BLOG_PERMS_FULL;
}
if ($perms <= BLOG_PERMS_DENY) {
$arPerms = CBlogPost::GetSocNetPerms($postId);
$arEntities = array();
if (isset($GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId]) && !empty($GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId])) {
$arEntities = $GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId];
} else {
$dbA = CAccess::GetUserCodes($userId);
while ($arA = $dbA->Fetch()) {
if ($arA["PROVIDER_ID"] == "intranet") {
$arEntities["DR"][$arA["ACCESS_CODE"]] = $arA["ACCESS_CODE"];
} elseif ($arA["PROVIDER_ID"] == "socnetgroup") {
$g = substr($arA["ACCESS_CODE"], 2);
$gId = IntVal($g);
$gR = substr($g, strpos($g, "_") + 1);
$arEntities["SG"][$gId][$gR] = $gR;
}
}
$GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId] = $arEntities;
}
foreach ($arPerms as $t => $val) {
foreach ($val as $id => $p) {
if (!is_array($p)) {
$p = array();
}
if ($userId > 0 && $t == "U" && $userId == $id) {
$perms = BLOG_PERMS_READ;
if (in_array("US" . $userId, $p)) {
// if author
$perms = BLOG_PERMS_FULL;
}
break;
}
if (in_array("G2", $p)) {
$perms = BLOG_PERMS_READ;
break;
}
if ($userId > 0 && in_array("AU", $p)) {
$perms = BLOG_PERMS_READ;
break;
}
if ($t == "SG") {
if (!empty($arEntities["SG"][$id])) {
foreach ($arEntities["SG"][$id] as $gr) {
if (in_array("SG" . $id . "_" . $gr, $p)) {
$perms = BLOG_PERMS_READ;
break;
}
}
}
}
if ($t == "DR" && !empty($arEntities["DR"])) {
if (in_array("DR" . $id, $arEntities["DR"])) {
$perms = BLOG_PERMS_READ;
break;
}
}
}
if ($perms > BLOG_PERMS_DENY) {
break;
//.........這裏部分代碼省略.........
示例12: array
/*Неэффективный кусок кода*/
$arResult[$el["ID"]]["ARTNUMBER"] = CIBlockElement::GetProperty($el["IBLOCK_ID"], $el["ID"], array(), array("CODE" => "ARTNUMBER"))->GetNext()["VALUE"];
//Получение артикула, для каждого инфоблока свой артикул, поэтому нельзя выбрать для всех сразу
/**********************************/
$arResult[$el["ID"]]["IMAGE"] = $sPath;
/***Получение количества товара с учетом наличия его на складе***/
$arProd = (int) CCatalogStoreProduct::GetList(array(), array('PRODUCT_ID' => $iProductId, "STORE_ID" => 1), false, false, array('AMOUNT'))->GetNext()['AMOUNT'];
$arResult[$el["ID"]]["QUANTITY"] = $arProd <= 0 || $arResult[$el["ID"]]['CATALOG_QUANTITY'] <= 0 ? 0 : $arResult[$el["ID"]]['CATALOG_QUANTITY'];
unset($arProd);
/****Получение ссылок редактирования и удаления элемента из публичной части****/
$arButtons = CIBlock::GetPanelButtons($el["IBLOCK_ID"], $el["ID"], 0, array("SECTION_BUTTONS" => false, "SESSID" => false));
$arResult[$el["ID"]]["EDIT_LINK"] = $arButtons["edit"]["edit_element"]["ACTION_URL"];
$arResult[$el["ID"]]["DELETE_LINK"] = $arButtons["edit"]["delete_element"]["ACTION_URL"];
unset($arButtons);
/******************************************************************************************/
//Получаем ИД поста (коммента)
//примечание: CIBlockPropertyTools::CODE_BLOG_COMMENTS_COUNT - возвращает некорректное значение
$iCommentId = (int) CIBlockElement::GetProperty($el["IBLOCK_ID"], $el["ID"], array("sort" => "asc"), array("CODE" => CIBlockPropertyTools::CODE_BLOG_POST))->GetNext()["ID"];
//Получем ИД самого коментария для товарной еденицы
$dbProp = CIBlockElement::GetList(array(), array("ID" => $el["ID"]), false, array(), array("PROPERTY_" . $iCommentId, "ID"));
//Получаем количество коментариев
$rsPosts = CBlogPost::GetList(array(), array('ID' => $dbProp->GetNext()["PROPERTY_" . $iCommentId . "_VALUE"]), false, false, array('NUM_COMMENTS'));
$arResult[$el["ID"]]["REVIEW_COUNT"] = $rsPosts->GetNext()['NUM_COMMENTS'];
unset($iCommentId, $dbProp, $rsPosts);
/*******************************************************************************************/
}
unset($elementIterator, $el);
}
unset($strImageStorePath);
$this->IncludeComponentTemplate();
}
示例13:
false,
$arSelect
);
if ($arElement = $rsElement->GetNext())
{
$arResult['ELEMENT'] = $arElement;
if ($arResult['BLOG_USE'])
{
$postID = (int)$arElement['PROPERTY_'.$arResult['BLOG_DATA']['BLOG_POST_ID_PROP'].'_VALUE'];
$commentsCount = (int)$arElement['PROPERTY_'.$arResult['BLOG_DATA']['BLOG_COMMENTS_COUNT_PROP']];
if ($postID > 0)
{
$rsPosts = CBlogPost::GetList(
array(),
array('ID' => $postID, 'BLOG_ID' => $arResult['BLOG_DATA']['BLOG_ID']),
false,
false,
array('ID', 'BLOG_ID', 'NUM_COMMENTS')
);
if ($postInfo = $rsPosts->Fetch())
{
$postInfo['NUM_COMMENTS'] = (int)$postInfo['NUM_COMMENTS'];
if ($postInfo['NUM_COMMENTS'] > 0 && $postInfo['NUM_COMMENTS'] != $commentsCount)
{
CIBlockElement::SetPropertyValues($arResult['ELEMENT']['ID'], $arResult['ELEMENT']['IBLOCK_ID'], $postInfo['NUM_COMMENTS'], $arResult['BLOG_DATA']['BLOG_COMMENTS_COUNT_PROP']);
$commentsCount = $postInfo['NUM_COMMENTS'];
}
}
else
{
$postID = 0;
示例14: SetStatus
public function SetStatus($StatusId)
{
if (!$this->IsAvailable()) {
return false;
}
$arStatusList = $this->GetStatusList();
$arStatusListXML = $this->GetStatusList(true);
$arPost = CBlogPost::GetList(array(), array("ID" => $this->IdeaId), false, false, array("ID", CIdeaManagment::UFStatusField))->Fetch();
$bUpdate = false;
//Get Status ID from XML List
if (array_key_exists($StatusId, $arStatusListXML)) {
$StatusId = $arStatusListXML[$StatusId]["ID"];
}
//Status Exists and not current
if (array_key_exists($StatusId, $arStatusList)) {
$bUpdate = $arPost[CIdeaManagment::UFStatusField] != $StatusId;
}
if ($arPost && $bUpdate) {
return CBlogPost::Update($this->IdeaId, array(CIdeaManagment::UFStatusField => $StatusId));
}
return false;
}
示例15: array
CHTTP::SetStatus("404 Not Found");
return;
}
$arPost = array();
$cacheTtl = 2592000;
$cacheId = 'blog_post_socnet_general_' . $arParams["ID"] . '_' . LANGUAGE_ID;
if ($arResult["TZ_OFFSET"] != 0) {
$cacheId .= "_" . $arResult["TZ_OFFSET"];
}
$cacheDir = '/blog/socnet_post/gen/' . intval($arParams["ID"] / 100) . '/' . $arParams["ID"];
$obCache = new CPHPCache();
if ($obCache->InitCache($cacheTtl, $cacheId, $cacheDir)) {
$arPost = $obCache->GetVars();
} else {
$obCache->StartDataCache();
$dbPost = CBlogPost::GetList(array(), array("ID" => $arParams["ID"]), false, false, array("ID", "BLOG_ID", "PUBLISH_STATUS", "TITLE", "AUTHOR_ID", "ENABLE_COMMENTS", "NUM_COMMENTS", "VIEWS", "CODE", "MICRO", "DETAIL_TEXT", "DATE_PUBLISH", "CATEGORY_ID", "HAS_SOCNET_ALL", "HAS_TAGS", "HAS_IMAGES", "HAS_PROPS", "HAS_COMMENT_IMAGES"));
$arPost = $dbPost->Fetch();
$obCache->EndDataCache($arPost);
}
if (!empty($arPost) && ($arPost["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH && !in_array($arParams["TYPE"], array("DRAFT", "MODERATION")))) {
unset($arPost);
}
$a = new CAccess();
$a->UpdateCodes();
if (!empty($arBlog) && $arBlog["ACTIVE"] == "Y" || $arResult["bFromList"]) {
if (!empty($arPost)) {
if (($arParams["GET_FOLLOW"] == "Y" && (!array_key_exists("FOLLOW", $arParams) || strlen($arParams["FOLLOW"]) <= 0) || intval($arParams["LOG_ID"]) <= 0) && CModule::IncludeModule("socialnetwork")) {
$rsLogSrc = CSocNetLog::GetList(array(), array("EVENT_ID" => array("blog_post", "blog_post_micro", "blog_post_important"), "SOURCE_ID" => $arParams["ID"], "SITE_ID" => CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite() ? SITE_ID : array(SITE_ID, false)), false, false, $arParams["GET_FOLLOW"] == "Y" ? array("ID", "FOLLOW", "FAVORITES_USER_ID") : array("ID", "FAVORITES_USER_ID"), $arParams["GET_FOLLOW"] == "Y" ? array("USE_FOLLOW" => "Y") : array());
if ($arLogSrc = $rsLogSrc->Fetch()) {
$arParams["LOG_ID"] = $arLogSrc["ID"];
$arParams["FAVORITES_USER_ID"] = $arLogSrc["FAVORITES_USER_ID"];