• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/classes/general/sharepoint.php
  • Класс: CAllIntranetSharepoint
  • Вызов: CAllIntranetSharepoint::CheckService
static function CheckService(&$arService, $method = '')
{
	global $APPLICATION;

	if ($arService['SYNC_ERRORS'] >= BX_INTRANET_SP_MAX_ERRORS)
	{
		$APPLICATION->ThrowException(GetMessage('SP_ERROR_MAX_ERRORS'));

		return false;
	}

	if ($arService['HANDLER_MODULE'])
	{
		if (!CModule::IncludeModule($arService['HANDLER_MODULE']))
		{
			$APPLICATION->ThrowException(GetMessage('SP_ERROR_MODULE_NOT_INSTALLED').': '.$arService['HANDLER_MODULE']);

			return false;
		}
	}

	if (!class_exists($arService['HANDLER_CLASS']))
	{
		$APPLICATION->ThrowException(GetMessage('SP_ERROR_CLASS_NOT_EXISTS').': '.$arService['HANDLER_CLASS']);
		return false;
	}

	if ($method && !method_exists($arService['HANDLER_CLASS'], $method))
	{
		$APPLICATION->ThrowException(GetMessage('SP_ERROR_METHOD_NOT_EXISTS', array('#CLASS#' => $arService['HANDLER_CLASS'], '#METHOD#' => $method)));
		return false;
	}

	if (!is_array($arService['SP_URL']))
		$URL = parse_url($arService['SP_URL']);
	else
		$URL = $arService['SP_URL'];

	if (!is_array($URL) || !isset($URL['host']))
	{
		$APPLICATION->ThrowException(GetMessage('SP_ERROR_WRONG_URL'));
		return false;
	}


	if ($arService['SP_AUTH_USER'])
	{
		$URL['user'] = $arService['SP_AUTH_USER'];
		$URL['pass'] = $arService['SP_AUTH_PASS'];
	}

	$arService['SP_URL'] = $URL;

	return true;
}