1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
regru.php
См. документацию.
1<?php
2namespace Bitrix\Mail\Registrar;
3
4class RegRu extends Registrar
5{
14 public static function checkDomain(string $user, string $password, string $domain, ?string &$error): ?bool
15 {
16 $domain = mb_strtolower($domain);
17
19
20 if ($result !== false)
21 {
22 if (
23 isset($result['domains'][0]['dname']) &&
24 $result['domains'][0]['dname'] == $domain
25 )
26 {
27 $result = $result['domains'][0];
28 if ($result['result'] == 'Available')
29 {
30 return false;
31 }
32 else if ($result['error_code'] == 'DOMAIN_ALREADY_EXISTS')
33 {
34 return true;
35 }
36 $error = $result['error_code'];
37 }
38 else
39 {
40 $error = 'unknown';
41 }
42 }
43
44 return null;
45 }
46
57 public static function suggestDomain(string $user, string $password, string $word1, string $word2, array $tlds, ?string &$error): ?array
58 {
59 $result = \CMailRegru::suggestDomain($user, $password, $word1, $word2, $tlds, $error);
60
61 if ($result !== false)
62 {
63 $suggestions = array();
64 if (!empty($result['suggestions']) && is_array($result['suggestions']))
65 {
66 foreach ($result['suggestions'] as $entry)
67 {
68 foreach ($entry['avail_in'] as $tlds)
69 {
70 $suggestions[] = sprintf('%s.%s', $entry['name'], $tlds);
71 }
72 }
73 }
74
75 return $suggestions;
76 }
77
78 return null;
79 }
80
90 public static function createDomain(string $user, string $password, string $domain, array $params, ?string &$error): ?bool
91 {
92 $domain = mb_strtolower($domain);
93 $params = array_merge(
94 $params,
95 array(
96 'period' => 1,
97 'nss' => array(
98 'ns0' => 'ns1.reg.ru.',
99 'ns1' => 'ns2.reg.ru.'
100 ),
101 )
102 );
103
104 if (array_key_exists('ip', $params))
105 {
106 $params['enduser_ip'] = $params['ip'];
107 }
108
110
111 if ($result !== false)
112 {
113 if (isset($result['dname']) && $result['dname'] == $domain)
114 {
115 return true;
116 }
117 else
118 {
119 $error = $result['error_code'] ?? 'unknown';
120 }
121 }
122
123 return null;
124 }
125
134 public static function renewDomain(string $user, string $password, string $domain, ?string &$error): ?bool
135 {
136 $result = \CMailRegru::renewDomain($user, $password, $domain, ['period' => 1], $error);
137
138 if ($result !== false)
139 {
140 if (isset($result['dname']) && mb_strtolower($result['dname']) == mb_strtolower($domain))
141 {
142 return true;
143 }
144 else
145 {
146 $error = 'unknown';
147 }
148 }
149
150 return null;
151 }
152
162 public static function updateDns(string $user, string $password, string $domain, array $params, ?string &$error): ?bool
163 {
164 $domain = mb_strtolower($domain);
165
166 foreach ($params as $k => $record)
167 {
168 switch ($record['type'])
169 {
170 case 'a':
171 $params[$k] = array(
172 'action' => 'add_alias',
173 'subdomain' => '@',
174 'ipaddr' => $record['value']
175 );
176 break;
177 case 'alias':
178 $params[$k] = array(
179 'action' => 'add_alias',
180 'subdomain' => $record['name'],
181 'ipaddr' => $record['value']
182 );
183 break;
184 case 'cname':
185 $params[$k] = array(
186 'action' => 'add_cname',
187 'subdomain' => $record['name'],
188 'canonical_name' => $record['value']
189 );
190 break;
191 case 'mx':
192 $params[$k] = array(
193 'action' => 'add_mx',
194 'subdomain' => $record['name'],
195 'mail_server' => $record['value'],
196 'priority' => $record['priority']
197 );
198 break;
199 }
200 }
201
203
204 if ($result !== false)
205 {
206 if (isset($result['dname']) && $result['dname'] == $domain)
207 {
208 if (isset($result['result']) && $result['result'] == 'success')
209 {
210 return true;
211 }
212 else
213 {
214 $error = $result['error_code'] ?? 'unknown';
215 }
216 }
217 else
218 {
219 $error = 'unknown';
220 }
221 }
222
223 return null;
224 }
225
233 public static function getDomainsList(string $user, string $password, ?string &$error): ?array
234 {
236
237 if ($result !== false)
238 {
239 $list = [];
240 foreach ($result as $domain)
241 {
242 if (!empty($domain['dname']))
243 {
244 $list[$domain['dname']] = [
245 'domain_name' => $domain['dname'],
246 'creation_date' => $domain['creation_date'],
247 'expiration_date' => $domain['expiration_date'],
248 'status' => $domain['state']
249 ];
250 }
251 }
252
253 return $list;
254 }
255
256 return null;
257 }
258}
static renewDomain(string $user, string $password, string $domain, ?string &$error)
Определения regru.php:134
static updateDns(string $user, string $password, string $domain, array $params, ?string &$error)
Определения regru.php:162
static suggestDomain(string $user, string $password, string $word1, string $word2, array $tlds, ?string &$error)
Определения regru.php:57
static checkDomain(string $user, string $password, string $domain, ?string &$error)
Определения regru.php:14
static createDomain(string $user, string $password, string $domain, array $params, ?string &$error)
Определения regru.php:90
static getDomainsList(string $user, string $password, ?string &$error)
Определения regru.php:233
static renewDomain($user, $password, $domain, $params, &$error)
Определения regru.php:86
static updateDns($user, $password, $domain, $params, &$error)
Определения regru.php:106
static getDomainsList($user, $password, &$error)
Определения regru.php:126
static suggestDomain($user, $password, $word1, $word2, $tlds, &$error)
Определения regru.php:29
static createDomain($user, $password, $domain, $params, &$error)
Определения regru.php:50
static checkDomain($user, $password, $domain, &$error)
Определения regru.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$user
Определения mysql_to_pgsql.php:33
$password
Определения mysql_to_pgsql.php:34
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$error
Определения subscription_card_product.php:20
$k
Определения template_pdf.php:567