1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
client.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\Service\MicroService;
4
5use Bitrix\Main\Loader;
6use Bitrix\Main\Context;
7use Bitrix\Main\Application;
8use Bitrix\Main\Config\Option;
9
10
11class Client
12{
13 public const
15 TYPE_BOX = 'BOX';
16
21 public static function getPortalType(): string
22 {
23 if (Loader::includeModule('bitrix24') && defined('BX24_HOST_NAME'))
24 {
25 return static::TYPE_BITRIX24;
26 }
27
28 return static::TYPE_BOX;
29 }
30
35 public static function getLicenseCode(): string
36 {
37 if (defined('BX24_HOST_NAME'))
38 {
39 return BX24_HOST_NAME;
40 }
41
42 return Application::getInstance()->getLicense()->getPublicHashKey();
43 }
44
49 public static function getServerName(): string
50 {
51 if (defined('BX24_HOST_NAME'))
52 {
53 return 'https://'. BX24_HOST_NAME;
54 }
55
56 if (Context::getCurrent()?->getRequest()->isHttps())
57 {
58 $scheme = 'https://';
59 }
60 else
61 {
62 $scheme = 'http://';
63 }
64
65 if (defined('SITE_SERVER_NAME') && strlen(SITE_SERVER_NAME) > 0)
66 {
67 return $scheme. SITE_SERVER_NAME;
68 }
69
70 return $scheme. Option::get('main', 'server_name');
71 }
72
81 public static function signRequest(array $parameters, string $suffix = ""): string
82 {
83 $paramStr = md5(implode("|", $parameters) . ($suffix ? "|" . $suffix : ""));
84
85 $portalType = static::getPortalType();
86 if ($portalType == self::TYPE_BITRIX24 && function_exists('bx_sign'))
87 {
88 return bx_sign($paramStr);
89 }
90
91 return md5($paramStr . Application::getInstance()->getLicense()->getHashLicenseKey());
92 }
93}
static getInstance()
Определения application.php:98
static includeModule($moduleName)
Определения loader.php:67
static getPortalType()
Определения client.php:21
static signRequest(array $parameters, string $suffix="")
Определения client.php:81
static getLicenseCode()
Определения client.php:35
static getServerName()
Определения client.php:49
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804