本文整理汇总了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"]);
}
}
}
}
}