Example #1
0
 function AddSocNetPerms($ID, $perms = false, $arPost = array())
 {
     if (IntVal($ID) <= 0) {
         return false;
     }
     $arResult = array();
     // D - department
     // U - user
     // SG - socnet group
     // DR - department and hier
     // G - user group
     // AU - authorized user
     //$bAU = false;
     if (empty($perms) || in_array("UA", $perms)) {
         CBlogPost::__AddSocNetPerms($ID, "U", $arPost["AUTHOR_ID"], "US" . $arPost["AUTHOR_ID"]);
         // for myself
         $perms1 = CBlogPost::GetSocnetGroups("U", $arPost["AUTHOR_ID"]);
         foreach ($perms1 as $val) {
             if (strlen($val) > 0) {
                 CBlogPost::__AddSocNetPerms($ID, "U", $arPost["AUTHOR_ID"], $val);
                 if (!in_array($val, $arResult)) {
                     $arResult[] = $val;
                 }
             }
         }
     }
     if (!empty($perms)) {
         foreach ($perms as $val) {
             if ($val == "UA") {
                 continue;
             }
             if (strlen($val) > 0) {
                 $scID = 0;
                 $scT = substr($val, 0, 2);
                 if (in_array($scT, array("DR", "SG"))) {
                     $scID = IntVal(substr($val, 2));
                 } else {
                     $scT = substr($val, 0, 1);
                     $scID = IntVal(substr($val, 1));
                 }
                 if ($scT == "SG") {
                     $permsNew = CBlogPost::GetSocnetGroups("G", $scID);
                     foreach ($permsNew as $val1) {
                         CBlogPost::__AddSocNetPerms($ID, $scT, $scID, $val1);
                         if (!in_array($val1, $arResult)) {
                             $arResult[] = $val1;
                         }
                     }
                 }
                 CBlogPost::__AddSocNetPerms($ID, $scT, $scID, $val);
                 if (!in_array($val, $arResult)) {
                     $arResult[] = $val;
                 }
             }
         }
     }
     return $arResult;
 }
Example #2
0
 function AddSocNetPerms($ID, $perms = false, $arPost = array())
 {
     if (IntVal($ID) <= 0) {
         return false;
     }
     $arResult = array();
     // D - department
     // U - user
     // SG - socnet group
     // DR - department and hier
     // G - user group
     // AU - authorized user
     //$bAU = false;
     if (empty($perms) || in_array("UA", $perms)) {
         CBlogPost::__AddSocNetPerms($ID, "U", $arPost["AUTHOR_ID"], "US" . $arPost["AUTHOR_ID"]);
         // for myself
         $perms1 = CBlogPost::GetSocnetGroups("U", $arPost["AUTHOR_ID"]);
         foreach ($perms1 as $val) {
             if (strlen($val) > 0) {
                 CBlogPost::__AddSocNetPerms($ID, "U", $arPost["AUTHOR_ID"], $val);
                 if (!in_array($val, $arResult)) {
                     $arResult[] = $val;
                 }
             }
         }
     }
     if (!empty($perms)) {
         foreach ($perms as $val) {
             if ($val == "UA") {
                 continue;
             }
             if (strlen($val) > 0) {
                 $scID = 0;
                 $scT = substr($val, 0, 2);
                 if (in_array($scT, array("DR", "SG"))) {
                     $scID = IntVal(substr($val, 2));
                 } else {
                     $scT = substr($val, 0, 1);
                     $scID = IntVal(substr($val, 1));
                 }
                 if ($scT == "SG") {
                     $permsNew = CBlogPost::GetSocnetGroups("G", $scID);
                     foreach ($permsNew as $val1) {
                         CBlogPost::__AddSocNetPerms($ID, $scT, $scID, $val1);
                         if (!in_array($val1, $arResult)) {
                             $arResult[] = $val1;
                         }
                     }
                 }
                 CBlogPost::__AddSocNetPerms($ID, $scT, $scID, $val);
                 if (!in_array($val, $arResult)) {
                     $arResult[] = $val;
                 }
             }
         }
     }
     BXClearCache(true, "/blog/getsocnetperms/" . $ID . "/");
     if (defined("BX_COMP_MANAGED_CACHE")) {
         $GLOBALS["CACHE_MANAGER"]->ClearByTag("blog_post_getsocnetperms_" . $ID);
     }
     return $arResult;
 }