當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CBlogPost::GetSocnetGroups方法代碼示例

本文整理匯總了PHP中CBlogPost::GetSocnetGroups方法的典型用法代碼示例。如果您正苦於以下問題:PHP CBlogPost::GetSocnetGroups方法的具體用法?PHP CBlogPost::GetSocnetGroups怎麽用?PHP CBlogPost::GetSocnetGroups使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CBlogPost的用法示例。


在下文中一共展示了CBlogPost::GetSocnetGroups方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: SetFeaturePermissions

 function SetFeaturePermissions($entity_type, $entity_id, $feature, $operation, $new_perm)
 {
     if (substr($operation, 0, 4) == "view") {
         if (CModule::IncludeModule('search')) {
             global $arSonetFeaturesPermsCache;
             unset($arSonetFeaturesPermsCache[$entity_type . "_" . $entity_id]);
             $arGroups = CSocNetSearch::GetSearchGroups($entity_type, $entity_id, $feature, $operation);
             $arParams = CSocNetSearch::GetSearchParams($entity_type, $entity_id, $feature, $operation);
             CSearch::ChangePermission(false, $arGroups, false, false, false, false, $arParams);
         }
     }
     if ($feature == "blog" && in_array($operation, array("view_post", "view_comment")) && CModule::IncludeModule('blog')) {
         if ($operation == "view_post") {
             CBlogPost::ChangeSocNetPermission($entity_type, $entity_id, $operation);
         }
         if ($operation == "view_post") {
             $arPost = CBlogPost::GetSocNetPostsPerms($entity_type, $entity_id);
             foreach ($arPost as $id => $perms) {
                 CSearch::ChangePermission("blog", $perms["PERMS"], "P" . $id);
             }
         } else {
             $arTmpCache = array();
             $arPost = CBlogPost::GetSocNetPostsPerms($entity_type, $entity_id);
             $dbComment = CBlogComment::GetSocNetPostsPerms($entity_type, $entity_id);
             while ($arComment = $dbComment->Fetch()) {
                 if (!empty($arPost[$arComment["POST_ID"]])) {
                     if (empty($arPost[$arComment["POST_ID"]]["PERMS_CALC"])) {
                         $arPost[$arComment["POST_ID"]]["PERMS_CALC"] = array();
                         if (is_array($arPost[$arComment["POST_ID"]]["PERMS_FULL"]) && !empty($arPost[$arComment["POST_ID"]]["PERMS_FULL"])) {
                             foreach ($arPost[$arComment["POST_ID"]]["PERMS_FULL"] as $e => $v) {
                                 if (in_array($v["TYPE"], array("SG", "U"))) {
                                     $type = $v["TYPE"] == "SG" ? "G" : "U";
                                     if (array_key_exists($type . $v["ID"], $arTmpCache)) {
                                         $spt = $arTmpCache[$type . $v["ID"]];
                                     } else {
                                         $spt = CBlogPost::GetSocnetGroups($type, $v["ID"], "view_comment");
                                         $arTmpCache[$type . $v["ID"]] = $spt;
                                     }
                                     foreach ($spt as $vv) {
                                         if (!in_array($vv, $arPost[$arComment["POST_ID"]]["PERMS_CALC"])) {
                                             $arPost[$arComment["POST_ID"]]["PERMS_CALC"][] = $vv;
                                         }
                                     }
                                 } else {
                                     $arPost[$arComment["POST_ID"]]["PERMS_CALC"][] = $e;
                                 }
                             }
                         }
                     }
                     CSearch::ChangePermission("blog", $arPost[$arComment["POST_ID"]]["PERMS_CALC"], "C" . $arComment["ID"]);
                 }
             }
         }
     }
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:55,代碼來源:search.php

示例2: GetSocNetCommentPerms

	public static function GetSocNetCommentPerms($postID = 0)
	{
		$postID = IntVal($postID);
		if($postID <= 0)
			return false;

		$arSp = Array();
		$sp = CBlogPost::GetSocnetPerms($postID);
		if(is_array($sp) && !empty($sp))
		{
			foreach($sp as $et => $v)
			{
				foreach($v as $eid => $tv)
				{
					if($et == "U" && in_array($et.$eid, $tv))
					{
						$arSp[] = $et.$eid;
					}
					elseif(in_array($et, Array("U", "SG")))
					{
						$spt = CBlogPost::GetSocnetGroups(($et == "SG" ? "G" : "U"), $eid, "view_comment");
						foreach($spt as $vv)
						{
							if(!in_array($vv, $arSp))
								$arSp[] = $vv;
						}
					}
					else
					{
						$arSp[] = $et.$eid;
					}
				}
			}
		}
		return $arSp;
	}
開發者ID:ASDAFF,項目名稱:bxApiDocs,代碼行數:36,代碼來源:blog_comment.php


注:本文中的CBlogPost::GetSocnetGroups方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。