Example #1
0
 function SetSonetLogRights($logID, $entity_type, $entity_id, $event_id)
 {
     if (!CModule::IncludeModule("socialnetwork")) {
         return;
     }
     if (in_array($entity_type, array(SONET_SUBSCRIBE_ENTITY_USER, SONET_SUBSCRIBE_ENTITY_GROUP))) {
         if (in_array($event_id, array("blog_post", "forum", "photo", "blog_post_micro", "files", "wiki"))) {
             $arLogEventTmp = CSocNetLogTools::FindLogEventByID($event_id);
             CSocNetLogRights::SetForSonet($logID, $entity_type, $entity_id, CSocNetLogTools::FindFeatureByEventID($event_id), $arLogEventTmp["OPERATION"]);
         } elseif (in_array($event_id, array("data", "system")) && $entity_type == SONET_SUBSCRIBE_ENTITY_GROUP) {
             CSocNetLogRights::Add($logID, array("SA", "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id, "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR, "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_USER));
         } elseif (in_array($event_id, array("data", "system")) && $entity_type == SONET_SUBSCRIBE_ENTITY_USER) {
             $perm = CSocNetUserPerms::GetOperationPerms($entity_id, "viewprofile");
             if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS))) {
                 CSocNetLogRights::Add($logID, array("SA", "U" . $entity_id, "S" . SONET_SUBSCRIBE_ENTITY_USER . $entity_id . "_" . $perm));
             } elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED) {
                 CSocNetLogRights::Add($logID, array("SA", "AU"));
             } elseif ($perm == SONET_RELATIONS_TYPE_ALL) {
                 CSocNetLogRights::Add($logID, array("SA", "G2"));
             }
         }
     } elseif ($entity_type == SONET_SUBSCRIBE_ENTITY_PROVIDER) {
         $arRights = array("SA");
         $rsSchemeRights = CXDILFSchemeRights::GetList(array(), array("SCHEME_ID" => $entity_id));
         while ($arSchemeRights = $rsSchemeRights->Fetch()) {
             if (substr($arSchemeRights["GROUP_CODE"], 0, 1) == "U") {
                 if (substr($arSchemeRights["GROUP_CODE"], 1) == "A") {
                     $arRights[] = "AU";
                     break;
                 } elseif (substr($arSchemeRights["GROUP_CODE"], 1) == "N") {
                     $arRights[] = "G2";
                     break;
                 } elseif (intval(substr($arSchemeRights["GROUP_CODE"], 1)) > 0) {
                     $arRights[] = "U" . substr($arSchemeRights["GROUP_CODE"], 1);
                 }
             }
         }
         if (count($arRights) > 0) {
             CSocNetLogRights::Add($logID, $arRights);
         }
     } elseif (defined("SONET_SUBSCRIBE_ENTITY_NEWS") && $entity_type == SONET_SUBSCRIBE_ENTITY_NEWS) {
         CSocNetLogRights::Add($logID, array("SA", "G2"));
     }
 }
Example #2
0
    if ($arRes = $rs->Fetch()) {
        $scheme_type = $arRes["TYPE"];
        if ($arRes["TYPE"] == "XML") {
            if ($arRes["PAGE"] == "/bitrix/tools/stat_gadget.php" && $arRes["METHOD"] == "GetLiveFeedData") {
                $predefined = "stat";
            }
            if ($arRes["PAGE"] == "/bitrix/tools/sale_gadget.php" && $arRes["METHOD"] == "GetLiveFeedData") {
                $predefined = "sale";
            }
        }
        if (strlen($arRes["URI"]) <= 0) {
            $arRes["URI"] = "http://" . $arRes["HOST"] . (intval($arRes["PORT"]) > 0 ? ":" . $arRes["PORT"] : "") . $arRes["PAGE"] . ($arRes["TYPE"] == "RSS" && strlen($arRes["PARAMS"]) > 0 ? "?" . $arRes["PARAMS"] : "");
        }
    }
    $DAYS_OF_WEEK = explode(",", $arRes["DAYS_OF_WEEK"]);
    $rsSchemeRights = CXDILFSchemeRights::GetList(array("GROUP_CODE" => "ASC"), array("SCHEME_ID" => $ID));
    while ($arSchemeRights = $rsSchemeRights->Fetch()) {
        if (substr($arSchemeRights["GROUP_CODE"], 0, 1) == "U") {
            if (substr($arSchemeRights["GROUP_CODE"], 1) == "A") {
                $arRes["RIGHTS_USER_ID"][] = "UA";
                break;
            } elseif (substr($arSchemeRights["GROUP_CODE"], 1) == "N") {
                $arRes["RIGHTS_USER_ID"][] = "UN";
                break;
            } elseif (intval(substr($arSchemeRights["GROUP_CODE"], 1)) > 0) {
                $arRes["RIGHTS_USER_ID"][] = substr($arSchemeRights["GROUP_CODE"], 1);
            }
        }
    }
} else {
    $DAYS_OF_WEEK = array();