예제 #1
0
 function OnAfterIBlockElementDelete($arFields)
 {
     // news
     if (!array_key_exists("WF_STATUS_ID", $arFields) || $arFields["WF_STATUS_ID"] == 1) {
         $dbIBlock = CIBlock::GetByID($arFields["IBLOCK_ID"]);
         if ($arIBlock = $dbIBlock->Fetch()) {
             $rsSite = CIBlock::GetSite($arFields["IBLOCK_ID"]);
             if ($arSite = $rsSite->Fetch()) {
                 $site_id = $arSite["SITE_ID"];
             }
             $val = COption::GetOptionString("intranet", "sonet_log_news_iblock", "", $site_id);
             if (strlen($val) > 0) {
                 $arIBCode = unserialize($val);
                 if (!is_array($arIBCode) || count($arIBCode) <= 0) {
                     $arIBCode = array();
                 }
             } else {
                 $arIBCode = array();
             }
             if (in_array($arIBlock["CODE"], $arIBCode) && CModule::IncludeModule("socialnetwork")) {
                 CSocNetAllowed::GetAllowedEntityTypes();
                 $dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_NEWS, "EVENT_ID" => "news", "SOURCE_ID" => $arFields["ID"]), false, false, array("ID"));
                 while ($arRes = $dbRes->Fetch()) {
                     CSocNetLog::Delete($arRes["ID"]);
                 }
             }
         }
     }
     // --news
 }
예제 #2
0
 public static function CheckFields($ACTION, &$arFields, $ID = 0)
 {
     static $arSiteWorkgroupsPage;
     global $DB, $arSocNetAllowedEntityTypes;
     if (!$arSiteWorkgroupsPage && IsModuleInstalled("extranet") && $arFields["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
         $rsSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
         while ($arSite = $rsSite->Fetch()) {
             $arSiteWorkgroupsPage[$arSite["ID"]] = COption::GetOptionString("socialnetwork", "workgroups_page", $arSite["DIR"] . "workgroups/", $arSite["ID"]);
         }
     }
     if ($ACTION != "ADD" && IntVal($ID) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException("System error 870164", "ERROR");
         return false;
     }
     $newEntityType = "";
     if ((is_set($arFields, "ENTITY_TYPE") || $ACTION == "ADD") && StrLen($arFields["ENTITY_TYPE"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_EMPTY_ENTITY_TYPE"), "EMPTY_ENTITY_TYPE");
         return false;
     } elseif (is_set($arFields, "ENTITY_TYPE")) {
         if (!in_array($arFields["ENTITY_TYPE"], CSocNetAllowed::GetAllowedEntityTypes())) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_ERROR_NO_ENTITY_TYPE"), "ERROR_NO_ENTITY_TYPE");
             return false;
         }
         $newEntityType = $arFields["ENTITY_TYPE"];
     }
     if ((is_set($arFields, "ENTITY_ID") || $ACTION == "ADD") && IntVal($arFields["ENTITY_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_EMPTY_ENTITY_ID"), "EMPTY_ENTITY_ID");
         return false;
     } elseif (is_set($arFields, "ENTITY_ID")) {
         if (StrLen($newEntityType) <= 0 && $ID > 0) {
             $arRe = CAllSocNetLog::GetByID($ID);
             if ($arRe) {
                 $newEntityType = $arRe["ENTITY_TYPE"];
             }
         }
         if (StrLen($newEntityType) <= 0) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GL_ERROR_CALC_ENTITY_TYPE"), "ERROR_CALC_ENTITY_TYPE");
             return false;
         }
         if ($newEntityType == SONET_ENTITY_GROUP) {
             $arResult = CSocNetGroup::GetByID($arFields["ENTITY_ID"]);
             if ($arResult == false) {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_ERROR_NO_ENTITY_ID"), "ERROR_NO_ENTITY_ID");
                 return false;
             }
         } elseif ($newEntityType == SONET_ENTITY_USER) {
             $dbResult = CUser::GetByID($arFields["ENTITY_ID"]);
             if (!$dbResult->Fetch()) {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_ERROR_NO_ENTITY_ID"), "ERROR_NO_ENTITY_ID");
                 return false;
             }
         }
     }
     if ((is_set($arFields, "LOG_ID") || $ACTION == "ADD") && intval($arFields["LOG_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_EMPTY_LOG_ID"), "EMPTY_LOG_ID");
         return false;
     }
     if ((is_set($arFields, "EVENT_ID") || $ACTION == "ADD") && strlen($arFields["EVENT_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_EMPTY_EVENT_ID"), "EMPTY_EVENT_ID");
         return false;
     } elseif (is_set($arFields, "EVENT_ID")) {
         $arFields["EVENT_ID"] = strtolower($arFields["EVENT_ID"]);
         $arEvent = CSocNetLogTools::FindLogCommentEventByID($arFields["EVENT_ID"]);
         if (!$arEvent) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_ERROR_NO_FEATURE_ID"), "ERROR_NO_FEATURE");
             return false;
         }
     }
     if (is_set($arFields, "USER_ID")) {
         $dbResult = CUser::GetByID($arFields["USER_ID"]);
         if (!$dbResult->Fetch()) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_ERROR_NO_USER_ID"), "ERROR_NO_USER_ID");
             return false;
         }
     }
     if (is_set($arFields, "LOG_DATE") && !$DB->IsDate($arFields["LOG_DATE"], false, LANG, "FULL")) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_EMPTY_DATE_CREATE"), "EMPTY_LOG_DATE");
         return false;
     }
     if (is_set($arFields["URL"]) && is_array($arSiteWorkgroupsPage)) {
         foreach ($arSiteWorkgroupsPage as $groups_page) {
             if (strpos($arFields["URL"], $groups_page) === 0) {
                 $arFields["URL"] = "#GROUPS_PATH#" . substr($arFields["URL"], strlen($groups_page), strlen($arFields["URL"]) - strlen($groups_page));
             }
         }
     }
     if (!$GLOBALS["USER_FIELD_MANAGER"]->CheckFields("SONET_COMMENT", $ID, $arFields)) {
         return false;
     }
     return True;
 }
예제 #3
0
 function Delete($entityType, $entityID, $feature = false, $event = false)
 {
     global $DB;
     $arSocNetAllowedSubscribeEntityTypes = CSocNetAllowed::GetAllowedEntityTypes();
     $arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
     $arSocNetLogEvents = CSocNetAllowed::GetAllowedLogEvents();
     $entityType = trim($entityType);
     if (!in_array($entityType, CSocNetAllowed::GetAllowedEntityTypes())) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_EUV_INCORRECT_ENTITY_TYPE"), "ERROR_INCORRECT_ENTITY_TYPE");
         return false;
     }
     $entityID = IntVal($entityID);
     if ($entityID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_EUV_EMPTY_ENTITY_ID"), "ERROR_EMPTY_ENTITY_ID");
         return false;
     }
     $strWhere = " WHERE ENTITY_TYPE = '" . $entityType . "' AND ENTITY_ID = " . $entityID;
     if ($feature) {
         if ($event) {
             $strWhere .= " AND EVENT_ID = '" . $event . "'";
         } else {
             $event_id = array();
             if (array_key_exists($feature, $arSocNetLogEvents) && array_key_exists("ENTITIES", $arSocNetLogEvents[$feature]) && array_key_exists($entityType, $arSocNetLogEvents[$feature]["ENTITIES"]) || array_key_exists($feature, $arSocNetFeaturesSettings) && array_key_exists("subscribe_events", $arSocNetFeaturesSettings[$feature]) && count($arSocNetFeaturesSettings[$feature]["subscribe_events"]) > 0) {
                 if (array_key_exists($feature, $arSocNetLogEvents)) {
                     $event_id[] = $feature;
                     if (array_key_exists("COMMENT_EVENT", $arSocNetLogEvents[$feature]) && is_array($arSocNetLogEvents[$feature]["COMMENT_EVENT"]) && array_key_exists("EVENT_ID", $arSocNetLogEvents[$feature]["COMMENT_EVENT"]) && strlen($arSocNetLogEvents[$feature]["COMMENT_EVENT"]["EVENT_ID"]) > 0) {
                         $event_id[] = $arSocNetLogEvents[$feature]["COMMENT_EVENT"]["EVENT_ID"];
                     }
                 }
                 if (array_key_exists($feature, $arSocNetFeaturesSettings) && array_key_exists("subscribe_events", $arSocNetFeaturesSettings[$feature]) && count($arSocNetFeaturesSettings[$feature]["subscribe_events"]) > 0) {
                     foreach ($arSocNetFeaturesSettings[$feature]["subscribe_events"] as $event_id_tmp => $arEventIDTmp) {
                         if (array_key_exists("NO_SET", $arEventIDTmp) && $arEventIDTmp["NO_SET"]) {
                             continue;
                         }
                         $event_id[] = $event_id_tmp;
                         if (array_key_exists("COMMENT_EVENT", $arEventIDTmp) && is_array($arEventIDTmp["COMMENT_EVENT"]) && array_key_exists("EVENT_ID", $arEventIDTmp["COMMENT_EVENT"]) && strlen($arEventIDTmp["COMMENT_EVENT"]["EVENT_ID"]) > 0) {
                             $event_id[] = $arEventIDTmp["COMMENT_EVENT"]["EVENT_ID"];
                         }
                     }
                 }
                 $event_id = array_unique($event_id);
                 $strWhere .= " AND (";
                 $i = 0;
                 foreach ($event_id as $ev) {
                     if ($i > 0) {
                         $strWhere .= " OR ";
                     }
                     $strWhere .= "EVENT_ID = '" . $ev . "'";
                     $i++;
                 }
                 $strWhere .= ")";
             }
         }
     }
     $bSuccess = $DB->Query("DELETE FROM b_sonet_event_user_view" . $strWhere, true);
     return $bSuccess;
 }
예제 #4
0
 function GetSubSelect($entityId, $entity_type = false, $entity_id = false, $event_id = false, $created_by_id = false, $arOfEntities = false, $arAdmin = false, $transport = false, $visible = "Y", $type = "L", $params = array(), $bDecrement = false, $bForAllAccess = false)
 {
     global $DB;
     if (is_array($entityId) && isset($entityId["LOG_ID"])) {
         $arFields = $entityId;
         $entityId = intval($arFields["LOG_ID"]);
         $entity_type = isset($arFields["ENTITY_TYPE"]) ? $arFields["ENTITY_TYPE"] : false;
         $entity_id = isset($arFields["ENTITY_ID"]) ? $arFields["ENTITY_ID"] : false;
         $event_id = isset($arFields["EVENT_ID"]) ? $arFields["EVENT_ID"] : false;
         $created_by_id = isset($arFields["CREATED_BY_ID"]) ? $arFields["CREATED_BY_ID"] : false;
         $arOfEntities = isset($arFields["ENTITIES"]) ? $arFields["ENTITIES"] : false;
         $transport = isset($arFields["TRANSPORT"]) ? $arFields["TRANSPORT"] : false;
         $visible = isset($arFields["VISIBLE"]) ? $arFields["VISIBLE"] : "Y";
         $type = isset($arFields["TYPE"]) ? $arFields["TYPE"] : "L";
         $code = isset($arFields["CODE"]) ? $arFields["CODE"] : false;
         $params = isset($arFields["PARAMS"]) ? $arFields["PARAMS"] : array();
         $bDecrement = isset($arFields["DECREMENT"]) ? $arFields["DECREMENT"] : false;
         $bMultiple = isset($arFields["MULTIPLE"]) && $arFields["MULTIPLE"] == "Y";
         $IsForAllAccessOnly = false;
         if (isset($arFields["FOR_ALL_ACCESS_ONLY"])) {
             $IsForAllAccessOnly = $arFields["FOR_ALL_ACCESS_ONLY"] ? "Y" : "N";
         }
         $bForAllAccess = $IsForAllAccessOnly == "Y" ? true : (isset($arFields["FOR_ALL_ACCESS"]) ? $arFields["FOR_ALL_ACCESS"] : false);
         $tagSet = isset($arFields["TAG_SET"]) ? $arFields["TAG_SET"] : false;
     }
     if (intval($entityId) <= 0) {
         return false;
     }
     $arSocNetAllowedSubscribeEntityTypesDesc = CSocNetAllowed::GetAllowedEntityTypesDesc();
     $bGroupCounters = $type === "group";
     $params = is_array($params) ? $params : array();
     $params['CODE'] = !empty($params['CODE']) ? $params['CODE'] : ($code ? $code : ($bGroupCounters ? "SLR0.GROUP_CODE" : "'**" . ($bMultiple ? $type . $entityId : "") . "'"));
     if ($type == "L" && ($arLog = CSocNetLog::GetByID($entityId))) {
         $logId = $entityId;
         $entity_type = $arLog["ENTITY_TYPE"];
         $entity_id = $arLog["ENTITY_ID"];
         $event_id = $arLog["EVENT_ID"];
         $created_by_id = $arLog["USER_ID"];
         $log_user_id = $arLog["USER_ID"];
     } elseif ($type == "LC" && ($arLogComment = CSocNetLogComments::GetByID($entityId))) {
         $entity_type = $arLogComment["ENTITY_TYPE"];
         $entity_id = $arLogComment["ENTITY_ID"];
         $event_id = $arLogComment["EVENT_ID"];
         $created_by_id = $arLogComment["USER_ID"];
         $logId = $arLogComment["LOG_ID"];
         // recalculate log_id
         $log_user_id = $arLogComment["LOG_USER_ID"];
     } else {
         $logId = $entityId;
     }
     if (!in_array($entity_type, CSocNetAllowed::GetAllowedEntityTypes()) || intval($entity_id) <= 0 || strlen($event_id) <= 0) {
         return false;
     }
     if (!$arOfEntities) {
         if (array_key_exists($entity_type, $arSocNetAllowedSubscribeEntityTypesDesc) && array_key_exists("HAS_MY", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["HAS_MY"] == "Y" && array_key_exists("CLASS_OF", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && array_key_exists("METHOD_OF", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && strlen($arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["CLASS_OF"]) > 0 && strlen($arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["METHOD_OF"]) > 0 && method_exists($arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["CLASS_OF"], $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["METHOD_OF"])) {
             $arOfEntities = call_user_func(array($arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["CLASS_OF"], $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["METHOD_OF"]), $entity_id);
         } else {
             $arOfEntities = array();
         }
     }
     if ((!defined("DisableSonetLogVisibleSubscr") || DisableSonetLogVisibleSubscr !== true) && $visible && strlen($visible) > 0) {
         $key_res = CSocNetGroup::GetFilterOperation($visible);
         $strField = $key_res["FIELD"];
         $strNegative = $key_res["NEGATIVE"];
         $strOperation = $key_res["OPERATION"];
         $visibleFilter = "AND (" . ($strNegative == "Y" ? " SLE.VISIBLE IS NULL OR NOT " : "") . "(SLE.VISIBLE " . $strOperation . " '" . $DB->ForSql($strField) . "'))";
         $transportFilter = "";
     } else {
         $visibleFilter = "";
         if ($transport && strlen($transport) > 0) {
             $key_res = CSocNetGroup::GetFilterOperation($transport);
             $strField = $key_res["FIELD"];
             $strNegative = $key_res["NEGATIVE"];
             $strOperation = $key_res["OPERATION"];
             $transportFilter = "AND (" . ($strNegative == "Y" ? " SLE.TRANSPORT IS NULL OR NOT " : "") . "(SLE.TRANSPORT " . $strOperation . " '" . $DB->ForSql($strField) . "'))";
         } else {
             $transportFilter = "";
         }
     }
     if ($type == "LC" && (!defined("DisableSonetLogFollow") || DisableSonetLogFollow !== true)) {
         $default_follow = COption::GetOptionString("socialnetwork", "follow_default_type", "Y");
         if ($default_follow == "Y") {
             $followJoin = " LEFT JOIN b_sonet_log_follow LFW ON LFW.USER_ID = U.ID AND (LFW.CODE = 'L" . $logId . "' OR LFW.CODE = '**') ";
             $followWhere = "AND (LFW.USER_ID IS NULL OR LFW.TYPE = 'Y')";
         } else {
             $followJoin = " \n\t\t\t\t\tINNER JOIN b_sonet_log_follow LFW ON LFW.USER_ID = U.ID AND (LFW.CODE = 'L" . $logId . "' OR LFW.CODE = '**')\n\t\t\t\t\tLEFT JOIN b_sonet_log_follow LFW2 ON LFW2.USER_ID = U.ID AND (LFW2.CODE = 'L" . $logId . "' AND LFW2.TYPE = 'N')\n\t\t\t\t";
             $followWhere = "\n\t\t\t\t\tAND (LFW.USER_ID IS NOT NULL AND LFW.TYPE = 'Y')\n\t\t\t\t\tAND LFW2.USER_ID IS NULL\n\t\t\t\t";
         }
     }
     $strOfEntities = is_array($arOfEntities) && count($arOfEntities) > 0 ? "U.ID IN (" . implode(",", $arOfEntities) . ")" : "";
     $strSQL = "\n\t\tSELECT DISTINCT\n\t\t\tU.ID as ID\n\t\t\t," . ($bDecrement ? "-1" : "1") . " as CNT\n\t\t\t," . $DB->IsNull("SLS.SITE_ID", "'**'") . " as SITE_ID\n\t\t\t," . $params['CODE'] . " as CODE,\n\t\t\t0 as SENT\n\t\t\t" . ($tagSet ? ", '" . $DB->ForSQL($tagSet) . "' as TAG" : "") . "\n\t\tFROM\n\t\t\tb_user U \n\t\t\tINNER JOIN b_sonet_log_right SLR ON SLR.LOG_ID = " . $logId . "\n\t\t\t" . ($bGroupCounters ? "INNER JOIN b_sonet_log_right SLR0 ON SLR0.LOG_ID = SLR.LOG_ID " : "") . "\n\t\t\t" . (!$bForAllAccess ? "INNER JOIN b_user_access UA ON UA.USER_ID = U.ID" : "") . "\n\t\t\tLEFT JOIN b_sonet_log_site SLS ON SLS.LOG_ID = SLR.LOG_ID\n\t\t\t" . (strlen($followJoin) > 0 ? $followJoin : "") . "\n\t\t\t" . (!$bGroupCounters && !IsModuleInstalled("intranet") ? "LEFT JOIN b_sonet_log_smartfilter SLSF ON SLSF.USER_ID = U.ID " : "") . "\n\t\t\t\n\t\tWHERE\n\t\t\tU.ACTIVE = 'Y'\n\t\t\tAND U.LAST_ACTIVITY_DATE IS NOT NULL\n\t\t\tAND\tU.LAST_ACTIVITY_DATE > " . CSocNetLogCounter::dbWeeksAgo(2) . "\n\t\t\t" . (($type == "LC" || array_key_exists("USE_CB_FILTER", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["USE_CB_FILTER"] == "Y") && intval($created_by_id) > 0 ? "AND U.ID <> " . $created_by_id : "") . "\n\t\t\t" . ($bGroupCounters ? "AND (SLR0.GROUP_CODE like 'SG%' AND SLR0.GROUP_CODE NOT LIKE 'SG%\\_%')" : "") . (!$bGroupCounters && !IsModuleInstalled("intranet") ? COption::GetOptionString("socialnetwork", "sonet_log_smart_filter", "N") == "Y" ? "\n\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t0=1 \n\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tSLSF.USER_ID IS NULL \n\t\t\t\t\t\t\t\t\t\t\tOR SLSF.TYPE = 'Y'\n\t\t\t\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\t\t\t\t" . (!$bForAllAccess ? "AND (UA.ACCESS_CODE = SLR.GROUP_CODE)" : "") . "\n\t\t\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t\t\tSLR.GROUP_CODE LIKE 'SG%'\n\t\t\t\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = 'U" . $log_user_id . "' \n\t\t\t\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = " . $DB->Concat("'U'", $DB->type == "MSSQL" ? "CAST(U.ID as varchar(17))" : "U.ID") . " \n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\tSLSF.TYPE <> 'Y'\n\t\t\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t\t\tSLR.GROUP_CODE IN ('AU', 'G2')\n\t\t\t\t\t\t\t\t\t\t\t" . (!$bForAllAccess ? "OR (UA.ACCESS_CODE = SLR.GROUP_CODE)" : "") . "\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t0=1 \n\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tSLSF.USER_ID IS NULL \n\t\t\t\t\t\t\t\t\t\t\tOR SLSF.TYPE <> 'Y'\n\t\t\t\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t\t\tSLR.GROUP_CODE IN ('AU', 'G2')\n\t\t\t\t\t\t\t\t\t\t\t" . ($bForAllAccess ? "" : " OR (UA.ACCESS_CODE = SLR.GROUP_CODE)") . "\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\tSLSF.TYPE = 'Y' \n\t\t\t\t\t\t\t\t\t\t" . ($bForAllAccess ? "" : "AND (UA.ACCESS_CODE = SLR.GROUP_CODE)") . "\n\t\t\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t\t\tSLR.GROUP_CODE LIKE 'SG%'\n\t\t\t\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = 'U" . $log_user_id . "'\n\t\t\t\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = " . $DB->Concat("'U'", $DB->type == "MSSQL" ? "CAST(U.ID as varchar(17))" : "U.ID") . " \n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t0=1\n\t\t\t\t\t\t\t" . ($IsForAllAccessOnly != "N" || $bForAllAccess ? "OR (SLR.GROUP_CODE IN ('AU', 'G2'))" : "") . "\n\t\t\t\t\t\t\t" . (!$bForAllAccess && $IsForAllAccessOnly != "Y" ? " OR (UA.ACCESS_CODE = SLR.GROUP_CODE) " : "") . "\n\t\t\t\t\t\t)\n\t\t\t\t\t") . " " . (strlen($followWhere) > 0 ? $followWhere : "") . "\n\t\t";
     if ($bGroupCounters) {
         return $strSQL;
     }
     if (strlen($visibleFilter) > 0 || strlen($transportFilter) > 0) {
         $strSQL .= "\n\t\t\t\tAND\t\n\t\t\t\t(\n\t\t\t\t\tEXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'N'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $entity_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\t" . $transportFilter . "\n\t\t\t\t\t\t\t" . $visibleFilter . "\n\t\t\t\t\t)";
         if (array_key_exists("USE_CB_FILTER", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["USE_CB_FILTER"] == "Y" && intval($created_by_id) > 0) {
             $strSQL .= "\n\t\t\t\tOR\n\t\t\t\t(\n\t\t\t\t\tEXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'Y'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $created_by_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\t" . $transportFilter . "\n\t\t\t\t\t\t\t" . $visibleFilter . "\n\t\t\t\t\t)\n\t\t\t\t)";
         }
         $strSQL .= "\n\t\t\tOR\n\t\t\t(\n\t\t\t\t(\n\t\t\t\t\tNOT EXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'N'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $entity_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t)\n\t\t\t\t\tOR\n\t\t\t\t\tEXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'N'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $entity_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\tAND " . ($visibleFilter ? "SLE.VISIBLE = 'I'" : "SLE.TRANSPORT = 'I'") . "\n\t\t\t\t\t)\n\t\t\t\t)";
         if (array_key_exists("USE_CB_FILTER", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["USE_CB_FILTER"] == "Y" && intval($created_by_id) > 0) {
             $strSQL .= "\n\t\t\t\tAND\n\t\t\t\t(\n\t\t\t\t\tNOT EXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'Y'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $created_by_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t)\n\t\t\t\t\tOR\n\t\t\t\t\tEXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'Y'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $created_by_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\tAND " . ($visibleFilter ? "SLE.VISIBLE = 'I'" : "SLE.TRANSPORT = 'I'") . "\n\t\t\t\t\t)\n\n\t\t\t\t)";
         }
         $strSQL .= "\n\t\t\t\tAND\n\t\t\t\t(\n\t\t\t\t\tEXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'N'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $entity_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = 'all'\n\t\t\t\t\t\t\t" . $transportFilter . "\n\t\t\t\t\t\t\t" . $visibleFilter . "\n\t\t\t\t\t)";
         if (array_key_exists("USE_CB_FILTER", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["USE_CB_FILTER"] == "Y" && intval($created_by_id) > 0) {
             $strSQL .= "\n\t\t\t\t\tOR\n\t\t\t\t\t(\n\t\t\t\t\t\tEXISTS(\n\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'Y'\n\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $created_by_id . "\n\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = 'all'\n\t\t\t\t\t\t\t\t" . $transportFilter . "\n\t\t\t\t\t\t\t\t" . $visibleFilter . "\n\t\t\t\t\t\t)\n\t\t\t\t\t)";
         }
         $strSQL .= "\n\t\t\t\t\tOR\n\t\t\t\t\t(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tNOT EXISTS(\n\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'N'\n\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $entity_id . "\n\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = 'all'\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\tEXISTS(\n\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'N'\n\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $entity_id . "\n\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = 'all'\n\t\t\t\t\t\t\t\t\tAND " . ($visibleFilter ? "SLE.VISIBLE = 'I'" : "SLE.TRANSPORT = 'I'") . "\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t\tAND ";
         if (array_key_exists("USE_CB_FILTER", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["USE_CB_FILTER"] == "Y" && intval($created_by_id) > 0) {
             $strSQL .= "\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tNOT EXISTS(\n\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'Y'\n\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $created_by_id . "\n\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = 'all'\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\tEXISTS(\n\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'Y'\n\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $created_by_id . "\n\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = 'all'\n\t\t\t\t\t\t\t\t\tAND " . ($visibleFilter ? "SLE.VISIBLE = 'I'" : "SLE.TRANSPORT = 'I'") . "\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t\tAND\n\t\t\t\t\t\t(\n\t\t\t\t\t\t";
         }
         if (strlen($strOfEntities) > 0) {
             $strSQL .= "\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t" . $strOfEntities . "\n\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tEXISTS(\n\t\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = 0\n\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_MY = 'Y'\n\t\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\t\t\t\t" . $transportFilter . "\n\t\t\t\t\t\t\t\t\t\t" . $visibleFilter . "\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\tEXISTS(\n\t\t\t\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = 0\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_MY = 'Y'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND " . ($visibleFilter ? "SLE.VISIBLE = 'I'" : "SLE.TRANSPORT = 'I'") . "\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\tNOT EXISTS(\n\t\t\t\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = 0\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_MY = 'Y'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\tEXISTS(\n\t\t\t\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = 0\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_MY = 'Y'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = 'all'\n\t\t\t\t\t\t\t\t\t\t\t\t" . $transportFilter . "\n\t\t\t\t\t\t\t\t\t\t\t\t" . $visibleFilter . "\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t\tOR\n\t\t\t\t\t";
         }
         $strSQL .= "\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tEXISTS(\n\t\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = 0\n\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_MY = 'N'\n\t\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\t\t\t\t" . $transportFilter . "\n\t\t\t\t\t\t\t\t\t\t" . $visibleFilter . "\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\tEXISTS(\n\t\t\t\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = 0\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_MY = 'N'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND " . ($visibleFilter ? "SLE.VISIBLE = 'I'" : "SLE.TRANSPORT = 'I'") . "\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\tNOT EXISTS(\n\t\t\t\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = 0\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_MY = 'N'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\tEXISTS(\n\t\t\t\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = 0\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_MY = 'N'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = 'all'\n\t\t\t\t\t\t\t\t\t\t" . $transportFilter . "\n\t\t\t\t\t\t\t\t\t\t" . $visibleFilter . "\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\tEXISTS(\n\t\t\t\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = 0\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_MY = 'N'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = 'all'\n\t\t\t\t\t\t\t\t\t\t\t\tAND " . ($visibleFilter ? "SLE.VISIBLE = 'I'" : "SLE.TRANSPORT = 'I'") . "\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\tNOT EXISTS(\n\t\t\t\t\t\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_ID = 0\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.ENTITY_MY = 'N'\n\t\t\t\t\t\t\t\t\t\t\t\tAND SLE.EVENT_ID = 'all'\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)";
         if (array_key_exists("USE_CB_FILTER", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["USE_CB_FILTER"] == "Y" && intval($created_by_id) > 0) {
             $strSQL .= "\n\t\t\t\t\t\t)";
         }
         $strSQL .= "\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\n\t\t\t)";
     }
     return $strSQL;
 }
예제 #5
0
 function GetSQLForEvent($entity_type, $entity_id, $event_id, $user_id, $transport = false, $visible = true, $arOfEntities = array())
 {
     if (!in_array($entity_type, CSocNetAllowed::GetAllowedEntityTypes())) {
         return false;
     }
     if (intval($entity_id) <= 0) {
         return false;
     }
     $strSQL = "";
     if (is_array($arOfEntities) && count($arOfEntities) > 0) {
         $strOfEntities = "AND LE.USER_ID IN (" . implode(",", $arOfEntities) . ")";
     } else {
         $strOfEntities = "";
     }
     if (is_array($transport) && count($transport) > 0) {
         $strTransport = "AND LE.TRANSPORT IN ('" . implode("', '", $transport) . "')";
     } elseif (!is_array($transport) && strlen($transport) > 0) {
         $strTransport = "AND LE.TRANSPORT = '" . $transport . "'";
     } else {
         $strTransport = "";
     }
     $strSQL .= "AND (\n\t\t\t(\t\n\t\t\t\tLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\tAND LE.ENTITY_ID = " . $entity_id . "\n\t\t\t\tAND LE.ENTITY_CB = 'N'\n\t\t\t\tAND LE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t" . $strTransport . "\n\t\t\t)";
     $arSocNetAllowedSubscribeEntityTypesDesc = CSocNetAllowed::GetAllowedEntityTypesDesc();
     if (array_key_exists("USE_CB_FILTER", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["USE_CB_FILTER"] == "Y" && intval($user_id) > 0) {
         $strSQL .= "\n\t\t\t\tOR \n\t\t\t\t(\n\t\t\t\t\tLE.ENTITY_TYPE = '" . SONET_SUBSCRIBE_ENTITY_USER . "'\n\t\t\t\t\tAND LE.ENTITY_ID = " . $user_id . "\n\t\t\t\t\tAND LE.ENTITY_CB = 'Y'\n\t\t\t\t\tAND \n\t\t\t\t\t(\n\t\t\t\t\t\tLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\tOR LE.EVENT_ID = 'all'\t\t\t\t\t\t\t\t\n\t\t\t\t\t)\n\t\t\t\t\t" . $strTransport . "\n\t\t\t\t)";
     }
     $strSQL .= "\n\t\t\tOR\n\t\t\t(\n\t\t\t\tLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\tAND LE.ENTITY_ID = " . $entity_id . "\n\t\t\t\tAND LE.ENTITY_CB = 'N'\n\t\t\t\tAND LE.EVENT_ID = 'all'\n\t\t\t\t" . $strTransport . "\n\t\t\t)\n\t\t\tOR \n\t\t\t(\n\t\t\t\tLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\tAND LE.ENTITY_ID = 0\n\t\t\t\tAND LE.ENTITY_MY = 'Y'\n\t\t\t\tAND \n\t\t\t\t(\n\t\t\t\t\tLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\tOR LE.EVENT_ID = 'all'\n\t\t\t\t)\n\t\t\t\t" . $strOfEntities . "\n\t\t\t\t" . $strTransport . "\n\t\t\t)\n\t\t\tOR\n\t\t\t(\n\t\t\t\tLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\tAND LE.ENTITY_ID = 0\n\t\t\t\tAND LE.ENTITY_MY = 'N'\n\t\t\t\tAND \n\t\t\t\t(\n\t\t\t\t\tLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\tOR LE.EVENT_ID = 'all'\n\t\t\t\t)\n\t\t\t\t" . $strTransport . "\n\t\t\t)\n\t\t)";
     return $strSQL;
 }
예제 #6
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("socialnetwork")) {
    ShowError(GetMessage("SONET_MODULE_NOT_INSTALL"));
    return;
}
$arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
$arSocNetLogEvents = CSocNetAllowed::GetAllowedLogEvents();
$arResult["arSocNetAllowedSubscribeEntityTypesDesc"] = CSocNetAllowed::GetAllowedEntityTypesDesc();
$arResult["arSocNetAllowedSubscribeEntityTypes"] = CSocNetAllowed::GetAllowedEntityTypes();
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components/bitrix/socialnetwork.subscribe_list/include.php";
$arParams["USER_ID"] = IntVal($GLOBALS["USER"]->GetID());
$arParams["SET_NAV_CHAIN"] = $arParams["SET_NAV_CHAIN"] == "N" ? "N" : "Y";
if (strLen($arParams["USER_VAR"]) <= 0) {
    $arParams["USER_VAR"] = "user_id";
}
if (strLen($arParams["PAGE_VAR"]) <= 0) {
    $arParams["PAGE_VAR"] = "page";
}
if (strLen($arParams["GROUP_VAR"]) <= 0) {
    $arParams["GROUP_VAR"] = "group_id";
}
$arParams["PATH_TO_USER"] = trim($arParams["PATH_TO_USER"]);
if (strlen($arParams["PATH_TO_USER"]) <= 0) {
    $arParams["PATH_TO_USER"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=user&" . $arParams["USER_VAR"] . "=#user_id#");
}
$arParams["PATH_TO_GROUP"] = trim($arParams["PATH_TO_GROUP"]);
if (strlen($arParams["PATH_TO_GROUP"]) <= 0) {
예제 #7
0
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
if (!$USER->IsAdmin()) {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
if (!CModule::IncludeModule('xdimport') || !CModule::IncludeModule('socialnetwork')) {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
IncludeModuleLangFile(__FILE__);
$arSocNetAllowedSubscribeEntityTypes = CSocNetAllowed::GetAllowedEntityTypes();
$arSocNetAllowedSubscribeEntityTypesDesc = CSocNetAllowed::GetAllowedEntityTypesDesc();
$arSocNetLogEvents = CSocNetAllowed::GetAllowedLogEvents();
$arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
$arEntityTypes = array();
$arEvents = array();
foreach ($arSocNetAllowedSubscribeEntityTypesDesc as $entity_type => $arEntityTypeTmp) {
    if (!array_key_exists("XDIMPORT_ALLOWED", $arEntityTypeTmp) || $arEntityTypeTmp["XDIMPORT_ALLOWED"] != "Y") {
        continue;
    }
    $arEntityTypes[$entity_type] = strtolower(array_key_exists("TITLE_ENTITY_XDI", $arEntityTypeTmp) ? $arEntityTypeTmp["TITLE_ENTITY_XDI"] : $arEntityTypeTmp["TITLE_ENTITY"]);
}
foreach ($arSocNetLogEvents as $event_id => $arEventTmp) {
    if (!$arEventTmp["HIDDEN"] && array_key_exists("ENTITIES", $arEventTmp) && is_array($arEventTmp["ENTITIES"])) {
        foreach ($arEventTmp["ENTITIES"] as $entity_type => $arEventEntityTmp) {
            $arEvents[$entity_type][$event_id] = array("ALLOWED" => array_key_exists("XDIMPORT_ALLOWED", $arEventTmp) && $arEventTmp["XDIMPORT_ALLOWED"] == "Y" ? "Y" : "N", "TITLE" => $arEventEntityTmp["TITLE"]);
        }
    }
}
foreach ($arSocNetFeaturesSettings as $feature_id => $arFeatureTmp) {
    if (array_key_exists("subscribe_events", $arFeatureTmp) && is_array($arFeatureTmp)) {