• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/event_user_view.php
  • Класс: CAllSocNetEventUserView
  • Вызов: CAllSocNetEventUserView::CheckPermissionsByEvent
static function CheckPermissionsByEvent($entity_type, $entity_id, $event_id, $user_id)
{
	global $DB;

	$user_id = intval($user_id);
	if ($user_id <= 0)
		$user_id = $GLOBALS["USER"]->GetID();
	if ($user_id <= 0)
		return false;
		
	$entity_id = intval($entity_id);
	if ($entity_id <= 0)
		return false;

	$entity_type = trim($entity_type);
	if ($entity_type == '')
		return false;

	$event_id = trim($event_id);
	if ($event_id == '')
		return false;

	$strSQL = "SELECT USER_ID FROM b_sonet_event_user_view WHERE
						ENTITY_TYPE = '".$DB->ForSQL($entity_type)."'
						AND ENTITY_ID IN (0, ".$entity_id.")
						AND EVENT_ID = '".$DB->ForSQL($event_id)."'
						AND USER_ID IN (0, ".$user_id.")";

	$dbRes = $GLOBALS["DB"]->Query($strSQL, false, "File: ".__FILE__."
Line: ".__LINE__); if ($arRes = $dbRes->Fetch()) return true; else return false; }