• Модуль: dav
  • Путь к файлу: ~/bitrix/modules/dav/classes/general/groupdavclientcalendar.php
  • Класс: CDavGroupdavClientCalendar
  • Вызов: CDavGroupdavClientCalendar::DoCheckCalDAVServer
static function DoCheckCalDAVServer($scheme, $host = null, $port = null, $username = null, $password = null, $path = null, $oauth = null)
{
	if ($scheme."!" == intval($scheme)."!")
	{
		$scheme = intval($scheme);
		if ($scheme <= 0)
			return false;

		$arConnection = CDavConnection::GetById($scheme);
		if (!is_array($arConnection))
			return false;

		$scheme = $arConnection["SERVER_SCHEME"];
		$host = $arConnection["SERVER_HOST"];
		$port = $arConnection["SERVER_PORT"];
		$username = $arConnection["SERVER_USERNAME"];
		$password = $arConnection["SERVER_PASSWORD"];
		$path = $arConnection["SERVER_PATH"];

		if ($arConnection['ACCOUNT_TYPE'] === BitrixCalendarSyncGoogleHelper::GOOGLE_ACCOUNT_TYPE_CALDAV)
		{
			$oauth = [
				'type' => 'google',
				'id' => $arConnection['ENTITY_ID']
			];
		}
	}

	$client = new CDavGroupdavClientCalendar($scheme, $host, $port, $username, $password);
	$client->SetPrivateIp(false);
	if (CDav::UseProxy())
	{
		$arProxy = CDav::GetProxySettings();
		$client->SetProxy($arProxy["PROXY_SCHEME"], $arProxy["PROXY_HOST"], $arProxy["PROXY_PORT"], $arProxy["PROXY_USERNAME"], $arProxy["PROXY_PASSWORD"]);
	}
	if (!empty($oauth['type']) && $oauth['type'] == 'google')
	{
		$client->setGoogleCalendarOAuth($oauth['id']);
	}

	return $client->CheckWebdavServer($path);
}