@@ -21,147 +21,147 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class Parallels |
23 | 23 | { |
24 | - public $LicenseType = 'billing'; // billing or purchase |
|
25 | - private $xml_options = array('sslverify' => false); |
|
26 | - private $default_url = 'https://ka.parallels.com:7050/'; |
|
27 | - private $default_demo_url = 'https://kademo.parallels.com:7050/'; |
|
28 | - public $url = ''; |
|
29 | - public $response; |
|
30 | - private $client = ''; |
|
31 | - private $login = ''; |
|
32 | - private $password = ''; |
|
33 | - public $xml; |
|
34 | - |
|
35 | - /** |
|
36 | - * Parallels::__construct() |
|
37 | - * @param bool $login |
|
38 | - * @param bool $password |
|
39 | - * @param bool $client |
|
40 | - * @param bool $demo |
|
41 | - * @param bool $xml_options |
|
42 | - * @return \Parallels |
|
43 | - */ |
|
44 | - public function __construct($login = false, $password = false, $client = false, $demo = false, $xml_options = false) { |
|
45 | - if ($login === false && defined('PARALLELS_KA_LOGIN')) |
|
46 | - $this->login = constant('PARALLELS_KA_LOGIN'); |
|
47 | - else |
|
48 | - $this->login = $login; |
|
49 | - if ($password === false && defined('PARALLELS_KA_PASSWORD')) |
|
50 | - $this->password = constant('PARALLELS_KA_PASSWORD'); |
|
51 | - else |
|
52 | - $this->password = $password; |
|
53 | - if ($client !== false) |
|
54 | - $this->client = $client; |
|
55 | - elseif (defined('PARALLELS_KA_CLIENT')) |
|
56 | - $this->client = constant('PARALLELS_KA_CLIENT'); |
|
57 | - if ($demo === true) |
|
58 | - $this->url = $this->default_demo_url; |
|
59 | - elseif ($demo === false) |
|
60 | - $this->url = $this->default_url; |
|
61 | - else |
|
62 | - $this->url = $demo; |
|
63 | - if ($xml_options !== false) |
|
64 | - $this->xml_options = $xml_options; |
|
65 | - if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) |
|
66 | - $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input'); |
|
67 | - require_once('XML/RPC2/Client.php'); |
|
68 | - $this->xml = XML_RPC2_Client::create($this->url, $this->xml_options); |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * @return array |
|
73 | - */ |
|
74 | - public function AuthInfo() { |
|
75 | - return array('login' => $this->login, 'password' => $this->password); |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * @param array $ips |
|
80 | - * @param array $macs |
|
81 | - * @return array |
|
82 | - */ |
|
83 | - public function ServerAddress($ips = array(), $macs = array()) { |
|
84 | - if (!is_array($ips) && $ips != '') |
|
85 | - $ips = array($ips); |
|
86 | - if (!is_array($macs) && $macs != '') |
|
87 | - $macs = array($macs); |
|
88 | - return array( |
|
89 | - 'ips' => $ips, |
|
90 | - 'macs' => $macs, |
|
91 | - ); |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * @param $Key |
|
96 | - * @return mixed |
|
97 | - */ |
|
98 | - public function terminateKey($Key) { |
|
99 | - $this->response = $this->xml->__call('partner10.terminateKey', array($this->AuthInfo(), $Key)); |
|
100 | - return $this->response; |
|
101 | - } |
|
102 | - |
|
103 | - /** |
|
104 | - * @param $Key |
|
105 | - * @return mixed |
|
106 | - */ |
|
107 | - public function resetKey($Key) { |
|
108 | - $this->response = $this->xml->__call('partner10.resetKey', array($this->AuthInfo(), $Key)); |
|
109 | - return $this->response; |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * @param $Key |
|
114 | - * @return mixed |
|
115 | - */ |
|
116 | - public function activateKey($Key) { |
|
117 | - $this->response = $this->xml->__call('partner10.activateKey', array($this->AuthInfo(), $Key)); |
|
118 | - return $this->response; |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * @param $Key |
|
123 | - * @param $Note |
|
124 | - * @return mixed |
|
125 | - */ |
|
126 | - public function addNoteToKey($Key, $Note) { |
|
127 | - $this->response = $this->xml->__call('partner10.addNoteToKey', array($this->AuthInfo(), $Key, $Note)); |
|
128 | - return $this->response; |
|
129 | - } |
|
130 | - |
|
131 | - /** |
|
132 | - * @param $Key |
|
133 | - * @param bool $Email |
|
134 | - * @return mixed |
|
135 | - */ |
|
136 | - public function sendKeyByEmail($Key, $Email = false) { |
|
137 | - if ($Email === false) |
|
138 | - $this->response = $this->xml->__call('partner10.sendKeyByEmail', array($this->AuthInfo(), $Key)); |
|
139 | - else |
|
140 | - $this->response = $this->xml->__call('partner10.sendKeyByEmail', array($this->AuthInfo(), $Key, $Email)); |
|
141 | - return $this->response; |
|
142 | - } |
|
143 | - |
|
144 | - /** |
|
145 | - * @param $KeyType |
|
146 | - * @param array $UpgradePlans |
|
147 | - * @param array $ips |
|
148 | - * @param array $macs |
|
149 | - * @param bool $LicenseType |
|
150 | - * @param bool $client |
|
151 | - * @return mixed |
|
152 | - */ |
|
153 | - public function createKey($KeyType, $UpgradePlans = array(), $ips = array(), $macs = array(), $LicenseType = false, $client = false) { |
|
154 | - if (!is_array($ips) && $ips != '') |
|
155 | - $ips = array($ips); |
|
156 | - $this->response = $this->xml->__call('partner10.createKey', array( |
|
157 | - $this->AuthInfo(), |
|
158 | - $this->ServerAddress($ips, $macs), |
|
159 | - ($client === false ? $this->client : $client), |
|
160 | - $KeyType, |
|
161 | - $UpgradePlans, |
|
162 | - ($LicenseType === false ? $this->LicenseType : $LicenseType))); |
|
163 | - return $this->response; |
|
164 | - /* Success: |
|
24 | + public $LicenseType = 'billing'; // billing or purchase |
|
25 | + private $xml_options = array('sslverify' => false); |
|
26 | + private $default_url = 'https://ka.parallels.com:7050/'; |
|
27 | + private $default_demo_url = 'https://kademo.parallels.com:7050/'; |
|
28 | + public $url = ''; |
|
29 | + public $response; |
|
30 | + private $client = ''; |
|
31 | + private $login = ''; |
|
32 | + private $password = ''; |
|
33 | + public $xml; |
|
34 | + |
|
35 | + /** |
|
36 | + * Parallels::__construct() |
|
37 | + * @param bool $login |
|
38 | + * @param bool $password |
|
39 | + * @param bool $client |
|
40 | + * @param bool $demo |
|
41 | + * @param bool $xml_options |
|
42 | + * @return \Parallels |
|
43 | + */ |
|
44 | + public function __construct($login = false, $password = false, $client = false, $demo = false, $xml_options = false) { |
|
45 | + if ($login === false && defined('PARALLELS_KA_LOGIN')) |
|
46 | + $this->login = constant('PARALLELS_KA_LOGIN'); |
|
47 | + else |
|
48 | + $this->login = $login; |
|
49 | + if ($password === false && defined('PARALLELS_KA_PASSWORD')) |
|
50 | + $this->password = constant('PARALLELS_KA_PASSWORD'); |
|
51 | + else |
|
52 | + $this->password = $password; |
|
53 | + if ($client !== false) |
|
54 | + $this->client = $client; |
|
55 | + elseif (defined('PARALLELS_KA_CLIENT')) |
|
56 | + $this->client = constant('PARALLELS_KA_CLIENT'); |
|
57 | + if ($demo === true) |
|
58 | + $this->url = $this->default_demo_url; |
|
59 | + elseif ($demo === false) |
|
60 | + $this->url = $this->default_url; |
|
61 | + else |
|
62 | + $this->url = $demo; |
|
63 | + if ($xml_options !== false) |
|
64 | + $this->xml_options = $xml_options; |
|
65 | + if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) |
|
66 | + $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input'); |
|
67 | + require_once('XML/RPC2/Client.php'); |
|
68 | + $this->xml = XML_RPC2_Client::create($this->url, $this->xml_options); |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * @return array |
|
73 | + */ |
|
74 | + public function AuthInfo() { |
|
75 | + return array('login' => $this->login, 'password' => $this->password); |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * @param array $ips |
|
80 | + * @param array $macs |
|
81 | + * @return array |
|
82 | + */ |
|
83 | + public function ServerAddress($ips = array(), $macs = array()) { |
|
84 | + if (!is_array($ips) && $ips != '') |
|
85 | + $ips = array($ips); |
|
86 | + if (!is_array($macs) && $macs != '') |
|
87 | + $macs = array($macs); |
|
88 | + return array( |
|
89 | + 'ips' => $ips, |
|
90 | + 'macs' => $macs, |
|
91 | + ); |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * @param $Key |
|
96 | + * @return mixed |
|
97 | + */ |
|
98 | + public function terminateKey($Key) { |
|
99 | + $this->response = $this->xml->__call('partner10.terminateKey', array($this->AuthInfo(), $Key)); |
|
100 | + return $this->response; |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * @param $Key |
|
105 | + * @return mixed |
|
106 | + */ |
|
107 | + public function resetKey($Key) { |
|
108 | + $this->response = $this->xml->__call('partner10.resetKey', array($this->AuthInfo(), $Key)); |
|
109 | + return $this->response; |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * @param $Key |
|
114 | + * @return mixed |
|
115 | + */ |
|
116 | + public function activateKey($Key) { |
|
117 | + $this->response = $this->xml->__call('partner10.activateKey', array($this->AuthInfo(), $Key)); |
|
118 | + return $this->response; |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * @param $Key |
|
123 | + * @param $Note |
|
124 | + * @return mixed |
|
125 | + */ |
|
126 | + public function addNoteToKey($Key, $Note) { |
|
127 | + $this->response = $this->xml->__call('partner10.addNoteToKey', array($this->AuthInfo(), $Key, $Note)); |
|
128 | + return $this->response; |
|
129 | + } |
|
130 | + |
|
131 | + /** |
|
132 | + * @param $Key |
|
133 | + * @param bool $Email |
|
134 | + * @return mixed |
|
135 | + */ |
|
136 | + public function sendKeyByEmail($Key, $Email = false) { |
|
137 | + if ($Email === false) |
|
138 | + $this->response = $this->xml->__call('partner10.sendKeyByEmail', array($this->AuthInfo(), $Key)); |
|
139 | + else |
|
140 | + $this->response = $this->xml->__call('partner10.sendKeyByEmail', array($this->AuthInfo(), $Key, $Email)); |
|
141 | + return $this->response; |
|
142 | + } |
|
143 | + |
|
144 | + /** |
|
145 | + * @param $KeyType |
|
146 | + * @param array $UpgradePlans |
|
147 | + * @param array $ips |
|
148 | + * @param array $macs |
|
149 | + * @param bool $LicenseType |
|
150 | + * @param bool $client |
|
151 | + * @return mixed |
|
152 | + */ |
|
153 | + public function createKey($KeyType, $UpgradePlans = array(), $ips = array(), $macs = array(), $LicenseType = false, $client = false) { |
|
154 | + if (!is_array($ips) && $ips != '') |
|
155 | + $ips = array($ips); |
|
156 | + $this->response = $this->xml->__call('partner10.createKey', array( |
|
157 | + $this->AuthInfo(), |
|
158 | + $this->ServerAddress($ips, $macs), |
|
159 | + ($client === false ? $this->client : $client), |
|
160 | + $KeyType, |
|
161 | + $UpgradePlans, |
|
162 | + ($LicenseType === false ? $this->LicenseType : $LicenseType))); |
|
163 | + return $this->response; |
|
164 | + /* Success: |
|
165 | 165 | Array |
166 | 166 | ( |
167 | 167 | [mainKeyNumber] => PLSK.00004266.0000 |
@@ -188,16 +188,16 @@ discard block |
||
188 | 188 | |
189 | 189 | ) |
190 | 190 | */ |
191 | - } |
|
192 | - |
|
193 | - /** |
|
194 | - * @param $Key |
|
195 | - * @return mixed |
|
196 | - */ |
|
197 | - public function retrieveKey($Key) { |
|
198 | - $this->response = $this->xml->__call('partner10.retrieveKey', array($this->AuthInfo(), $Key)); |
|
199 | - return $this->response; |
|
200 | - /* Success |
|
191 | + } |
|
192 | + |
|
193 | + /** |
|
194 | + * @param $Key |
|
195 | + * @return mixed |
|
196 | + */ |
|
197 | + public function retrieveKey($Key) { |
|
198 | + $this->response = $this->xml->__call('partner10.retrieveKey', array($this->AuthInfo(), $Key)); |
|
199 | + return $this->response; |
|
200 | + /* Success |
|
201 | 201 | Array |
202 | 202 | ( |
203 | 203 | [keyExtension] => xml |
@@ -346,16 +346,16 @@ discard block |
||
346 | 346 | ) |
347 | 347 | |
348 | 348 | */ |
349 | - } |
|
350 | - |
|
351 | - /** |
|
352 | - * @param $Key |
|
353 | - * @return mixed |
|
354 | - */ |
|
355 | - public function getAvailableUpgrades($Key) { |
|
356 | - $this->response = $this->xml->__call('partner10.getAvailableUpgrades', array($this->AuthInfo(), $Key)); |
|
357 | - return $this->response; |
|
358 | - /* Success |
|
349 | + } |
|
350 | + |
|
351 | + /** |
|
352 | + * @param $Key |
|
353 | + * @return mixed |
|
354 | + */ |
|
355 | + public function getAvailableUpgrades($Key) { |
|
356 | + $this->response = $this->xml->__call('partner10.getAvailableUpgrades', array($this->AuthInfo(), $Key)); |
|
357 | + return $this->response; |
|
358 | + /* Success |
|
359 | 359 | Array |
360 | 360 | ( |
361 | 361 | [upgradePlans] => Array |
@@ -382,16 +382,16 @@ discard block |
||
382 | 382 | [resultDesc] => Following upgrade plans are available for given key: 3_LANGUAGE_PACKS, FOTOLIA_OFF, 5_LANGUAGE_PACKS, NEWSFEED_OFF, VIRTUOZZO_PROMO_OFF, ADDITIONAL_LANGUAGE_PACK, DISABLE_SITEBUILDER, 4_LANGUAGE_PACKS, DISABLE_FEATURE_UPGRADES, 1_LANGUAGE_PACK, STORE_BUTTON_OFF, PLESK_SWSOFT_SERVICES_OFF, DISABLE_GOOGLE_TOOLS, 2_LANGUAGE_PACKS, EXTRAS_BUTTONS_OFF, PLESK-UNLIMITED-PB-ACCOUNTS |
383 | 383 | ) |
384 | 384 | */ |
385 | - } |
|
386 | - |
|
387 | - /** |
|
388 | - * @param $Key |
|
389 | - * @return mixed |
|
390 | - */ |
|
391 | - public function getKeyInfo($Key) { |
|
392 | - $this->response = $this->xml->__call('partner10.getKeyInfo', array($this->AuthInfo(), $Key)); |
|
393 | - return $this->response; |
|
394 | - /* Success |
|
385 | + } |
|
386 | + |
|
387 | + /** |
|
388 | + * @param $Key |
|
389 | + * @return mixed |
|
390 | + */ |
|
391 | + public function getKeyInfo($Key) { |
|
392 | + $this->response = $this->xml->__call('partner10.getKeyInfo', array($this->AuthInfo(), $Key)); |
|
393 | + return $this->response; |
|
394 | + /* Success |
|
395 | 395 | Array |
396 | 396 | ( |
397 | 397 | [keyInfo] => Array |
@@ -578,47 +578,47 @@ discard block |
||
578 | 578 | [keyNumber] => PLSK.00005819.0000 |
579 | 579 | ) |
580 | 580 | */ |
581 | - } |
|
582 | - |
|
583 | - /** |
|
584 | - * @param $ip |
|
585 | - * @return bool |
|
586 | - */ |
|
587 | - public function getMainKeyFromIp($ip) { |
|
588 | - $response = $this->getKeyNumbers($ip); |
|
589 | - //$response = $this->getKeysInfoByIP($ip); |
|
590 | - $return = false; |
|
591 | - if (isset($response['keyInfos'])) { |
|
592 | - foreach ($response['keyInfos'] as $idx => $data) { |
|
593 | - if ($return === false) |
|
594 | - $return = $data['keyNumber']; |
|
595 | - if ($data['type'] == 'MAIN') |
|
596 | - $return = $data['keyNumber']; |
|
597 | - } |
|
598 | - return $return; |
|
599 | - } else |
|
600 | - return false; |
|
601 | - } |
|
602 | - |
|
603 | - /** |
|
604 | - * @param $ip |
|
605 | - * @return mixed |
|
606 | - */ |
|
607 | - public function getKeysInfoByIP($ip) { |
|
608 | - $this->response = $this->xml->__call('partner10.getKeysInfoByIP', array($this->AuthInfo(), $ip)); |
|
609 | - return $this->response; |
|
610 | - } |
|
611 | - |
|
612 | - /** |
|
613 | - * @param array $ips |
|
614 | - * @param array $macs |
|
615 | - * @return mixed |
|
616 | - */ |
|
617 | - public function getKeyNumbers($ips = array(), $macs = array()) { |
|
618 | - myadmin_log('licenses', 'info', json_encode($this->ServerAddress($ips, $macs)), __LINE__, __FILE__); |
|
619 | - $this->response = $this->xml->__call('partner10.getKeyNumbers', array($this->AuthInfo(), $this->ServerAddress($ips, $macs))); |
|
620 | - return $this->response; |
|
621 | - /* Success |
|
581 | + } |
|
582 | + |
|
583 | + /** |
|
584 | + * @param $ip |
|
585 | + * @return bool |
|
586 | + */ |
|
587 | + public function getMainKeyFromIp($ip) { |
|
588 | + $response = $this->getKeyNumbers($ip); |
|
589 | + //$response = $this->getKeysInfoByIP($ip); |
|
590 | + $return = false; |
|
591 | + if (isset($response['keyInfos'])) { |
|
592 | + foreach ($response['keyInfos'] as $idx => $data) { |
|
593 | + if ($return === false) |
|
594 | + $return = $data['keyNumber']; |
|
595 | + if ($data['type'] == 'MAIN') |
|
596 | + $return = $data['keyNumber']; |
|
597 | + } |
|
598 | + return $return; |
|
599 | + } else |
|
600 | + return false; |
|
601 | + } |
|
602 | + |
|
603 | + /** |
|
604 | + * @param $ip |
|
605 | + * @return mixed |
|
606 | + */ |
|
607 | + public function getKeysInfoByIP($ip) { |
|
608 | + $this->response = $this->xml->__call('partner10.getKeysInfoByIP', array($this->AuthInfo(), $ip)); |
|
609 | + return $this->response; |
|
610 | + } |
|
611 | + |
|
612 | + /** |
|
613 | + * @param array $ips |
|
614 | + * @param array $macs |
|
615 | + * @return mixed |
|
616 | + */ |
|
617 | + public function getKeyNumbers($ips = array(), $macs = array()) { |
|
618 | + myadmin_log('licenses', 'info', json_encode($this->ServerAddress($ips, $macs)), __LINE__, __FILE__); |
|
619 | + $this->response = $this->xml->__call('partner10.getKeyNumbers', array($this->AuthInfo(), $this->ServerAddress($ips, $macs))); |
|
620 | + return $this->response; |
|
621 | + /* Success |
|
622 | 622 | Array |
623 | 623 | ( |
624 | 624 | [keyInfos] => Array |
@@ -737,16 +737,16 @@ discard block |
||
737 | 737 | [detailResultCode] => 0 |
738 | 738 | ) |
739 | 739 | */ |
740 | - } |
|
741 | - |
|
742 | - /** |
|
743 | - * @param bool $client |
|
744 | - * @return mixed |
|
745 | - */ |
|
746 | - public function getAvailableKeyTypesAndFeatures($client = false) { |
|
747 | - $this->response = $this->xml->__call('partner10.getAvailableKeyTypesAndFeatures', array($this->AuthInfo(), ($client === false ? $this->client : $client))); |
|
748 | - return $this->response; |
|
749 | - /* My Output: |
|
740 | + } |
|
741 | + |
|
742 | + /** |
|
743 | + * @param bool $client |
|
744 | + * @return mixed |
|
745 | + */ |
|
746 | + public function getAvailableKeyTypesAndFeatures($client = false) { |
|
747 | + $this->response = $this->xml->__call('partner10.getAvailableKeyTypesAndFeatures', array($this->AuthInfo(), ($client === false ? $this->client : $client))); |
|
748 | + return $this->response; |
|
749 | + /* My Output: |
|
750 | 750 | Array |
751 | 751 | ( |
752 | 752 | [resultCode] => 100 |
@@ -1052,6 +1052,6 @@ discard block |
||
1052 | 1052 | |
1053 | 1053 | ) |
1054 | 1054 | */ |
1055 | - } |
|
1055 | + } |
|
1056 | 1056 | |
1057 | 1057 | } |
@@ -42,28 +42,34 @@ discard block |
||
42 | 42 | * @return \Parallels |
43 | 43 | */ |
44 | 44 | public function __construct($login = false, $password = false, $client = false, $demo = false, $xml_options = false) { |
45 | - if ($login === false && defined('PARALLELS_KA_LOGIN')) |
|
46 | - $this->login = constant('PARALLELS_KA_LOGIN'); |
|
47 | - else |
|
48 | - $this->login = $login; |
|
49 | - if ($password === false && defined('PARALLELS_KA_PASSWORD')) |
|
50 | - $this->password = constant('PARALLELS_KA_PASSWORD'); |
|
51 | - else |
|
52 | - $this->password = $password; |
|
53 | - if ($client !== false) |
|
54 | - $this->client = $client; |
|
55 | - elseif (defined('PARALLELS_KA_CLIENT')) |
|
56 | - $this->client = constant('PARALLELS_KA_CLIENT'); |
|
57 | - if ($demo === true) |
|
58 | - $this->url = $this->default_demo_url; |
|
59 | - elseif ($demo === false) |
|
60 | - $this->url = $this->default_url; |
|
61 | - else |
|
62 | - $this->url = $demo; |
|
63 | - if ($xml_options !== false) |
|
64 | - $this->xml_options = $xml_options; |
|
65 | - if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) |
|
66 | - $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input'); |
|
45 | + if ($login === false && defined('PARALLELS_KA_LOGIN')) { |
|
46 | + $this->login = constant('PARALLELS_KA_LOGIN'); |
|
47 | + } else { |
|
48 | + $this->login = $login; |
|
49 | + } |
|
50 | + if ($password === false && defined('PARALLELS_KA_PASSWORD')) { |
|
51 | + $this->password = constant('PARALLELS_KA_PASSWORD'); |
|
52 | + } else { |
|
53 | + $this->password = $password; |
|
54 | + } |
|
55 | + if ($client !== false) { |
|
56 | + $this->client = $client; |
|
57 | + } elseif (defined('PARALLELS_KA_CLIENT')) { |
|
58 | + $this->client = constant('PARALLELS_KA_CLIENT'); |
|
59 | + } |
|
60 | + if ($demo === true) { |
|
61 | + $this->url = $this->default_demo_url; |
|
62 | + } elseif ($demo === false) { |
|
63 | + $this->url = $this->default_url; |
|
64 | + } else { |
|
65 | + $this->url = $demo; |
|
66 | + } |
|
67 | + if ($xml_options !== false) { |
|
68 | + $this->xml_options = $xml_options; |
|
69 | + } |
|
70 | + if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) { |
|
71 | + $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input'); |
|
72 | + } |
|
67 | 73 | require_once('XML/RPC2/Client.php'); |
68 | 74 | $this->xml = XML_RPC2_Client::create($this->url, $this->xml_options); |
69 | 75 | } |
@@ -81,10 +87,12 @@ discard block |
||
81 | 87 | * @return array |
82 | 88 | */ |
83 | 89 | public function ServerAddress($ips = array(), $macs = array()) { |
84 | - if (!is_array($ips) && $ips != '') |
|
85 | - $ips = array($ips); |
|
86 | - if (!is_array($macs) && $macs != '') |
|
87 | - $macs = array($macs); |
|
90 | + if (!is_array($ips) && $ips != '') { |
|
91 | + $ips = array($ips); |
|
92 | + } |
|
93 | + if (!is_array($macs) && $macs != '') { |
|
94 | + $macs = array($macs); |
|
95 | + } |
|
88 | 96 | return array( |
89 | 97 | 'ips' => $ips, |
90 | 98 | 'macs' => $macs, |
@@ -134,10 +142,11 @@ discard block |
||
134 | 142 | * @return mixed |
135 | 143 | */ |
136 | 144 | public function sendKeyByEmail($Key, $Email = false) { |
137 | - if ($Email === false) |
|
138 | - $this->response = $this->xml->__call('partner10.sendKeyByEmail', array($this->AuthInfo(), $Key)); |
|
139 | - else |
|
140 | - $this->response = $this->xml->__call('partner10.sendKeyByEmail', array($this->AuthInfo(), $Key, $Email)); |
|
145 | + if ($Email === false) { |
|
146 | + $this->response = $this->xml->__call('partner10.sendKeyByEmail', array($this->AuthInfo(), $Key)); |
|
147 | + } else { |
|
148 | + $this->response = $this->xml->__call('partner10.sendKeyByEmail', array($this->AuthInfo(), $Key, $Email)); |
|
149 | + } |
|
141 | 150 | return $this->response; |
142 | 151 | } |
143 | 152 | |
@@ -151,8 +160,9 @@ discard block |
||
151 | 160 | * @return mixed |
152 | 161 | */ |
153 | 162 | public function createKey($KeyType, $UpgradePlans = array(), $ips = array(), $macs = array(), $LicenseType = false, $client = false) { |
154 | - if (!is_array($ips) && $ips != '') |
|
155 | - $ips = array($ips); |
|
163 | + if (!is_array($ips) && $ips != '') { |
|
164 | + $ips = array($ips); |
|
165 | + } |
|
156 | 166 | $this->response = $this->xml->__call('partner10.createKey', array( |
157 | 167 | $this->AuthInfo(), |
158 | 168 | $this->ServerAddress($ips, $macs), |
@@ -590,14 +600,17 @@ discard block |
||
590 | 600 | $return = false; |
591 | 601 | if (isset($response['keyInfos'])) { |
592 | 602 | foreach ($response['keyInfos'] as $idx => $data) { |
593 | - if ($return === false) |
|
594 | - $return = $data['keyNumber']; |
|
595 | - if ($data['type'] == 'MAIN') |
|
596 | - $return = $data['keyNumber']; |
|
603 | + if ($return === false) { |
|
604 | + $return = $data['keyNumber']; |
|
605 | + } |
|
606 | + if ($data['type'] == 'MAIN') { |
|
607 | + $return = $data['keyNumber']; |
|
608 | + } |
|
597 | 609 | } |
598 | 610 | return $return; |
599 | - } else |
|
600 | - return false; |
|
611 | + } else { |
|
612 | + return false; |
|
613 | + } |
|
601 | 614 | } |
602 | 615 | |
603 | 616 | /** |