|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright (C) MIKO LLC - All Rights Reserved |
|
4
|
|
|
* Unauthorized copying of this file, via any medium is strictly prohibited |
|
5
|
|
|
* Proprietary and confidential |
|
6
|
|
|
* Written by Nikolay Beketov, 6 2018 |
|
7
|
|
|
* |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace MikoPBX\AdminCabinet\Controllers; |
|
11
|
|
|
|
|
12
|
|
|
use MikoPBX\AdminCabinet\Forms\LicensingActivateCouponForm; |
|
13
|
|
|
use MikoPBX\AdminCabinet\Forms\LicensingChangeLicenseKeyForm; |
|
14
|
|
|
use MikoPBX\AdminCabinet\Forms\LicensingGetKeyForm; |
|
15
|
|
|
use MikoPBX\Common\Models\PbxSettings; |
|
16
|
|
|
use Phalcon\Text; |
|
17
|
|
|
use SimpleXMLElement; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @property \MikoPBX\Service\License license |
|
21
|
|
|
*/ |
|
22
|
|
|
class LicensingController extends BaseController |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* License key, get new key, activate coupon form |
|
26
|
|
|
* |
|
27
|
|
|
*/ |
|
28
|
|
|
public function modifyAction(): void |
|
29
|
|
|
{ |
|
30
|
|
|
if ($this->language === 'ru') { |
|
31
|
|
|
$this->view->modulesExampleImgPath = $this->url->get('assets/img/modules-example-ru.png'); |
|
32
|
|
|
} else { |
|
33
|
|
|
$this->view->modulesExampleImgPath = $this->url->get('assets/img/modules-example-en.png'); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
// License key form |
|
37
|
|
|
$licKey = PbxSettings::getValueByKey('PBXLicense'); |
|
38
|
|
|
$changeLicenseKeyForm = new LicensingChangeLicenseKeyForm(null, ['licKey' => $licKey]); |
|
39
|
|
|
$this->view->changeLicenseKeyForm = $changeLicenseKeyForm; |
|
40
|
|
|
|
|
41
|
|
|
// Coupon form |
|
42
|
|
|
$activateCouponForm = new LicensingActivateCouponForm(); |
|
43
|
|
|
$this->view->activateCouponForm = $activateCouponForm; |
|
44
|
|
|
|
|
45
|
|
|
// Get new license key form |
|
46
|
|
|
$getKeyForm = new LicensingGetKeyForm(); |
|
47
|
|
|
$this->view->getKeyForm = $getKeyForm; |
|
48
|
|
|
$this->view->submitMode = null; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* After some changes on form we will refresh some session cache |
|
53
|
|
|
*/ |
|
54
|
|
|
public function saveAction() |
|
55
|
|
|
{ |
|
56
|
|
|
$this->session->remove('PBXLicense'); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
} |