• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/functions.php
  • Класс: CSocNetAllowed
  • Вызов: CSocNetAllowed::addStandardFeatureList
static function addStandardFeatureList()
{
	if (ModuleManager::isModuleInstalled('forum'))
	{
		$arFeatureTmp = array(
			"allowed" => array(),
			"operations" => array(
				"full" => array(),
				"newtopic" => array(),
				"answer" => array(),
				"view" => array(),
			),
			"minoperation" => array("view"),
			"subscribe_events" => array(
				"forum" =>  array(
					"ENTITIES" => array(),
					"OPERATION" => "view",
					"CLASS_FORMAT" => "CSocNetLogTools",
					"METHOD_FORMAT" => "FormatEvent_Forum",
					"HAS_CB" => "Y",
					"COMMENT_EVENT"	=> array(
						"EVENT_ID" => "forum",
						"OPERATION" => "view",
						"OPERATION_ADD" => "answer",
						"ADD_CALLBACK" => array("CSocNetLogTools", "AddComment_Forum"),
						"UPDATE_CALLBACK" => array("CSocNetLogTools", "UpdateComment_Forum"),
						"DELETE_CALLBACK" => array("CSocNetLogTools", "DeleteComment_Forum"),
						"CLASS_FORMAT" => "CSocNetLogTools",
						"METHOD_FORMAT" => "FormatComment_Forum",
						"RATING_TYPE_ID" => "FORUM_POST"
					)
				)
			)
		);

		if (COption::GetOptionString("socialnetwork", "allow_forum_user", "Y") == "Y")
		{
			$arFeatureTmp["subscribe_events"]["forum"]["ENTITIES"][SONET_SUBSCRIBE_ENTITY_USER] = array(
				"TITLE" => GetMessage("SOCNET_LOG_FORUM_USER"),
				"TITLE_SETTINGS" => GetMessage("SOCNET_LOG_FORUM_USER_SETTINGS"),
				"TITLE_SETTINGS_1" => GetMessage("SOCNET_LOG_FORUM_USER_SETTINGS_1"),
				"TITLE_SETTINGS_2" => GetMessage("SOCNET_LOG_FORUM_USER_SETTINGS_2"),
			);

			$arFeatureTmp["allowed"][] = SONET_ENTITY_USER;
			$arFeatureTmp["operations"]["full"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_forum_operation_full_user", SONET_RELATIONS_TYPE_NONE);
			$arFeatureTmp["operations"]["newtopic"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_forum_operation_newtopic_user", SONET_RELATIONS_TYPE_NONE);
			$arFeatureTmp["operations"]["answer"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_forum_operation_answer_user", (CSocNetUser::IsFriendsAllowed() ? SONET_RELATIONS_TYPE_FRIENDS : SONET_RELATIONS_TYPE_AUTHORIZED));
			$arFeatureTmp["operations"]["view"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_forum_operation_view_user", SONET_RELATIONS_TYPE_ALL);
		}

		if (COption::GetOptionString("socialnetwork", "allow_forum_group", "Y") == "Y")
		{
			$arFeatureTmp["subscribe_events"]["forum"]["ENTITIES"][SONET_SUBSCRIBE_ENTITY_GROUP] = array(
				"TITLE" => GetMessage("SOCNET_LOG_FORUM_GROUP"),
				"TITLE_SETTINGS" => GetMessage("SOCNET_LOG_FORUM_GROUP_SETTINGS"),
				"TITLE_SETTINGS_1" => GetMessage("SOCNET_LOG_FORUM_GROUP_SETTINGS_1"),
				"TITLE_SETTINGS_2" => GetMessage("SOCNET_LOG_FORUM_GROUP_SETTINGS_2"),
			);

			$arFeatureTmp["allowed"][] = SONET_ENTITY_GROUP;
			$arFeatureTmp["operations"]["full"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_forum_operation_full_group", SONET_ROLES_MODERATOR);
			$arFeatureTmp["operations"]["newtopic"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_forum_operation_newtopic_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["answer"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_forum_operation_answer_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["view"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_forum_operation_view_group", SONET_ROLES_USER);
		}

		CSocNetAllowed::addAllowedFeature("forum", $arFeatureTmp);
	}

	if (ModuleManager::isModuleInstalled('photogallery'))
	{
		$arFeatureTmp = array(
			"allowed" => array(),
			"operations" => array(
				"write" => array(),
				"view" => array(),
			),
			"minoperation" => array("view"),
			"subscribe_events" => array(
				"photo" =>  array(
					"ENTITIES" => array(),
					"OPERATION" => "view",
					"CLASS_FORMAT" => "CSocNetLogTools",
					"METHOD_FORMAT"	=> "FormatEvent_Photo",
					"HAS_CB" => "Y",
					"FULL_SET" => array("photo", "photo_photo", "photo_comment"),
					"COMMENT_EVENT"	=> array(
						"EVENT_ID" => "photoalbum_comment",
						"OPERATION" => "view",
						"OPERATION_ADD"	=> "view",
						"ADD_CALLBACK" => array("CSocNetPhotoCommentEvent", "AddComment_PhotoAlbum"),
						"UPDATE_CALLBACK" => "NO_SOURCE",
						"DELETE_CALLBACK" => "NO_SOURCE",
						"CLASS_FORMAT" => "CSocNetLogTools",
						"METHOD_FORMAT"	=> "FormatComment_PhotoAlbum",
						"RATING_TYPE_ID" => "LOG_COMMENT"
					)
				),
				"photo_photo" =>  array(
					"OPERATION" => "view",
					"CLASS_FORMAT" => "CSocNetLogTools",
					"METHOD_FORMAT"	=> "FormatEvent_PhotoPhoto",
					"HIDDEN" => true,
					"HAS_CB" => "Y",
					"ENTITIES" => array(
						SONET_SUBSCRIBE_ENTITY_USER => array(),
						SONET_SUBSCRIBE_ENTITY_GROUP => array()
					),
					"COMMENT_EVENT"	=> array(
						"EVENT_ID" => "photo_comment",
						"OPERATION" => "view",
						"OPERATION_ADD"	=> "view",
						"ADD_CALLBACK" => array("CSocNetPhotoCommentEvent", "AddComment_Photo"),
						"UPDATE_CALLBACK" => array("CSocNetPhotoCommentEvent", "UpdateComment_Photo"),
						"DELETE_CALLBACK" => array("CSocNetPhotoCommentEvent", "DeleteComment_Photo"),
						"CLASS_FORMAT" => "CSocNetLogTools",
						"METHOD_FORMAT"	=> "FormatComment_Photo"
					)
				)
			)
		);

		if (COption::GetOptionString("socialnetwork", "allow_photo_user", "Y") == "Y")
		{
			$arFeatureTmp["subscribe_events"]["photo"]["ENTITIES"][SONET_SUBSCRIBE_ENTITY_USER] = array(
				"TITLE" => GetMessage("SOCNET_LOG_PHOTO_USER"),
				"TITLE_SETTINGS" => GetMessage("SOCNET_LOG_PHOTO_USER_SETTINGS"),
				"TITLE_SETTINGS_1" => GetMessage("SOCNET_LOG_PHOTO_USER_SETTINGS_1"),
				"TITLE_SETTINGS_2" => GetMessage("SOCNET_LOG_PHOTO_USER_SETTINGS_2"),
			);

			$arFeatureTmp["allowed"][] = SONET_ENTITY_USER;
			$arFeatureTmp["operations"]["write"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_photo_operation_write_user", SONET_RELATIONS_TYPE_NONE);
			$arFeatureTmp["operations"]["view"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_photo_operation_view_user", SONET_RELATIONS_TYPE_ALL);
		}

		if (COption::GetOptionString("socialnetwork", "allow_photo_group", "Y") == "Y")
		{
			$arFeatureTmp["subscribe_events"]["photo"]["ENTITIES"][SONET_SUBSCRIBE_ENTITY_GROUP] = array(
				"TITLE" 			=> GetMessage("SOCNET_LOG_PHOTO_GROUP"),
				"TITLE_SETTINGS"	=> GetMessage("SOCNET_LOG_PHOTO_GROUP_SETTINGS"),
				"TITLE_SETTINGS_1"	=> GetMessage("SOCNET_LOG_PHOTO_GROUP_SETTINGS_1"),
				"TITLE_SETTINGS_2"	=> GetMessage("SOCNET_LOG_PHOTO_GROUP_SETTINGS_2"),
			);

			$arFeatureTmp["allowed"][] = SONET_ENTITY_GROUP;
			$arFeatureTmp["operations"]["write"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_photo_operation_write_group", SONET_ROLES_MODERATOR);
			$arFeatureTmp["operations"]["view"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_photo_operation_view_group", SONET_ROLES_USER);
		}

		CSocNetAllowed::addAllowedFeature("photo", $arFeatureTmp);
	}

	$bIntranet = ModuleManager::isModuleInstalled('intranet');
	$bCalendar = (
		$bIntranet
		&& ModuleManager::isModuleInstalled('calendar')
		&& CBXFeatures::IsFeatureEditable("calendar")
	);

	if ($bCalendar)
	{
		$arFeatureTmp = array(
			"allowed" => array(),
			"operations" => array(
				"write" => array(),
				"view" => array(),
			),
			"minoperation" => array("view"),
		);

		if (COption::GetOptionString("socialnetwork", "allow_calendar_user", "Y") == "Y")
		{
			$arFeatureTmp["allowed"][] = SONET_ENTITY_USER;
			$arFeatureTmp["operations"]["write"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_calendar_operation_write_user", SONET_RELATIONS_TYPE_NONE);
			$arFeatureTmp["operations"]["view"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_calendar_operation_view_user", SONET_RELATIONS_TYPE_ALL);
		}

		if (COption::GetOptionString("socialnetwork", "allow_calendar_group", "Y") == "Y")
		{
			$arFeatureTmp["allowed"][] = SONET_ENTITY_GROUP;
			$arFeatureTmp["operations"]["write"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_calendar_operation_write_group", SONET_ROLES_MODERATOR);
			$arFeatureTmp["operations"]["view"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_calendar_operation_view_group", SONET_ROLES_USER);
		}

		CSocNetAllowed::addAllowedFeature("calendar", $arFeatureTmp);
	}

	if (
		$bIntranet
		&& ModuleManager::isModuleInstalled('tasks')
	)
	{
		$arFeatureTmp = array(
			"allowed" => array(),
			"operations" => array(
				"view" => array(),
				"view_all" => array(),
				"sort" => array(),
				"create_tasks" => array(),
				"edit_tasks" => array(),
				"delete_tasks" => array(),
				"modify_folders" => array(),
				"modify_common_views" => array(),
			),
			"minoperation" => array("view_all", "view"),
			"subscribe_events" => array(
				"tasks" =>  array(
					"ENTITIES" => array(),
					'FORUM_COMMENT_ENTITY' => 'TK',
					"OPERATION" => "view",
					"CLASS_FORMAT" => "CSocNetLogTools",
					"METHOD_FORMAT" => "FormatEvent_Task2",
					"HAS_CB" => "Y",
					"FULL_SET" => array("tasks", "tasks_comment", "crm_activity_add"),
					"COMMENT_EVENT" => array(
						"EVENT_ID" => "tasks_comment",
						"OPERATION" => "view",
						"OPERATION_ADD"	=> "log_rights",
						"ADD_CALLBACK" => array("CSocNetLogTools", "AddComment_Tasks"),
						"UPDATE_CALLBACK" => array("CSocNetLogTools", "UpdateComment_Task"),
						"DELETE_CALLBACK" => array("CSocNetLogTools", "DeleteComment_Task"),
						"CLASS_FORMAT" => "CSocNetLogTools",
						"METHOD_FORMAT"	=> "FormatComment_Forum",
						"METHOD_CANEDIT" => array("CSocNetLogTools", "CanEditComment_Task"),
						"METHOD_CANEDITOWN" => array("CSocNetLogTools", "CanEditOwnComment_Task"),
						"METHOD_GET_URL" => array("CSocNetLogTools", "GetCommentUrl_Task"),
						"RATING_TYPE_ID" => "FORUM_POST"
					)
				)
			)
		);

		if (COption::GetOptionString("socialnetwork", "allow_tasks_user", "Y") == "Y")
		{
			$arFeatureTmp["subscribe_events"]["tasks"]["ENTITIES"][SONET_SUBSCRIBE_ENTITY_USER] = array(
				"TITLE" => GetMessage("SOCNET_LOG_TASKS_USER"),
				"TITLE_SETTINGS" => GetMessage("SOCNET_LOG_TASKS_USER_SETTINGS"),
				"TITLE_SETTINGS_1" => GetMessage("SOCNET_LOG_TASKS_USER_SETTINGS_1"),
				"TITLE_SETTINGS_2" => GetMessage("SOCNET_LOG_TASKS_USER_SETTINGS_2"),
			);

			$arFeatureTmp["allowed"][] = SONET_ENTITY_USER;
			$arFeatureTmp["operations"]["view"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_tasks_operation_view_user", SONET_RELATIONS_TYPE_ALL);
			$arFeatureTmp["operations"]["view_all"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_tasks_operation_view_all_user", SONET_RELATIONS_TYPE_NONE);
			$arFeatureTmp["operations"]["create_tasks"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_tasks_operation_create_tasks_user", SONET_RELATIONS_TYPE_AUTHORIZED);
			$arFeatureTmp["operations"]["edit_tasks"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_tasks_operation_edit_tasks_user", SONET_RELATIONS_TYPE_NONE);
			$arFeatureTmp["operations"]["delete_tasks"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_tasks_operation_delete_tasks_user", SONET_RELATIONS_TYPE_NONE);
			$arFeatureTmp["operations"]["modify_folders"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_tasks_operation_modify_folders_user", SONET_RELATIONS_TYPE_NONE);
			$arFeatureTmp["operations"]["modify_common_views"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_tasks_operation_modify_common_views_user", SONET_RELATIONS_TYPE_NONE);
		}

		if (COption::GetOptionString("socialnetwork", "allow_tasks_group", "Y") == "Y")
		{
			$arFeatureTmp["subscribe_events"]["tasks"]["ENTITIES"][SONET_SUBSCRIBE_ENTITY_GROUP] = array(
				"TITLE" => GetMessage("SOCNET_LOG_TASKS_GROUP"),
				"TITLE_SETTINGS" => GetMessage("SOCNET_LOG_TASKS_GROUP_SETTINGS"),
				"TITLE_SETTINGS_1" => GetMessage("SOCNET_LOG_TASKS_GROUP_SETTINGS_1"),
				"TITLE_SETTINGS_2" => GetMessage("SOCNET_LOG_TASKS_GROUP_SETTINGS_2"),
			);

			$arFeatureTmp["allowed"][] = SONET_ENTITY_GROUP;
			$arFeatureTmp["operations"]["view"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_tasks_operation_view_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["view_all"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_tasks_operation_view_all_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["sort"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_tasks_operation_sort_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["create_tasks"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_tasks_operation_create_tasks_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["edit_tasks"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_tasks_operation_edit_tasks_group", SONET_ROLES_MODERATOR);
			$arFeatureTmp["operations"]["delete_tasks"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_tasks_operation_delete_tasks_group", SONET_ROLES_MODERATOR);
			$arFeatureTmp["operations"]["modify_folders"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_tasks_operation_modify_folders_group", SONET_ROLES_MODERATOR);
			$arFeatureTmp["operations"]["modify_common_views"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_tasks_operation_modify_common_views_group", SONET_ROLES_MODERATOR);
		}

		CSocNetAllowed::addAllowedFeature("tasks", $arFeatureTmp);
	}

	// files
	if (
		$bIntranet
		&& (
			ModuleManager::isModuleInstalled('webdav')
			|| ModuleManager::isModuleInstalled('disk')
		)
		&& (
			COption::GetOptionString("socialnetwork", "allow_files_user", "Y") == "Y"
			|| COption::GetOptionString("socialnetwork", "allow_files_group", "Y") == "Y"
		)
	)
	{
		$arFeatureTmp = array(
			"allowed" => array(),
			"operations" => array(
				"view" => array(),
				"write_limited" => array(),
			),
			"minoperation" => array("view"),
			"subscribe_events" => array(
				"files" => array(
					"ENTITIES" => array(),
					"OPERATION" => "view",
					"CLASS_FORMAT" => "CSocNetLogTools",
					"METHOD_FORMAT" => "FormatEvent_Files",
					"HAS_CB" => "Y",
					"FULL_SET" => array("files", "files_comment"),
					"COMMENT_EVENT" => array(
						"EVENT_ID" => "files_comment",
						"OPERATION" => "view",
						"OPERATION_ADD" => "",
						"ADD_CALLBACK" => array("CSocNetLogTools", "AddComment_Files"),
						"CLASS_FORMAT" => "CSocNetLogTools",
						"METHOD_FORMAT" => "FormatComment_Files"
					)
				)
			)
		);

		if (ModuleManager::isModuleInstalled("bizproc"))
		{
			$arFeatureTmp["operations"]["bizproc"] = array();
		}

		$arFeatureTmp["operations"]["write"] = array();

		if (COption::GetOptionString("socialnetwork", "allow_files_user", "Y") == "Y")
		{
			$arFeatureTmp["subscribe_events"]["files"]["ENTITIES"][SONET_SUBSCRIBE_ENTITY_USER] = array(
				"TITLE" => GetMessage("SOCNET_LOG_FILES_USER"),
				"TITLE_SETTINGS" => GetMessage("SOCNET_LOG_FILES_USER_SETTINGS"),
				"TITLE_SETTINGS_1" => GetMessage("SOCNET_LOG_FILES_USER_SETTINGS_1"),
				"TITLE_SETTINGS_2" => GetMessage("SOCNET_LOG_FILES_USER_SETTINGS_2"),
			);

			$arFeatureTmp["allowed"][] = SONET_ENTITY_USER;
			$arFeatureTmp["operations"]["view"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_files_operation_view_user", (CSocNetUser::IsFriendsAllowed() ? SONET_RELATIONS_TYPE_FRIENDS : SONET_RELATIONS_TYPE_ALL));
			$arFeatureTmp["operations"]["write_limited"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_files_operation_write_limited_user", SONET_RELATIONS_TYPE_NONE);
			$arFeatureTmp["operations"]["write"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_files_operation_write_user", SONET_RELATIONS_TYPE_NONE);
		}

		if (COption::GetOptionString("socialnetwork", "allow_files_group", "Y") == "Y")
		{
			$arFeatureTmp["subscribe_events"]["files"]["ENTITIES"][SONET_SUBSCRIBE_ENTITY_GROUP] = array(
				"TITLE" => GetMessage("SOCNET_LOG_FILES_GROUP"),
				"TITLE_SETTINGS" => GetMessage("SOCNET_LOG_FILES_GROUP_SETTINGS"),
				"TITLE_SETTINGS_1" => GetMessage("SOCNET_LOG_FILES_GROUP_SETTINGS_1"),
				"TITLE_SETTINGS_2" => GetMessage("SOCNET_LOG_FILES_GROUP_SETTINGS_2"),
			);

			$arFeatureTmp["allowed"][] = SONET_ENTITY_GROUP;
			$arFeatureTmp["operations"]["view"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_files_operation_view_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["write_limited"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_files_operation_write_limited_group", SONET_ROLES_MODERATOR);
			$arFeatureTmp["operations"]["write"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_files_operation_write_group", SONET_ROLES_MODERATOR);
		}

		CSocNetAllowed::addAllowedFeature("files", $arFeatureTmp);
	}

	if (
		ModuleManager::isModuleInstalled('blog')
		&& (
			COption::GetOptionString("socialnetwork", "allow_blog_user", "Y") == "Y"
			|| COption::GetOptionString("socialnetwork", "allow_blog_group", "Y") == "Y"
		)
	)
	{
		$livefeedProvider = new BitrixSocialnetworkLivefeedBlogPost;

		$arFeatureTmp = array(
			"allowed" => array(),
			"operations" => array(
				"view_post" => array(),
				"premoderate_post" => array(),
				"write_post" => array(),
				"moderate_post" => array(),
				"full_post" => array(),
				"view_comment" => array(),
				"premoderate_comment" => array(),
				"write_comment" => array(),
				"moderate_comment" => array(),
				"full_comment" => array(),
			),
			"minoperation" => array("view_comment", "view_post"),
			"subscribe_events" => array(
				"blog" =>  array(
					"ENTITIES" => array(),
					"OPERATION" => "",
					"NO_SET" => true,
					"REAL_EVENT_ID" => "blog_post",
					"FULL_SET" => array_unique(array_merge($livefeedProvider->getEventId(), array("blog", "blog_comment")))
				),
				"blog_post" => array(
					"ENTITIES" => array(),
					"OPERATION" => "view_post",
					"HIDDEN" => true,
					"CLASS_FORMAT"	=> "CSocNetLogTools",
					"METHOD_FORMAT" => "FormatEvent_Blog",
					"HAS_CB" => "Y",
					"COMMENT_EVENT" => array(
						"EVENT_ID"	=> "blog_comment",
						"OPERATION" => "view_comment",
						"OPERATION_ADD" => "premoderate_comment",
						"ADD_CALLBACK"	=> array("CSocNetLogTools", "AddComment_Blog"),
						"CLASS_FORMAT"	=> "CSocNetLogTools",
						"METHOD_FORMAT" => "FormatComment_Blog"
					)
				),
				"blog_comment" => array(
					"ENTITIES" => array(),
					"OPERATION" => "view_comment",
					"HIDDEN" => true,
					"CLASS_FORMAT"	=> "CSocNetLogTools",
					"METHOD_FORMAT"	=> "FormatEvent_Blog",
					"HAS_CB" => "Y"
				)
			)
		);

		if (COption::GetOptionString("socialnetwork", "allow_blog_user", "Y") == "Y")
		{
			$arFeatureTmp["subscribe_events"]["blog"]["ENTITIES"][SONET_SUBSCRIBE_ENTITY_USER] = array(
				"TITLE" 			=> GetMessage("SOCNET_LOG_BLOG_USER"),
				"TITLE_SETTINGS"	=> GetMessage("SOCNET_LOG_BLOG_USER_SETTINGS"),
				"TITLE_SETTINGS_1"	=> GetMessage("SOCNET_LOG_BLOG_USER_SETTINGS_1"),
				"TITLE_SETTINGS_2"	=> GetMessage("SOCNET_LOG_BLOG_USER_SETTINGS_2"),
			);

			$arFeatureTmp["subscribe_events"]["blog_post"]["ENTITIES"][SONET_SUBSCRIBE_ENTITY_USER] = array(
				"TITLE" => GetMessage("SOCNET_LOG_BLOG_POST_USER")
			);

			$arFeatureTmp["allowed"][] = SONET_ENTITY_USER;
			$arFeatureTmp["operations"]["view_post"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_blog_operation_view_post_user", SONET_RELATIONS_TYPE_ALL);
			$arFeatureTmp["operations"]["view_comment"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_blog_operation_view_comment_user", SONET_RELATIONS_TYPE_ALL);
			$arFeatureTmp["operations"]["premoderate_comment"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_blog_operation_premoderate_comment_user", SONET_RELATIONS_TYPE_AUTHORIZED);
			$arFeatureTmp["operations"]["write_comment"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_blog_operation_write_comment_user", SONET_RELATIONS_TYPE_AUTHORIZED);
		}

		if (COption::GetOptionString("socialnetwork", "allow_blog_group", "Y") == "Y")
		{
			$arFeatureTmp["subscribe_events"]["blog"]["ENTITIES"][SONET_SUBSCRIBE_ENTITY_GROUP] = array(
				"TITLE" 			=> GetMessage("SOCNET_LOG_BLOG_GROUP"),
				"TITLE_SETTINGS"	=> GetMessage("SOCNET_LOG_BLOG_GROUP_SETTINGS"),
				"TITLE_SETTINGS_1"	=> GetMessage("SOCNET_LOG_BLOG_GROUP_SETTINGS_1"),
				"TITLE_SETTINGS_2"	=> GetMessage("SOCNET_LOG_BLOG_GROUP_SETTINGS_2"),
			);

			$arFeatureTmp["subscribe_events"]["blog_post"]["ENTITIES"][SONET_SUBSCRIBE_ENTITY_GROUP] = array(
				"TITLE" => GetMessage("SOCNET_LOG_BLOG_POST_GROUP")
			);

			$arFeatureTmp["allowed"][] = SONET_ENTITY_GROUP;
			$arFeatureTmp["operations"]["view_post"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_blog_operation_view_post_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["premoderate_post"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_blog_operation_premoderate_post_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["write_post"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_blog_operation_write_post_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["moderate_post"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_blog_operation_moderate_post_group", SONET_ROLES_MODERATOR);
			$arFeatureTmp["operations"]["full_post"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_blog_operation_full_post_group", SONET_ROLES_OWNER);
			$arFeatureTmp["operations"]["view_comment"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_blog_operation_view_comment_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["premoderate_comment"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_blog_operation_premoderate_comment_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["write_comment"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_blog_operation_write_comment_group", SONET_ROLES_USER);
			$arFeatureTmp["operations"]["moderate_comment"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_blog_operation_moderate_comment_group", SONET_ROLES_MODERATOR);
			$arFeatureTmp["operations"]["full_comment"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_blog_operation_full_comment_group", SONET_ROLES_MODERATOR);

			$arFeatureTmp["operations"]["write_post"]["restricted"][SONET_ENTITY_GROUP] = array(SONET_ROLES_ALL);
			$arFeatureTmp["operations"]["premoderate_post"]["restricted"][SONET_ENTITY_GROUP] = array(SONET_ROLES_ALL);
			$arFeatureTmp["operations"]["moderate_post"]["restricted"][SONET_ENTITY_GROUP] = array(SONET_ROLES_ALL);
			$arFeatureTmp["operations"]["full_post"]["restricted"][SONET_ENTITY_GROUP] = array(SONET_ROLES_ALL);
			$arFeatureTmp["operations"]["moderate_comment"]["restricted"][SONET_ENTITY_GROUP] = array(SONET_ROLES_ALL);
			$arFeatureTmp["operations"]["full_comment"]["restricted"][SONET_ENTITY_GROUP] = array(SONET_ROLES_ALL);
		}
		$arFeatureTmp["subscribe_events"]["blog_post_important"] = $arFeatureTmp["subscribe_events"]["blog_post"];
		if (ModuleManager::isModuleInstalled('vote'))
		{
			$arFeatureTmp["subscribe_events"]["blog_post_vote"] = $arFeatureTmp["subscribe_events"]["blog_post"];
		}
		if (ModuleManager::isModuleInstalled('intranet'))
		{
			$arFeatureTmp["subscribe_events"]["blog_post_grat"] = $arFeatureTmp["subscribe_events"]["blog_post"];
		}
		CSocNetAllowed::addAllowedFeature("blog", $arFeatureTmp);
	}

	if (
		ModuleManager::isModuleInstalled('search')
		&& (
			COption::GetOptionString("socialnetwork", "allow_search_user", "N") == "Y"
			|| COption::GetOptionString("socialnetwork", "allow_search_group", "Y") == "Y"
		)
	)
	{
		$arFeatureTmp = array(
			"allowed" => array(),
			"operations" => array(),
			"minoperation" => array(),
		);

		if (COption::GetOptionString("socialnetwork", "allow_search_user", "N") == "Y")
		{
			$arFeatureTmp["allowed"][] = SONET_ENTITY_USER;
			$arFeatureTmp["operations"]["view"][SONET_ENTITY_USER] = COption::GetOptionString("socialnetwork", "default_search_operation_view_user", SONET_RELATIONS_TYPE_ALL);
		}

		if (COption::GetOptionString("socialnetwork", "allow_search_group", "Y") == "Y")
		{
			$arFeatureTmp["allowed"][] = SONET_ENTITY_GROUP;
			$arFeatureTmp["operations"]["view"][SONET_ENTITY_GROUP] = COption::GetOptionString("socialnetwork", "default_search_operation_view_group", SONET_ROLES_USER);
		}

		CSocNetAllowed::addAllowedFeature("search", $arFeatureTmp);
	}

	// chat
	if (
		ModuleManager::isModuleInstalled('im')
		&& (COption::GetOptionString('socialnetwork', 'use_workgroup_chat', "Y") == "Y")
	)
	{
		$arFeatureTmp = array(
			"allowed" => array(SONET_ENTITY_GROUP),
			"operations" => array(),
			"minoperation" => array(),
		);

		CSocNetAllowed::addAllowedFeature("chat", $arFeatureTmp);
	}

	if (defined("BX_STARTED"))
	{
		self::addRestFeatures();
	}
	else
	{
		AddEventHandler("main", "OnBeforeProlog", array("CSocNetAllowed", "addRestFeatures"));
	}
}