Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
infohelper.php
1<?php
2
4
6use Bitrix\Bitrix24;
7use Bitrix\Bitrix24\License\Market;
11
12class InfoHelper extends Engine\Controller
13{
14 public function getInitParamsAction(?string $currentUrl = null)
15 {
16 return \Bitrix\UI\InfoHelper::getInitParams($currentUrl);
17 }
18
19 public function activateDemoLicenseAction()
20 {
21 $result = [
22 'success' => 'N',
23 ];
24 if (Loader::includeModule('bitrix24') && defined('BX24_HOST_NAME'))
25 {
26 $queryField = [
27 'DEMO' => 'Y',
28 'SITE' => BX24_HOST_NAME,
29 ];
30
31 if (function_exists('bx_sign'))
32 {
33 $queryField['hash'] = bx_sign(md5(implode('|', $queryField)));
34 }
35
36 $httpClient = new HttpClient();
37 $res = $httpClient->post('https://www.1c-bitrix.ru/buy_tmp/b24_coupon.php', $queryField);
38 if ($res && mb_strpos($res, 'OK') !== false)
39 {
40 $result['success'] = 'Y';
41 }
42 }
43
44 return $result;
45 }
46
48 {
49 $action = 'blank';
50 if (Loader::includeModule('bitrix24'))
51 {
52 $url = Market::PATH_MARKET_BUY;
53 }
54 else
55 {
56 $lkeySign = Application::getInstance()->getLicense()->getHashLicenseKey();
57 $url = 'https://www.1c-bitrix.ru/buy_tmp/key_update.php?license_key=' . $lkeySign . '&tobasket=y&action=b24subscr';
58 }
59
60 return [
61 'url' => $url,
62 'action' => $action,
63 ];
64 }
65
66 public function activateTrialFeatureAction(string $featureId)
67 {
68 $result = [
69 'success' => 'N',
70 ];
71
72 if (
73 Loader::includeModule('bitrix24')
74 && method_exists(Bitrix24\Feature::class, 'trialFeature')
75 )
76 {
77 $trialable = Bitrix24\Feature::isFeatureTrialable($featureId);
78
79 if ($trialable)
80 {
81 $result['success'] = Bitrix24\Feature::trialFeature($featureId) ? 'Y' : 'N';
82 }
83 else
84 {
85 $result['error'] = 'IS_NOT_TRIALABLE';
86 }
87 }
88
89 return $result;
90 }
91
92 public function showLimitSliderAction(): bool
93 {
94 return true;
95 }
96}
getInitParamsAction(?string $currentUrl=null)
activateTrialFeatureAction(string $featureId)