• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/controller/contentview.php
  • Класс: BitrixSocialnetworkControllerContentView
  • Вызов: ContentView::setAction
public function setAction(array $params = []): ?array
{
	global $USER;

	$xmlIdList = (
		isset($params["viewXMLIdList"])
		&& is_array($params["viewXMLIdList"])
			? $params["viewXMLIdList"]
			: []
	);

	$context = ($params['context'] ?? '');

	if (!Loader::includeModule('socialnetwork'))
	{
		$this->addError(new Error('Cannot include Socialnetwork module', 'SONET_CONTROLLER_CONTENTVIEW_NO_SOCIALNETWORK_MODULE'));
		return null;
	}

	$signer = new BitrixMainEngineActionFilterServiceToken($USER->getId());

	foreach ($xmlIdList as $key => $item)
	{
		if (empty($item['xmlId']))
		{
			unset($xmlIdList[$key]);
			continue;
		}

		if (!empty($item['signedKey']))
		{
			try
			{
				if ($signer->unsign($item['signedKey'], $item['xmlId']) === $item['xmlId'])
				{
					$xmlIdList[$key]['checkAccess'] = false;
				}
				else
				{
					unset($xmlIdList[$key]);
				}
			}
			catch(Exception $e)
			{
				$xmlIdList[$key]['checkAccess'] = true;
			}
		}
		else
		{
			$xmlIdList[$key]['checkAccess'] = true;
		}
	}

	UserContentView::set([
		'xmlIdList' => $xmlIdList,
		'context' => $context,
		'userId' => $this->getCurrentUser()->getId(),
	]);

	return [
		'SUCCESS' => 'Y'
	];
}