Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
client.php
1
<?php
2
3
namespace
Bitrix\Main\Service\MicroService
;
4
5
use
Bitrix\Main\Application
;
6
use
Bitrix\Main\Config\Option
;
7
use
Bitrix\Main\Loader
;
8
9
class
Client
10
{
11
const
TYPE_BITRIX24
=
"B24"
;
12
const
TYPE_BOX
=
"BOX"
;
13
14
public
static
function
getPortalType
(): string
15
{
16
if
(
Loader::includeModule
(
"bitrix24"
) && defined(
"BX24_HOST_NAME"
))
17
{
18
return
static::TYPE_BITRIX24;
19
}
20
else
21
{
22
return
static::TYPE_BOX;
23
}
24
}
25
31
public
static
function
getLicenseCode
(): string
32
{
33
if
(defined(
'BX24_HOST_NAME'
))
34
{
35
return
BX24_HOST_NAME;
36
}
37
else
38
{
39
return
Application::getInstance
()->getLicense()->getPublicHashKey();
40
}
41
}
42
43
public
static
function
getServerName
(): string
44
{
45
if
(defined(
'BX24_HOST_NAME'
))
46
{
47
return
"https://"
. BX24_HOST_NAME;
48
}
49
else
50
{
51
return
(\CMain::isHTTPS() ?
"https"
:
"http"
).
"://"
.((defined(
"SITE_SERVER_NAME"
) && strlen(SITE_SERVER_NAME) > 0) ? SITE_SERVER_NAME : Option::get(
"main"
,
"server_name"
));
52
}
53
}
54
63
public
static
function
signRequest
(array $parameters,
string
$suffix =
""
): string
64
{
65
$paramStr = md5(implode(
"|"
, $parameters) . ($suffix ?
"|"
. $suffix :
""
));
66
67
$portalType = static::getPortalType();
68
if
($portalType == self::TYPE_BITRIX24 && function_exists(
'bx_sign'
))
69
{
70
return
bx_sign($paramStr);
71
}
72
else
73
{
74
return
md5($paramStr .
Application::getInstance
()->getLicense()->getHashLicenseKey());
75
}
76
}
77
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getInstance
static getInstance()
Definition
application.php:95
Bitrix\Main\Config\Option
Definition
option.php:15
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Definition
loader.php:69
Bitrix\Main\Service\MicroService\Client
Definition
client.php:10
Bitrix\Main\Service\MicroService\Client\getPortalType
static getPortalType()
Definition
client.php:14
Bitrix\Main\Service\MicroService\Client\TYPE_BITRIX24
const TYPE_BITRIX24
Definition
client.php:11
Bitrix\Main\Service\MicroService\Client\signRequest
static signRequest(array $parameters, string $suffix="")
Definition
client.php:63
Bitrix\Main\Service\MicroService\Client\TYPE_BOX
const TYPE_BOX
Definition
client.php:12
Bitrix\Main\Service\MicroService\Client\getLicenseCode
static getLicenseCode()
Definition
client.php:31
Bitrix\Main\Service\MicroService\Client\getServerName
static getServerName()
Definition
client.php:43
Bitrix\Main\Service\MicroService
Definition
basereceiver.php:3
modules
main
lib
service
microservice
client.php
Создано системой
1.10.0