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


PHP CBlogPost::GetByID方法代码示例

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


在下文中一共展示了CBlogPost::GetByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CheckFields

 function CheckFields($ACTION, &$arFields, $ID = 0)
 {
     if ((is_set($arFields, "POST_ID") || $ACTION == "ADD") && strlen($arFields["POST_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GCT_EMPTY_POST_ID"), "EMPTY_POST_ID");
         return false;
     } elseif (is_set($arFields, "POST_ID")) {
         $arResult = CBlogPost::GetByID($arFields["POST_ID"]);
         if (!$arResult) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["POST_ID"], GetMessage("BLG_GCT_ERROR_NO_POST")), "ERROR_NO_POST");
             return false;
         }
     }
     if ((is_set($arFields, "BLOG_ID") || $ACTION == "ADD") && IntVal($arFields["BLOG_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GCT_EMPTY_BLOG_ID"), "EMPTY_BLOG_ID");
         return false;
     } elseif (is_set($arFields, "BLOG_ID")) {
         $arResult = CBlog::GetByID($arFields["BLOG_ID"]);
         if (!$arResult) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["BLOG_ID"], GetMessage("BLG_GCT_ERROR_NO_BLOG")), "ERROR_NO_BLOG");
             return false;
         }
     }
     if ((is_set($arFields, "CATEGORY_ID") || $ACTION == "ADD") && IntVal($arFields["CATEGORY_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GCT_EMPTY_CATEGORY_ID"), "EMPTY_CATEGORY_ID");
         return false;
     } elseif (is_set($arFields, "CATEGORY_ID")) {
         $arResult = CBlogCategory::GetByID($arFields["CATEGORY_ID"]);
         if (!$arResult) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["CATEGORY_ID"], GetMessage("BLG_GCT_ERROR_NO_CATEGORY")), "ERROR_NO_CATEGORY");
             return false;
         }
     }
     return True;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:34,代码来源:blog_post_category.php

示例2: CanUserDeletePost

 public static function CanUserDeletePost($ID, $userID, $blogOwnerID, $groupOwnerID)
 {
     $ID = IntVal($ID);
     $userID = IntVal($userID);
     $blogOwnerID = IntVal($blogOwnerID);
     $groupOwnerID = IntVal($groupOwnerID);
     $blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
     if ($blogModulePermissions >= "W") {
         return True;
     }
     $arPost = CBlogPost::GetByID($ID);
     if (empty($arPost)) {
         return False;
     }
     if ($groupOwnerID > 0) {
         $arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
         if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y") {
             return False;
         }
         $perms = BLOG_PERMS_DENY;
         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "view_post")) {
             $perms = BLOG_PERMS_READ;
         }
         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "write_post")) {
             $perms = BLOG_PERMS_WRITE;
         }
         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "full_post")) {
             $perms = BLOG_PERMS_FULL;
         }
         if ($perms >= BLOG_PERMS_WRITE && $arPost["AUTHOR_ID"] == $userID) {
             return true;
         }
         if ($perms > BLOG_PERMS_WRITE) {
             return true;
         }
     } else {
         $arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
         $arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
         if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y") {
             return False;
         }
         $perms = BLOG_PERMS_DENY;
         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "view_post")) {
             $perms = BLOG_PERMS_READ;
         }
         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "write_post")) {
             $perms = BLOG_PERMS_WRITE;
         }
         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "full_post")) {
             $perms = BLOG_PERMS_FULL;
         }
         if ($perms >= BLOG_PERMS_WRITE && $arPost["AUTHOR_ID"] == $userID) {
             return true;
         }
         if ($perms > BLOG_PERMS_WRITE) {
             return true;
         }
     }
     return False;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:60,代码来源:sonet.php

示例3: GetPing

 public static function GetPing($blogUrl, $postID, $arParams = array())
 {
     global $DB;
     $blogUrl = Trim($blogUrl);
     $postID = IntVal($postID);
     $bSuccess = True;
     $arPost = CBlogPost::GetByID($postID);
     if (!$arPost) {
         CBlogTrackback::SendPingResponce(1, "Invalid target post");
         $bSuccess = False;
     }
     if ($bSuccess) {
         if ($arPost["ENABLE_TRACKBACK"] != "Y" || COption::GetOptionString("blog", "enable_trackback", "Y") != "Y") {
             CBlogTrackback::SendPingResponce(1, "Trackbacks disabled");
             $bSuccess = False;
         }
     }
     if ($bSuccess) {
         $arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
         if (!$arBlog || $arBlog["URL"] != $blogUrl) {
             CBlogTrackback::SendPingResponce(1, "Invalid target blog");
             $bSuccess = False;
         }
     }
     if ($bSuccess) {
         if (!isset($arParams["title"]) || strlen($arParams["title"]) <= 0 || !isset($arParams["url"]) || strlen($arParams["url"]) <= 0) {
             CBlogTrackback::SendPingResponce(1, "Missing required fields");
             $bSuccess = False;
         }
     }
     if ($bSuccess) {
         if (!isset($arParams["excerpt"])) {
             $arParams["excerpt"] = $arParams["title"];
         }
         if (!isset($arParams["blog_name"])) {
             $arParams["blog_name"] = "";
         }
     }
     if ($bSuccess) {
         $serverCharset = "";
         $arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
         $dbSite = CSite::GetList($b = "sort", $o = "asc", array("LID" => $arGroup["SITE_ID"]));
         if ($arSite = $dbSite->Fetch()) {
             $serverCharset = $arSite["CHARSET"];
         }
         if (strlen($serverCharset) <= 0) {
             if (defined("SITE_CHARSET") && strlen(SITE_CHARSET) > 0) {
                 $serverCharset = SITE_CHARSET;
             } else {
                 $serverCharset = "windows-1251";
             }
         }
         preg_match("/charset=(\")*(.*?)(\")*(;|\$)/", $_SERVER["CONTENT_TYPE"], $charset);
         $charset = preg_replace("#[^[:space:]a-zA-Z0-9\\-]#is", "", $charset[2]);
         if (strlen($charset) <= 0) {
             $charset = "utf-8";
         }
         if ($charset != $serverCharset) {
             $arParams["title"] = $GLOBALS["APPLICATION"]->ConvertCharset($arParams["title"], $charset, $serverCharset);
             $arParams["url"] = $GLOBALS["APPLICATION"]->ConvertCharset($arParams["url"], $charset, $serverCharset);
             $arParams["excerpt"] = $GLOBALS["APPLICATION"]->ConvertCharset($arParams["excerpt"], $charset, $serverCharset);
             $arParams["blog_name"] = $GLOBALS["APPLICATION"]->ConvertCharset($arParams["blog_name"], $charset, $serverCharset);
         }
         $arFields = array("TITLE" => $arParams["title"], "URL" => $arParams["url"], "PREVIEW_TEXT" => $arParams["excerpt"], "BLOG_NAME" => $arParams["blog_name"], "=POST_DATE" => $DB->CurrentTimeFunction(), "BLOG_ID" => $arPost["BLOG_ID"], "POST_ID" => $arPost["ID"]);
         $dbTrackback = CBlogTrackback::GetList(array(), array("BLOG_ID" => $arPost["BLOG_ID"], "POST_ID" => $arPost["ID"], "URL" => $arParams["url"]));
         if ($arTrackback = $dbTrackback->Fetch()) {
             if (!CBlogTrackback::Update($arTrackback["ID"], $arFields)) {
                 if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
                     $errorMessage = $ex->GetString() . ".<br>";
                 } else {
                     $errorMessage = "Unknown error" . ".<br>";
                 }
                 CBlogTrackback::SendPingResponce(1, $errorMessage);
             }
         } else {
             if (!CBlogTrackback::Add($arFields)) {
                 if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
                     $errorMessage = $ex->GetString() . ".<br>";
                 } else {
                     $errorMessage = "Unknown error" . ".<br>";
                 }
                 CBlogTrackback::SendPingResponce(1, $errorMessage);
             }
         }
         CBlogTrackback::SendPingResponce(0, "Ping accepted");
     }
     return $bSuccess;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:88,代码来源:blog_trackback.php

示例4: GetMessage

     }
 } else {
     $dbUser = CUser::GetByID($arBlogUser["USER_ID"]);
     $arUser = $dbUser->GetNext();
     if ($arParams["SET_TITLE"] == "Y") {
         $APPLICATION->SetTitle(str_replace("#NAME#", CBlogUser::GetUserName($arBlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]), GetMessage("B_B_FR_TITLE_OF")));
     }
 }
 $dbList = CBlogUser::GetUserFriendsList($arParams["ID"], $USER->GetID(), $USER->IsAuthorized(), $arParams["MESSAGE_COUNT"], $arParams["GROUP_ID"]);
 $arResult["FRIENDS_POSTS"] = 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 ($arList = $dbList->Fetch()) {
     $arResult["IDS"][] = $arList["ID"];
     $arPost = CBlogPost::GetByID($arList["ID"]);
     $arPost = CBlogTools::htmlspecialcharsExArray($arPost);
     $arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
     $arBlog = CBlogTools::htmlspecialcharsExArray($arBlog);
     $arPost["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"])));
     $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"]));
     } else {
         if ($arOwnerBlog = CBlog::GetByOwnerID($arPost["AUTHOR_ID"], $arParams["GROUP_ID"])) {
             $arPost["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arOwnerBlog["URL"]));
         }
     }
     $arImages = array();
     $dbImage = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "N"));
     while ($arImage = $dbImage->Fetch()) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例5: define

} else {
    define("LANGUAGE_ID", "en");
}
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates/mobile_app/components/bitrix/socialnetwork.blog.post/mobile/ajax.php");
$strError = false;
if ($post_id <= 0) {
    $strError = GetMessage("BLOG_MOBILE_AJAX_POST_ID_ERROR");
} elseif (!$GLOBALS["USER"]->IsAuthorized()) {
    $strError = GetMessage("BLOG_MOBILE_AJAX_USER_NOT_AUTHORIZED_ERROR");
} elseif (!check_bitrix_sessid()) {
    $strError = GetMessage("BLOG_MOBILE_AJAX_SESSION_ERROR");
} elseif (!CModule::IncludeModule("blog")) {
    $strError = GetMessage("BLOG_MOBILE_AJAX_BLOG_MODULE_ERROR");
} elseif (!CModule::IncludeModule("socialnetwork")) {
    $strError = GetMessage("BLOG_MOBILE_AJAX_SONET_MODULE_ERROR");
} elseif (!($arBlogPost = CBlogPost::GetByID($post_id))) {
    $strError = GetMessage("BLOG_MOBILE_BLOG_POST_ERROR");
} elseif (!($arBlog = CBlog::GetByID($arBlogPost["BLOG_ID"]))) {
    $strError = GetMessage("BLOG_MOBILE_BLOG_ERROR");
}
if (!$strError) {
    if ($action == "delete_post") {
        $PostPerm = CBlogPost::GetSocNetPostPerms($post_id, true, $GLOBALS["USER"]->GetID(), $arBlogPost["AUTHOR_ID"]);
        if ($PostPerm < BLOG_PERMS_FULL) {
            $strError = GetMessage("BLOG_MOBILE_DELETE_PERMISSION_ERROR");
        } else {
            CBlogPost::DeleteLog($post_id);
            if (CBlogPost::Delete($post_id)) {
                BXClearCache(True, "/" . SITE_ID . "/blog/popular_posts/");
                BXClearCache(true, "/blog/socnet_post/" . $post_id . "/");
                BXClearCache(true, "/blog/socnet_post/gen/" . $post_id . "/");
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:ajax.php

示例6: BuildRSS

	public static function BuildRSS($postID, $blogID, $type = "RSS2.0", $numPosts = 10, $arPathTemplate = Array())
	{
		$blogID = IntVal($blogID);
		$postID = IntVal($postID);
		if($blogID <= 0)
			return false;
		if($postID <= 0)
			return false;
		$numPosts = IntVal($numPosts);
		$type = strtolower(preg_replace("/[^a-zA-Z0-9.]/is", "", $type));
		if ($type != "rss.92" && $type != "atom.03")
			$type = "rss2.0";

		$rssText = False;

		$arBlog = CBlog::GetByID($blogID);
		if ($arBlog && $arBlog["ACTIVE"] == "Y" && $arBlog["ENABLE_RSS"] == "Y")
		{
			$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
			if($arGroup["SITE_ID"] == SITE_ID)
			{
				$arPost = CBlogPost::GetByID($postID);
				if(!empty($arPost) && $arPost["BLOG_ID"] == $arBlog["ID"] && $arPost["ENABLE_COMMENTS"] == "Y")
				{
					$now = date("r");
					$nowISO = date("Y-m-d\TH:i:s").substr(date("O"), 0, 3).":".substr(date("O"), -2, 2);

					$serverName = "";
					$charset = "";
					$language = "";
					$dbSite = CSite::GetList(($b = "sort"), ($o = "asc"), array("LID" => SITE_ID));
					if ($arSite = $dbSite->Fetch())
					{
						$serverName = $arSite["SERVER_NAME"];
						$charset = $arSite["CHARSET"];
						$language = $arSite["LANGUAGE_ID"];
					}

					if (strlen($serverName) <= 0)
					{
						if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0)
							$serverName = SITE_SERVER_NAME;
						else
							$serverName = COption::GetOptionString("main", "server_name", "");
					}

					if (strlen($charset) <= 0)
					{
						if (defined("SITE_CHARSET") && strlen(SITE_CHARSET) > 0)
							$charset = SITE_CHARSET;
						else
							$charset = "windows-1251";
					}

					if(strlen($arPathTemplate["PATH_TO_BLOG"])>0)
						$blogURL = htmlspecialcharsbx("http://".$serverName.CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"], "group_id" => $arBlog["SOCNET_GROUP_ID"])));
					else
						$blogURL = htmlspecialcharsbx("http://".$serverName.CBlog::PreparePath($arBlog["URL"], $arGroup["SITE_ID"]));

					if(strlen($arPathTemplate["PATH_TO_POST"])>0)
						$url = htmlspecialcharsbx("http://".$serverName.CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_POST"], array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplate["ALLOW_POST_CODE"]), "user_id" => $arBlog["OWNER_ID"], "group_id" => $arBlog["SOCNET_GROUP_ID"])));
					else
						$url = htmlspecialcharsbx("http://".$serverName.CBlogPost::PreparePath($arBlog["URL"], $arPost["ID"], $arGroup["SITE_ID"]));

					$dbUser = CUser::GetByID($arPost["AUTHOR_ID"]);
					$arUser = $dbUser->Fetch();

					if($arPathTemplate["USE_SOCNET"] == "Y")
					{
						$blogName = GetMessage("BLG_GCM_RSS_TITLE_SOCNET", Array("#AUTHOR_NAME#" => htmlspecialcharsEx($arUser["NAME"]." ".$arUser["LAST_NAME"]), "#POST_TITLE#" => htmlspecialcharsEx($arPost["TITLE"])));
					}
					else
					{
						$blogName = GetMessage("BLG_GCM_RSS_TITLE", Array("#BLOG_NAME#" => htmlspecialcharsEx($arBlog["NAME"]), "#POST_TITLE#" => htmlspecialcharsEx($arPost["TITLE"])));
					}

					$rssText = "";
					if ($type == "rss.92")
					{
						$rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
						$rssText .= "<rss version=\".92\">\n";
						$rssText .= " <channel>\n";
						$rssText .= "	<title>".$blogName."</title>\n";
						$rssText .= "	<description>".$blogName."</description>\n";
						$rssText .= "	<link>".$url."</link>\n";
						$rssText .= "	<language>".$language."</language>\n";
						$rssText .= "	<docs>http://backend.userland.com/rss092</docs>\n";
						$rssText .= "\n";
					}
					elseif ($type == "rss2.0")
					{
						$rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
						$rssText .= "<rss version=\"2.0\">\n";
						$rssText .= " <channel>\n";
						$rssText .= "	<title>".$blogName."</title>\n";
						$rssText .= "	<description>".$blogName."</description>\n";
						//$rssText .= "	<guid>".$url."</guid>\n";
						$rssText .= "	<link>".$url."</link>\n";
						$rssText .= "	<language>".$language."</language>\n";
						$rssText .= "	<docs>http://backend.userland.com/rss2</docs>\n";
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:blog_comment.php

示例7: unset

    $arParams["SEO_USE"] = "N";
}
$user_id = $USER->GetID();
$arResult["USER_ID"] = $user_id;
$arBlog = CBlog::GetByUrl($arParams["BLOG_URL"], $arParams["GROUP_ID"]);
$arBlog = CBlogTools::htmlspecialcharsExArray($arBlog);
$arResult["Blog"] = $arBlog;
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if (!empty($arBlog) && $arBlog["ACTIVE"] == "Y" && $arGroup["SITE_ID"] == SITE_ID) {
    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"]));
        }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例8: AddLiveComment

	function AddLiveComment($commentId = 0, $path = "")
	{
		if(IntVal($commentId) <= 0)
			return;
		if(CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus())
		{
			if($arComment = CBlogComment::GetByID($commentId))
			{
				if(strlen($path) <= 0 && strlen($arComment["PATH"]) > 0)
					$path = CComponentEngine::MakePathFromTemplate($arComment["PATH"], array("post_id"   =>$arComment["POST_ID"], "comment_id"=>$arComment["ID"]));
				if(strlen($path) <= 0)
				{
					$arPost = CBlogPost::GetByID($arComment["POST_ID"]);
					$path = $path = CComponentEngine::MakePathFromTemplate($arPost["PATH"], array("post_id"   =>$arComment["POST_ID"], "comment_id"=>$arComment["ID"]))."?commentId=".$arComment["ID"];
				}

				CPullWatch::AddToStack("UNICOMMENTSBLOG_".$arComment["POST_ID"],
					array(
						'module_id'	=> "unicomments",
						'command'	=> "comment",
						'params'	=> Array(
							"AUTHOR_ID"		=> $arComment["AUTHOR_ID"],
							"ID"			=> $arComment["ID"],
							"POST_ID"		=> $arComment["POST_ID"],
							"TS"			=> time(),
							"ACTION"		=> "REPLY",
							"URL"			=> array(
								"LINK" => $path,
							),
							"ENTITY_XML_ID"	=> "BLOG_".$arComment["POST_ID"],
							"APPROVED"		=> "Y",
							"NEED_REQUEST"	=> "Y",
						),
					)
				);
			}
		}
	}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:38,代码来源:blog_comment.php

示例9: Delete

 public static function Delete($ID)
 {
     global $DB;
     $ID = IntVal($ID);
     $arPost = CBlogPost::GetByID($ID);
     if ($arPost) {
         foreach (GetModuleEvents("blog", "OnBeforePostDelete", true) as $arEvent) {
             if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
                 return false;
             }
         }
         $dbResult = CBlogComment::GetList(array(), array("POST_ID" => $ID), false, false, array("ID"));
         while ($arResult = $dbResult->Fetch()) {
             if (!CBlogComment::Delete($arResult["ID"])) {
                 return False;
             }
         }
         $dbResult = CBlogUserGroupPerms::GetList(array(), array("POST_ID" => $ID, "BLOG_ID" => $arPost["BLOG_ID"]), false, false, array("ID"));
         while ($arResult = $dbResult->Fetch()) {
             if (!CBlogUserGroupPerms::Delete($arResult["ID"])) {
                 return False;
             }
         }
         $dbResult = CBlogTrackback::GetList(array(), array("POST_ID" => $ID, "BLOG_ID" => $arPost["BLOG_ID"]), false, false, array("ID"));
         while ($arResult = $dbResult->Fetch()) {
             if (!CBlogTrackback::Delete($arResult["ID"])) {
                 return False;
             }
         }
         $dbResult = CBlogPostCategory::GetList(array(), array("POST_ID" => $ID, "BLOG_ID" => $arPost["BLOG_ID"]), false, false, array("ID"));
         while ($arResult = $dbResult->Fetch()) {
             if (!CBlogPostCategory::Delete($arResult["ID"])) {
                 return False;
             }
         }
         $strSql = "SELECT F.ID " . "FROM b_blog_post P, b_file F " . "WHERE P.ID = " . $ID . " " . "\tAND P.ATTACH_IMG = F.ID ";
         $z = $DB->Query($strSql, false, "FILE: " . __FILE__ . " LINE:" . __LINE__);
         while ($zr = $z->Fetch()) {
             CFile::Delete($zr["ID"]);
         }
         CBlogPost::DeleteSocNetPostPerms($ID);
         unset($GLOBALS["BLOG_POST"]["BLOG_POST_CACHE_" . $ID]);
         $arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
         $result = $DB->Query("DELETE FROM b_blog_post WHERE ID = " . $ID . "", true);
         if (IntVal($arBlog["LAST_POST_ID"]) == $ID) {
             CBlog::SetStat($arPost["BLOG_ID"]);
         }
         if ($result) {
             $res = CBlogImage::GetList(array(), array("POST_ID" => $ID, "IS_COMMENT" => "N"));
             while ($aImg = $res->Fetch()) {
                 CBlogImage::Delete($aImg['ID']);
             }
         }
         if ($result) {
             $GLOBALS["USER_FIELD_MANAGER"]->Delete("BLOG_POST", $ID);
         }
         foreach (GetModuleEvents("blog", "OnPostDelete", true) as $arEvent) {
             ExecuteModuleEventEx($arEvent, array($ID, &$result));
         }
         if (CModule::IncludeModule("search")) {
             CSearch::Index("blog", "P" . $ID, array("TITLE" => "", "BODY" => ""));
             //CSearch::DeleteIndex("blog", false, "COMMENT", $arPost["BLOG_ID"]."|".$ID);
         }
         return $result;
     } else {
         return false;
     }
     return True;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:69,代码来源:blog_post.php

示例10: GetMessage

             }
         }
     } else {
         $arResult["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_NO_BLOG");
         CHTTP::SetStatus("404 Not Found");
     }
 } elseif (IntVal($_GET["show_id"]) > 0 && $arResult["IDEA_MODERATOR"]) {
     if ($arResult["BLOG"] = CBlog::GetByUrl($arParams["BLOG_URL"], $arParams["GROUP_ID"])) {
         if ($_GET["success"] == "Y") {
             $arResultNFCache["OK_MESSAGE"][] = GetMessage("IDEA_BLOG_BLOG_MES_SHOWED");
         } else {
             if (check_bitrix_sessid()) {
                 $arResult["PostPerm"] = CBlog::GetBlogUserPostPerms($arResult["BLOG"]["ID"], $user_id);
                 $hide_id = IntVal($_GET["show_id"]);
                 if ($arResult["PostPerm"] >= BLOG_PERMS_MODERATE) {
                     if (CBlogPost::GetByID($hide_id)) {
                         if (CBlogPost::Update($hide_id, array("PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH))) {
                             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arParams["BLOG_URL"] . "/first_page/");
                             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arParams["BLOG_URL"] . "/pages/");
                             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arParams["BLOG_URL"] . "/post/" . $hide_id . "/");
                             BXClearCache(True, '/' . SITE_ID . '/idea/statistic_list/');
                             LocalRedirect($APPLICATION->GetCurPageParam("show_id=" . $hide_id . "&success=Y", array("del_id", "sessid", "success", "hide_id", "show_id")));
                         } else {
                             $arResultNFCache["ERROR_MESSAGE"][] = GetMessage("IDEA_BLOG_BLOG_MES_SHOW_ERROR");
                         }
                     }
                 } else {
                     $arResultNFCache["ERROR_MESSAGE"][] = GetMessage("IDEA_BLOG_BLOG_MES_SHOW_NO_RIGHTS");
                 }
             }
         }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例11: AddComment_Review_CheckIBlock_Blog

 function AddComment_Review_CheckIBlock_Blog($arElement)
 {
     if (!CModule::IncludeModule("iblock")) {
         return false;
     }
     if (!CModule::IncludeModule("blog")) {
         return false;
     }
     $needProperty = array();
     $ELEMENT_IBLOCK_ID = intVal($arElement["IBLOCK_ID"]);
     $ELEMENT_NAME = Trim($arElement["~NAME"]);
     $ELEMENT_BLOG_POST_ID = intVal($arElement["PROPERTY_BLOG_POST_ID_VALUE"]);
     $ELEMENT_BLOG_COMMENT_CNT = intVal($arElement["PROPERTY_BLOG_COMMENT_CNT_VALUE"]);
     if ($ELEMENT_BLOG_POST_ID <= 0) {
         $db_res = CIBlockElement::GetProperty($ELEMENT_IBLOCK_ID, $arElement["ID"], false, false, array("CODE" => "BLOG_POST_ID"));
         if (!($db_res && ($res = $db_res->Fetch()))) {
             $needProperty[] = "BLOG_POST_ID";
         }
     }
     if ($ELEMENT_BLOG_COMMENT_CNT <= 0) {
         $db_res = CIBlockElement::GetProperty($ELEMENT_IBLOCK_ID, $arElement["ID"], false, false, array("CODE" => "BLOG_COMMENT_CNT"));
         if (!($db_res && ($res = $db_res->Fetch()))) {
             $needProperty[] = "BLOG_COMMENT_CNT";
         }
     }
     if (!empty($needProperty)) {
         $obProperty = new CIBlockProperty();
         $res = true;
         foreach ($needProperty as $nameProperty) {
             $sName = trim($nameProperty == "BLOG_POST_ID" ? GetMessage("P_BLOG_POST_ID") : GetMessage("P_BLOG_COMMENTS_CNT"));
             $sName = empty($sName) ? $nameProperty : $sName;
             $res = $obProperty->Add(array("IBLOCK_ID" => $ELEMENT_IBLOCK_ID, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => $sName, "CODE" => $nameProperty));
         }
     }
     // Set NULL for post_id if it was deleted
     if ($ELEMENT_BLOG_POST_ID > 0) {
         $arTopic = CBlogPost::GetByID($ELEMENT_BLOG_POST_ID);
         if (!$arTopic || !is_array($arTopic) || count($arTopic) <= 0) {
             CIBlockElement::SetPropertyValues($arElement["ID"], $ELEMENT_IBLOCK_ID, 0, "BLOG_POST_ID");
             $ELEMENT_BLOG_POST_ID = 0;
         }
     }
     return $ELEMENT_BLOG_POST_ID;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:44,代码来源:log_tools.php

示例12: OnGetRatingContentOwner

 function OnGetRatingContentOwner($arParams)
 {
     if ($arParams['ENTITY_TYPE_ID'] == 'BLOG_POST') {
         $arPost = CBlogPost::GetByID(IntVal($arParams['ENTITY_ID']));
         return $arPost['AUTHOR_ID'];
     } elseif ($arParams['ENTITY_TYPE_ID'] == 'BLOG_COMMENT') {
         $arComment = CBlogComment::GetByID(IntVal($arParams['ENTITY_ID']));
         return $arComment['AUTHOR_ID'];
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:11,代码来源:ratings_components.php

示例13: implode

         $v = CBlogCategory::Add(array("BLOG_ID" => $arCopyBlog["ID"], "NAME" => $arCat["NAME"]));
     } else {
         $v = $arCatBlogCopy[ToLower($arCat["NAME"])];
     }
     CBlogPostCategory::Add(array("BLOG_ID" => $arCopyBlog["ID"], "POST_ID" => $copyID, "CATEGORY_ID" => $v));
     $arCopyCat[] = $v;
 }
 if (!empty($arCopyCat)) {
     $arCopyPostUpdate["CATEGORY_ID"] = implode(",", $arCopyCat);
 }
 if ($_POST["move2blogcopy"] == "Y") {
     $arCopyPostUpdate["NUM_COMMENTS"] = 0;
 }
 if (!empty($arCopyPostUpdate)) {
     $copyID = CBlogPost::Update($copyID, $arCopyPostUpdate);
     $arCopyPost = CBlogPost::GetByID($copyID);
 }
 if ($_POST["move2blogcopy"] != "Y") {
     if (CBlogPost::CanUserDeletePost($arParams["ID"], $user_id)) {
         $dbC = CBlogComment::GetList(array("ID" => "ASC"), array("BLOG_ID" => $arBlog["ID"], "POST_ID" => $arParams["ID"]), false, false, array("PATH", "PUBLISH_STATUS", "POST_TEXT", "TITLE", "DATE_CREATE", "AUTHOR_IP1", "AUTHOR_IP", "AUTHOR_EMAIL", "AUTHOR_NAME", "AUTHOR_ID", "PARENT_ID", "POST_ID", "BLOG_ID", "ID"));
         while ($arC = $dbC->Fetch()) {
             $arCTmp = array("BLOG_ID" => $arCopyBlog["ID"], "POST_ID" => $copyID);
             CBlogComment::Update($arC["ID"], $arCTmp);
         }
         $arFilter = array("POST_ID" => $arParams["ID"], "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "Y");
         $res = CBlogImage::GetList(array("ID" => "ASC"), $arFilter);
         while ($arImg = $res->GetNext()) {
             $arNewImg = array("BLOG_ID" => $arCopyBlog["ID"], "POST_ID" => $copyID);
             CBlogImage::Update($arImg["ID"], $arNewImg);
         }
         if (!CBlogPost::Delete($arParams["ID"])) {
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php

示例14: array

<?php

if (CModule::IncludeModule("blog")) {
    $arComments = array();
    $dbLogComment = CSocNetLogComments::GetList(array("LOG_DATE" => "ASC"), array("EVENT_ID" => "blog_comment_micro", "SOURCE_ID" => false), false, false, array("ID", "LOG_SOURCE_ID", "USER_ID", "TEXT_MESSAGE", "LOG_DATE"));
    while ($arLogComment = $dbLogComment->Fetch()) {
        $arPost = CBlogPost::GetByID($arLogComment["LOG_SOURCE_ID"]);
        if ($arPost) {
            $arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
            $arFieldsComment = array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "POST_TEXT" => $arLogComment["TEXT_MESSAGE"], "DATE_CREATE" => $arLogComment["LOG_DATE"], "AUTHOR_ID" => $arLogComment["USER_ID"], "PARENT_ID" => false);
            $commentId = CBlogComment::Add($arFieldsComment);
            $arComments[$arLogComment["ID"]] = $commentId;
        }
    }
    foreach ($arComments as $log_comment_id => $blog_comment_id) {
        CSocNetLogComments::Update($log_comment_id, array("SOURCE_ID" => $blog_comment_id));
    }
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:18,代码来源:updtr1100.php

示例15: addLiveComment

    /**
     * Use component main.post.list to work with LiveFeed
     * @param int $commentId Comment ID which needs to send.
     * @param array $arParams Array of settings (DATE_TIME_FORMAT, SHOW_RATING, PATH_TO_USER, AVATAR_SIZE, NAME_TEMPLATE, SHOW_LOGIN)
     * @return string
     */
    public static function addLiveComment($commentId = 0, $arParams = array())
    {
        $res = "";
        if ($commentId > 0 && CModule::IncludeModule("pull") && \CPullOptions::GetNginxStatus() && ($comment = CBlogComment::GetByID($commentId)) && ($arPost = CBlogPost::GetByID($comment["POST_ID"]))) {
            global $DB, $APPLICATION;
            $arParams["DATE_TIME_FORMAT"] = isset($arParams["DATE_TIME_FORMAT"]) ? $arParams["DATE_TIME_FORMAT"] : $DB->DateFormatToPHP(CSite::GetDateFormat("FULL"));
            $arParams["SHOW_RATING"] = $arParams["SHOW_RATING"] == "N" ? "N" : "Y";
            $arParams["PATH_TO_USER"] = isset($arParams["PATH_TO_USER"]) ? $arParams["PATH_TO_USER"] : '';
            $arParams["AVATAR_SIZE_COMMENT"] = $arParams["AVATAR_SIZE_COMMENT"] > 0 ? $arParams["AVATAR_SIZE_COMMENT"] : ($arParams["AVATAR_SIZE"] > $arParams["AVATAR_SIZE"] ? $arParams["AVATAR_SIZE"] : 58);
            $arParams["NAME_TEMPLATE"] = isset($arParams["NAME_TEMPLATE"]) ? $arParams["NAME_TEMPLATE"] : CSite::GetNameFormat();
            $arParams["SHOW_LOGIN"] = $arParams["SHOW_LOGIN"] == "N" ? "N" : "Y";
            $comment["DateFormated"] = FormatDateFromDB($comment["DATE_CREATE"], $arParams["DATE_TIME_FORMAT"], true);
            $timestamp = MakeTimeStamp($comment["DATE_CREATE"]);
            if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
                $comment["DateFormated"] = ToLower($comment["DateFormated"]);
            }
            $comment["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("BLOG_COMMENT", $commentId, LANGUAGE_ID);
            $arAuthor = CBlogUser::GetUserInfo($comment["AUTHOR_ID"], $arParams["PATH_TO_USER"], array("AVATAR_SIZE_COMMENT" => $arParams["AVATAR_SIZE_COMMENT"]));
            if (intval($arAuthor["PERSONAL_PHOTO"]) > 0) {
                $image_resize = CFile::ResizeImageGet($arAuthor["PERSONAL_PHOTO"], array("width" => $arParams["AVATAR_SIZE_COMMENT"], "height" => $arParams["AVATAR_SIZE_COMMENT"]), BX_RESIZE_IMAGE_EXACT);
                $arAuthor["PERSONAL_PHOTO_RESIZED"] = array("src" => $image_resize["src"]);
            }
            $p = new blogTextParser(false, '');
            $ufCode = "UF_BLOG_COMMENT_FILE";
            if (is_array($comment["UF"][$ufCode])) {
                $p->arUserfields = array($ufCode => array_merge($comment["UF"][$ufCode], array("TAG" => "DOCUMENT ID")));
            }
            $arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "SHORT_ANCHOR" => "Y");
            $arParserParams = array("imageWidth" => 800, "imageHeight" => 800);
            $comment["TextFormated"] = $p->convert($comment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
            $p->bMobile = true;
            $comment["TextFormatedMobile"] = $p->convert($comment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
            $comment["TextFormatedJS"] = CUtil::JSEscape(htmlspecialcharsBack($comment["POST_TEXT"]));
            $comment["TITLE"] = CUtil::JSEscape(htmlspecialcharsBack($comment["TITLE"]));
            $eventHandlerID = AddEventHandler("main", "system.field.view.file", array("CSocNetLogTools", "logUFfileShow"));
            $res = $APPLICATION->IncludeComponent("bitrix:main.post.list", "", array("TEMPLATE_ID" => 'BLOG_COMMENT_BG_', "RATING_TYPE_ID" => $arParams["SHOW_RATING"] == "Y" ? "BLOG_COMMENT" : "", "ENTITY_XML_ID" => "BLOG_" . $arPost["ID"], "RECORDS" => array($commentId => array("ID" => $comment["ID"], "NEW" => $arParams["FOLLOW"] != "N" && $comment["NEW"] == "Y" ? "Y" : "N", "APPROVED" => $comment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH ? "Y" : "N", "POST_TIMESTAMP" => $timestamp, "POST_TIME" => $comment["DATE_CREATE_TIME"], "POST_DATE" => $comment["DateFormated"], "AUTHOR" => array("ID" => $arAuthor["ID"], "NAME" => $arAuthor["~NAME"], "LAST_NAME" => $arAuthor["~LAST_NAME"], "SECOND_NAME" => $arAuthor["~SECOND_NAME"], "AVATAR" => $arAuthor["PERSONAL_PHOTO_resized"]["src"]), "FILES" => false, "UF" => $comment["UF"], "~POST_MESSAGE_TEXT" => $comment["POST_TEXT"], "WEB" => array("POST_TIME" => $comment["DATE_CREATE_TIME"], "POST_DATE" => $comment["DateFormated"], "CLASSNAME" => "", "POST_MESSAGE_TEXT" => $comment["TextFormated"], "AFTER" => <<<HTML
<script>top.text{$commentId} = text{$commentId} = '{$comment["TextFormatedJS"]}';top.title{$commentId} = title{$commentId} = '{$comment["TITLE"]}';top.arComFiles{$commentId} = [];</script>
HTML
), "MOBILE" => array("POST_TIME" => $comment["DATE_CREATE_TIME"], "POST_DATE" => $comment["DateFormated"], "CLASSNAME" => "", "POST_MESSAGE_TEXT" => $comment["TextFormatedMobile"]))), "NAV_STRING" => "", "NAV_RESULT" => "", "PREORDER" => "N", "RIGHTS" => array("MODERATE" => "N", "EDIT" => "N", "DELETE" => "N"), "VISIBLE_RECORDS_COUNT" => 1, "ERROR_MESSAGE" => "", "OK_MESSAGE" => "", "RESULT" => $commentId, "PUSH&PULL" => array("ACTION" => "REPLY", "ID" => $commentId), "MODE" => "PULL_MESSAGE", "VIEW_URL" => "", "EDIT_URL" => "", "MODERATE_URL" => "", "DELETE_URL" => "", "AUTHOR_URL" => "", "AVATAR_SIZE" => $arParams["AVATAR_SIZE_COMMENT"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "DATE_TIME_FORMAT" => "", "LAZYLOAD" => "", "NOTIFY_TAG" => "", "NOTIFY_TEXT" => "", "SHOW_MINIMIZED" => "Y", "SHOW_POST_FORM" => "", "IMAGE_SIZE" => "", "mfi" => ""), array(), null);
            if ($eventHandlerID !== false && intval($eventHandlerID) > 0) {
                RemoveEventHandler('main', 'system.field.view.file', $eventHandlerID);
            }
        }
        return $res;
    }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:51,代码来源:blog_comment.php


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