Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
register.php
1
<?php
2
namespace
Bitrix\Landing\Domain
;
3
4
use \Bitrix\Landing\Manager;
5
use \Bitrix\Main\Web\HttpClient;
6
7
class
Register
8
{
12
const
B24_SERVICE_DETECT_IP
=
'https://ip.bitrix24.site/getipforzone/?bx24_zone='
;
13
17
const
B24_SERVICE_DETECT_DOMAIN
=
'https://ip.bitrix24.site/getdomainstatus/?bx24_site_domain='
;
18
22
const
B24_DEFAULT_DNS_IP
=
'52.59.124.117'
;
23
27
const
B24_DEFAULT_DNS_CNAME
=
'lb.bitrix24.site.'
;
28
33
public
static
function
getInstance
(): ?
Provider
34
{
35
return
new
Provider\Bitrix24
();
36
}
37
43
protected
static
function
getINA
(?
string
$tld =
null
): string
44
{
45
$http =
new
HttpClient
;
46
$zone = ($tld ==
'kz'
) ?
'kz'
:
Manager::getZone
();
47
$ip = $http->get(self::B24_SERVICE_DETECT_IP . $zone);
48
$ip = \CUtil::jsObjectToPhp($ip);
49
50
return
isset($ip[
'IP'
]) ? $ip[
'IP'
] :
self::B24_DEFAULT_DNS_IP
;
51
}
52
58
public
static
function
getDNSRecords
(?
string
$tld =
null
): array
59
{
60
static
$result =
null
;
61
62
if
($result !==
null
)
63
{
64
return
$result;
65
}
66
67
$result = [
68
'INA'
=>
self::getINA
($tld),
69
'CNAME'
=>
self::B24_DEFAULT_DNS_CNAME
70
];
71
72
return
$result;
73
}
74
80
public
static
function
isDomainActive
(
string
$domainName): bool
81
{
82
$http =
new
HttpClient
;
83
$status = $http->
get
(self::B24_SERVICE_DETECT_DOMAIN . $domainName);
84
$status = \CUtil::jsObjectToPhp($status);
85
// protect from bad answer
86
if
(!isset($status[
'status'
]))
87
{
88
return
true
;
89
}
90
return
$status[
'status'
] ===
'ready'
;
91
}
92
}
Bitrix\Landing\Domain\Provider\Bitrix24
Definition
bitrix24.php:11
Bitrix\Landing\Domain\Provider
Definition
provider.php:5
Bitrix\Landing\Domain\Register
Definition
register.php:8
Bitrix\Landing\Domain\Register\getINA
static getINA(?string $tld=null)
Definition
register.php:43
Bitrix\Landing\Domain\Register\B24_SERVICE_DETECT_IP
const B24_SERVICE_DETECT_IP
Definition
register.php:12
Bitrix\Landing\Domain\Register\getDNSRecords
static getDNSRecords(?string $tld=null)
Definition
register.php:58
Bitrix\Landing\Domain\Register\isDomainActive
static isDomainActive(string $domainName)
Definition
register.php:80
Bitrix\Landing\Domain\Register\getInstance
static getInstance()
Definition
register.php:33
Bitrix\Landing\Domain\Register\B24_SERVICE_DETECT_DOMAIN
const B24_SERVICE_DETECT_DOMAIN
Definition
register.php:17
Bitrix\Landing\Domain\Register\B24_DEFAULT_DNS_CNAME
const B24_DEFAULT_DNS_CNAME
Definition
register.php:27
Bitrix\Landing\Domain\Register\B24_DEFAULT_DNS_IP
const B24_DEFAULT_DNS_IP
Definition
register.php:22
Bitrix\Landing\Manager\getZone
static getZone()
Definition
manager.php:925
Bitrix\Main\Web\HttpClient
Definition
httpclient.php:24
Bitrix\Main\Web\HttpClient\get
get($url)
Definition
httpclient.php:192
Bitrix\Landing\Domain
Definition
provider.php:2
modules
landing
lib
domain
register.php
Создано системой
1.10.0