Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
domainsigner.php
1<?php
2
4
6
8{
9 private string $domain;
10
11 public function __construct(string $domain)
12 {
13 $this->domain = $domain;
14 }
15
16 public function signDomain(): string
17 {
18 if (Main\Loader::includeModule('bitrix24'))
19 {
20 return \CBitrix24::RequestSign($this->domain);
21 }
22
23 $privateKey = Main\Analytics\Counter::getPrivateKey();
24 return md5($this->domain . $privateKey);
25 }
26
27 public function isValidDomain(string $signedDomain): bool
28 {
29 return $signedDomain === $this->signDomain();
30 }
31}