- Модуль: rest
- Путь к файлу: ~/bitrix/modules/rest/classes/general/rest_provider.php
- Класс: CRestProvider
- Вызов: CRestProvider::appInfo
static function appInfo($params, $n, CRestServer $server)
{
$licensePrevious = '';
if(BitrixMainModuleManager::isModuleInstalled('bitrix24'))
{
$result = self::getBitrix24LicenseName();
$license = $result['LICENSE'];
if ($result['TYPE'] == 'demo')
{
$result = self::getBitrix24LicenseName(CBitrix24::LICENSE_TYPE_PREVIOUS);
$licensePrevious = $result['LICENSE'];
}
}
else
{
$license = LANGUAGE_ID.'_selfhosted';
}
if($server->getClientId())
{
$arApp = self::getApp($server);
$info = BitrixRestAppTable::getAppStatusInfo($arApp, '');
$res = array(
'ID' => $arApp['ID'],
'CODE' => $arApp['CODE'],
'VERSION' => intval($arApp['VERSION']),
'STATUS' => $info['STATUS'],
'INSTALLED' => $arApp['INSTALLED'] == BitrixRestAppTable::INSTALLED,
'PAYMENT_EXPIRED' => $info['PAYMENT_EXPIRED'],
'DAYS' => $info['DAYS_LEFT'],
'LANGUAGE_ID' => CRestUtil::getLanguage(),
'LICENSE' => $license,
);
if ($licensePrevious)
{
$res['LICENSE_PREVIOUS'] = $licensePrevious;
}
if (CModule::IncludeModule('bitrix24'))
{
$res['LICENSE_TYPE'] = CBitrix24::getLicenseType();
$res['LICENSE_FAMILY'] = CBitrix24::getLicenseFamily();
}
$server->setSecurityState($res);
}
elseif($server->getPasswordId())
{
$res = array(
'SCOPE' => static::getScope($server),
'LICENSE' => $license,
);
}
else
{
throw new AccessException("Application context required");
}
foreach(GetModuleEvents('rest', 'OnRestAppInfo', true) as $event)
{
$eventData = ExecuteModuleEventEx($event, array($server, &$res));
if(is_array($eventData))
{
if(!isset($res['ADDITIONAL']))
{
$res['ADDITIONAL'] = array();
}
$res['ADDITIONAL'] = array_merge($res['ADDITIONAL'], $eventData);
}
}
return $res;
}