Beispiel #1
0
 public function onPrepareComponentParams($params)
 {
     $this->arIBlock = CIBlock::GetArrayByID($params["IBLOCK_ID"]);
     $this->arResult["IBLOCK"] = htmlspecialcharsex($this->arIBlock);
     $this->arResult["IBLOCK_ID"] = $this->arIBlock["ID"];
     $this->arResult["GRID_ID"] = "lists_list_elements_" . $this->arResult["IBLOCK_ID"];
     $this->arResult["ANY_SECTION"] = isset($_GET["list_section_id"]) && strlen($_GET["list_section_id"]) == 0;
     $this->arResult["SECTIONS"] = array();
     $this->arResult["SECTION_ID"] = false;
     $this->arResult["LIST_SECTIONS"] = array();
     if (isset($_GET["list_section_id"])) {
         $sectionId = intval($_GET["list_section_id"]);
     } else {
         $sectionId = intval($params["SECTION_ID"]);
     }
     $rsSections = CIBlockSection::GetList(array("left_margin" => "asc"), array("IBLOCK_ID" => $this->arIBlock["ID"], "GLOBAL_ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y"));
     while ($arSection = $rsSections->GetNext()) {
         $this->arResult["SECTIONS"][$arSection["ID"]] = array("ID" => $arSection["ID"], "NAME" => $arSection["NAME"]);
         if ($arSection["ID"] == $sectionId) {
             $this->arResult["SECTION"] = $arSection;
             $this->arResult["SECTION_ID"] = $arSection["ID"];
         }
         $this->arResult["LIST_SECTIONS"][$arSection["ID"]] = str_repeat(" . ", $arSection["DEPTH_LEVEL"]) . $arSection["NAME"];
     }
     $this->arResult["IS_SOCNET_GROUP_CLOSED"] = false;
     if (intval($params["~SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule("socialnetwork")) {
         $arSonetGroup = CSocNetGroup::GetByID(intval($params["~SOCNET_GROUP_ID"]));
         if (is_array($arSonetGroup) && $arSonetGroup["CLOSED"] == "Y" && !CSocNetUser::IsCurrentUserModuleAdmin() && ($arSonetGroup["OWNER_ID"] != $GLOBALS["USER"]->GetID() || COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") != "Y")) {
             $this->arResult["IS_SOCNET_GROUP_CLOSED"] = true;
         }
     }
     return $params;
 }
Beispiel #2
0
 function _FormatUser(&$arUser, $arPath)
 {
     global $USER, $CACHE_ABSENCE;
     if ($arUser['PERSONAL_PHOTO']) {
         $arImage = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 30);
         $arUser['PERSONAL_PHOTO'] = $arImage['IMG'];
     }
     if ($arPath['DETAIL_URL']) {
         $arUser['DETAIL_URL'] = str_replace('#ID#', $arUser['ID'], $arPath['DETAIL_URL']);
     }
     $arUser["canViewProfile"] = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arUser['ID'], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
     $arUser["canMessage"] = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arUser['ID'], "message", CSocNetUser::IsCurrentUserModuleAdmin());
     if ($arPath['MESSAGES_CHAT_URL']) {
         $arUser['MESSAGES_CHAT_URL'] = str_replace('#ID#', $arUser['ID'], $arPath['MESSAGES_CHAT_URL']);
     }
     $arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
     $arUser['IS_ONLINE'] = CSocNetUser::IsOnLine($arUser['ID']);
     if ($arUser['IS_ABSENT']) {
         $maxAbsence = 0;
         foreach ($CACHE_ABSENCE[$arUser["ID"]] as $arAbsence) {
             if (MakeTimeStamp($arAbsence["DATE_TO"]) > $maxAbsence) {
                 $arUser['ABSENT_TILL'] = $arAbsence["DATE_TO"];
             }
         }
     }
     $arFilter = array("TO_USER_ID" => $arUser['ID'], "MESSAGE_TYPE" => SONET_MESSAGE_PRIVATE, "FROM_USER_ID" => $USER->GetID());
     $dbMessages = CSocNetMessages::GetList(array("DATE_CREATE" => "DESC"), $arFilter, false, array("nTopCount" => 1), array("ID", "DATE_CREATE"));
     if ($arMessages = $dbMessages->GetNext()) {
         $arUser['LAST_CHAT'] = $arMessages["DATE_CREATE"];
     }
     return true;
 }
Beispiel #3
0
 public static function OnFillSocNetMenu(&$arResult, $arParams = array())
 {
     global $USER;
     $arResult["AllowSettings"]["group_lists"] = true;
     $arResult["CanView"]["group_lists"] = (array_key_exists("ActiveFeatures", $arResult) ? array_key_exists("group_lists", $arResult["ActiveFeatures"]) : true) && CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), $arParams["ENTITY_TYPE"], $arParams["ENTITY_ID"], "group_lists", "view", CSocNetUser::IsCurrentUserModuleAdmin());
     $arResult["Title"]["group_lists"] = array_key_exists("ActiveFeatures", $arResult) && array_key_exists("group_lists", $arResult["ActiveFeatures"]) && strlen($arResult["ActiveFeatures"]["group_lists"]) > 0 ? $arResult["ActiveFeatures"]["group_lists"] : GetMessage("LISTS_SOCNET_TAB");
     if (!array_key_exists("SEF_MODE", $arResult) || $arResult["SEF_MODE"] != "N") {
         if (isset($arResult["Urls"])) {
             $arResult["Urls"]["group_lists"] = $arResult["Urls"]["view"] . "lists/";
         }
     } else {
         if (!array_key_exists("PAGE_VAR", $arResult)) {
             $arResult["PAGE_VAR"] = "page";
         }
         if (!array_key_exists("GROUP_VAR", $arResult)) {
             $arResult["GROUP_VAR"] = "group_id";
         }
         $arResult["Urls"]["group_lists"] = "?" . $arResult["PAGE_VAR"] . "=group_lists&" . $arResult["GROUP_VAR"] . "=" . $arResult["Group"]["ID"];
     }
 }
Beispiel #4
0
 function __GCEGetGroup(&$group_id, &$arGroupProperties = array(), &$arGroupTmp = array(), $tab = false)
 {
     if (!CModule::IncludeModule("socialnetwork")) {
         $group_id = 0;
         return;
     }
     $arGroup = CSocNetGroup::GetByID($group_id);
     if ($arGroup && ($tab == "edit" && ($arGroup["OWNER_ID"] == $GLOBALS["USER"]->GetID() || CSocNetUser::IsCurrentUserModuleAdmin()) || $tab == "invite" && (CSocNetUser::IsCurrentUserModuleAdmin() || CSocNetGroup::CanUserInitiate($GLOBALS["USER"]->GetID(), $group_id)))) {
         $arGroupTmp["NAME"] = $arGroup["NAME"];
         $arGroupTmp["DESCRIPTION"] = $arGroup["DESCRIPTION"];
         $arGroupTmp["IMAGE_ID_DEL"] = "N";
         $arGroupTmp["SUBJECT_ID"] = $arGroup["SUBJECT_ID"];
         $arGroupTmp["VISIBLE"] = $arGroup["VISIBLE"];
         $arGroupTmp["OPENED"] = $arGroup["OPENED"];
         $arGroupTmp["CLOSED"] = $arGroup["CLOSED"];
         $arGroupTmp["KEYWORDS"] = $arGroup["KEYWORDS"];
         $arGroupTmp["OWNER_ID"] = $arGroup["OWNER_ID"];
         $arGroupTmp["INITIATE_PERMS"] = $arGroup["INITIATE_PERMS"];
         $arGroupTmp["SPAM_PERMS"] = $arGroup["SPAM_PERMS"];
         $arGroupTmp["IMAGE_ID"] = $arGroup["IMAGE_ID"];
         $arGroupTmp["IMAGE_ID_FILE"] = CFile::GetFileArray($arGroup["IMAGE_ID"]);
         $arGroupTmp["IMAGE_ID_IMG"] = '<img src="' . ($arGroupTmp["IMAGE_ID_FILE"] != false ? $arGroupTmp["IMAGE_ID_FILE"]["SRC"] : "/bitrix/images/1.gif") . '" height="60" class="sonet-group-create-popup-image" id="sonet_group_create_popup_image" border="0">';
         foreach ($arGroupProperties as $field => $arUserField) {
             if (array_key_exists($field, $arGroup)) {
                 $arGroupProperties[$field]["VALUE"] = $arGroup["~" . $field];
                 $arGroupProperties[$field]["ENTITY_VALUE_ID"] = $arGroup["ID"];
             }
         }
         $arGroupTmp["IS_EXTRANET_GROUP"] = "N";
         if (CModule::IncludeModule("extranet") && CExtranet::IsExtranetSocNetGroup($group_id)) {
             $arGroupTmp["IS_EXTRANET_GROUP"] = "Y";
         }
     } else {
         $arGroupTmp["VISIBLE"] = "Y";
         $arGroupTmp["IS_EXTRANET_GROUP"] = "N";
         $group_id = 0;
     }
 }
Beispiel #5
0
	public static function inviteGroupUsers($arFields)
	{
		global $USER;

		$groupID = $arFields['GROUP_ID'];
		$arUserID = $arFields['USER_ID'];
		$message = $arFields['MESSAGE'];

		if(intval($groupID) <= 0)
			throw new Exception('Wrong group ID');

		if (
			(is_array($arUserID) && count($arUserID) <= 0)
			|| (!is_array($arUserID) && intval($arUserID) <= 0)
		)
			throw new Exception('Wrong user IDs');

		if (!is_array($arUserID))
			$arUserID = array($arUserID);

		$arSuccessID = array();

		$dbRes = CSocNetGroup::GetList(array(), array(
			"ID" => $groupID,
			"CHECK_PERMISSIONS" => $USER->GetID(),
		));
		$arGroup = $dbRes->Fetch();
		if(is_array($arGroup))
		{
			foreach($arUserID as $user_id)
			{
				$isCurrentUserTmp = ($USER->GetID() == $user_id);
				$canInviteGroup = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $user_id, "invitegroup", CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false));
				$user2groupRelation = CSocNetUserToGroup::GetUserRole($user_id, $arGroup["ID"]);

				if (
					!$isCurrentUserTmp && $canInviteGroup && !$user2groupRelation
					&& CSocNetUserToGroup::SendRequestToJoinGroup($USER->GetID(), $user_id, $arGroup["ID"], $message, true)
				)
					$arSuccessID[] = $user_id;
			}
		}
		else
			throw new Exception('Socialnetwork group not found');

		return $arSuccessID;
	}
Beispiel #6
0
     unset($arFilter[">PERMS"]);
 }
 $arSelectedFields = array("ID", "BLOG_ID", "TITLE", "DATE_PUBLISH", "AUTHOR_ID", "DETAIL_TEXT", "BLOG_ACTIVE", "BLOG_URL", "BLOG_GROUP_ID", "BLOG_GROUP_SITE_ID", "AUTHOR_LOGIN", "AUTHOR_NAME", "AUTHOR_LAST_NAME", "AUTHOR_SECOND_NAME", "BLOG_USER_ALIAS", "BLOG_OWNER_ID", "VIEWS", "NUM_COMMENTS", "ATTACH_IMG", "BLOG_SOCNET_GROUP_ID", "CODE", "MICRO");
 if (CModule::IncludeModule("socialnetwork") && $arParams["USE_SOCNET"] == "Y") {
     unset($arFilter[">PERMS"]);
     $arFilter["BLOG_USE_SOCNET"] = "Y";
     if (IntVal($arParams["SOCNET_GROUP_ID"]) <= 0 && IntVal($arParams["USER_ID"]) <= 0) {
         $arFilter["FOR_USER"] = $user_id;
     } else {
         if (IntVal($arParams["USER_ID"]) > 0) {
             $arFilter["AUTHOR_ID"] = $arParams["USER_ID"];
             $arFilter["FOR_USER"] = $user_id;
         } elseif (IntVal($arParams["SOCNET_GROUP_ID"]) > 0) {
             $arFilter["SOCNET_GROUP_ID"] = $arParams["SOCNET_GROUP_ID"];
             $perms = BLOG_PERMS_DENY;
             if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "blog", "full_post", CSocNetUser::IsCurrentUserModuleAdmin()) || $APPLICATION->GetGroupRight("blog") >= "W") {
                 $perms = BLOG_PERMS_FULL;
             } elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "blog", "write_post")) {
                 $perms = BLOG_PERMS_WRITE;
             } elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "blog", "view_post")) {
                 $perms = BLOG_PERMS_READ;
             }
         }
     }
 }
 if ($perms != BLOG_PERMS_DENY) {
     $SORT = array($arParams["SORT_BY1"] => $arParams["SORT_ORDER1"], $arParams["SORT_BY2"] => $arParams["SORT_ORDER2"]);
     if ($arParams["MESSAGE_COUNT"] > 0) {
         $COUNT = array("nTopCount" => $arParams["MESSAGE_COUNT"]);
     } else {
         $COUNT = false;
Beispiel #7
0
 if ($gadget["BLOG_ONLY"] == true && $gadget["SG_ONLY"] == true && intval($arParams["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule('socialnetwork') && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "blog")) {
     continue;
 }
 if ($gadget["FORUM_ONLY"] == true && $gadget["SU_ONLY"] == true && intval($arParams["USER_ID"]) > 0 && CModule::IncludeModule('socialnetwork') && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $arParams["USER_ID"], "forum")) {
     continue;
 }
 if ($gadget["FORUM_ONLY"] == true && $gadget["SG_ONLY"] == true && intval($arParams["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule('socialnetwork') && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum")) {
     continue;
 }
 if ($gadget["SEARCH_ONLY"] == true && $gadget["SU_ONLY"] == true && intval($arParams["USER_ID"]) > 0 && CModule::IncludeModule('socialnetwork') && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $arParams["USER_ID"], "search")) {
     continue;
 }
 if ($gadget["SEARCH_ONLY"] == true && $gadget["SG_ONLY"] == true && intval($arParams["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule('socialnetwork') && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "search")) {
     continue;
 }
 if ($gadget["WIKI_ONLY"] == true && $gadget["SG_ONLY"] == true && intval($arParams["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule('socialnetwork') && (!CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "wiki") || !CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "wiki", "view", CSocNetUser::IsCurrentUserModuleAdmin()))) {
     continue;
 }
 if ($gadget["GROUP"]["ID"] == "") {
     $gadget["GROUP"]["ID"] = "other";
 }
 if (!isset($gadget["TOTALLY_FIXED"]) || !$gadget["TOTALLY_FIXED"]) {
     if (!is_array($gadget["GROUP"]["ID"])) {
         $arGroups[$gadget["GROUP"]["ID"]]["GADGETS"][] = $gadget["ID"];
     } else {
         foreach ($gadget["GROUP"]["ID"] as $group_id) {
             if (in_array($arParams["MODE"], array("SU", "SG")) && $group_id != "sonet" || !in_array($arParams["MODE"], array("SU", "SG")) && $group_id == "sonet" || $arParams["MODE"] == "AI" && $group_id != "admin" || $arParams["MODE"] != "AI" && $group_id == "admin") {
                 continue;
             }
             $arGroups[$group_id]["GADGETS"][] = $gadget["ID"];
         }
Beispiel #8
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
/**
 * @var array $arParams
 * @var array $arResult
 * @var CMain $APPLICATION
 * @var CUser $USER
 */
$rights = "N";
if (\CSocNetUser::IsCurrentUserModuleAdmin() || $APPLICATION->GetGroupRight("blog") >= "W") {
    $rights = "ALL";
} else {
    if (IsModuleInstalled("intranet") && $USER->IsAuthorized()) {
        $rights = "OWN";
    } else {
        if (!IsModuleInstalled("intranet")) {
            $rights = $arResult["Perm"] < BLOG_PERMS_FULL ? "OWNLAST" : "ALL";
        }
    }
}
$eventHandlerID = AddEventHandler('main', 'system.field.view.file', array('CBlogTools', 'blogUFfileShow'));
$arResult["OUTPUT_LIST"] = $APPLICATION->IncludeComponent("bitrix:main.post.list", "", array("TEMPLATE_ID" => 'BLOG_COMMENT_BG_', "RATING_TYPE_ID" => $arParams["SHOW_RATING"] == "Y" ? "BLOG_COMMENT" : "", "ENTITY_XML_ID" => $arParams["ENTITY_XML_ID"], "RECORDS" => $arResult["RECORDS"], "NAV_STRING" => $arResult["NAV_STRING"], "NAV_RESULT" => $arResult["NAV_RESULT"], "PREORDER" => "N", "RIGHTS" => array("MODERATE" => $arResult["Perm"] >= BLOG_PERMS_MODERATE ? "Y" : "N", "EDIT" => $rights, "DELETE" => $rights), "VISIBLE_RECORDS_COUNT" => $arResult["newCount"], "ERROR_MESSAGE" => $arResult["ERROR_MESSAGE"] ?: $arResult["COMMENT_ERROR"], "OK_MESSAGE" => $arResult["MESSAGE"], "RESULT" => $arResult["ajax_comment"] ?: $_GET["commentId"], "PUSH&PULL" => $arResult["PUSH&PULL"], "VIEW_URL" => str_replace("#comment_id#", "#ID#", $arResult["urlMobileToComment"]), "EDIT_URL" => str_replace("#comment_id#", "#ID#", $arResult["urlMobileToComment"]), "MODERATE_URL" => str_replace(array("hide_comment_id=", "#comment_id#"), array("#action#_comment_id=", "#ID#"), $arResult["urlMobileToHide"]), "DELETE_URL" => str_replace("#comment_id#", "#ID#", $arResult["urlMobileToDelete"]), "AUTHOR_URL" => "/mobile/users/?user_id=#user_id#", "AVATAR_SIZE" => $arParams["AVATAR_SIZE_COMMENT"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams['SHOW_LOGIN'], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT"], "LAZYLOAD" => $arParams["LAZYLOAD"], "NOTIFY_TAG" => $arParams["bFromList"] ? "BLOG|COMMENT" : "", "NOTIFY_TEXT" => $arParams["bFromList"] ? TruncateText(str_replace(array("\r\n", "\n"), " ", $arParams["POST_DATA"]["~TITLE"]), 100) : "", "SHOW_MINIMIZED" => "Y", "SHOW_POST_FORM" => $arResult["CanUserComment"] ? "Y" : "N", "IMAGE_SIZE" => $arParams["IMAGE_SIZE"], "mfi" => $arParams["mfi"], "FORM" => array("ID" => $this->__component->__name, "URL" => $APPLICATION->GetCurPageParam("", array("sessid", "comment_post_id", "act", "post", "comment", "decode", "ACTION", "ENTITY_TYPE_ID", "ENTITY_ID", "empty_get_form", "empty_get_comments")))), $this->__component);
if ($eventHandlerID > 0) {
    RemoveEventHandler('main', 'system.field.view.file', $eventHandlerID);
}
if ($arResult["CanUserComment"] == "Y") {
    ob_start();
    include_once __DIR__ . "/script.php";
Beispiel #9
0
<?php

define("STOP_STATISTICS", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
require_once "functions.php";
CModule::IncludeModule('socialnetwork');
if (!$USER->IsAuthorized()) {
    die;
}
$SITE_ID = isset($_GET["SITE_ID"]) ? $_GET["SITE_ID"] : SITE_ID;
if ($_REQUEST["mode"] == "search") {
    CUtil::decodeURIComponent($_GET);
    $APPLICATION->RestartBuffer();
    CSocNetTools::InitGlobalExtranetArrays($SITE_ID);
    $arFilter = array("SITE_ID" => $SITE_ID, "%NAME" => $_GET["query"]);
    if (!CSocNetUser::IsCurrentUserModuleAdmin($SITE_ID)) {
        $arFilter["CHECK_PERMISSIONS"] = $USER->GetID();
    }
    $rsGroups = CSocNetGroup::GetList(array("NAME" => "ASC"), $arFilter);
    $arGroups = array();
    while ($arGroup = $rsGroups->Fetch()) {
        if (isset($GLOBALS["arExtranetGroupID"]) && is_array($GLOBALS["arExtranetGroupID"]) && in_array($arGroup["ID"], $GLOBALS["arExtranetGroupID"])) {
            $arGroup["IS_EXTRANET"] = "Y";
        }
        $arGroups[] = group2JSItem($arGroup);
    }
    if (isset($_REQUEST["features_perms"]) && sizeof($_REQUEST["features_perms"]) == 2) {
        filterByFeaturePerms($arGroups, $_REQUEST["features_perms"]);
    }
    Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
    echo CUtil::PhpToJsObject($arGroups);
Beispiel #10
0
 $arResult["Urls"]["Microblog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_MICROBLOG"], array("user_id" => $arResult["User"]["ID"]));
 $arResult["Urls"]["Photo"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_PHOTO"], array("user_id" => $arResult["User"]["ID"]));
 $arResult["Urls"]["Forum"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_FORUM"], array("user_id" => $arResult["User"]["ID"]));
 $arResult["Urls"]["Calendar"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_CALENDAR"], array("user_id" => $arResult["User"]["ID"]));
 $arResult["Urls"]["Tasks"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_TASKS"], array("user_id" => $arResult["User"]["ID"]));
 $arResult["Urls"]["Files"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_FILES"], array("user_id" => $arResult["User"]["ID"], "path" => ""));
 $arResult["Urls"]["content_search"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_CONTENT_SEARCH"], array("user_id" => $arResult["User"]["ID"]));
 $arResult["ActiveFeatures"] = CSocNetFeatures::GetActiveFeaturesNames(SONET_ENTITY_USER, $arResult["User"]["ID"]);
 $arResult["CanView"]["files"] = array_key_exists("files", $arResult["ActiveFeatures"]) && (CSocNetUser::IsCurrentUserModuleAdmin() || CModule::IncludeModule('webdav') && CIBlockWebdavSocnet::CanAccessFiles($arParams["FILES_USER_IBLOCK_ID"], 'user', $arResult["User"]["ID"]));
 $arResult["CanView"]["tasks"] = array_key_exists("tasks", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "tasks", "view", CSocNetUser::IsCurrentUserModuleAdmin());
 $arResult["CanView"]["calendar"] = array_key_exists("calendar", $arResult["ActiveFeatures"]);
 $arResult["CanView"]["microblog"] = array_key_exists("microblog", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "blog", "view_post", CSocNetUser::IsCurrentUserModuleAdmin());
 $arResult["CanView"]["blog"] = array_key_exists("blog", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "blog", "view_post", CSocNetUser::IsCurrentUserModuleAdmin());
 $arResult["CanView"]["photo"] = array_key_exists("photo", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "photo", "view", CSocNetUser::IsCurrentUserModuleAdmin());
 $arResult["CanView"]["forum"] = array_key_exists("forum", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "forum", "view", CSocNetUser::IsCurrentUserModuleAdmin());
 $arResult["CanView"]["content_search"] = array_key_exists("search", $arResult["ActiveFeatures"]) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "search", "view", CSocNetUser::IsCurrentUserModuleAdmin());
 $arResult["Title"]["blog"] = array_key_exists("blog", $arResult["ActiveFeatures"]) && StrLen($arResult["ActiveFeatures"]["blog"]) > 0 ? $arResult["ActiveFeatures"]["blog"] : GetMessage("SONET_UM_BLOG");
 $arResult["Title"]["microblog"] = array_key_exists("microblog", $arResult["ActiveFeatures"]) && StrLen($arResult["ActiveFeatures"]["microblog"]) > 0 ? $arResult["ActiveFeatures"]["microblog"] : GetMessage("SONET_UM_MICROBLOG");
 $arResult["Title"]["photo"] = array_key_exists("photo", $arResult["ActiveFeatures"]) && StrLen($arResult["ActiveFeatures"]["photo"]) > 0 ? $arResult["ActiveFeatures"]["photo"] : GetMessage("SONET_UM_PHOTO");
 $arResult["Title"]["forum"] = array_key_exists("forum", $arResult["ActiveFeatures"]) && StrLen($arResult["ActiveFeatures"]["forum"]) > 0 ? $arResult["ActiveFeatures"]["forum"] : GetMessage("SONET_UM_FORUM");
 $arResult["Title"]["calendar"] = array_key_exists("calendar", $arResult["ActiveFeatures"]) && StrLen($arResult["ActiveFeatures"]["calendar"]) > 0 ? $arResult["ActiveFeatures"]["calendar"] : GetMessage("SONET_UM_CALENDAR");
 $arResult["Title"]["tasks"] = array_key_exists("tasks", $arResult["ActiveFeatures"]) && StrLen($arResult["ActiveFeatures"]["tasks"]) > 0 ? $arResult["ActiveFeatures"]["tasks"] : GetMessage("SONET_UM_TASKS");
 $arResult["Title"]["files"] = array_key_exists("files", $arResult["ActiveFeatures"]) && StrLen($arResult["ActiveFeatures"]["files"]) > 0 ? $arResult["ActiveFeatures"]["files"] : GetMessage("SONET_UM_FILES");
 $arResult["Title"]["content_search"] = array_key_exists("search", $arResult["ActiveFeatures"]) && StrLen($arResult["ActiveFeatures"]["search"]) > 0 ? $arResult["ActiveFeatures"]["search"] : GetMessage("SONET_UM_SEARCH");
 $a = array_keys($arResult["Urls"]);
 foreach ($a as $v) {
     $arResult["Urls"][strtolower($v)] = $arResult["Urls"][$v];
 }
 $events = GetModuleEvents("socialnetwork", "OnFillSocNetMenu");
 while ($arEvent = $events->Fetch()) {
     ExecuteModuleEventEx($arEvent, array(&$arResult));
Beispiel #11
0
    $arResult["NEED_AUTH"] = "Y";
} else {
    $arGroup = CSocNetGroup::GetByID($arParams["GROUP_ID"]);
    if (!$arGroup || !is_array($arGroup) || $arGroup["ACTIVE"] != "Y") {
        $arResult["FatalError"] = GetMessage("SONET_P_USER_NO_GROUP") . ". ";
    } else {
        $arGroupSites = array();
        $rsGroupSite = CSocNetGroup::GetSite($arGroup["ID"]);
        while ($arGroupSite = $rsGroupSite->Fetch()) {
            $arGroupSites[] = $arGroupSite["LID"];
        }
        if (!in_array(SITE_ID, $arGroupSites)) {
            $arResult["FatalError"] = GetMessage("SONET_P_USER_NO_GROUP");
        } else {
            $arResult["Group"] = $arGroup;
            $arResult["CurrentUserPerms"] = CSocNetUserToGroup::InitUserPerms($GLOBALS["USER"]->GetID(), $arResult["Group"], CSocNetUser::IsCurrentUserModuleAdmin());
            $arResult["Urls"]["User"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $GLOBALS["USER"]->GetID()));
            $arResult["Urls"]["Group"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arResult["Group"]["ID"]));
            if ($arParams["SET_TITLE"] == "Y") {
                $APPLICATION->SetTitle(GetMessage("SONET_C37_PAGE_TITLE"));
            }
            if ($arParams["SET_NAV_CHAIN"] != "N") {
                $APPLICATION->AddChainItem($arResult["Group"]["NAME"], $arResult["Urls"]["Group"]);
                $APPLICATION->AddChainItem(GetMessage("SONET_C37_PAGE_TITLE"));
            }
            if ($arResult["CurrentUserPerms"]["UserIsOwner"]) {
                $arResult["FatalError"] = GetMessage("SONET_C37_IS_OWNER") . ". ";
            } elseif (!$arResult["CurrentUserPerms"]["UserIsMember"]) {
                $arResult["FatalError"] = GetMessage("SONET_C37_NOT_MEMBER") . ". ";
            } else {
                if ($arParams["SET_TITLE"] == "Y") {
Beispiel #12
0
 public function GetFormHtml($arParams = false)
 {
     global $USER;
     if (is_array($arParams["socnetgroups"]) && $arParams["socnetgroups"]["disabled"] == "true") {
         return false;
     }
     $currElements = '';
     if (is_array($arParams[$this->id]) && ($group_id = intval($arParams[$this->id]["group_id"])) > 0) {
         $arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 4);
         $arFilter = array("ID" => $group_id, "ACTIVE" => "Y");
         if (!CSocNetUser::IsCurrentUserModuleAdmin($arParams["SITE_ID"])) {
             $arFilter["CHECK_PERMISSIONS"] = $USER->GetID();
         }
         $rsGroups = CSocNetGroup::GetList(array(), $arFilter);
         if ($arGroup = $rsGroups->Fetch()) {
             $arItem = array("ID" => "SG" . $arGroup['ID'], "AVATAR" => '/bitrix/js/main/core/images/access/avatar-user-everyone.png', "NAME" => $arGroup['NAME'], "DESC" => $arGroup['DESCRIPTION'], "OPEN" => "Y", "CHECKBOX" => array("#ID#_A" => GetMessage("authprov_sg_a"), "#ID#_E" => GetMessage("authprov_sg_e"), "#ID#_K" => GetMessage("authprov_sg_k")));
             if ($arGroup["IMAGE_ID"]) {
                 $imageFile = CFile::GetFileArray($arGroup["IMAGE_ID"]);
                 if ($imageFile !== false) {
                     $arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
                     $arItem["AVATAR"] = $arFileTmp["src"];
                 }
             }
             $currElements .= CFinder::GetFinderItem($arFinderParams, $arItem);
         }
     }
     $elements = "";
     $arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 3);
     $arLRU = CAccess::GetLastRecentlyUsed($this->id);
     if (!empty($arLRU)) {
         $arLast = array();
         $arLastID = array();
         $arElements = array();
         foreach ($arLRU as $val) {
             if (preg_match('/^SG([0-9]+)_([A-Z])/', $val, $match)) {
                 $arLast[$match[2]][$match[1]] = $match[1];
                 $arLastID[$match[1]] = $match[1];
             }
         }
         if (!empty($arLastID)) {
             $arFilter = array("ID" => $arLastID, "ACTIVE" => "Y");
             if ($arParams["SITE_ID"] != '') {
                 $arFilter["SITE_ID"] = $arParams["SITE_ID"];
             }
             if (!CSocNetUser::IsCurrentUserModuleAdmin($arParams["SITE_ID"])) {
                 $arFilter["CHECK_PERMISSIONS"] = $USER->GetID();
             }
             $rsGroups = CSocNetGroup::GetList(array("NAME" => "ASC"), $arFilter);
             while ($arGroup = $rsGroups->Fetch()) {
                 $arItem = array("ID" => $arGroup['ID'], "AVATAR" => '/bitrix/js/main/core/images/access/avatar-user-everyone.png', "NAME" => $arGroup['NAME'], "DESC" => $arGroup['DESCRIPTION']);
                 if ($arGroup["IMAGE_ID"]) {
                     $imageFile = CFile::GetFileArray($arGroup["IMAGE_ID"]);
                     if ($imageFile !== false) {
                         $arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
                         $arItem["AVATAR"] = $arFileTmp["src"];
                     }
                 }
                 $arElements[$arItem['ID']] = $arItem;
             }
             foreach ($arLRU as $val) {
                 if (preg_match('/^SG([0-9]+)_([A-Z])/', $val, $match)) {
                     $arItem = $arElements[$match[1]];
                     if ($match[2] == 'K') {
                         $arItem['ID'] = 'SG' . $arElements[$match[1]]['ID'] . '_K';
                         $arItem['NAME'] = $arElements[$match[1]]['NAME'] . ': ' . GetMessage("authprov_sg_k");
                     } else {
                         if ($match[2] == 'E') {
                             $arItem['ID'] = 'SG' . $arElements[$match[1]]['ID'] . '_E';
                             $arItem['NAME'] = $arElements[$match[1]]['NAME'] . ': ' . GetMessage("authprov_sg_e");
                         } else {
                             if ($match[2] == 'A') {
                                 $arItem['ID'] = 'SG' . $arElements[$match[1]]['ID'] . '_A';
                                 $arItem['NAME'] = $arElements[$match[1]]['NAME'] . ': ' . GetMessage("authprov_sg_a");
                             }
                         }
                     }
                     $elements .= CFinder::GetFinderItem($arFinderParams, $arItem);
                 }
             }
         }
     }
     $arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 4);
     $arFilter = array("USER_ID" => $USER->GetID(), "<=ROLE" => SONET_ROLES_USER, "GROUP_ACTIVE" => "Y");
     if ($arParams["SITE_ID"] != '') {
         $arFilter["GROUP_SITE_ID"] = $arParams["SITE_ID"];
     }
     $rsGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), $arFilter, false, array(), array("ID", "GROUP_ID", "GROUP_NAME", "GROUP_DESCRIPTION", "GROUP_IMAGE_ID"));
     $myElements = '';
     while ($arGroup = $rsGroups->Fetch()) {
         $arItem = array("ID" => "SG" . $arGroup['GROUP_ID'], "AVATAR" => $arGroup['GROUP_IMAGE_ID'], "NAME" => $arGroup['GROUP_NAME'], "DESC" => $arGroup['GROUP_DESCRIPTION'], "CHECKBOX" => array("#ID#_A" => GetMessage("authprov_sg_a"), "#ID#_E" => GetMessage("authprov_sg_e"), "#ID#_K" => GetMessage("authprov_sg_k")));
         if ($arGroup["GROUP_IMAGE_ID"]) {
             $imageFile = CFile::GetFileArray($arGroup["GROUP_IMAGE_ID"]);
             if ($imageFile !== false) {
                 $arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
                 $arItem["AVATAR"] = $arFileTmp["src"];
             }
         }
         $myElements .= CFinder::GetFinderItem($arFinderParams, $arItem);
     }
     $arPanels = array();
     if ($currElements != '') {
         $arPanels[] = array("NAME" => GetMessage("authprov_sg_current"), "ELEMENTS" => $currElements);
     }
     $arPanels[] = array("NAME" => GetMessage("authprov_sg_panel_last"), "ELEMENTS" => $elements);
     $arPanels[] = array("NAME" => GetMessage("authprov_sg_panel_my_group"), "ELEMENTS" => $myElements);
     $arPanels[] = array("NAME" => GetMessage("authprov_sg_panel_search"), "ELEMENTS" => CFinder::GetFinderItem(array("TYPE" => "text"), array("TEXT" => GetMessage("authprov_sg_panel_search_text"))), "SEARCH" => "Y");
     $html = CFinder::GetFinderAppearance($arFinderParams, $arPanels);
     return array("HTML" => $html, "SELECTED" => $currElements != '');
 }
Beispiel #13
0
                $APPLICATION->AddChainItem(GetMessage("SONET_C36_PAGE_TITLE"));
            } elseif ($arParams["PAGE"] == "user_groups") {
                $APPLICATION->AddChainItem($strTitleFormatted, CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arResult["User"]["ID"])));
                $APPLICATION->AddChainItem(GetMessage("SONET_C36_PAGE_TITLE1"));
            } else {
                if ($arResult["filter_my"] == "Y") {
                    $APPLICATION->AddChainItem(GetMessage("SONET_C36_PAGE_TITLE2_1"));
                } elseif ($arResult["filter_archive"] == "Y") {
                    $APPLICATION->AddChainItem(GetMessage("SONET_C36_PAGE_TITLE2_2"));
                } elseif ($arResult["filter_extranet"] == "Y") {
                    $APPLICATION->AddChainItem(GetMessage("SONET_C36_PAGE_TITLE2_3"));
                } else {
                    $APPLICATION->AddChainItem(GetMessage("SONET_C36_PAGE_TITLE2"));
                }
            }
        }
    }
    if (CSocNetUser::IsCurrentUserModuleAdmin() && CModule::IncludeModule('intranet')) {
        global $INTRANET_TOOLBAR;
        $INTRANET_TOOLBAR->AddButton(array('HREF' => "/bitrix/admin/socnet_subject.php?lang=" . LANGUAGE_ID, "TEXT" => GetMessage('SONET_C36_EDIT_ENTRIES'), 'ICON' => 'settings', "SORT" => 1000));
    }
}
$this->IncludeComponentTemplate();
?>






Beispiel #14
0
 public function GetUserMaxPermission($ownerType, $ownerId, $userId, $iblockId)
 {
     $arParameters = array("PERMISSION" => "D", "CHECK_CREATOR" => "N");
     $ownerId = intVal($ownerId);
     $userId = intVal($userId);
     $iblockId = intval($iblockId);
     if (!in_array($ownerType, array("user", "group")) || $ownerId <= 0 || $iblockId <= 0) {
         return $arParameters;
     } elseif ($GLOBALS["USER"]->IsAuthorized() && $GLOBALS["USER"]->GetID() == $userId && CSocNetUser::IsCurrentUserModuleAdmin()) {
         $arParameters["PERMISSION"] = "X";
         return $arParameters;
     }
     $bBizproc = false;
     if (CModule::IncludeModule("bizproc") && CIBlock::GetArrayByID($iblockId, "BIZPROC") != "N") {
         $bBizproc = true;
     }
     $arParameters["PERMISSION"] = "X";
     /*
     		if ($ownerType == "user"):
     			if ($userId == $ownerId):
     				$arParameters["PERMISSION"] = "X";
     			elseif (CSocNetFeaturesPerms::CanPerformOperation(
     				$userId,
     				SONET_ENTITY_USER,
     				$ownerId,
     				"files",
     				"write",
     				CSocNetUser::IsCurrentUserModuleAdmin())):
     				$arParameters["PERMISSION"]	= "W";
     			elseif ($bBizproc && CSocNetFeaturesPerms::CanPerformOperation(
     				$userId,
     				SONET_ENTITY_USER,
     				$ownerId,
     				"files",
     				"bizproc",
     				CSocNetUser::IsCurrentUserModuleAdmin())):
     				$arParameters["PERMISSION"]	= "U";
     			elseif (CSocNetFeaturesPerms::CanPerformOperation(
     				$userId,
     				SONET_ENTITY_USER,
     				$ownerId,
     				"files",
     				"write_limited",
     				CSocNetUser::IsCurrentUserModuleAdmin())):
     				$arParameters["PERMISSION"]	= "W";
     				$arParameters["CHECK_CREATOR"] = "Y";
     			elseif (CSocNetFeaturesPerms::CanPerformOperation(
     				$userId,
     				SONET_ENTITY_USER,
     				$ownerId,
     				"files",
     				"view",
     				CSocNetUser::IsCurrentUserModuleAdmin())):
     				$arParameters["PERMISSION"]	= "R";
     			endif;
     		elseif ($ownerType == "group"):
     			if (CSocNetUserToGroup::GetUserRole($userId, $ownerId) == SONET_ROLES_OWNER):
     				$arParameters["PERMISSION"]	= "X";
     			elseif (CSocNetFeaturesPerms::CanPerformOperation(
     				$userId,
     				SONET_ENTITY_GROUP,
     				$ownerId,
     				"files",
     				"write",
     				CSocNetUser::IsCurrentUserModuleAdmin())):
     				$arParameters["PERMISSION"]	= "W";
     			elseif ($bBizproc && CSocNetFeaturesPerms::CanPerformOperation(
     				$userId,
     				SONET_ENTITY_GROUP,
     				$ownerId,
     				"files",
     				"bizproc",
     				CSocNetUser::IsCurrentUserModuleAdmin())):
     				$arParameters["PERMISSION"]	= "U";
     			elseif (CSocNetFeaturesPerms::CanPerformOperation(
     				$userId,
     				SONET_ENTITY_GROUP,
     				$ownerId,
     				"files",
     				"write_limited",
     				CSocNetUser::IsCurrentUserModuleAdmin())):
     				$arParameters["PERMISSION"]	= "W";
     				$arParameters["CHECK_CREATOR"] = "Y";
     			elseif (CSocNetFeaturesPerms::CanPerformOperation(
     				$userId,
     				SONET_ENTITY_GROUP,
     				$ownerId,
     				"files",
     				"view",
     				CSocNetUser::IsCurrentUserModuleAdmin())):
     				$arParameters["PERMISSION"]	= "R";
     			endif;
     		endif;
     */
     return $arParameters;
 }
Beispiel #15
0
if (strlen($arParams["NAME_TEMPLATE"]) <= 0) {
    $arParams["NAME_TEMPLATE"] = CSite::GetNameFormat();
}
$bUseLogin = $arParams['SHOW_LOGIN'] != "N" ? true : false;
if (!CSocNetUser::IsFriendsAllowed()) {
    $arResult["FatalError"] = GetMessage("SONET_C35_NO_FR_FUNC") . ". ";
} else {
    if (!$GLOBALS["USER"]->IsAuthorized()) {
        $arResult["NEED_AUTH"] = "Y";
    } else {
        $dbUser = CUser::GetByID($arParams["ID"]);
        $arResult["User"] = $dbUser->GetNext();
        if (!is_array($arResult["User"])) {
            $arResult["FatalError"] = GetMessage("SONET_P_USER_NO_USER") . ". ";
        } else {
            $arResult["CurrentUserPerms"] = CSocNetUserPerms::InitUserPerms($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"], CSocNetUser::IsCurrentUserModuleAdmin());
            if (!$arResult["CurrentUserPerms"]["IsCurrentUser"]) {
                $arResult["CurrentUserRelation"] = CSocNetUserRelations::GetRelation($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"]);
            }
            $arResult["Urls"]["User"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arResult["User"]["ID"]));
            $arResult["User"]["NAME_FORMATTED"] = CUser::FormatName($arParams['NAME_TEMPLATE'], $arResult["User"], $bUseLogin);
            if ($arParams["SET_TITLE"] == "Y" || $arParams["SET_NAV_CHAIN"] != "N") {
                $arParams["TITLE_NAME_TEMPLATE"] = str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
                $strTitleFormatted = CUser::FormatName($arParams['TITLE_NAME_TEMPLATE'], $arResult["User"], $bUseLogin);
            }
            if ($arParams["SET_TITLE"] == "Y") {
                $APPLICATION->SetTitle($strTitleFormatted . ": " . GetMessage("SONET_C35_PAGE_TITLE"));
            }
            if ($arParams["SET_NAV_CHAIN"] != "N") {
                $APPLICATION->AddChainItem($strTitleFormatted, $arResult["Urls"]["User"]);
                $APPLICATION->AddChainItem(GetMessage("SONET_C35_PAGE_TITLE"));
Beispiel #16
0
         $cache->EndDataCache($arCacheData);
     }
 }
 $arResult["arUser"]["urlToPostImportant"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST_IMPORTANT"], array("user_id" => $arPost["AUTHOR_ID"]));
 $arResult["CanComment"] = $GLOBALS["USER"]->IsAuthorized();
 $arResult["dest_users"] = array();
 foreach ($arResult["Post"]["SPERM"] as $key => $value) {
     foreach ($value as $kk => $vv) {
         $arResult["PostSrc"]["SPERM"][$key][] = $kk;
         if ($key == "U") {
             $arResult["dest_users"][] = $kk;
         }
     }
 }
 $arResult["PostSrc"]["HAVE_ALL_IN_ADR"] = $arResult["Post"]["HAVE_ALL_IN_ADR"];
 if ($arParams["CHECK_PERMISSIONS_DEST"] == "N" && !CSocNetUser::IsCurrentUserModuleAdmin() && is_object($GLOBALS["USER"])) {
     $arResult["Post"]["SPERM_HIDDEN"] = 0;
     $arGroupID = CSocNetLogTools::GetAvailableGroups($arResult["bExtranetUser"] ? "Y" : "N", $arResult["bExtranetSite"] ? "Y" : "N");
     if (!$arResult["bExtranetUser"] && CModule::IncludeModule("extranet")) {
         $arAvailableExtranetUserID = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
     }
     foreach ($arResult["Post"]["SPERM"] as $group_code => $arBlogSPerm) {
         foreach ($arBlogSPerm as $entity_id => $arBlogSPermDesc) {
             if ($group_code == "SG" && !in_array($entity_id, $arGroupID) || $group_code == "DR" && $arResult["bExtranetUser"] || $group_code == "U" && isset($arUserIdVisible) && is_array($arUserIdVisible) && !in_array($entity_id, $arUserIdVisible) || $group_code == "U" && isset($arBlogSPermDesc["IS_EXTRANET"]) && $arBlogSPermDesc["IS_EXTRANET"] == "Y" && isset($arAvailableExtranetUserID) && is_array($arAvailableExtranetUserID) && !in_array($entity_id, $arAvailableExtranetUserID)) {
                 unset($arResult["Post"]["SPERM"][$group_code][$entity_id]);
                 $arResult["Post"]["SPERM_HIDDEN"]++;
                 $arResult["PostSrc"]["SPERM_HIDDEN"][] = $group_code . $entity_id;
             }
         }
     }
 }
Beispiel #17
0
 function GetSocNetPostPerms($postId = 0, $bNeedFull = false, $userId = false)
 {
     if (!$userId) {
         $userId = IntVal($GLOBALS["USER"]->GetID());
         $bByUserId = false;
     } else {
         $userId = IntVal($userId);
         $bByUserId = true;
     }
     $postId = IntVal($postId);
     if ($postId <= 0) {
         return false;
     }
     $perms = BLOG_PERMS_DENY;
     $arAvailPerms = array_keys($GLOBALS["AR_BLOG_PERMS"]);
     if (!$bByUserId) {
         $blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
         if ($blogModulePermissions >= "W" || CSocNetUser::IsCurrentUserModuleAdmin()) {
             $perms = $arAvailPerms[count($arAvailPerms) - 1];
         }
     } else {
         if (CSocNetUser::IsUserModuleAdmin($userId)) {
             $perms = $arAvailPerms[count($arAvailPerms) - 1];
         }
     }
     $arPost = CBlogPost::GetByID($postId);
     if ($arPost["AUTHOR_ID"] == $userId) {
         $perms = BLOG_PERMS_FULL;
     }
     if ($perms <= BLOG_PERMS_DENY) {
         $arPerms = CBlogPost::GetSocNetPerms($postId);
         $arEntities = array();
         if (isset($GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId]) && !empty($GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId])) {
             $arEntities = $GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId];
         } else {
             $dbA = CAccess::GetUserCodes($userId);
             while ($arA = $dbA->Fetch()) {
                 if ($arA["PROVIDER_ID"] == "intranet") {
                     $arEntities["DR"][] = $arA["ACCESS_CODE"];
                 } elseif ($arA["PROVIDER_ID"] == "socnetgroup") {
                     $g = substr($arA["ACCESS_CODE"], 2);
                     $gId = IntVal($g);
                     $gR = substr($g, strpos($g, "_") + 1);
                     $arEntities["SG"][$gId][] = $gR;
                 }
             }
             $GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId] = $arEntities;
         }
         foreach ($arPerms as $t => $val) {
             foreach ($val as $id => $p) {
                 if ($userId > 0 && $t == "U" && $userId == $id) {
                     $perms = BLOG_PERMS_READ;
                     if (in_array("US" . $userId, $p)) {
                         // if author
                         $perms = BLOG_PERMS_FULL;
                     }
                     break;
                 }
                 if (in_array("G2", $p)) {
                     $perms = BLOG_PERMS_READ;
                     break;
                 }
                 if ($userId > 0 && in_array("AU", $p)) {
                     $perms = BLOG_PERMS_READ;
                     break;
                 }
                 if ($t == "SG") {
                     if (!empty($arEntities["SG"][$id])) {
                         foreach ($arEntities["SG"][$id] as $gr) {
                             if (in_array("SG" . $id . "_" . $gr, $p)) {
                                 $perms = BLOG_PERMS_READ;
                                 break;
                             }
                         }
                     }
                 }
                 if ($t == "DR") {
                     if (in_array("DR" . $id, $arEntities["DR"])) {
                         $perms = BLOG_PERMS_READ;
                         break;
                     }
                 }
             }
             if ($perms > BLOG_PERMS_DENY) {
                 break;
             }
         }
         if ($bNeedFull && $perms <= BLOG_PERMS_FULL) {
             $arGroupsId = array();
             if (!empty($arPerms["SG"])) {
                 foreach ($arPerms["SG"] as $gid => $val) {
                     if (!empty($arEntities["SG"][$gid])) {
                         $arGroupsId[] = $gid;
                     }
                 }
             }
             $operation = array("full_post", "moderate_post", "write_post", "premoderate_post");
             if (!empty($arGroupsId)) {
                 foreach ($operation as $v) {
                     if ($perms <= BLOG_PERMS_READ) {
                         $f = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_GROUP, $arGroupsId, "blog", $v);
                         if (!empty($f)) {
                             foreach ($f as $gid => $val) {
                                 if (in_array($val, $arEntities["SG"][$gid])) {
                                     switch ($v) {
                                         case "full_post":
                                             $perms = BLOG_PERMS_FULL;
                                             break;
                                         case "moderate_post":
                                             $perms = BLOG_PERMS_MODERATE;
                                             break;
                                         case "write_post":
                                             $perms = BLOG_PERMS_WRITE;
                                             break;
                                         case "premoderate_post":
                                             $perms = BLOG_PERMS_PREMODERATE;
                                             break;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $perms;
 }
Beispiel #18
0
    die;
}
if (!CModule::IncludeModule("socialnetwork")) {
    ShowError(GetMessage("SONET_MODULE_NOT_INSTALL"));
    return;
}
$arDefaultUrlTemplates404 = array("index" => "index.php", "user_reindex" => "user_reindex.php", "user_content_search" => "user/#user_id#/search/", "user" => "user/#user_id#/", "user_current" => "user/index.php", "user_friends" => "user/#user_id#/friends/", "user_friends_add" => "user/#user_id#/friends/add/", "user_friends_delete" => "user/#user_id#/friends/delete/", "user_groups" => "user/#user_id#/groups/", "user_groups_add" => "user/#user_id#/groups/add/", "group_create" => "user/#user_id#/groups/create/", "user_profile_edit" => "user/#user_id#/edit/", "user_settings_edit" => "user/#user_id#/settings/", "user_features" => "user/#user_id#/features/", "user_subscribe" => "user/#user_id#/subscribe/", "user_requests" => "user/#user_id#/requests/", "group_request_group_search" => "group/#user_id#/group_search/", "group_request_user" => "group/#group_id#/user/#user_id#/request/", "search" => "search.php", "mail" => "mail/", "message_form" => "messages/form/#user_id#/", "message_form_mess" => "messages/chat/#user_id#/#message_id#/", "messages_chat" => "messages/chat/#user_id#/", "messages_users" => "messages/", "messages_users_messages" => "messages/#user_id#/", "messages_input" => "messages/input/", "messages_output" => "messages/output/", "messages_input_user" => "messages/input/#user_id#/", "messages_output_user" => "messages/output/#user_id#/", "user_ban" => "messages/ban/", "log" => "log/", "crm" => "crm/", "log_entry" => "log/#log_id#/", "activity" => "user/#user_id#/activity/", "subscribe" => "subscribe/", "bizproc" => "bizproc/", "bizproc_edit" => "bizproc/#task_id#/", "bizproc_task_list" => "user/#user_id#/bizproc/", "bizproc_task" => "user/#user_id#/bizproc/#task_id#/", "video_call" => "video/#user_id#/", "processes" => "processes/", "user_photo" => "user/#user_id#/photo/", "user_photo_gallery" => "user/#user_id#/photo/gallery/", "user_photo_gallery_edit" => "user/#user_id#/photo/gallery/action/#action#/", "user_photo_galleries" => "user/#user_id#/photo/galleries/", "user_photo_section" => "user/#user_id#/photo/album/#section_id#/", "user_photo_section_edit" => "user/#user_id#/photo/album/#section_id#/action/#action#/", "user_photo_section_edit_icon" => "user/#user_id#/photo/album/#section_id#/icon/action/#action#/", "user_photo_element_upload" => "user/#user_id#/photo/photo/#section_id#/action/upload/", "user_photo_element" => "user/#user_id#/photo/photo/#section_id#/#element_id#/", "user_photo_element_edit" => "user/#user_id#/photo/photo/#section_id#/#element_id#/action/#action#/", "user_photo_element_slide_show" => "user/#user_id#/photo/photo/#section_id#/#element_id#/slide_show/", "user_photofull_gallery" => "user/#user_id#/photo/gallery/#user_alias#/", "user_photofull_gallery_edit" => "user/#user_id#/photo/gallery/#user_alias#/action/#action#/", "user_photofull_section" => "user/#user_id#/photo/album/#user_alias#/#section_id#/", "user_photofull_section_edit" => "user/#user_id#/photo/album/#user_alias#/#section_id#/action/#action#/", "user_photofull_section_edit_icon" => "user/#user_id#/photo/album/#user_alias#/#section_id#/icon/action/#action#/", "user_photofull_element_upload" => "user/#user_id#/photo/photo/#user_alias#/#section_id#/action/upload/", "user_photofull_element" => "user/#user_id#/photo/photo/#user_alias#/#section_id#/#element_id#/", "user_photofull_element_edit" => "user/#user_id#/photo/photo/#user_alias#/#section_id#/#element_id#/action/#action#/", "user_photofull_element_slide_show" => "user/#user_id#/photo/photo/#user_alias#/#section_id#/#element_id#/slide_show/", "user_calendar" => "user/#user_id#/calendar/", "user_files" => "user/#user_id#/files/lib/#path#", "user_files_short" => "folder/view/#section_id#/#element_id#/#element_name#", "user_files_section_edit" => "user/#user_id#/files/folder/edit/#section_id#/#action#/", "user_files_element" => "user/#user_id#/files/element/view/#element_id#/", "user_files_element_comment" => "user/#user_id#/files/element/comment/#topic_id#/#message_id#/", "user_files_element_edit" => "user/#user_id#/files/element/edit/#element_id#/#action#/", "user_files_element_file" => "", "user_files_element_history" => "user/#user_id#/files/element/history/#element_id#/", "user_files_element_history_get" => "user/#user_id#/files/element/historyget/#element_id#/#element_name#", "user_files_element_version" => "user/#user_id#/files/element/version/#action#/#element_id#/", "user_files_element_versions" => "user/#user_id#/files/element/versions/#element_id#/", "user_files_element_upload" => "user/#user_id#/files/element/upload/#section_id#/", "user_files_help" => "user/#user_id#/files/help/", "user_files_connector" => "user/#user_id#/files/connector/", "user_files_webdav_bizproc_history" => "user/#user_id#/files/bizproc/history/#element_id#/", "user_files_webdav_bizproc_history_get" => "user/#user_id#/files/bizproc/historyget/#element_id#/#id#/#element_name#", "user_files_webdav_bizproc_log" => "user/#user_id#/files/bizproc/log/#element_id#/#id#/", "user_files_webdav_bizproc_view" => "user/#user_id#/files/bizproc/bizproc/#element_id#/", "user_files_webdav_bizproc_workflow_admin" => "user/#user_id#/files/bizproc/admin/", "user_files_webdav_bizproc_workflow_edit" => "user/#user_id#/files/bizproc/edit/#id#/", "user_files_webdav_start_bizproc" => "user/#user_id#/files/bizproc/start/#element_id#/", "user_blog" => "user/#user_id#/blog/", "user_blog_post_important" => "user/#user_id#/blog/important/", "user_blog_post_edit" => "user/#user_id#/blog/edit/#post_id#/", "user_blog_rss" => "user/#user_id#/blog/rss/#type#/", "user_blog_post_rss" => "user/#user_id#/blog/rss/#type#/#post_id#/", "user_blog_draft" => "user/#user_id#/blog/draft/", "user_blog_moderation" => "user/#user_id#/blog/moderation/", "user_blog_post" => "user/#user_id#/blog/#post_id#/", "user_tasks" => "user/#user_id#/tasks/", "user_tasks_task" => "user/#user_id#/tasks/task/#action#/#task_id#/", "user_tasks_view" => "user/#user_id#/tasks/view/#action#/#view_id#/", "user_tasks_departments_overview" => "user/#user_id#/tasks/departments/", "user_tasks_projects_overview" => "user/#user_id#/tasks/projects/", "user_tasks_report" => "user/#user_id#/tasks/report/", "user_tasks_report_construct" => "user/#user_id#/tasks/report/construct/#report_id#/#action#/", "user_tasks_report_view" => "user/#user_id#/tasks/report/view/#report_id#/", "user_tasks_templates" => "user/#user_id#/tasks/templates/", "user_templates_template" => "user/#user_id#/tasks/templates/template/#action#/#template_id#/", "user_forum" => "user/#user_id#/forum/", "user_forum_topic" => "user/#user_id#/forum/#topic_id#/", "user_forum_topic_edit" => "user/#user_id#/forum/edit/#action#/#topic_id#/#message_id#/", "user_forum_message" => "user/#user_id#/forum/message/#topic_id#/#message_id#/", "user_forum_message_edit" => "user/#user_id#/forum/message/#action#/#topic_id#/#message_id#/", "user_security" => "user/#user_id#/security/", "user_codes" => "user/#user_id#/codes/", "user_passwords" => "user/#user_id#/passwords/");
$diskEnabled = \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk');
$bExtranetEnabled = IsModuleInstalled('extranet');
if ($bExtranetEnabled) {
    $extranetSiteId = COption::GetOptionString("extranet", "extranet_site");
    if (strlen($extranetSiteId) <= 0) {
        $bExtranetEnabled = false;
    }
}
if ($bExtranetEnabled && $arParams["SEF_MODE"] == "Y" && SITE_ID == $extranetSiteId && !CSocNetUser::IsCurrentUserModuleAdmin() && CModule::IncludeModule('intranet')) {
    if ($USER->IsAuthorized()) {
        $rsCurrentUser = CUser::GetById($USER->GetId());
        if (($arCurrentUser = $rsCurrentUser->Fetch()) && !empty($arCurrentUser["UF_DEPARTMENT"]) && is_array($arCurrentUser["UF_DEPARTMENT"]) && intval($arCurrentUser["UF_DEPARTMENT"][0]) > 0) {
            $arRedirectSite = CSocNetLogComponent::GetSiteByDepartmentId($arCurrentUser["UF_DEPARTMENT"]);
            if (!$arRedirectSite) {
                $arRedirectSite = array("LID" => SITE_ID, "SERVER_NAME" => SITE_SERVER_NAME);
            }
        }
    }
}
if ($diskEnabled) {
    $arDefaultUrlTemplates404["user_disk"] = "user/#user_id#/disk/path/#PATH#";
    $arDefaultUrlTemplates404["user_disk_file"] = "user/#user_id#/disk/file/#FILE_PATH#";
    $arDefaultUrlTemplates404["user_trashcan_list"] = "user/#user_id#/disk/trashcan/#TRASH_PATH#";
    $arDefaultUrlTemplates404["user_trashcan_file_view"] = "user/#user_id#/disk/trash/file/#TRASH_FILE_PATH#";
Beispiel #19
0
             LocalRedirect($APPLICATION->GetCurPageParam("invite_sent=Y", array("invite_user_id", "employee")));
         }
     }
 }
 $parser = new CSocNetTextParser(LANGUAGE_ID, $arParams["PATH_TO_SMILE"]);
 $arResult["Requests"] = false;
 $dbRequests = CSocNetUserToGroup::GetList(array("DATE_CREATE" => "ASC"), array("GROUP_ID" => $arResult["Group"]["ID"], "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP), false, $arNavParams, array("ID", "USER_ID", "DATE_CREATE", "DATE_UPDATE", "MESSAGE", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "USER_PERSONAL_PHOTO", "USER_PERSONAL_GENDER"));
 if ($dbRequests) {
     $arResult["Requests"] = array();
     $arResult["Requests"]["List"] = false;
     while ($arRequests = $dbRequests->GetNext()) {
         if ($arResult["Requests"]["List"] == false) {
             $arResult["Requests"]["List"] = array();
         }
         $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arRequests["USER_ID"]));
         $canViewProfile = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arRequests["USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
         if (intval($arRequests["USER_PERSONAL_PHOTO"]) <= 0) {
             switch ($arRequests["USER_PERSONAL_GENDER"]) {
                 case "M":
                     $suffix = "male";
                     break;
                 case "F":
                     $suffix = "female";
                     break;
                 default:
                     $suffix = "unknown";
             }
             $arRequests["USER_PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
         }
         $arImage = CSocNetTools::InitImage($arRequests["USER_PERSONAL_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $pu, $canViewProfile);
         $arResult["Requests"]["List"][] = array("ID" => $arRequests["ID"], "USER_ID" => $arRequests["USER_ID"], "USER_NAME" => $arRequests["USER_NAME"], "USER_LAST_NAME" => $arRequests["USER_LAST_NAME"], "USER_SECOND_NAME" => $arRequests["USER_SECOND_NAME"], "USER_LOGIN" => $arRequests["USER_LOGIN"], "USER_PERSONAL_PHOTO" => $arRequests["USER_PERSONAL_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "DATE_CREATE" => FormatDateFromDB($arRequests["DATE_CREATE"]), "MESSAGE" => $parser->convert($arRequests["~MESSAGE"], false, array(), array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LIST" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "SMILES" => "Y", "UPLOAD" => "N", "NL2BR" => "N")));
Beispiel #20
0
 function GetList($arOrder = array("ID" => "DESC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array(), $arParams = array())
 {
     global $DB, $arSocNetAllowedEntityTypes, $USER, $USER_FIELD_MANAGER;
     $arSocNetAllowedSubscribeEntityTypesDesc = CSocNetAllowed::GetAllowedEntityTypesDesc();
     $obUserFieldsSql = new CUserTypeSQL();
     $obUserFieldsSql->SetEntity("SONET_LOG", "L.ID");
     $obUserFieldsSql->SetSelect($arSelectFields);
     $obUserFieldsSql->SetFilter($arFilter);
     $obUserFieldsSql->SetOrder($arOrder);
     if (count($arSelectFields) <= 0) {
         $arSelectFields = array("ID", "TMP_ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "EVENT_ID", "LOG_DATE", "LOG_UPDATE", "TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "CALLBACK_FUNC", "EXTERNAL_ID", "SITE_ID", "PARAMS", "COMMENTS_COUNT", "ENABLE_COMMENTS", "SOURCE_ID", "GROUP_NAME", "GROUP_OWNER_ID", "GROUP_INITIATE_PERMS", "GROUP_VISIBLE", "GROUP_OPENED", "GROUP_IMAGE_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "USER_PERSONAL_PHOTO", "USER_PERSONAL_GENDER", "CREATED_BY_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LOGIN", "CREATED_BY_PERSONAL_PHOTO", "CREATED_BY_PERSONAL_GENDER", "RATING_TYPE_ID", "RATING_ENTITY_ID", "RATING_TOTAL_VALUE", "RATING_TOTAL_VOTES", "RATING_TOTAL_POSITIVE_VOTES", "RATING_TOTAL_NEGATIVE_VOTES", "RATING_USER_VOTE_VALUE", "SOURCE_TYPE");
         if (!isset($arParams["USE_FAVORITES"]) || $arParams["USE_FAVORITES"] != "N") {
             $arSelectFields[] = "FAVORITES_USER_ID";
         }
     }
     static $arFields1 = array("ID" => array("FIELD" => "L.ID", "TYPE" => "int"), "TMP_ID" => array("FIELD" => "L.TMP_ID", "TYPE" => "int"), "SOURCE_ID" => array("FIELD" => "L.SOURCE_ID", "TYPE" => "int"), "ENTITY_TYPE" => array("FIELD" => "L.ENTITY_TYPE", "TYPE" => "string"), "ENTITY_ID" => array("FIELD" => "L.ENTITY_ID", "TYPE" => "int"), "USER_ID" => array("FIELD" => "L.USER_ID", "TYPE" => "int"), "EVENT_ID" => array("FIELD" => "L.EVENT_ID", "TYPE" => "string"), "LOG_DATE" => array("FIELD" => "L.LOG_DATE", "TYPE" => "datetime"), "LOG_DATE_TS" => array("FIELD" => "UNIX_TIMESTAMP(L.LOG_DATE)", "TYPE" => "int"), "LOG_UPDATE" => array("FIELD" => "L.LOG_UPDATE", "TYPE" => "datetime"), "TITLE_TEMPLATE" => array("FIELD" => "L.TITLE_TEMPLATE", "TYPE" => "string"), "TITLE" => array("FIELD" => "L.TITLE", "TYPE" => "string"), "MESSAGE" => array("FIELD" => "L.MESSAGE", "TYPE" => "string"), "TEXT_MESSAGE" => array("FIELD" => "L.TEXT_MESSAGE", "TYPE" => "string"), "URL" => array("FIELD" => "L.URL", "TYPE" => "string"), "MODULE_ID" => array("FIELD" => "L.MODULE_ID", "TYPE" => "string"), "CALLBACK_FUNC" => array("FIELD" => "L.CALLBACK_FUNC", "TYPE" => "string"), "EXTERNAL_ID" => array("FIELD" => "L.EXTERNAL_ID", "TYPE" => "string"), "PARAMS" => array("FIELD" => "L.PARAMS", "TYPE" => "string"), "COMMENTS_COUNT" => array("FIELD" => "L.COMMENTS_COUNT", "TYPE" => "int"), "ENABLE_COMMENTS" => array("FIELD" => "L.ENABLE_COMMENTS", "TYPE" => "string"), "SOURCE_TYPE" => array("FIELD" => "L.SOURCE_TYPE", "TYPE" => "string"), "GROUP_NAME" => array("FIELD" => "G.NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_sonet_group G ON (L.ENTITY_TYPE = 'G' AND L.ENTITY_ID = G.ID)"), "GROUP_OWNER_ID" => array("FIELD" => "G.OWNER_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_sonet_group G ON (L.ENTITY_TYPE = 'G' AND L.ENTITY_ID = G.ID)"), "GROUP_INITIATE_PERMS" => array("FIELD" => "G.INITIATE_PERMS", "TYPE" => "string", "FROM" => "LEFT JOIN b_sonet_group G ON (L.ENTITY_TYPE = 'G' AND L.ENTITY_ID = G.ID)"), "GROUP_VISIBLE" => array("FIELD" => "G.VISIBLE", "TYPE" => "string", "FROM" => "LEFT JOIN b_sonet_group G ON (L.ENTITY_TYPE = 'G' AND L.ENTITY_ID = G.ID)"), "GROUP_OPENED" => array("FIELD" => "G.OPENED", "TYPE" => "string", "FROM" => "LEFT JOIN b_sonet_group G ON (L.ENTITY_TYPE = 'G' AND L.ENTITY_ID = G.ID)"), "GROUP_IMAGE_ID" => array("FIELD" => "G.IMAGE_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_sonet_group G ON (L.ENTITY_TYPE = 'G' AND L.ENTITY_ID = G.ID)"), "USER_NAME" => array("FIELD" => "U.NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (L.ENTITY_TYPE = 'U' AND L.ENTITY_ID = U.ID)"), "USER_LAST_NAME" => array("FIELD" => "U.LAST_NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (L.ENTITY_TYPE = 'U' AND L.ENTITY_ID = U.ID)"), "USER_SECOND_NAME" => array("FIELD" => "U.SECOND_NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (L.ENTITY_TYPE = 'U' AND L.ENTITY_ID = U.ID)"), "USER_LOGIN" => array("FIELD" => "U.LOGIN", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (L.ENTITY_TYPE = 'U' AND L.ENTITY_ID = U.ID)"), "USER_PERSONAL_PHOTO" => array("FIELD" => "U.PERSONAL_PHOTO", "TYPE" => "int", "FROM" => "LEFT JOIN b_user U ON (L.ENTITY_TYPE = 'U' AND L.ENTITY_ID = U.ID)"), "USER_PERSONAL_GENDER" => array("FIELD" => "U.PERSONAL_GENDER", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U ON (L.ENTITY_TYPE = 'U' AND L.ENTITY_ID = U.ID)"), "CREATED_BY_NAME" => array("FIELD" => "U1.NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U1 ON L.USER_ID = U1.ID"), "CREATED_BY_LAST_NAME" => array("FIELD" => "U1.LAST_NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U1 ON L.USER_ID = U1.ID"), "CREATED_BY_SECOND_NAME" => array("FIELD" => "U1.SECOND_NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U1 ON L.USER_ID = U1.ID"), "CREATED_BY_LOGIN" => array("FIELD" => "U1.LOGIN", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U1 ON L.USER_ID = U1.ID"), "CREATED_BY_PERSONAL_PHOTO" => array("FIELD" => "U1.PERSONAL_PHOTO", "TYPE" => "int", "FROM" => "LEFT JOIN b_user U1 ON L.USER_ID = U1.ID"), "CREATED_BY_PERSONAL_GENDER" => array("FIELD" => "U1.PERSONAL_GENDER", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U1 ON L.USER_ID = U1.ID"), "USER_ID|COMMENT_USER_ID" => array("FIELD" => "L.USER_ID|LC.USER_ID", "WHERE" => array("CSocNetLog", "GetSimpleOrQuery"), "FROM" => "LEFT JOIN b_sonet_log_comment LC ON LC.LOG_ID = L.ID"));
     $arFields = array("RATING_TYPE_ID" => array("FIELD" => "L.RATING_TYPE_ID", "TYPE" => "string"), "RATING_ENTITY_ID" => array("FIELD" => "L.RATING_ENTITY_ID", "TYPE" => "int"), "RATING_TOTAL_VALUE" => array("FIELD" => $DB->IsNull('RG.TOTAL_VALUE', '0'), "TYPE" => "double", "FROM" => "LEFT JOIN b_rating_voting RG ON L.RATING_TYPE_ID = RG.ENTITY_TYPE_ID AND L.RATING_ENTITY_ID = RG.ENTITY_ID"), "RATING_TOTAL_VOTES" => array("FIELD" => $DB->IsNull('RG.TOTAL_VOTES', '0'), "TYPE" => "double", "FROM" => "LEFT JOIN b_rating_voting RG ON L.RATING_TYPE_ID = RG.ENTITY_TYPE_ID AND L.RATING_ENTITY_ID = RG.ENTITY_ID"), "RATING_TOTAL_POSITIVE_VOTES" => array("FIELD" => $DB->IsNull('RG.TOTAL_POSITIVE_VOTES', '0'), "TYPE" => "int", "FROM" => "LEFT JOIN b_rating_voting RG ON L.RATING_TYPE_ID = RG.ENTITY_TYPE_ID AND L.RATING_ENTITY_ID = RG.ENTITY_ID"), "RATING_TOTAL_NEGATIVE_VOTES" => array("FIELD" => $DB->IsNull('RG.TOTAL_NEGATIVE_VOTES', '0'), "TYPE" => "int", "FROM" => "LEFT JOIN b_rating_voting RG ON L.RATING_TYPE_ID = RG.ENTITY_TYPE_ID AND L.RATING_ENTITY_ID = RG.ENTITY_ID"));
     if (isset($USER) && is_object($USER)) {
         $arFields["RATING_USER_VOTE_VALUE"] = array("FIELD" => $DB->IsNull('RV.VALUE', '0'), "TYPE" => "double", "FROM" => "LEFT JOIN b_rating_vote RV ON L.RATING_TYPE_ID = RV.ENTITY_TYPE_ID AND L.RATING_ENTITY_ID = RV.ENTITY_ID AND RV.USER_ID = " . intval($USER->GetID()));
         if (!isset($arParams["USE_FAVORITES"]) || $arParams["USE_FAVORITES"] != "N") {
             $join_type = "LEFT";
             $field_value = $DB->IsNull("SLF.USER_ID", "0");
             foreach ($arFilter as $key => $value) {
                 if (strpos($key, "FAVORITES_USER_ID") !== false) {
                     $join_type = "INNER";
                     $field_value = "SLF.USER_ID";
                     break;
                 }
             }
             $arFields["FAVORITES_USER_ID"] = array("FIELD" => $field_value, "TYPE" => "double", "FROM" => $join_type . " JOIN b_sonet_log_favorites SLF ON L.ID = SLF.LOG_ID AND SLF.USER_ID = " . intval($USER->GetID()));
         }
     }
     if (isset($USER) && is_object($USER) && $USER->IsAuthorized() && $arParams["USE_FOLLOW"] == "Y") {
         $default_follow = CSocNetLogFollow::GetDefaultValue($USER->GetID());
         $default_field = $default_follow == "Y" ? "LOG_UPDATE" : "LOG_DATE";
         $arFields["DATE_FOLLOW"] = array("FIELD" => "CASE\n\t\t\t\t\tWHEN LFW.USER_ID IS NULL\n\t\t\t\t\t\tTHEN L." . $default_field . "\n\t\t\t\t\tWHEN LFW.FOLLOW_DATE IS NOT NULL\n\t\t\t\t\t\tTHEN LFW.FOLLOW_DATE\n\t\t\t\t\tWHEN LFW.TYPE = 'Y'\n\t\t\t\t\t\tTHEN L.LOG_UPDATE\n\t\t\t\t\tELSE L.LOG_DATE\n\t\t\t\tEND", "TYPE" => "datetime", "FROM" => "LEFT JOIN b_sonet_log_follow LFW ON LFW.USER_ID = " . $USER->GetID() . " AND LFW.REF_ID = L.ID AND LFW.CODE = " . $DB->Concat("'L'", "L.ID"));
         $arFields["FOLLOW"] = array("FIELD" => "CASE\n\t\t\t\t\tWHEN LFW.USER_ID IS NULL\n\t\t\t\t\t\tTHEN '" . $default_follow . "'\n\t\t\t\t\tELSE LFW.TYPE\n\t\t\t\tEND", "TYPE" => "string", "FROM" => "LEFT JOIN b_sonet_log_follow LFW ON LFW.USER_ID = " . $USER->GetID() . " AND LFW.REF_ID = L.ID AND LFW.CODE = " . $DB->Concat("'L'", "L.ID"));
         if (!in_array("FOLLOW", $arSelectFields)) {
             $arSelectFields[] = "FOLLOW";
         }
     }
     if (array_key_exists("SITE_ID", $arFilter)) {
         $arFields["SITE_ID"] = array("FIELD" => "SLS.SITE_ID", "TYPE" => "string", "FROM" => "LEFT JOIN b_sonet_log_site SLS ON L.ID = SLS.LOG_ID");
         if (is_array($arFilter["SITE_ID"])) {
             $site_cnt = 0;
             foreach ($arFilter["SITE_ID"] as $site_id_tmp) {
                 if ($site_id_tmp) {
                     $site_cnt++;
                 }
             }
             $strDistinct = $site_cnt > 1 ? " DISTINCT " : " ";
         } else {
             $strDistinct = " ";
         }
         foreach ($arSelectFields as $i => $strFieldTmp) {
             if ($strFieldTmp == "SITE_ID") {
                 unset($arSelectFields[$i]);
             }
         }
         foreach ($arOrder as $by => $order) {
             if (!in_array($by, $arSelectFields)) {
                 $arSelectFields[] = $by;
             }
         }
     } else {
         $arFields["SITE_ID"] = array("FIELD" => "L.SITE_ID", "TYPE" => "string");
         $strDistinct = " ";
     }
     if (array_key_exists("USER_ID", $arFilter) && !array_key_exists("ENTITY_TYPE", $arFilter)) {
         $arCBFilterEntityType = array();
         foreach ($arSocNetAllowedSubscribeEntityTypesDesc as $entity_type_tmp => $arEntityTypeTmp) {
             if (array_key_exists("USE_CB_FILTER", $arEntityTypeTmp) && $arEntityTypeTmp["USE_CB_FILTER"] == "Y") {
                 $arCBFilterEntityType[] = $entity_type_tmp;
             }
         }
         if (is_array($arCBFilterEntityType) && count($arCBFilterEntityType) > 0) {
             $arFilter["ENTITY_TYPE"] = $arCBFilterEntityType;
         }
     }
     if (array_key_exists("LOG_RIGHTS", $arFilter)) {
         $Rights = array();
         if (is_array($arFilter["LOG_RIGHTS"])) {
             foreach ($arFilter["LOG_RIGHTS"] as $str) {
                 if (trim($str)) {
                     $Rights[] = trim($str);
                 }
             }
         } elseif (trim($arFilter["LOG_RIGHTS"])) {
             $Rights = trim($arFilter["LOG_RIGHTS"]);
         }
         unset($arFilter["LOG_RIGHTS"]);
         if (is_array($Rights) && !empty($Rights) || !is_array($Rights)) {
             $arFilter["LOG_RIGHTS"] = $Rights;
             $arFields["LOG_RIGHTS"] = array("FIELD" => "SLR0.GROUP_CODE", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_log_right SLR0 ON L.ID = SLR0.LOG_ID");
         }
         if (is_array($Rights) && count($Rights) > 1) {
             $strDistinct = " DISTINCT ";
         }
     }
     if (array_key_exists("USER_ID|COMMENT_USER_ID", $arFilter)) {
         $strDistinct = " DISTINCT ";
     }
     if ($arParams["IS_CRM"] == "Y") {
         $events = GetModuleEvents("socialnetwork", "OnFillSocNetLogFields");
         while ($arEvent = $events->Fetch()) {
             ExecuteModuleEventEx($arEvent, array(&$arFields));
         }
     }
     $arFields = array_merge($arFields1, $arFields);
     $arSqls = CSocNetGroup::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields, $obUserFieldsSql);
     $listEvents = GetModuleEvents("socialnetwork", "OnBuildSocNetLogSql");
     while ($arEvent = $listEvents->Fetch()) {
         ExecuteModuleEventEx($arEvent, array(&$arFields, &$arOrder, &$arFilter, &$arGroupBy, &$arSelectFields, &$arSqls));
     }
     $r = $obUserFieldsSql->GetFilter();
     if (strlen($r) > 0) {
         $strSqlUFFilter = " (" . $r . ") ";
     }
     $arSqls["RIGHTS"] = "";
     $arSqls["CRM_RIGHTS"] = "";
     if (!empty($arParams) && (array_key_exists("CHECK_RIGHTS", $arParams) && $arParams["CHECK_RIGHTS"] == "Y" || array_key_exists("CHECK_CRM_RIGHTS", $arParams) && $arParams["CHECK_CRM_RIGHTS"] == "Y") && !array_key_exists("USER_ID", $arParams) && is_object($USER)) {
         $arParams["USER_ID"] = $USER->GetID();
     }
     if (!empty($arParams) && array_key_exists("USER_ID", $arParams) && $arParams["CHECK_CRM_RIGHTS"] != "Y") {
         $arParams["CHECK_RIGHTS"] = "Y";
     }
     if (!empty($arParams) && ($arParams["USE_SUBSCRIBE"] == "Y" || $arParams["USE_FOLLOW"] == "Y")) {
         if (!array_key_exists("SUBSCRIBE_USER_ID", $arParams)) {
             if (array_key_exists("USER_ID", $arParams) && intval($arParams["USER_ID"]) > 0) {
                 $arParams["SUBSCRIBE_USER_ID"] = $arParams["USER_ID"];
             } elseif (is_object($USER)) {
                 $arParams["SUBSCRIBE_USER_ID"] = $USER->GetID();
             }
         }
         if ($arParams["USE_SUBSCRIBE"] == "Y" && !array_key_exists("MY_ENTITIES", $arParams)) {
             foreach ($arSocNetAllowedSubscribeEntityTypesDesc as $entity_type_tmp => $arEntityTypeTmp) {
                 if (array_key_exists("HAS_MY", $arEntityTypeTmp) && $arEntityTypeTmp["HAS_MY"] == "Y" && array_key_exists("CLASS_MY", $arEntityTypeTmp) && array_key_exists("METHOD_MY", $arEntityTypeTmp) && strlen($arEntityTypeTmp["CLASS_MY"]) > 0 && strlen($arEntityTypeTmp["METHOD_MY"]) > 0 && method_exists($arEntityTypeTmp["CLASS_MY"], $arEntityTypeTmp["METHOD_MY"])) {
                     $arMyEntities[$entity_type_tmp] = call_user_func(array($arEntityTypeTmp["CLASS_MY"], $arEntityTypeTmp["METHOD_MY"]));
                 }
             }
             $arParams["MY_ENTITIES"] = $arMyEntities;
         }
     }
     if (!empty($arParams) && array_key_exists("CHECK_RIGHTS", $arParams) && $arParams["CHECK_RIGHTS"] == "Y" && array_key_exists("USER_ID", $arParams)) {
         $acc = new CAccess();
         $acc->UpdateCodes();
         $arSqls["RIGHTS"] = "EXISTS ( SELECT SLR.ID FROM b_sonet_log_right SLR\n\t\t\t\tLEFT JOIN b_user_access UA ON (UA.ACCESS_CODE = SLR.GROUP_CODE AND UA.USER_ID = " . (is_object($USER) ? intval($USER->GetID()) : 0) . ")\n\t\t\t\tWHERE L.ID = SLR.LOG_ID " . (is_object($USER) && $USER->IsAuthorized() && $arParams["MY_GROUPS_ONLY"] == "Y" ? " AND (\n\t\t\t\t\t\t\t\t(SLR.GROUP_CODE LIKE 'SG%' AND (UA.ACCESS_CODE = SLR.GROUP_CODE AND UA.USER_ID = " . intval($USER->GetID()) . ")) \n\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = 'U" . intval($USER->GetID()) . "'\n\t\t\t\t\t\t\t)" : " AND (\n\t\t\t\t\t\t\t\t0=1 " . (is_object($USER) && CSocNetUser::IsCurrentUserModuleAdmin() ? " OR SLR.GROUP_CODE = 'SA'" : "") . (is_object($USER) && $USER->IsAuthorized() ? " OR (SLR.GROUP_CODE = 'AU')" : "") . " OR (SLR.GROUP_CODE = 'G2')" . (is_object($USER) && $USER->IsAuthorized() ? " OR (UA.ACCESS_CODE = SLR.GROUP_CODE AND UA.USER_ID = " . intval($USER->GetID()) . ")" : "") . "\n\t\t\t\t\t\t\t)") . ")";
     }
     if (!empty($arParams) && array_key_exists("CHECK_CRM_RIGHTS", $arParams) && $arParams["CHECK_CRM_RIGHTS"] == "Y" && array_key_exists("USER_ID", $arParams)) {
         $permParams = array('ALIAS_PREFIX' => 'L', 'PERM_TYPE' => 'READ', 'FILTER_PARAMS' => isset($arParams['CUSTOM_FILTER_PARAMS']) ? $arParams['CUSTOM_FILTER_PARAMS'] : array(), 'OPTIONS' => array('ENTITY_TYPE_COLUMN' => 'ENTITY_TYPE', 'IDENTITY_COLUMN' => 'ENTITY_ID'));
         $altPerms = array();
         $events = GetModuleEvents("socialnetwork", "OnBuildSocNetLogPerms");
         while ($arEvent = $events->Fetch()) {
             ExecuteModuleEventEx($arEvent, array(&$altPerms, $permParams));
         }
         if (!empty($altPerms)) {
             foreach ($altPerms as $permSql) {
                 if ($permSql === false) {
                     //Access denied
                     $dbRes = new CDBResult();
                     $dbRes->InitFromArray(array());
                     return $dbRes;
                 }
                 if (is_string($permSql) && $permSql !== '') {
                     if ($arSqls['CRM_RIGHTS'] !== '') {
                         $arSqls['CRM_RIGHTS'] .= ' AND ';
                     }
                     $arSqls['CRM_RIGHTS'] = $permSql;
                 }
             }
         }
     }
     if ($arParams["USE_SUBSCRIBE"] == "Y" && intval($arParams["SUBSCRIBE_USER_ID"]) > 0) {
         $arSqls["SUBSCRIBE"] = CSocNetLogEvents::GetSQL($arParams["SUBSCRIBE_USER_ID"], is_array($arParams["MY_ENTITIES"]) ? $arParams["MY_ENTITIES"] : array(), $arParams["TRANSPORT"], $arParams["VISIBLE"]);
         $arParams["MIN_ID_JOIN"] = true;
     }
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", $strDistinct, $arSqls["SELECT"]);
     $strMinIDJoin = "";
     if (is_array($arGroupBy) && count($arGroupBy) == 0) {
         $strSql = "SELECT " . $arSqls["SELECT"] . " " . $obUserFieldsSql->GetSelect() . " " . "FROM b_sonet_log L " . $strMinIDJoin . "\t" . $arSqls["FROM"] . " " . $obUserFieldsSql->GetJoin("L.ID") . " ";
         $bWhereStarted = false;
         if (strlen($arSqls["WHERE"]) > 0) {
             $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
             $bWhereStarted = true;
         }
         if (strlen($strSqlUFFilter) > 0) {
             $strSql .= ($bWhereStarted ? " AND " : " WHERE ") . $strSqlUFFilter . " ";
             $bWhereStarted = true;
         }
         if (strlen($arSqls["RIGHTS"]) > 0) {
             $strSql .= ($bWhereStarted ? " AND " : " WHERE ") . $arSqls["RIGHTS"] . " ";
             $bWhereStarted = true;
         }
         if (strlen($arSqls["CRM_RIGHTS"]) > 0) {
             $strSql .= ($bWhereStarted ? " AND " : " WHERE ") . $arSqls["CRM_RIGHTS"] . " ";
             $bWhereStarted = true;
         }
         if (strlen($arSqls["SUBSCRIBE"]) > 0) {
             $strSql .= ($bWhereStarted ? " AND " : " WHERE ") . "(" . $arSqls["SUBSCRIBE"] . ") ";
             $bWhereStarted = true;
         }
         if (strlen($arSqls["GROUPBY"]) > 0) {
             $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         //echo "!1!=".htmlspecialcharsbx($strSql)."<br>";
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return False;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . $obUserFieldsSql->GetSelect() . " " . "FROM b_sonet_log L " . $strMinIDJoin . "\t" . $arSqls["FROM"] . " " . $obUserFieldsSql->GetJoin("L.ID") . " ";
     $bWhereStarted = false;
     if (strlen($arSqls["WHERE"]) > 0) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
         $bWhereStarted = true;
     }
     if (strlen($strSqlUFFilter) > 0) {
         $strSql .= ($bWhereStarted ? " AND " : " WHERE ") . $strSqlUFFilter . " ";
         $bWhereStarted = true;
     }
     if (strlen($arSqls["RIGHTS"]) > 0) {
         $strSql .= ($bWhereStarted ? " AND " : " WHERE ") . $arSqls["RIGHTS"] . " ";
         $bWhereStarted = true;
     }
     if (strlen($arSqls["CRM_RIGHTS"]) > 0) {
         $strSql .= ($bWhereStarted ? " AND " : " WHERE ") . $arSqls["CRM_RIGHTS"] . " ";
         $bWhereStarted = true;
     }
     if (strlen($arSqls["SUBSCRIBE"]) > 0) {
         $strSql .= ($bWhereStarted ? " AND " : " WHERE ") . "(" . $arSqls["SUBSCRIBE"] . ") ";
         $bWhereStarted = true;
     }
     if (strlen($arSqls["GROUPBY"]) > 0) {
         $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
     }
     if (strlen($arSqls["ORDERBY"]) > 0) {
         $strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
     }
     if (is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) <= 0) {
         if (isset($arNavStartParams["nRecordCount"]) && intval($arNavStartParams["nRecordCount"]) > 0) {
             $cnt = intval($arNavStartParams["nRecordCount"]);
         } else {
             $strSql_tmp = "SELECT COUNT('x') as CNT " . $obUserFieldsSql->GetSelect() . " " . "FROM b_sonet_log L " . $strMinIDJoin . "\t" . $arSqls["FROM"] . " " . $obUserFieldsSql->GetJoin("L.ID") . " ";
             $bWhereStarted = false;
             if (strlen($arSqls["WHERE"]) > 0) {
                 $strSql_tmp .= "WHERE " . $arSqls["WHERE"] . " ";
                 $bWhereStarted = true;
             }
             if (strlen($strSqlUFFilter) > 0) {
                 $strSql_tmp .= ($bWhereStarted ? " AND " : " WHERE ") . $strSqlUFFilter . " ";
                 $bWhereStarted = true;
             }
             if (strlen($arSqls["RIGHTS"]) > 0) {
                 $strSql_tmp .= ($bWhereStarted ? " AND " : " WHERE ") . $arSqls["RIGHTS"] . " ";
                 $bWhereStarted = true;
             }
             if (strlen($arSqls["CRM_RIGHTS"]) > 0) {
                 $strSql_tmp .= ($bWhereStarted ? " AND " : " WHERE ") . $arSqls["CRM_RIGHTS"] . " ";
                 $bWhereStarted = true;
             }
             if (strlen($arSqls["SUBSCRIBE"]) > 0) {
                 $strSql_tmp .= ($bWhereStarted ? " AND " : " WHERE ") . "(" . $arSqls["SUBSCRIBE"] . ") ";
                 $bWhereStarted = true;
             }
             if (strlen($arSqls["GROUPBY"]) > 0) {
                 $strSql_tmp .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
             }
             //echo "!2.1!=".htmlspecialcharsbx($strSql_tmp)."<br>";
             $dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             $cnt = 0;
             if (strlen($arSqls["GROUPBY"]) <= 0) {
                 if ($arRes = $dbRes->Fetch()) {
                     $cnt = $arRes["CNT"];
                 }
             } else {
                 // рнкэйн дкъ MYSQL!!! дкъ ORACLE дпсцни йнд
                 $cnt = $dbRes->SelectedRowsCount();
             }
             // for empty 2nd page show
             if ($arNavStartParams["bSkipPageReset"] && $arNavStartParams["nPageSize"] >= $cnt) {
                 $cnt = $arNavStartParams["nPageSize"] + $cnt;
             }
         }
         $dbRes = new CDBResult();
         //echo "!2.2!=".htmlspecialcharsbx($strSql)."<br>";
         $dbRes->SetUserFields($USER_FIELD_MANAGER->GetUserFields("SONET_LOG"));
         $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
     } else {
         if (is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) > 0) {
             $strSql .= "LIMIT " . intval($arNavStartParams["nTopCount"]);
         }
         //echo "!3!=".htmlspecialcharsbx($strSql)."<br>";
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $dbRes->SetUserFields($USER_FIELD_MANAGER->GetUserFields("SONET_LOG"));
     }
     return $dbRes;
 }
Beispiel #21
0
/********************************************************************
				Default params # 1
********************************************************************/
$arResult["TOPIC"] = array();
$arResult["FORUM"] = CForumNew::GetByID($arParams["FID"]);
$arParams["PERMISSION_ORIGINAL"] = ForumCurrUserPermissions($arParams["FID"]);
$arParams["PERMISSION"] = "A";
$arError = array();
$arNote = array();
/********************************************************************
				/Default params #1
********************************************************************/
/********************************************************************
				Main Data & Permissions
********************************************************************/
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
if (empty($arResult["FORUM"])) {
    ShowError(GetMessage("F_FID_IS_LOST"));
    CHTTP::SetStatus("404 Not Found");
    return false;
} elseif ($arParams["MODE"] == "GROUP" && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum") || $arParams["MODE"] != "GROUP" && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $arParams["USER_ID"], "forum")) {
    ShowError(GetMessage("FORUM_SONET_MODULE_NOT_AVAIBLE"));
    return false;
} else {
    $user_id = $USER->GetID();
    if ($arParams["MODE"] == "GROUP") {
        if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum", "full", $bCurrentUserIsAdmin)) {
            $arParams["PERMISSION"] = "Y";
        } elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum", "newtopic", $bCurrentUserIsAdmin)) {
            $arParams["PERMISSION"] = "M";
        } elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum", "answer", $bCurrentUserIsAdmin)) {
Beispiel #22
0
	public static function GetSocNetUserPerms($postId = 0, $authorId = 0)
	{
		global $APPLICATION, $USER, $AR_BLOG_PERMS, $BLOG_POST;

		$userId = IntVal($USER->GetID());
		$postId = IntVal($postId);
		$authorId = IntVal($authorId);
		if($postId <= 0)
			return false;

		$perms = BLOG_PERMS_DENY;

		$blogModulePermissions = $APPLICATION->GetGroupRight("blog");
		if($authorId > 0 && $userId == $authorId)
			$perms = BLOG_PERMS_FULL;
		elseif ($blogModulePermissions >= "W" || CSocNetUser::IsCurrentUserModuleAdmin())
		{
			end($AR_BLOG_PERMS);
			$perms = key($AR_BLOG_PERMS);
			reset($AR_BLOG_PERMS);
		}

		if($perms <= BLOG_PERMS_DENY)
		{
			$arPerms = CBlogPost::GetSocNetPerms($postId);
			$arEntities = Array();
			if (isset($BLOG_POST["UAC_CACHE_".$userId]) && !empty($BLOG_POST["UAC_CACHE_".$userId]))
			{
				$arEntities = $BLOG_POST["UAC_CACHE_".$userId];
			}
			else
			{
				$dbA = CAccess::GetUserCodes($userId);
				while($arA = $dbA->Fetch())
				{
					if($arA["PROVIDER_ID"] == "intranet")
					{
						$arEntities["DR"][$arA["ACCESS_CODE"]] = $arA["ACCESS_CODE"];
					}
					elseif($arA["PROVIDER_ID"] == "socnetgroup")
					{
						$g = substr($arA["ACCESS_CODE"], 2);
						$gId = IntVal($g);
						$gR = substr($g, strpos($g, "_")+1);

						$arEntities["SG"][$gId][$gR] = $gR;
					}
				}
				$BLOG_POST["UAC_CACHE_".$userId] = $arEntities;
			}

			if(!empty($arEntities["DR"]) && !empty($arPerms["DR"]))
			{
				foreach($arPerms["DR"] as $id => $val)
				{
					if(isset($arEntities["DR"]["DR".$id]))
					{
						$perms = BLOG_PERMS_READ;
						break;
					}
				}
			}
			if((!empty($arPerms["U"][$userId]) && in_array("US".$userId, $arPerms["U"][$userId])) || ($authorId >0 && $userId == $authorId)) // if author
				$perms = BLOG_PERMS_FULL;
			else
			{
				if($authorId <= 0)
				{
					foreach($arPerms["U"] as $id => $p)
					{
						if(in_array("US".$id, $p))
						{
							$authorId = $id;
							break;
						}
					}
				}

				if(!empty($arPerms["U"][$userId]) || (!empty($arPerms["U"][$authorId]) && in_array("US".$authorId, $arPerms["U"][$authorId])) || $perms == BLOG_PERMS_READ)
				{
					if (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "write_comment"))
						$perms = BLOG_PERMS_WRITE;
					elseif (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "premoderate_comment"))
						$perms = BLOG_PERMS_PREMODERATE;
					elseif (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "view_comment"))
						$perms = BLOG_PERMS_READ;
				}
			}

			if($perms <= BLOG_PERMS_FULL)
			{
				$arGroupsId = Array();

				if(!empty($arPerms["SG"]))
				{
					foreach($arPerms["SG"] as $gid => $val)
					{
						//if(!empty($arEntities["SG"][$gid]))
						$arGroupsId[] = $gid;
					}
					$operation = Array("full_comment", "moderate_comment", "write_comment", "premoderate_comment");
					if($perms < BLOG_PERMS_READ)
						$operation[] = "view_comment";
				}

				if(!empty($arGroupsId))
				{
					foreach($operation as $v)
					{
						if($perms <= BLOG_PERMS_READ)
						{
							$f = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_GROUP, $arGroupsId, "blog", $v);
							if(!empty($f))
							{
								foreach($f as $gid => $val)
								{
									if((!empty($arEntities["SG"][$gid]) && in_array($val, $arEntities["SG"][$gid])) || $val == SONET_ROLES_ALL || ($userId > 0 && $val == SONET_ROLES_AUTHORIZED))
									{
										switch($v)
										{
											case "full_comment":
												$perms = BLOG_PERMS_FULL;
												break;
											case "moderate_comment":
												$perms = BLOG_PERMS_MODERATE;
												break;
											case "write_comment":
												$perms = BLOG_PERMS_WRITE;
												break;
											case "premoderate_comment":
												$perms = BLOG_PERMS_PREMODERATE;
												break;
											case "view_comment":
												$perms = BLOG_PERMS_READ;
												break;
										}
									}
								}
							}
						}
					}
				}
			}
		}

		return $perms;
	}
Beispiel #23
0
                if ($arUser['PERSONAL_BIRTHDAY']) {
                    $arBirthDate = ParseDateTime($arUser['PERSONAL_BIRTHDAY'], CSite::GetDateFormat('SHORT'));
                    $arUser['IS_BIRTHDAY'] = intval($arBirthDate['MM']) == date('n') && intval($arBirthDate['DD']) == date('j');
                }
                $arUser['IS_FEATURED'] = CIntranetUtils::IsUserHonoured($arUser['ID']);
                $arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
                $arResult["SEARCH"][$i]["USER"] = $arUser;
            }
        }
    }
    $arResult['USER_PROP'] = array();
    $arRes = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("USER", 0, LANGUAGE_ID);
    if (!empty($arRes)) {
        foreach ($arRes as $key => $val) {
            $arResult['USER_PROP'][$val["FIELD_NAME"]] = strLen($val["EDIT_FORM_LABEL"]) > 0 ? $val["EDIT_FORM_LABEL"] : $val["FIELD_NAME"];
        }
    }
}
$arrDropdown = array();
$arResult["DROPDOWN_SONET"] = array();
$EntityType = array_key_exists("arrFILTER", $arParams) && in_array("socialnetwork_group", $arParams["arrFILTER"]) ? SONET_ENTITY_GROUP : SONET_ENTITY_USER;
$EntityID = $EntityType == SONET_ENTITY_GROUP ? $arParams["arrFILTER_socialnetwork"][0] : $arParams["arrFILTER_socialnetwork_user"];
$arActiveFeaturesNames = CSocNetFeatures::GetActiveFeaturesNames($EntityType, $EntityID);
foreach ($arParams["arrWHERE_SONET"] as $feature_id) {
    if (strlen($feature_id) > 0 && array_key_exists($feature_id, $arActiveFeaturesNames) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $EntityType, $EntityID, $feature_id, $arSocNetFeaturesSettings[$feature_id]["minoperation"][0], CSocNetUser::IsCurrentUserModuleAdmin()) && array_key_exists($feature_id, $arSocNetFeaturesSettings)) {
        $arrDropdown[$feature_id] = strlen($arActiveFeaturesNames[$feature_id]) > 0 ? $arActiveFeaturesNames[$feature_id] : GetMessage("SEARCH_CONTENT_TYPE_" . strtoupper($feature_id) . "_" . $EntityType);
    }
}
if (count($arrDropdown) > 0) {
    $arResult["DROPDOWN_SONET"] = htmlspecialcharsex($arrDropdown);
}
Beispiel #24
0
 function RejectRequestToBeMember($userID, $groupID, $arRelationID)
 {
     global $APPLICATION, $DB;
     $userID = IntVal($userID);
     if ($userID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_USERID");
         return false;
     }
     $groupID = IntVal($groupID);
     if ($groupID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_GROUPID"), "ERROR_GROUPID");
         return false;
     }
     if (!is_array($arRelationID)) {
         return true;
     }
     $arGroup = CSocNetGroup::GetByID($groupID);
     if (!$arGroup || !is_array($arGroup)) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UG_ERROR_NO_GROUP_ID"), "ERROR_NO_GROUP");
         return false;
     }
     $arGroupSites = array();
     $rsGroupSite = CSocNetGroup::GetSite($groupID);
     while ($arGroupSite = $rsGroupSite->Fetch()) {
         $arGroupSites[] = $arGroupSite["LID"];
     }
     $userRole = CSocNetUserToGroup::GetUserRole($userID, $groupID);
     $bUserIsMember = $userRole && in_array($userRole, array(SONET_ROLES_OWNER, SONET_ROLES_MODERATOR, SONET_ROLES_USER));
     $bCanInitiate = $GLOBALS["USER"]->IsAdmin() || CSocNetUser::IsCurrentUserModuleAdmin($arGroupSites) || $userRole && ($arGroup["INITIATE_PERMS"] == SONET_ROLES_OWNER && $userID == $arGroup["OWNER_ID"] || $arGroup["INITIATE_PERMS"] == SONET_ROLES_MODERATOR && in_array($userRole, array(SONET_ROLES_OWNER, SONET_ROLES_MODERATOR)) || $arGroup["INITIATE_PERMS"] == SONET_ROLES_USER && $bUserIsMember);
     if (!$bCanInitiate) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UG_ERROR_NO_PERMS"), "ERROR_NO_PERMS");
         return false;
     }
     $bSuccess = true;
     $tmp_count = count($arRelationID);
     for ($i = 0; $i < $tmp_count; $i++) {
         $arRelationID[$i] = IntVal($arRelationID[$i]);
         if ($arRelationID[$i] <= 0) {
             continue;
         }
         $arRelation = CSocNetUserToGroup::GetByID($arRelationID[$i]);
         if (!$arRelation) {
             continue;
         }
         if ($arRelation["GROUP_ID"] != $groupID || $arRelation["INITIATED_BY_TYPE"] != SONET_INITIATED_BY_USER || $arRelation["ROLE"] != SONET_ROLES_REQUEST) {
             continue;
         }
         if (CSocNetUserToGroup::Delete($arRelation["ID"])) {
             $arMessageFields = array("FROM_USER_ID" => $userID, "TO_USER_ID" => $arRelation["USER_ID"], "MESSAGE" => str_replace("#NAME#", $arGroup["NAME"], GetMessage("SONET_UG_REJECT_MEMBER_MESSAGE_G")), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM);
             CSocNetMessages::Add($arMessageFields);
         } else {
             $errorMessage = "";
             if ($e = $APPLICATION->GetException()) {
                 $errorMessage = $e->GetString();
             }
             if (StrLen($errorMessage) <= 0) {
                 $errorMessage = GetMessage("SONET_UR_ERROR_CREATE_USER2GROUP");
             }
             $GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_CONFIRM_MEMBER");
             $bSuccess = false;
         }
     }
     return $bSuccess;
 }
Beispiel #25
0
	public static function InitUsersTmp($message, $titleTemplate1, $titleTemplate2, $arParams, $bCurrentUserIsAdmin = "unknown", $bRSS = false)
	{
		$arUsersID = explode(",", $message);

		$message = "";
		$title = "";

		$bFirst = true;
		$count = 0;

		if ($bCurrentUserIsAdmin == "unknown")
			$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();

		foreach ($arUsersID as $userID)
		{
			list($titleTmp, $messageTmp) = CSocNetLog::InitUserTmp($userID, $arParams, $bCurrentUserIsAdmin, $bRSS);

			if (StrLen($titleTmp) > 0)
			{
				if (!$bFirst)
					$title .= ", ";
				$title .= $titleTmp;
				$count++;
			}

			if (StrLen($messageTmp) > 0)
			{
				if (!$bFirst)
					$message .= " ";
				$message .= $messageTmp;
			}

			$bFirst = false;
		}
		return array(Str_Replace("#TITLE#", $title, (($count > 1) ? $titleTemplate2 : $titleTemplate1)), $message);
	}
Beispiel #26
0
             $arResult["BLOG"] = array("SHOW" => false, "TITLE" => GetMessage("SONET_C39_BLOG_TITLE"));
             if (array_key_exists("blog", $arResult["ActiveFeatures"]) && (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "blog", "view_post", CSocNetUser::IsCurrentUserModuleAdmin()) || $APPLICATION->GetGroupRight("blog") >= "W") && CModule::IncludeModule("blog")) {
                 $arResult["BLOG"]["SHOW"] = true;
                 if (StrLen($arResult["ActiveFeatures"]["blog"]) > 0) {
                     $arResult["BLOG"]["TITLE"] = $arResult["ActiveFeatures"]["blog"];
                 }
             }
             $arResult["forum"] = array("SHOW" => false, "TITLE" => GetMessage("SONET_C39_FORUM_TITLE"));
             if (array_key_exists("forum", $arResult["ActiveFeatures"]) && (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "forum", "view", CSocNetUser::IsCurrentUserModuleAdmin()) || $APPLICATION->GetGroupRight("forum") >= "W") && CModule::IncludeModule("forum")) {
                 $arResult["forum"]["SHOW"] = true;
                 if (StrLen($arResult["ActiveFeatures"]["forum"]) > 0) {
                     $arResult["forum"]["TITLE"] = $arResult["ActiveFeatures"]["forum"];
                 }
             }
             $arResult["tasks"] = array("SHOW" => false, "TITLE" => GetMessage("SONET_C39_TASKS_TITLE"));
             if (array_key_exists("tasks", $arResult["ActiveFeatures"]) && (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "tasks", "view", CSocNetUser::IsCurrentUserModuleAdmin()) || $APPLICATION->GetGroupRight("intranet") >= "W") && CModule::IncludeModule("intranet")) {
                 $arResult["tasks"]["SHOW"] = true;
                 if (StrLen($arResult["ActiveFeatures"]["tasks"]) > 0) {
                     $arResult["tasks"]["TITLE"] = $arResult["ActiveFeatures"]["tasks"];
                 }
             }
         }
     }
     if (array_key_exists("RatingMultiple", $arResult) && count($arResult["RatingMultiple"]) > 0) {
         foreach ($arParams["RATING_ID_ARR"] as $rating_id) {
             if (array_key_exists($rating_id, $arResult["RatingMultiple"])) {
                 $arResult["RatingMultiple"][$rating_id]["VALUE"] = $arResult["User"]["RATING_" . $rating_id . "_CURRENT_VALUE"];
             }
         }
     }
 }
Beispiel #27
0
 function __SLEGetLogRecord($logID, $arParams, $arCurrentUserSubscribe, $current_page_date)
 {
     static $isExtranetInstalled, $isExtranetSite, $isExtranetUser, $arUserIdVisible, $arAvailableExtranetUserID, $isExtranetAdmin, $bCurrentUserIsAdmin, $arSocNetFeaturesSettings;
     if (!$isExtranetInstalled) {
         $isExtranetInstalled = CModule::IncludeModule("extranet") ? "Y" : "N";
         $isExtranetSite = $isExtranetInstalled == "Y" && CExtranet::IsExtranetSite() ? "Y" : "N";
         $isExtranetUser = $isExtranetInstalled == "Y" && !CExtranet::IsIntranetUser() ? "Y" : "N";
         $isExtranetAdmin = $isExtranetInstalled == "Y" && CExtranet::IsExtranetAdmin() ? "Y" : "N";
         $bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
         $arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
         if ($isExtranetUser == "Y") {
             $arUserIdVisible = CExtranet::GetMyGroupsUsersSimple(SITE_ID);
         } elseif ($isExtranetInstalled == "Y" && $isExtranetUser != "Y") {
             if ($isExtranetAdmin == "Y" && $bCurrentUserIsAdmin) {
                 $arAvailableExtranetUserID = CExtranet::GetMyGroupsUsers(SITE_ID);
             } else {
                 $arAvailableExtranetUserID = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
             }
         }
     }
     $cache_time = 31536000;
     $arEvent = array();
     $cache = new CPHPCache();
     $arCacheID = array();
     $arKeys = array("AVATAR_SIZE", "DESTINATION_LIMIT", "CHECK_PERMISSIONS_DEST", "NAME_TEMPLATE", "NAME_TEMPLATE_WO_NOBR", "SHOW_LOGIN", "DATE_TIME_FORMAT", "PATH_TO_USER", "PATH_TO_GROUP", "PATH_TO_CONPANY_DEPARTMENT");
     foreach ($arKeys as $param_key) {
         if (array_key_exists($param_key, $arParams)) {
             $arCacheID[$param_key] = $arParams[$param_key];
         } else {
             $arCacheID[$param_key] = false;
         }
     }
     $cache_id = "log_post_" . $logID . "_" . md5(serialize($arCacheID)) . "_" . SITE_TEMPLATE_ID . "_" . SITE_ID . "_" . LANGUAGE_ID . "_" . FORMAT_DATETIME . "_" . CTimeZone::GetOffset();
     $cache_path = "/sonet/log/" . intval(intval($logID) / 1000) . "/" . $logID . "/entry/";
     if (is_object($cache) && $cache->InitCache($cache_time, $cache_id, $cache_path)) {
         $arCacheVars = $cache->GetVars();
         $arEvent["FIELDS_FORMATTED"] = $arCacheVars["FIELDS_FORMATTED"];
         if (array_key_exists("CACHED_CSS_PATH", $arEvent["FIELDS_FORMATTED"])) {
             if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) && strlen($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) > 0) {
                 $GLOBALS['APPLICATION']->SetAdditionalCSS($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]);
             } elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"])) {
                 foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"] as $css_path) {
                     $GLOBALS['APPLICATION']->SetAdditionalCSS($css_path);
                 }
             }
         }
         if (array_key_exists("CACHED_JS_PATH", $arEvent["FIELDS_FORMATTED"])) {
             if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"]) && $arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"] !== '') {
                 $GLOBALS['APPLICATION']->AddHeadScript($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"]);
             } elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"])) {
                 foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"] as $js_path) {
                     $GLOBALS['APPLICATION']->AddHeadScript($js_path);
                 }
             }
         }
     } else {
         if (is_object($cache)) {
             $cache->StartDataCache($cache_time, $cache_id, $cache_path);
         }
         $arFilter = array("ID" => $logID);
         $arListParams = array("CHECK_RIGHTS" => "N", "USE_FOLLOW" => "N", "USE_SUBSCRIBE" => "N");
         $arSelect = array("ID", "TMP_ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "EVENT_ID", "LOG_DATE", "LOG_UPDATE", "TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "CALLBACK_FUNC", "EXTERNAL_ID", "SITE_ID", "PARAMS", "COMMENTS_COUNT", "ENABLE_COMMENTS", "SOURCE_ID", "GROUP_NAME", "GROUP_OWNER_ID", "GROUP_INITIATE_PERMS", "GROUP_VISIBLE", "GROUP_OPENED", "GROUP_IMAGE_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "USER_PERSONAL_PHOTO", "USER_PERSONAL_GENDER", "CREATED_BY_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LOGIN", "CREATED_BY_PERSONAL_PHOTO", "CREATED_BY_PERSONAL_GENDER", "RATING_TYPE_ID", "RATING_ENTITY_ID", "SOURCE_TYPE");
         $dbEvent = CSocNetLog::GetList(array(), $arFilter, false, false, $arSelect, $arListParams);
         if ($arEvent = $dbEvent->GetNext()) {
             if (defined("BX_COMP_MANAGED_CACHE")) {
                 $GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
                 $GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . intval($arEvent["USER_ID"]));
                 $GLOBALS["CACHE_MANAGER"]->RegisterTag("SONET_LOG_" . intval($arEvent["ID"]));
                 if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
                     $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group_" . $arEvent["ENTITY_ID"]);
                 }
             }
             $arEvent["EVENT_ID_FULLSET"] = CSocNetLogTools::FindFullSetEventIDByEventID($arEvent["EVENT_ID"]);
             if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
                 static $arSiteWorkgroupsPage;
                 if (!$arSiteWorkgroupsPage && (IsModuleInstalled("extranet") || is_set($arEvent["URL"]) && strpos($arEvent["URL"], "#GROUPS_PATH#") !== false)) {
                     $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 (is_set($arEvent["URL"]) && isset($arSiteWorkgroupsPage[SITE_ID])) {
                     $arEvent["URL"] = str_replace("#GROUPS_PATH#", $arSiteWorkgroupsPage[SITE_ID], $arEvent["URL"]);
                 }
             }
             $arEventTmp = CSocNetLogTools::FindLogEventByID($arEvent["EVENT_ID"]);
             if ($arEventTmp && isset($arEventTmp["CLASS_FORMAT"]) && isset($arEventTmp["METHOD_FORMAT"])) {
                 $arEvent["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("SONET_LOG", $arEvent["ID"], LANGUAGE_ID);
                 $arEvent["FIELDS_FORMATTED"] = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arEvent, $arParams);
                 if (is_array($arEvent["FIELDS_FORMATTED"])) {
                     if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"])) {
                         if (in_array($arEvent["EVENT_ID"], array('calendar'))) {
                             $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] = htmlspecialcharsback($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]);
                         } else {
                             $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] = CSocNetTextParser::closetags(htmlspecialcharsback($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]));
                         }
                     }
                     if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"])) {
                         $arFields2Cache = array("URL", "STYLE", "DESTINATION", "DESTINATION_MORE", "TITLE_24", "TITLE_24_2", "TITLE_24_2_STYLE", "IS_IMPORTANT", "MESSAGE", "FOOTER_MESSAGE", "MESSAGE_TITLE_24", "DATETIME_FORMATTED", "LOG_DATE_FORMAT", "MENU", "COMMENT_URL");
                         foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"] as $field => $value) {
                             if (!in_array($field, $arFields2Cache)) {
                                 unset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"][$field]);
                             }
                         }
                     }
                     if (isset($arEvent["FIELDS_FORMATTED"]["EVENT"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT"])) {
                         $arFields2Cache = array("ID", "URL", "USER_ID", "ENTITY_TYPE", "ENTITY_ID", "EVENT_ID", "EVENT_ID_FULLSET", "TITLE", "MESSAGE", "SOURCE_ID", "PARAMS", "RATING_TYPE_ID", "RATING_ENTITY_ID");
                         foreach ($arEvent["FIELDS_FORMATTED"]["EVENT"] as $field => $value) {
                             if (!in_array($field, $arFields2Cache)) {
                                 unset($arEvent["FIELDS_FORMATTED"]["EVENT"][$field]);
                             }
                         }
                     }
                     if (isset($arEvent["FIELDS_FORMATTED"]["CREATED_BY"]) && is_array($arEvent["FIELDS_FORMATTED"]["CREATED_BY"])) {
                         $arFields2Cache = array("TOOLTIP_FIELDS", "FORMATTED", "URL", "IS_EXTRANET");
                         foreach ($arEvent["FIELDS_FORMATTED"]["CREATED_BY"] as $field => $value) {
                             if (!in_array($field, $arFields2Cache)) {
                                 unset($arEvent["FIELDS_FORMATTED"]["CREATED_BY"][$field]);
                             }
                         }
                         if (isset($arEvent["FIELDS_FORMATTED"]["CREATED_BY"]["TOOLTIP_FIELDS"]) && is_array($arEvent["FIELDS_FORMATTED"]["CREATED_BY"]["TOOLTIP_FIELDS"])) {
                             $arFields2Cache = array("ID", "PATH_TO_SONET_USER_PROFILE", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "EMAIL");
                             foreach ($arEvent["FIELDS_FORMATTED"]["CREATED_BY"]["TOOLTIP_FIELDS"] as $field => $value) {
                                 if (!in_array($field, $arFields2Cache)) {
                                     unset($arEvent["FIELDS_FORMATTED"]["CREATED_BY"]["TOOLTIP_FIELDS"][$field]);
                                 }
                             }
                         }
                     }
                     if (isset($arEvent["FIELDS_FORMATTED"]["ENTITY"]) && is_array($arEvent["FIELDS_FORMATTED"]["ENTITY"])) {
                         $arFields2Cache = array("TOOLTIP_FIELDS", "FORMATTED", "URL");
                         foreach ($arEvent["FIELDS_FORMATTED"]["ENTITY"] as $field => $value) {
                             if (!in_array($field, $arFields2Cache)) {
                                 unset($arEvent["FIELDS_FORMATTED"]["ENTITY"][$field]);
                             }
                         }
                         if (isset($arEvent["FIELDS_FORMATTED"]["ENTITY"]["TOOLTIP_FIELDS"]) && is_array($arEvent["FIELDS_FORMATTED"]["ENTITY"]["TOOLTIP_FIELDS"])) {
                             $arFields2Cache = array("ID", "PATH_TO_SONET_USER_PROFILE", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "EMAIL");
                             foreach ($arEvent["FIELDS_FORMATTED"]["ENTITY"]["TOOLTIP_FIELDS"] as $field => $value) {
                                 if (!in_array($field, $arFields2Cache)) {
                                     unset($arEvent["FIELDS_FORMATTED"]["ENTITY"]["TOOLTIP_FIELDS"][$field]);
                                 }
                             }
                         }
                     }
                     $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["UF"] = $arEvent["UF"];
                 } else {
                     $bEmpty = true;
                 }
             }
             if (!$bEmpty) {
                 $dateFormated = FormatDate($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp(isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"]) ? $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"] : (array_key_exists("LOG_DATE_FORMAT", $arEvent) ? $arEvent["LOG_DATE_FORMAT"] : $arEvent["LOG_DATE"])));
                 $timeFormated = FormatDateFromDB(isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"]) ? $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"] : (array_key_exists("LOG_DATE_FORMAT", $arEvent) ? $arEvent["LOG_DATE_FORMAT"] : $arEvent["LOG_DATE"]), stripos($arParams["DATE_TIME_FORMAT"], 'a') || ($arParams["DATE_TIME_FORMAT"] == 'FULL' && IsAmPmMode()) !== false ? strpos(FORMAT_DATETIME, 'TT') !== false ? 'H:MI TT' : 'H:MI T' : 'HH:MI');
                 $dateTimeFormated = FormatDate(!empty($arParams["DATE_TIME_FORMAT"]) ? $arParams["DATE_TIME_FORMAT"] == "FULL" ? $GLOBALS["DB"]->DateFormatToPHP(str_replace(":SS", "", FORMAT_DATETIME)) : $arParams["DATE_TIME_FORMAT"] : $GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME), MakeTimeStamp(isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"]) ? $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"] : (array_key_exists("LOG_DATE_FORMAT", $arEvent) ? $arEvent["LOG_DATE_FORMAT"] : $arEvent["LOG_DATE"])));
                 if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
                     $dateTimeFormated = ToLower($dateTimeFormated);
                     $dateFormated = ToLower($dateFormated);
                     $timeFormated = ToLower($timeFormated);
                 }
                 // strip current year
                 if (!empty($arParams['DATE_TIME_FORMAT']) && ($arParams['DATE_TIME_FORMAT'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT'] == 'j F Y g:i a')) {
                     $dateTimeFormated = ltrim($dateTimeFormated, '0');
                     $curYear = date('Y');
                     $dateTimeFormated = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $dateTimeFormated);
                 }
                 $arEvent["MESSAGE_FORMAT"] = htmlspecialcharsback($arEvent["MESSAGE"]);
                 if (StrLen($arEvent["CALLBACK_FUNC"]) > 0) {
                     if (StrLen($arEvent["MODULE_ID"]) > 0) {
                         CModule::IncludeModule($arEvent["MODULE_ID"]);
                     }
                     $arEvent["MESSAGE_FORMAT"] = call_user_func($arEvent["CALLBACK_FUNC"], $arEvent);
                 }
                 $arEvent["FIELDS_FORMATTED"]["LOG_TIME_FORMAT"] = $timeFormated;
                 $arEvent["FIELDS_FORMATTED"]["LOG_UPDATE_TS"] = MakeTimeStamp($arEvent["LOG_UPDATE"]);
                 $arEvent["FIELDS_FORMATTED"]["LOG_DATE_TS"] = MakeTimeStamp($arEvent["LOG_DATE"]);
                 $arEvent["FIELDS_FORMATTED"]["LOG_DATE_DAY"] = ConvertTimeStamp(MakeTimeStamp($arEvent["LOG_DATE"]), "SHORT");
                 $arEvent["FIELDS_FORMATTED"]["LOG_UPDATE_DAY"] = ConvertTimeStamp(MakeTimeStamp($arEvent["LOG_UPDATE"]), "SHORT");
                 $arEvent["FIELDS_FORMATTED"]["COMMENTS_COUNT"] = $arEvent["COMMENTS_COUNT"];
                 $arEvent["FIELDS_FORMATTED"]["TMP_ID"] = $arEvent["TMP_ID"];
                 $arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
                 $arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arEvent["EVENT_ID"]);
                 if (!array_key_exists("HAS_COMMENTS", $arEvent["FIELDS_FORMATTED"]) || $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] != "N") {
                     $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] = $arCommentEvent && (!array_key_exists("ENABLE_COMMENTS", $arEvent) || $arEvent["ENABLE_COMMENTS"] != "N") ? "Y" : "N";
                 }
             }
         }
         if (is_object($cache)) {
             $arCacheData = array("FIELDS_FORMATTED" => $arEvent["FIELDS_FORMATTED"]);
             $cache->EndDataCache($arCacheData);
             if (defined("BX_COMP_MANAGED_CACHE")) {
                 $GLOBALS["CACHE_MANAGER"]->EndTagCache();
             }
         }
     }
     if ($bEmpty) {
         return false;
     }
     $feature = CSocNetLogTools::FindFeatureByEventID($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
     if ($feature && (!array_key_exists($feature, $arSocNetFeaturesSettings) || array_key_exists("allowed", $arSocNetFeaturesSettings[$feature]) && is_array($arSocNetFeaturesSettings[$feature]["allowed"]) && !in_array($arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_TYPE"], $arSocNetFeaturesSettings[$feature]["allowed"]))) {
         return false;
     }
     if (!array_key_exists("COMMENTS_PARAMS", $arEvent["FIELDS_FORMATTED"])) {
         $arForumMetaData = CSocNetLogTools::GetForumCommentMetaData($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
         if ($arForumMetaData && $arEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"] > 0) {
             $arEvent["FIELDS_FORMATTED"]["COMMENTS_PARAMS"] = array("ENTITY_TYPE" => $arForumMetaData[1], "ENTITY_XML_ID" => $arForumMetaData[0] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"], "NOTIFY_TAGS" => $arForumMetaData[2]);
         } else {
             $arEvent["FIELDS_FORMATTED"]["COMMENTS_PARAMS"] = array("ENTITY_TYPE" => substr(strtoupper($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]) . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], 0, 2), "ENTITY_XML_ID" => strtoupper($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]) . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], "NOTIFY_TAGS" => "");
         }
     }
     foreach (GetModuleEvents("socialnetwork", "OnSonetLogEntryMenuCreate", true) as $arModuleEvent) {
         if (!array_key_exists("FIELDS_FORMATTED", $arEvent)) {
             $arEvent["FIELDS_FORMATTED"] = array();
         }
         if (!array_key_exists("MENU", $arEvent["FIELDS_FORMATTED"])) {
             $arEvent["FIELDS_FORMATTED"]["MENU"] = array();
         }
         $arMenuItems = ExecuteModuleEventEx($arModuleEvent, array($arEvent));
         if (!empty($arMenuItems)) {
             $arEvent["FIELDS_FORMATTED"]["MENU"] = array_merge($arEvent["FIELDS_FORMATTED"]["MENU"], $arMenuItems);
         }
     }
     if (is_array($arCurrentUserSubscribe)) {
         $arEvent["FIELDS_FORMATTED"]["TRANSPORT"] = __SLEGetTransport($arEvent, $arCurrentUserSubscribe);
     }
     $arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
     if (!$GLOBALS["USER"]->IsAuthorized()) {
         $arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = "N";
     } elseif ($arCommentEvent && array_key_exists("OPERATION_ADD", $arCommentEvent) && $arCommentEvent["OPERATION_ADD"] == "log_rights") {
         $arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = CSocNetLogRights::CheckForUser($arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], $GLOBALS["USER"]->GetID()) ? "Y" : "N";
     } else {
         $array_key = $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_TYPE"] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_ID"] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"];
         if (array_key_exists($array_key, $GLOBALS["CurUserCanAddComments"])) {
             $arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
         } else {
             if ($feature && $arCommentEvent && array_key_exists("OPERATION_ADD", $arCommentEvent) && strlen($arCommentEvent["OPERATION_ADD"]) > 0) {
                 $GLOBALS["CurUserCanAddComments"][$array_key] = CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_TYPE"], $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_ID"], $feature == "microblog" ? "blog" : $feature, $arCommentEvent["OPERATION_ADD"], $bCurrentUserIsAdmin) ? "Y" : "N";
             } else {
                 $GLOBALS["CurUserCanAddComments"][$array_key] = "Y";
             }
             $arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
         }
     }
     $arEvent["FIELDS_FORMATTED"]["FAVORITES"] = $arParams["EVENT"]["FAVORITES"];
     if ($arParams["USE_FOLLOW"] == "Y") {
         $arEvent["FIELDS_FORMATTED"]["EVENT"]["FOLLOW"] = $arParams["EVENT"]["FOLLOW"];
         $arEvent["FIELDS_FORMATTED"]["EVENT"]["DATE_FOLLOW_X1"] = $arParams["EVENT"]["DATE_FOLLOW_X1"];
         $arEvent["FIELDS_FORMATTED"]["EVENT"]["DATE_FOLLOW"] = $arParams["EVENT"]["DATE_FOLLOW"];
     }
     if ($arParams["CHECK_PERMISSIONS_DEST"] == "N" && !$bCurrentUserIsAdmin && is_object($GLOBALS["USER"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && (array_key_exists("DESTINATION", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) || array_key_exists("DESTINATION_CODE", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"]))) {
         $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"] = 0;
         $arGroupID = CSocNetLogTools::GetAvailableGroups();
         if (array_key_exists("DESTINATION", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"])) {
             foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"] as $key => $arDestination) {
                 if (array_key_exists("TYPE", $arDestination) && array_key_exists("ID", $arDestination) && ($arDestination["TYPE"] == "SG" && !in_array(intval($arDestination["ID"]), $arGroupID) || in_array($arDestination["TYPE"], array("CRMCOMPANY", "CRMLEAD", "CRMCONTACT", "CRMDEAL")) && CModule::IncludeModule("crm") && !CCrmAuthorizationHelper::CheckReadPermission(CCrmLiveFeedEntity::ResolveEntityTypeID($arDestination["TYPE"]), $arDestination["ID"]) || in_array($arDestination["TYPE"], array("DR", "D")) && $isExtranetUser == "Y" || $arDestination["TYPE"] == "U" && isset($arUserIdVisible) && is_array($arUserIdVisible) && !in_array(intval($arDestination["ID"]), $arUserIdVisible) || $arDestination["TYPE"] == "U" && isset($arDestination["IS_EXTRANET"]) && $arDestination["IS_EXTRANET"] == "Y" && isset($arAvailableExtranetUserID) && is_array($arAvailableExtranetUserID) && !in_array(intval($arDestination["ID"]), $arAvailableExtranetUserID))) {
                     unset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"][$key]);
                     $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"]++;
                 }
             }
             if (intval($arParams["DESTINATION_LIMIT_SHOW"]) > 0 && count($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) > $arParams["DESTINATION_LIMIT_SHOW"]) {
                 $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_MORE"] = count($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) - $arParams["DESTINATION_LIMIT_SHOW"];
                 $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"] = array_slice($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"], 0, $arParams["DESTINATION_LIMIT_SHOW"]);
             }
         } elseif (array_key_exists("DESTINATION_CODE", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"])) {
             foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"] as $key => $right_tmp) {
                 if (preg_match('/^SG(\\d+)$/', $right_tmp, $matches) && !in_array(intval($matches[1]), $arGroupID)) {
                     unset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"][$key]);
                     $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"]++;
                 }
             }
         }
     }
     if ($arParams["SHOW_RATING"] == "Y" && strlen($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_TYPE_ID"]) > 0 && intval($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_ENTITY_ID"]) > 0) {
         $arEvent["FIELDS_FORMATTED"]["RATING"] = CRatings::GetRatingVoteResult($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_TYPE_ID"], $arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_ENTITY_ID"]);
     }
     return $arEvent["FIELDS_FORMATTED"];
 }
Beispiel #28
0
/** @var string $parentComponentPath */
/** @var string $parentComponentTemplate */
$this->setFrameMode(false);
if (!CModule::IncludeModule('lists')) {
    ShowError(GetMessage("CC_BLL_MODULE_NOT_INSTALLED"));
    return;
}
$IBLOCK_ID = intval($arParams["~IBLOCK_ID"]);
if (isset($_GET["list_section_id"])) {
    $section_id = intval($_GET["list_section_id"]);
} else {
    $section_id = intval($arParams["~SECTION_ID"]);
}
if (intval($arParams["~SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule("socialnetwork")) {
    $arSonetGroup = CSocNetGroup::GetByID(intval($arParams["~SOCNET_GROUP_ID"]));
    if (is_array($arSonetGroup) && $arSonetGroup["CLOSED"] == "Y" && !CSocNetUser::IsCurrentUserModuleAdmin() && ($arSonetGroup["OWNER_ID"] != $GLOBALS["USER"]->GetID() || COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") != "Y")) {
        $arResult["IS_SOCNET_GROUP_CLOSED"] = true;
    }
}
$lists_perm = CListPermissions::CheckAccess($USER, $arParams["~IBLOCK_TYPE_ID"], $IBLOCK_ID, $arParams["~SOCNET_GROUP_ID"]);
if ($lists_perm < 0) {
    switch ($lists_perm) {
        case CListPermissions::WRONG_IBLOCK_TYPE:
            ShowError(GetMessage("CC_BLL_WRONG_IBLOCK_TYPE"));
            return;
        case CListPermissions::WRONG_IBLOCK:
            ShowError(GetMessage("CC_BLL_WRONG_IBLOCK"));
            return;
        case CListPermissions::LISTS_FOR_SONET_GROUP_DISABLED:
            ShowError(GetMessage("CC_BLL_LISTS_FOR_SONET_GROUP_DISABLED"));
            return;
Beispiel #29
0
    function GetUsersBlogs($params, $arPath)
    {
        global $USER;
        $blog = CBlogMetaWeblog::DecodeParams($params[0]["#"]["value"][0]["#"]);
        $user = CBlogMetaWeblog::DecodeParams($params[1]["#"]["value"][0]["#"]);
        $password = CBlogMetaWeblog::DecodeParams($params[2]["#"]["value"][0]["#"]);
        if (CBlogMetaWeblog::Authorize($user, $password)) {
            $result = '';
            $userId = $USER->GetID();
            $dbBlog = CBlog::GetList(array(), array("OWNER_ID" => $userId, "GROUP_SITE_ID" => SITE_ID, "ACTIVE" => "Y"), false, false, array("ID", "URL", "NAME", "OWNER_ID"));
            while ($arBlog = $dbBlog->GetNext()) {
                if (strlen($arPath["PATH_TO_BLOG"]) > 0) {
                    if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
                        $serverName = SITE_SERVER_NAME;
                    } else {
                        $serverName = COption::GetOptionString("main", "server_name", "");
                    }
                    if (strlen($serverName) <= 0) {
                        $serverName = $_SERVER["SERVER_NAME"];
                    }
                    $path2Blog = "http://" . $serverName . CComponentEngine::MakePathFromTemplate($arPath["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"]));
                } else {
                    $path2Blog = $arBlog["URL"];
                }
                $result .= '
						<value>
							<struct>
								<member>
									<name>url</name>
									<value>' . $path2Blog . '</value>
								</member>
								<member>
									<name>blogid</name>
									<value>' . $arBlog["ID"] . '</value>
								</member>
								<member>
									<name>blogName</name>
									<value>' . $arBlog["NAME"] . '</value>
								</member>
							</struct>
						</value>
					';
            }
            if (CModule::IncludeModule("socialnetwork")) {
                $arGroupFilter = array("USER_ID" => $userId, "<=ROLE" => SONET_ROLES_USER, "GROUP_SITE_ID" => SITE_ID, "GROUP_ACTIVE" => "Y");
                $dbGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), $arGroupFilter, false, false, array("ID", "GROUP_ID", "GROUP_OWNER_ID", "GROUP_NAME", "GROUP_SITE_ID"));
                while ($arGroups = $dbGroups->GetNext()) {
                    $perms = BLOG_PERMS_DENY;
                    if (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_GROUP, $arGroups["GROUP_ID"], "blog", "write_post", CSocNetUser::IsCurrentUserModuleAdmin($arGroups["GROUP_SITE_ID"]))) {
                        $perms = BLOG_PERMS_WRITE;
                    } elseif (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_GROUP, $arGroups["GROUP_ID"], "blog", "full_post")) {
                        $perms = BLOG_PERMS_FULL;
                    }
                    if ($perms >= BLOG_PERMS_WRITE) {
                        $dbBlog = CBlog::GetList(array(), array("SOCNET_GROUP_ID" => $arGroups["GROUP_ID"], "GROUP_SITE_ID" => SITE_ID, "ACTIVE" => "Y"), false, false, array("ID", "URL", "NAME"));
                        if ($arBlog = $dbBlog->GetNext()) {
                            $result .= '
									<value>
										<struct>
											<member>
												<name>url</name>
												<value>' . $arBlog["URL"] . '</value>
											</member>
											<member>
												<name>blogid</name>
												<value>' . $arBlog["ID"] . '</value>
											</member>
											<member>
												<name>blogName</name>
												<value>' . $arBlog["NAME"] . '</value>
											</member>
										</struct>
									</value>
								';
                        }
                    }
                }
            }
            if (strlen($result) > 0) {
                return '<params>
							<param>
								<value>
									<array>
										<data>' . $result . '</data>
									</array>
								</value>
							</param>
						</params>';
            } else {
                return '<fault>
					<value>
						<struct>
							<member>
								<name>faultCode</name>
								<value><int>4</int></value>
								</member>
							<member>
								<name>faultString</name>
								<value><string>User hasn\'t blog.</string></value>
								</member>
							</struct>
						</value>
					</fault>';
            }
        } else {
            return '<fault>
				<value>
					<struct>
						<member>
							<name>faultCode</name>
							<value><int>3</int></value>
							</member>
						<member>
							<name>faultString</name>
							<value><string>' . $arAuthResult["MESSAGE"] . '</string></value>
							</member>
						</struct>
					</value>
				</fault>';
        }
    }
Beispiel #30
0
         if (in_array($arUser["ID"], $arUsersInListID)) {
             continue;
         }
         $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"]));
         $canViewProfile = CSocNetUserPerms::CanPerformOperation($arResult["UserSelf"]["ID"], $arUser["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
         $strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $bUseLogin);
         $arResult["Friends"][] = array("USER_ID" => $arUser["ID"], "USER_NAME" => $arUser["NAME"], "USER_LAST_NAME" => $arUser["LAST_NAME"], "USER_SECOND_NAME" => $arUser["SECOND_NAME"], "USER_LOGIN" => $arUser["LOGIN"], "USER_NAME_FORMATTED" => $strNameFormatted, "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "PATH_TO_MESSAGES_CHAT" => str_replace("#user_id#", $arUser["ID"], $arParams["PATH_TO_MESSAGES_CHAT"]), "IS_ONLINE" => $arUser["IS_ONLINE"] == "Y");
     }
 }
 //Recent users
 $arResult["RecentUsers"] = array();
 $arNavParams = array("nPageSize" => 20, "bDescPageNumbering" => false);
 $dbMessages = CSocNetMessages::GetMessagesUsers($GLOBALS["USER"]->GetID(), $arNavParams);
 while ($arMessages = $dbMessages->GetNext()) {
     $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arMessages["ID"]));
     $canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arMessages["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
     $arTmpUser = array("NAME" => $arMessages["~NAME"], "LAST_NAME" => $arMessages["~LAST_NAME"], "SECOND_NAME" => $arMessages["~SECOND_NAME"], "LOGIN" => $arMessages["~LOGIN"]);
     $strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin);
     $arResult["RecentUsers"][] = array("USER_ID" => $arMessages["ID"], "USER_NAME" => $arMessages["NAME"], "USER_LAST_NAME" => $arMessages["LAST_NAME"], "USER_SECOND_NAME" => $arMessages["SECOND_NAME"], "USER_LOGIN" => $arMessages["LOGIN"], "USER_NAME_FORMATTED" => $strNameFormatted, "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "PATH_TO_MESSAGES_CHAT" => str_replace("#user_id#", $arMessages["ID"], $arParams["PATH_TO_MESSAGES_CHAT"]), "IS_ONLINE" => $arMessages["IS_ONLINE"] == "Y");
 }
 $arResult["PrintSmilesList"] = CSocNetSmile::PrintSmilesList(0, LANGUAGE_ID, $arParams["PATH_TO_SMILE"]);
 $strNow = CSocNetMessages::Now();
 $strNow_ts = MakeTimeStamp($strNow, "YYYY-MM-DD HH:MI:SS") + CTimeZone::GetOffset();
 $arResult["Now"] = date("Y-m-d H:i:s", $strNow_ts);
 //user options
 require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/" . strtolower($GLOBALS['DB']->type) . "/favorites.php";
 $arResult["USER_OPTIONS"] = CUserOptions::GetOption('socnet', 'chat', array());
 if ($arResult["USER_OPTIONS"]["sound"] != "N") {
     $arResult["USER_OPTIONS"]["sound"] = "Y";
 }
 if ($arResult["USER_OPTIONS"]["contacts"] != "Y") {