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


PHP CBlogPost::ChangeSocNetPermission方法代码示例

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


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


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