@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function terminateKey($key) |
107 | 107 | { |
108 | - \StatisticClient::tick('Parallels', 'terminateKey'); |
|
108 | + \StatisticClient::tick('Parallels', 'terminateKey'); |
|
109 | 109 | $this->response = $this->xml->__call('partner10.terminateKey', [$this->authInfo(), $key]); |
110 | - if ($this->response === false) |
|
111 | - \StatisticClient::report('Parallels', 'terminateKey', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
112 | - else |
|
113 | - \StatisticClient::report('Parallels', 'terminateKey', true, 0, '', STATISTICS_SERVER); |
|
110 | + if ($this->response === false) |
|
111 | + \StatisticClient::report('Parallels', 'terminateKey', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
112 | + else |
|
113 | + \StatisticClient::report('Parallels', 'terminateKey', true, 0, '', STATISTICS_SERVER); |
|
114 | 114 | return $this->response; |
115 | 115 | } |
116 | 116 | |
@@ -120,12 +120,12 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function resetKey($key) |
122 | 122 | { |
123 | - \StatisticClient::tick('Parallels', 'resetKey'); |
|
123 | + \StatisticClient::tick('Parallels', 'resetKey'); |
|
124 | 124 | $this->response = $this->xml->__call('partner10.resetKey', [$this->authInfo(), $key]); |
125 | - if ($this->response === false) |
|
126 | - \StatisticClient::report('Parallels', 'resetKey', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
127 | - else |
|
128 | - \StatisticClient::report('Parallels', 'resetKey', true, 0, '', STATISTICS_SERVER); |
|
125 | + if ($this->response === false) |
|
126 | + \StatisticClient::report('Parallels', 'resetKey', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
127 | + else |
|
128 | + \StatisticClient::report('Parallels', 'resetKey', true, 0, '', STATISTICS_SERVER); |
|
129 | 129 | return $this->response; |
130 | 130 | } |
131 | 131 | |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function activateKey($key) |
137 | 137 | { |
138 | - \StatisticClient::tick('Parallels', 'activateKey'); |
|
138 | + \StatisticClient::tick('Parallels', 'activateKey'); |
|
139 | 139 | $this->response = $this->xml->__call('partner10.activateKey', [$this->authInfo(), $key]); |
140 | - if ($this->response === false) |
|
141 | - \StatisticClient::report('Parallels', 'activateKey', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
142 | - else |
|
143 | - \StatisticClient::report('Parallels', 'activateKey', true, 0, '', STATISTICS_SERVER); |
|
140 | + if ($this->response === false) |
|
141 | + \StatisticClient::report('Parallels', 'activateKey', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
142 | + else |
|
143 | + \StatisticClient::report('Parallels', 'activateKey', true, 0, '', STATISTICS_SERVER); |
|
144 | 144 | return $this->response; |
145 | 145 | } |
146 | 146 | |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function addNoteToKey($key, $note) |
153 | 153 | { |
154 | - \StatisticClient::tick('Parallels', 'addNoteToKey'); |
|
154 | + \StatisticClient::tick('Parallels', 'addNoteToKey'); |
|
155 | 155 | $this->response = $this->xml->__call('partner10.addNoteToKey', [$this->authInfo(), $key, $note]); |
156 | - if ($this->response === false) |
|
157 | - \StatisticClient::report('Parallels', 'addNoteToKey', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
158 | - else |
|
159 | - \StatisticClient::report('Parallels', 'addNoteToKey', true, 0, '', STATISTICS_SERVER); |
|
156 | + if ($this->response === false) |
|
157 | + \StatisticClient::report('Parallels', 'addNoteToKey', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
158 | + else |
|
159 | + \StatisticClient::report('Parallels', 'addNoteToKey', true, 0, '', STATISTICS_SERVER); |
|
160 | 160 | return $this->response; |
161 | 161 | } |
162 | 162 | |
@@ -167,16 +167,16 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function sendKeyByEmail($key, $email = false) |
169 | 169 | { |
170 | - \StatisticClient::tick('Parallels', 'sendKeyByEmail'); |
|
170 | + \StatisticClient::tick('Parallels', 'sendKeyByEmail'); |
|
171 | 171 | if ($email === false) { |
172 | 172 | $this->response = $this->xml->__call('partner10.sendKeyByEmail', [$this->authInfo(), $key]); |
173 | 173 | } else { |
174 | 174 | $this->response = $this->xml->__call('partner10.sendKeyByEmail', [$this->authInfo(), $key, $email]); |
175 | 175 | } |
176 | - if ($this->response === false) |
|
177 | - \StatisticClient::report('Parallels', 'sendKeyByEmail', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
178 | - else |
|
179 | - \StatisticClient::report('Parallels', 'sendKeyByEmail', true, 0, '', STATISTICS_SERVER); |
|
176 | + if ($this->response === false) |
|
177 | + \StatisticClient::report('Parallels', 'sendKeyByEmail', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
178 | + else |
|
179 | + \StatisticClient::report('Parallels', 'sendKeyByEmail', true, 0, '', STATISTICS_SERVER); |
|
180 | 180 | return $this->response; |
181 | 181 | } |
182 | 182 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | if (!is_array($ips) && $ips != '') { |
195 | 195 | $ips = [$ips]; |
196 | 196 | } |
197 | - \StatisticClient::tick('Parallels', 'createKey'); |
|
197 | + \StatisticClient::tick('Parallels', 'createKey'); |
|
198 | 198 | $this->response = $this->xml->__call('partner10.createKey', [ |
199 | 199 | $this->authInfo(), |
200 | 200 | $this->serverAddress($ips, $macs), $client === false ? $this->client : $client, |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | $upgradePlans, $licenseType === false ? $this->licenseType : $licenseType |
203 | 203 | ] |
204 | 204 | ); |
205 | - if ($this->response === false) |
|
206 | - \StatisticClient::report('Parallels', 'createKey', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
207 | - else |
|
208 | - \StatisticClient::report('Parallels', 'createKey', true, 0, '', STATISTICS_SERVER); |
|
205 | + if ($this->response === false) |
|
206 | + \StatisticClient::report('Parallels', 'createKey', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
207 | + else |
|
208 | + \StatisticClient::report('Parallels', 'createKey', true, 0, '', STATISTICS_SERVER); |
|
209 | 209 | return $this->response; |
210 | 210 | /* Success: |
211 | 211 | Array |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function retrieveKey($key) |
244 | 244 | { |
245 | - \StatisticClient::tick('Parallels', 'retrieveKey'); |
|
245 | + \StatisticClient::tick('Parallels', 'retrieveKey'); |
|
246 | 246 | $this->response = $this->xml->__call('partner10.retrieveKey', [$this->authInfo(), $key]); |
247 | - if ($this->response === false) |
|
248 | - \StatisticClient::report('Parallels', 'retrieveKey', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
249 | - else |
|
250 | - \StatisticClient::report('Parallels', 'retrieveKey', true, 0, '', STATISTICS_SERVER); |
|
247 | + if ($this->response === false) |
|
248 | + \StatisticClient::report('Parallels', 'retrieveKey', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
249 | + else |
|
250 | + \StatisticClient::report('Parallels', 'retrieveKey', true, 0, '', STATISTICS_SERVER); |
|
251 | 251 | return $this->response; |
252 | 252 | /* Success |
253 | 253 | Array |
@@ -409,12 +409,12 @@ discard block |
||
409 | 409 | */ |
410 | 410 | public function getAvailableUpgrades($key) |
411 | 411 | { |
412 | - \StatisticClient::tick('Parallels', 'getAvailableUpgrades'); |
|
412 | + \StatisticClient::tick('Parallels', 'getAvailableUpgrades'); |
|
413 | 413 | $this->response = $this->xml->__call('partner10.getAvailableUpgrades', [$this->authInfo(), $key]); |
414 | - if ($this->response === false) |
|
415 | - \StatisticClient::report('Parallels', 'getAvailableUpgrades', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
416 | - else |
|
417 | - \StatisticClient::report('Parallels', 'getAvailableUpgrades', true, 0, '', STATISTICS_SERVER); |
|
414 | + if ($this->response === false) |
|
415 | + \StatisticClient::report('Parallels', 'getAvailableUpgrades', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
416 | + else |
|
417 | + \StatisticClient::report('Parallels', 'getAvailableUpgrades', true, 0, '', STATISTICS_SERVER); |
|
418 | 418 | return $this->response; |
419 | 419 | } |
420 | 420 | |
@@ -584,12 +584,12 @@ discard block |
||
584 | 584 | */ |
585 | 585 | public function getKeyInfo($key) |
586 | 586 | { |
587 | - \StatisticClient::tick('Parallels', 'getKeyInfo'); |
|
587 | + \StatisticClient::tick('Parallels', 'getKeyInfo'); |
|
588 | 588 | $this->response = $this->xml->__call('partner10.getKeyInfo', [$this->authInfo(), $key]); |
589 | - if ($this->response === false) |
|
590 | - \StatisticClient::report('Parallels', 'getKeyInfo', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
591 | - else |
|
592 | - \StatisticClient::report('Parallels', 'getKeyInfo', true, 0, '', STATISTICS_SERVER); |
|
589 | + if ($this->response === false) |
|
590 | + \StatisticClient::report('Parallels', 'getKeyInfo', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
591 | + else |
|
592 | + \StatisticClient::report('Parallels', 'getKeyInfo', true, 0, '', STATISTICS_SERVER); |
|
593 | 593 | return $this->response; |
594 | 594 | } |
595 | 595 | |
@@ -624,12 +624,12 @@ discard block |
||
624 | 624 | */ |
625 | 625 | public function getKeysInfoByIP($ipAddress) |
626 | 626 | { |
627 | - \StatisticClient::tick('Parallels', 'getKeysInfoByIP'); |
|
627 | + \StatisticClient::tick('Parallels', 'getKeysInfoByIP'); |
|
628 | 628 | $this->response = $this->xml->__call('partner10.getKeysInfoByIP', [$this->authInfo(), $ipAddress]); |
629 | - if ($this->response === false) |
|
630 | - \StatisticClient::report('Parallels', 'getKeysInfoByIP', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
631 | - else |
|
632 | - \StatisticClient::report('Parallels', 'getKeysInfoByIP', true, 0, '', STATISTICS_SERVER); |
|
629 | + if ($this->response === false) |
|
630 | + \StatisticClient::report('Parallels', 'getKeysInfoByIP', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
631 | + else |
|
632 | + \StatisticClient::report('Parallels', 'getKeysInfoByIP', true, 0, '', STATISTICS_SERVER); |
|
633 | 633 | return $this->response; |
634 | 634 | } |
635 | 635 | |
@@ -641,13 +641,13 @@ discard block |
||
641 | 641 | public function getKeyNumbers($ips = [], $macs = []) |
642 | 642 | { |
643 | 643 | myadmin_log('licenses', 'info', json_encode($this->serverAddress($ips, $macs)), __LINE__, __FILE__); |
644 | - \StatisticClient::tick('Parallels', 'getKeyNumbers'); |
|
644 | + \StatisticClient::tick('Parallels', 'getKeyNumbers'); |
|
645 | 645 | $this->response = $this->xml->__call('partner10.getKeyNumbers', [$this->authInfo(), $this->serverAddress($ips, $macs)]); |
646 | - if ($this->response === false) |
|
647 | - \StatisticClient::report('Parallels', 'getKeyNumbers', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
648 | - else |
|
649 | - \StatisticClient::report('Parallels', 'getKeyNumbers', true, 0, '', STATISTICS_SERVER); |
|
650 | - return $this->response; |
|
646 | + if ($this->response === false) |
|
647 | + \StatisticClient::report('Parallels', 'getKeyNumbers', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
648 | + else |
|
649 | + \StatisticClient::report('Parallels', 'getKeyNumbers', true, 0, '', STATISTICS_SERVER); |
|
650 | + return $this->response; |
|
651 | 651 | /* Success |
652 | 652 | Array |
653 | 653 | ( |
@@ -775,12 +775,12 @@ discard block |
||
775 | 775 | */ |
776 | 776 | public function getAvailableKeyTypesAndFeatures($client = false) |
777 | 777 | { |
778 | - \StatisticClient::tick('Parallels', 'getAvailableKeyTypesAndFeatures'); |
|
778 | + \StatisticClient::tick('Parallels', 'getAvailableKeyTypesAndFeatures'); |
|
779 | 779 | $this->response = $this->xml->__call('partner10.getAvailableKeyTypesAndFeatures', [$this->authInfo(), $client === false ? $this->client : $client]); |
780 | - if ($this->response === false) |
|
781 | - \StatisticClient::report('Parallels', 'getAvailableKeyTypesAndFeatures', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
782 | - else |
|
783 | - \StatisticClient::report('Parallels', 'getAvailableKeyTypesAndFeatures', true, 0, '', STATISTICS_SERVER); |
|
780 | + if ($this->response === false) |
|
781 | + \StatisticClient::report('Parallels', 'getAvailableKeyTypesAndFeatures', false, 1, 'XML Call Error', STATISTICS_SERVER); |
|
782 | + else |
|
783 | + \StatisticClient::report('Parallels', 'getAvailableKeyTypesAndFeatures', true, 0, '', STATISTICS_SERVER); |
|
784 | 784 | return $this->response; |
785 | 785 | /* My Output: |
786 | 786 | Array |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @access public |
23 | 23 | */ |
24 | -class Parallels |
|
25 | -{ |
|
24 | +class Parallels { |
|
26 | 25 | public $licenseType = 'billing'; // billing or purchase |
27 | 26 | private $xmlOptions = ['sslverify' => false]; |
28 | 27 | private $defaultUrl = 'https://ka.parallels.com:7050/'; |
@@ -41,8 +40,7 @@ discard block |
||
41 | 40 | * @param bool $demo defaults to FALSE, whether or not to use the demo interface instae dof the normal one |
42 | 41 | * @param NULL|array $xmlOptions array of optoins ot pass to xmlrpc2 client |
43 | 42 | */ |
44 | - public function __construct($login = null, $password = null, $client = null, $demo = false, $xmlOptions = null) |
|
45 | - { |
|
43 | + public function __construct($login = null, $password = null, $client = null, $demo = false, $xmlOptions = null) { |
|
46 | 44 | if (null === $login && defined('PARALLELS_KA_LOGIN')) { |
47 | 45 | $this->login = constant('PARALLELS_KA_LOGIN'); |
48 | 46 | } else { |
@@ -75,8 +73,7 @@ discard block |
||
75 | 73 | /** |
76 | 74 | * @return array |
77 | 75 | */ |
78 | - public function authInfo() |
|
79 | - { |
|
76 | + public function authInfo() { |
|
80 | 77 | return ['login' => $this->login, 'password' => $this->password]; |
81 | 78 | } |
82 | 79 | |
@@ -85,8 +82,7 @@ discard block |
||
85 | 82 | * @param array $macs |
86 | 83 | * @return array |
87 | 84 | */ |
88 | - public function serverAddress($ips = [], $macs = []) |
|
89 | - { |
|
85 | + public function serverAddress($ips = [], $macs = []) { |
|
90 | 86 | if (!is_array($ips) && $ips != '') { |
91 | 87 | $ips = [$ips]; |
92 | 88 | } |
@@ -103,8 +99,7 @@ discard block |
||
103 | 99 | * @param $key |
104 | 100 | * @return mixed |
105 | 101 | */ |
106 | - public function terminateKey($key) |
|
107 | - { |
|
102 | + public function terminateKey($key) { |
|
108 | 103 | \StatisticClient::tick('Parallels', 'terminateKey'); |
109 | 104 | $this->response = $this->xml->__call('partner10.terminateKey', [$this->authInfo(), $key]); |
110 | 105 | if ($this->response === false) |
@@ -118,8 +113,7 @@ discard block |
||
118 | 113 | * @param $key |
119 | 114 | * @return mixed |
120 | 115 | */ |
121 | - public function resetKey($key) |
|
122 | - { |
|
116 | + public function resetKey($key) { |
|
123 | 117 | \StatisticClient::tick('Parallels', 'resetKey'); |
124 | 118 | $this->response = $this->xml->__call('partner10.resetKey', [$this->authInfo(), $key]); |
125 | 119 | if ($this->response === false) |
@@ -133,8 +127,7 @@ discard block |
||
133 | 127 | * @param $key |
134 | 128 | * @return mixed |
135 | 129 | */ |
136 | - public function activateKey($key) |
|
137 | - { |
|
130 | + public function activateKey($key) { |
|
138 | 131 | \StatisticClient::tick('Parallels', 'activateKey'); |
139 | 132 | $this->response = $this->xml->__call('partner10.activateKey', [$this->authInfo(), $key]); |
140 | 133 | if ($this->response === false) |
@@ -149,8 +142,7 @@ discard block |
||
149 | 142 | * @param $note |
150 | 143 | * @return mixed |
151 | 144 | */ |
152 | - public function addNoteToKey($key, $note) |
|
153 | - { |
|
145 | + public function addNoteToKey($key, $note) { |
|
154 | 146 | \StatisticClient::tick('Parallels', 'addNoteToKey'); |
155 | 147 | $this->response = $this->xml->__call('partner10.addNoteToKey', [$this->authInfo(), $key, $note]); |
156 | 148 | if ($this->response === false) |
@@ -165,8 +157,7 @@ discard block |
||
165 | 157 | * @param bool $email |
166 | 158 | * @return mixed |
167 | 159 | */ |
168 | - public function sendKeyByEmail($key, $email = false) |
|
169 | - { |
|
160 | + public function sendKeyByEmail($key, $email = false) { |
|
170 | 161 | \StatisticClient::tick('Parallels', 'sendKeyByEmail'); |
171 | 162 | if ($email === false) { |
172 | 163 | $this->response = $this->xml->__call('partner10.sendKeyByEmail', [$this->authInfo(), $key]); |
@@ -189,8 +180,7 @@ discard block |
||
189 | 180 | * @param bool $client |
190 | 181 | * @return mixed |
191 | 182 | */ |
192 | - public function createKey($keyType, $upgradePlans = [], $ips = [], $macs = [], $licenseType = false, $client = false) |
|
193 | - { |
|
183 | + public function createKey($keyType, $upgradePlans = [], $ips = [], $macs = [], $licenseType = false, $client = false) { |
|
194 | 184 | if (!is_array($ips) && $ips != '') { |
195 | 185 | $ips = [$ips]; |
196 | 186 | } |
@@ -240,8 +230,7 @@ discard block |
||
240 | 230 | * @param $key |
241 | 231 | * @return mixed |
242 | 232 | */ |
243 | - public function retrieveKey($key) |
|
244 | - { |
|
233 | + public function retrieveKey($key) { |
|
245 | 234 | \StatisticClient::tick('Parallels', 'retrieveKey'); |
246 | 235 | $this->response = $this->xml->__call('partner10.retrieveKey', [$this->authInfo(), $key]); |
247 | 236 | if ($this->response === false) |
@@ -407,8 +396,7 @@ discard block |
||
407 | 396 | * @param $key |
408 | 397 | * @return mixed |
409 | 398 | */ |
410 | - public function getAvailableUpgrades($key) |
|
411 | - { |
|
399 | + public function getAvailableUpgrades($key) { |
|
412 | 400 | \StatisticClient::tick('Parallels', 'getAvailableUpgrades'); |
413 | 401 | $this->response = $this->xml->__call('partner10.getAvailableUpgrades', [$this->authInfo(), $key]); |
414 | 402 | if ($this->response === false) |
@@ -582,8 +570,7 @@ discard block |
||
582 | 570 | * @param $key |
583 | 571 | * @return mixed |
584 | 572 | */ |
585 | - public function getKeyInfo($key) |
|
586 | - { |
|
573 | + public function getKeyInfo($key) { |
|
587 | 574 | \StatisticClient::tick('Parallels', 'getKeyInfo'); |
588 | 575 | $this->response = $this->xml->__call('partner10.getKeyInfo', [$this->authInfo(), $key]); |
589 | 576 | if ($this->response === false) |
@@ -597,8 +584,7 @@ discard block |
||
597 | 584 | * @param string $ipAddress the ip address |
598 | 585 | * @return false|string false if no key , or a string w/ the key |
599 | 586 | */ |
600 | - public function getMainKeyFromIp($ipAddress) |
|
601 | - { |
|
587 | + public function getMainKeyFromIp($ipAddress) { |
|
602 | 588 | $response = $this->getKeyNumbers($ipAddress); |
603 | 589 | //$response = $this->getKeysInfoByIP($ipAddress); |
604 | 590 | $return = false; |
@@ -622,8 +608,7 @@ discard block |
||
622 | 608 | * @param $ipAddress |
623 | 609 | * @return mixed |
624 | 610 | */ |
625 | - public function getKeysInfoByIP($ipAddress) |
|
626 | - { |
|
611 | + public function getKeysInfoByIP($ipAddress) { |
|
627 | 612 | \StatisticClient::tick('Parallels', 'getKeysInfoByIP'); |
628 | 613 | $this->response = $this->xml->__call('partner10.getKeysInfoByIP', [$this->authInfo(), $ipAddress]); |
629 | 614 | if ($this->response === false) |
@@ -638,8 +623,7 @@ discard block |
||
638 | 623 | * @param array $macs |
639 | 624 | * @return mixed |
640 | 625 | */ |
641 | - public function getKeyNumbers($ips = [], $macs = []) |
|
642 | - { |
|
626 | + public function getKeyNumbers($ips = [], $macs = []) { |
|
643 | 627 | myadmin_log('licenses', 'info', json_encode($this->serverAddress($ips, $macs)), __LINE__, __FILE__); |
644 | 628 | \StatisticClient::tick('Parallels', 'getKeyNumbers'); |
645 | 629 | $this->response = $this->xml->__call('partner10.getKeyNumbers', [$this->authInfo(), $this->serverAddress($ips, $macs)]); |
@@ -773,8 +757,7 @@ discard block |
||
773 | 757 | * @param bool $client |
774 | 758 | * @return mixed |
775 | 759 | */ |
776 | - public function getAvailableKeyTypesAndFeatures($client = false) |
|
777 | - { |
|
760 | + public function getAvailableKeyTypesAndFeatures($client = false) { |
|
778 | 761 | \StatisticClient::tick('Parallels', 'getAvailableKeyTypesAndFeatures'); |
779 | 762 | $this->response = $this->xml->__call('partner10.getAvailableKeyTypesAndFeatures', [$this->authInfo(), $client === false ? $this->client : $client]); |
780 | 763 | if ($this->response === false) |