1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
site24.php
См. документацию.
1<?php
3
6
7class Site24
8{
18 public static function updateDomain($domain, $newName, $url)
19 {
20 return self::Execute('update', array('domain' => $domain, 'newname' => $newName, 'url' => $url));
21 }
22
32 public static function activateDomain($domain, $active = 'Y', $lang = '')
33 {
34 return self::Execute('activate', array('domain' => $domain, 'active' => $active, 'lang' => $lang));
35 }
36
48 public static function addDomain($domain, $url, $active = 'Y', $type = 'site', $lang = '')
49 {
50 return self::Execute('add', array('domain' => $domain, 'url' => $url, 'active' => $active, 'type' => $type, 'lang' => $lang));
51 }
52
65 public static function isDomainExists($domain)
66 {
67 return self::Execute('check', array('domain' => $domain));
68 }
69
79 public static function deleteDomain($domain)
80 {
81 return self::Execute('delete', array('domain' => $domain));
82 }
83
95 public static function addRandomDomain($url, $type = 'site', $lang = '')
96 {
97 return self::Execute('addrandom', array('url' => $url, 'type' => $type, 'lang' => $lang));
98 }
99
109 protected static function Execute($operation, $params = array())
110 {
111 $params['operation'] = $operation;
112
113 $license = Application::getInstance()->getLicense();
114 $params['key'] = $license->getPublicHashKey();
115 $params['keysign'] = $license->getHashLicenseKey();
116 $params['host']= \Bitrix\Main\Config\Option::get('intranet', 'portal_url', null);
117
118 if (!$params['host'])
119 {
121 'landing',
122 'portal_url',
123 $_SERVER['HTTP_HOST']
124 );
125 }
126
127 if (!$params['host'])
128 {
129 $params['host'] = $_SERVER['HTTP_HOST'];
130 }
131
132 $params['host'] = trim($params['host']);
133
134 if (
135 mb_strpos($params['host'], 'http://') === 0 ||
136 mb_strpos($params['host'], 'https://') === 0
137 )
138 {
139 $parseHost = parse_url($params['host']);
140 if (isset($parseHost['host']))
141 {
142 $params['host'] = $parseHost['host'];
143 if (isset($parseHost['port']))
144 {
145 $params['host'] .= ':' . $parseHost['port'];
146 }
147 }
148 }
149
150 if (!isset($params['lang']) || !$params['lang'])
151 {
152 unset($params['lang']);
153 }
154
155 $httpClient = new \Bitrix\Main\Web\HttpClient(array(
156 'socketTimeout' => 5,
157 'streamTimeout' => 30
158 ));
159
160 $httpClient->setHeader('User-Agent', 'Bitrix24 Sites');
161 if (in_array($license->getRegion(), ['ru', 'by', 'kz', 'uz']))
162 {
163 $answer = $httpClient->post('https://c.bitrix24.ru/pub.php', $params);
164 }
165 else
166 {
167 $answer = $httpClient->post('https://c.bitrix24.com/pub.php', $params);
168 }
169
170 $result = '';
171 if ($answer && $httpClient->getStatus() == '200')
172 {
173 $result = $httpClient->getResult();
174 }
175
176 if ($result <> '')
177 {
178 try
179 {
181 }
182 catch(\Bitrix\Main\ArgumentException $e)
183 {
184 throw new SystemException('Bad response');
185 }
186
187 if ($result['result'] === 'Bad license')
188 {
189 throw new SystemException('Bad license');
190 }
191
192 return $result['result'];
193 }
194
195 throw new SystemException('Bad response');
196 }
197}
$type
Определения options.php:106
static deleteDomain($domain)
Определения site24.php:79
static activateDomain($domain, $active='Y', $lang='')
Определения site24.php:32
static updateDomain($domain, $newName, $url)
Определения site24.php:18
static Execute($operation, $params=array())
Определения site24.php:109
static addDomain($domain, $url, $active='Y', $type='site', $lang='')
Определения site24.php:48
static isDomainExists($domain)
Определения site24.php:65
static addRandomDomain($url, $type='site', $lang='')
Определения site24.php:95
static get($moduleId, $name, $default="", $siteId=false)
Определения option.php:30
static decode($data)
Определения json.php:50
</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
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
if(!defined('SITE_ID')) $lang
Определения include.php:91
if(file_exists(( $_fname=__DIR__ . "/classes/general/update_db_updater.php"))) if(($_fname=getLocalPath("init.php")) !==false) if(( $_fname=getLocalPath("php_interface/init.php", BX_PERSONAL_ROOT)) !==false) if(($_fname=getLocalPath("php_interface/" . SITE_ID . "/init.php", BX_PERSONAL_ROOT)) !==false) if((!(defined("STATISTIC_ONLY") &&STATISTIC_ONLY &&!str_starts_with( $GLOBALS["APPLICATION"]->GetCurPage(), BX_ROOT . "/admin/"))) &&COption::GetOptionString("main", "include_charset", "Y")=="Y" &&LANG_CHARSET !='') if(COption::GetOptionString("main", "set_p3p_header", "Y")=="Y") $license
Определения include.php:158
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$url
Определения iframe.php:7