Completed
Branch master (188864)
by Joe
04:05
created
src/Cloudlinux.php 1 patch
Indentation   +278 added lines, -278 removed lines patch added patch discarded remove patch
@@ -30,301 +30,301 @@
 block discarded – undo
30 30
  */
31 31
 class Cloudlinux
32 32
 {
33
-	private $login = '';
34
-	private $key = '';
35
-	private $authToken;
36
-	public $prefix = 'registration.';
37
-	public $encoding = 'utf-8'; // utf-8 / UTF-8
38
-	public $api_type = 'rest';
39
-	public $sslverify = false;
40
-	public $xml_options = [];
41
-	public $xml_url = 'https://cln.cloudlinux.com/clweb/xmlrpc';
42
-	public $rest_url = 'https://cln.cloudlinux.com/api/';
43
-	public $rest_options = [];
44
-	/**
45
-	 * @var \XML_RPC2_Client
46
-	 */
47
-	public $xml_client;
48
-	public $response;
33
+    private $login = '';
34
+    private $key = '';
35
+    private $authToken;
36
+    public $prefix = 'registration.';
37
+    public $encoding = 'utf-8'; // utf-8 / UTF-8
38
+    public $api_type = 'rest';
39
+    public $sslverify = false;
40
+    public $xml_options = [];
41
+    public $xml_url = 'https://cln.cloudlinux.com/clweb/xmlrpc';
42
+    public $rest_url = 'https://cln.cloudlinux.com/api/';
43
+    public $rest_options = [];
44
+    /**
45
+     * @var \XML_RPC2_Client
46
+     */
47
+    public $xml_client;
48
+    public $response;
49 49
 
50
-	/**
51
-	 * Cloudlinux::__construct()
52
-	 *
53
-	 * @param string $login API Login Name
54
-	 * @param string $key API Key
55
-	 * @param string $type API type to use, can be 'rest' or 'xml'
56
-	 */
57
-	public function __construct($login, $key, $type = 'rest') {
58
-		$this->login = $login;
59
-		$this->key = $key;
60
-		if (!isset($GLOBALS['HTTP_RAW_POST_DATA']))
61
-			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input');
62
-		//if ($api_type == 'xml') {
63
-			include_once('XML/RPC2/Client.php');
64
-			$this->xml_options['prefix'] = $this->prefix;
65
-			$this->xml_options['encoding'] = $this->encoding;
66
-			$this->xml_options['sslverify'] = $this->sslverify;
67
-			$this->xml_client = \XML_RPC2_Client::create($this->xml_url, $this->xml_options);
68
-		//} elseif ($this->api_type == 'rest') {
69
-			//$this->rest_options[CURLOPT_SSL_VERIFYHOST] = $this->sslverify;
70
-		//}
71
-	}
50
+    /**
51
+     * Cloudlinux::__construct()
52
+     *
53
+     * @param string $login API Login Name
54
+     * @param string $key API Key
55
+     * @param string $type API type to use, can be 'rest' or 'xml'
56
+     */
57
+    public function __construct($login, $key, $type = 'rest') {
58
+        $this->login = $login;
59
+        $this->key = $key;
60
+        if (!isset($GLOBALS['HTTP_RAW_POST_DATA']))
61
+            $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input');
62
+        //if ($api_type == 'xml') {
63
+            include_once('XML/RPC2/Client.php');
64
+            $this->xml_options['prefix'] = $this->prefix;
65
+            $this->xml_options['encoding'] = $this->encoding;
66
+            $this->xml_options['sslverify'] = $this->sslverify;
67
+            $this->xml_client = \XML_RPC2_Client::create($this->xml_url, $this->xml_options);
68
+        //} elseif ($this->api_type == 'rest') {
69
+            //$this->rest_options[CURLOPT_SSL_VERIFYHOST] = $this->sslverify;
70
+        //}
71
+    }
72 72
 
73
-	/**
74
-	 * getcurlpage()
75
-	 * gets a webpage via curl and returns the response.
76
-	 * also it sets a mozilla type agent.
77
-	 * @param string $url        the url of the page you want
78
-	 * @param string $postfields postfields in the format of "v1=10&v2=20&v3=30"
79
-	 * @param string $options
80
-	 * @return string the webpage
81
-	 */
82
-	public function getcurlpage($url, $postfields = '', $options = '') {
83
-		//myadmin_log('myadmin', 'info', "Get Url Page $url", __LINE__, __FILE__);
84
-		$agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2790.0 Safari/537.36';
85
-		$ch = curl_init($url);
86
-		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
87
-		curl_setopt($ch, CURLOPT_USERAGENT, $agent);
88
-		if (is_array($postfields) || $postfields != '') {
89
-			if (is_array($postfields)) {
90
-				$postdata = [];
91
-				foreach ($postfields as $field => $value) {
92
-					$postdata[] = $field . '=' . urlencode($value);
93
-				}
94
-				curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $postdata));
95
-			} else {
96
-				curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
97
-			}
98
-		}
99
-		if (is_array($options) && sizeof($options) > 0) {
100
-			foreach ($options as $key => $value) {
101
-				curl_setopt($ch, $key, $value);
102
-			}
103
-		}
104
-		$tmp = curl_exec($ch);
105
-		curl_close($ch);
106
-		$ret = $tmp;
107
-		return $ret;
108
-	}
73
+    /**
74
+     * getcurlpage()
75
+     * gets a webpage via curl and returns the response.
76
+     * also it sets a mozilla type agent.
77
+     * @param string $url        the url of the page you want
78
+     * @param string $postfields postfields in the format of "v1=10&v2=20&v3=30"
79
+     * @param string $options
80
+     * @return string the webpage
81
+     */
82
+    public function getcurlpage($url, $postfields = '', $options = '') {
83
+        //myadmin_log('myadmin', 'info', "Get Url Page $url", __LINE__, __FILE__);
84
+        $agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2790.0 Safari/537.36';
85
+        $ch = curl_init($url);
86
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
87
+        curl_setopt($ch, CURLOPT_USERAGENT, $agent);
88
+        if (is_array($postfields) || $postfields != '') {
89
+            if (is_array($postfields)) {
90
+                $postdata = [];
91
+                foreach ($postfields as $field => $value) {
92
+                    $postdata[] = $field . '=' . urlencode($value);
93
+                }
94
+                curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $postdata));
95
+            } else {
96
+                curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
97
+            }
98
+        }
99
+        if (is_array($options) && sizeof($options) > 0) {
100
+            foreach ($options as $key => $value) {
101
+                curl_setopt($ch, $key, $value);
102
+            }
103
+        }
104
+        $tmp = curl_exec($ch);
105
+        curl_close($ch);
106
+        $ret = $tmp;
107
+        return $ret;
108
+    }
109 109
 
110
-	public function log($level, $text, $line = '', $file = '') {
111
-		if (function_exists('myadmin_log'))
112
-			myadmin_log('cloudlinux', $level, $text, $line, $file);
113
-		else
114
-			error_log($text);
115
-	}
110
+    public function log($level, $text, $line = '', $file = '') {
111
+        if (function_exists('myadmin_log'))
112
+            myadmin_log('cloudlinux', $level, $text, $line, $file);
113
+        else
114
+            error_log($text);
115
+    }
116 116
 
117
-	/**
118
-	 * Return system information about several Cloudlinux services
119
-	 *
120
-	 * @return array array of system information
121
-	 */
122
-	public function status() {
123
-		$this->response = $this->getcurlpage($this->rest_url.'status.json', '', $this->rest_options);
124
-		return json_decode($this->response, true);
125
-	}
117
+    /**
118
+     * Return system information about several Cloudlinux services
119
+     *
120
+     * @return array array of system information
121
+     */
122
+    public function status() {
123
+        $this->response = $this->getcurlpage($this->rest_url.'status.json', '', $this->rest_options);
124
+        return json_decode($this->response, true);
125
+    }
126 126
 
127
-	/**
128
-	 * Will return information about what kind of license types are available for registration and what types are already used by current account.
129
-	 * @param string $ip ip address to check
130
-	 * @return array returns an array with  available(int[]) ­ list of types that can be used to register new IP license, and owned(int[]) ­ list of types that already registered(owned) by this account
131
-	 */
132
-	public function availability($ip) {
133
-		$this->response = $this->getcurlpage($this->rest_url.'ipl/availability.json?ip='.$ip.'&token='.$this->authToken(), '', $this->rest_options);
134
-		return json_decode($this->response, true);
135
-	}
127
+    /**
128
+     * Will return information about what kind of license types are available for registration and what types are already used by current account.
129
+     * @param string $ip ip address to check
130
+     * @return array returns an array with  available(int[]) ­ list of types that can be used to register new IP license, and owned(int[]) ­ list of types that already registered(owned) by this account
131
+     */
132
+    public function availability($ip) {
133
+        $this->response = $this->getcurlpage($this->rest_url.'ipl/availability.json?ip='.$ip.'&token='.$this->authToken(), '', $this->rest_options);
134
+        return json_decode($this->response, true);
135
+    }
136 136
 
137
-	/**
138
-	 * Check if IP license is registered by any customer.
139
-	 *
140
-	 * @param string $ip ip address to check
141
-	 * @return array Will return list of registered license types or empty list if provided IP is not registered yet.
142
-	 */
143
-	public function check($ip) {
144
-		$this->response = $this->getcurlpage($this->rest_url.'ipl/check.json?ip='.$ip.'&token='.$this->authToken(), '', $this->rest_options);
145
-		$response = json_decode($this->response, true);
146
-		if ($response['success'] == 1)
147
-			return $response['data'];
148
-		else
149
-			return false;
150
-	}
137
+    /**
138
+     * Check if IP license is registered by any customer.
139
+     *
140
+     * @param string $ip ip address to check
141
+     * @return array Will return list of registered license types or empty list if provided IP is not registered yet.
142
+     */
143
+    public function check($ip) {
144
+        $this->response = $this->getcurlpage($this->rest_url.'ipl/check.json?ip='.$ip.'&token='.$this->authToken(), '', $this->rest_options);
145
+        $response = json_decode($this->response, true);
146
+        if ($response['success'] == 1)
147
+            return $response['data'];
148
+        else
149
+            return false;
150
+    }
151 151
 
152
-	/**
153
-	 * Will register IP based license for authorized user.
154
-	 *
155
-	 * @param string $ip ip address to registger
156
-	 * @param int $type IP license type (1,2 or 16)
157
-	 * @return array On success response returns information about created or already registered license.   ip(string)    type(int) ­ license type (1,2,16)   registered(boolean) ­ true if server was registered in CLN with this license (CLN licenses only).     created(string) ­ license creation time
158
-	 */
159
-	public function register($ip, $type) {
160
-		$this->response = $this->getcurlpage($this->rest_url.'ipl/register.json?ip='.$ip.'&type='.$type.'&token='.$this->authToken(), '', $this->rest_options);
161
-		return json_decode($this->response, true);
162
-	}
152
+    /**
153
+     * Will register IP based license for authorized user.
154
+     *
155
+     * @param string $ip ip address to registger
156
+     * @param int $type IP license type (1,2 or 16)
157
+     * @return array On success response returns information about created or already registered license.   ip(string)    type(int) ­ license type (1,2,16)   registered(boolean) ­ true if server was registered in CLN with this license (CLN licenses only).     created(string) ­ license creation time
158
+     */
159
+    public function register($ip, $type) {
160
+        $this->response = $this->getcurlpage($this->rest_url.'ipl/register.json?ip='.$ip.'&type='.$type.'&token='.$this->authToken(), '', $this->rest_options);
161
+        return json_decode($this->response, true);
162
+    }
163 163
 
164
-	/**
165
-	 * Will remove IP based license from authorized user licenses.
166
-	 *
167
-	 * @param string $ip ip address to remove licenses on
168
-	 * @param int $type optional license type. If empty, will remove licenses with all types
169
-	 * @return bool
170
-	 */
171
-	public function rest_remove($ip, $type = 0) {
172
-		if ($type != 0)
173
-			$this->response = $this->getcurlpage($this->rest_url.'ipl/remove.json?ip='.$ip.'&type='.$type.'&token='.$this->authToken(), '', $this->rest_options);
174
-		else
175
-			$this->response = $this->getcurlpage($this->rest_url.'ipl/remove.json?ip='.$ip.'&token='.$this->authToken(), '', $this->rest_options);
176
-		return json_decode($this->response, true);
177
-	}
164
+    /**
165
+     * Will remove IP based license from authorized user licenses.
166
+     *
167
+     * @param string $ip ip address to remove licenses on
168
+     * @param int $type optional license type. If empty, will remove licenses with all types
169
+     * @return bool
170
+     */
171
+    public function rest_remove($ip, $type = 0) {
172
+        if ($type != 0)
173
+            $this->response = $this->getcurlpage($this->rest_url.'ipl/remove.json?ip='.$ip.'&type='.$type.'&token='.$this->authToken(), '', $this->rest_options);
174
+        else
175
+            $this->response = $this->getcurlpage($this->rest_url.'ipl/remove.json?ip='.$ip.'&token='.$this->authToken(), '', $this->rest_options);
176
+        return json_decode($this->response, true);
177
+    }
178 178
 
179
-	/**
180
-	 * Will remove IP based license from authorized user licenses.
181
-	 *
182
-	 * @param string $ip ip address to remove licenses on
183
-	 * @param int $type optional license type. If empty or 0, will remove licenses with all types
184
-	 * @return bool
185
-	 */
186
-	public function remove($ip, $type = 0) {
187
-		if ($this->api_type == 'xml')
188
-			return $this->remove_license($ip, $type);
189
-		else
190
-			return $this->rest_remove($ip, $type);
191
-	}
179
+    /**
180
+     * Will remove IP based license from authorized user licenses.
181
+     *
182
+     * @param string $ip ip address to remove licenses on
183
+     * @param int $type optional license type. If empty or 0, will remove licenses with all types
184
+     * @return bool
185
+     */
186
+    public function remove($ip, $type = 0) {
187
+        if ($this->api_type == 'xml')
188
+            return $this->remove_license($ip, $type);
189
+        else
190
+            return $this->rest_remove($ip, $type);
191
+    }
192 192
 
193
-	/**
194
-	 * Return all IP licenses owned by authorized user.
195
-	 *
196
-	 * @return array an array of licenses each one containing these fields: ip(string)   ype(int) ­ license type (1,2,16)   registered(boolean) ­ true if server was registered in CLN with this license (CLN licenses only).    created(string) ­ license creation time
197
-	 */
198
-	public function rest_list() {
199
-		$this->response = $this->getcurlpage($this->rest_url.'ipl/list.json?token='.$this->authToken(), '', $this->rest_options);
200
-		return json_decode($this->response, true);
201
-	}
193
+    /**
194
+     * Return all IP licenses owned by authorized user.
195
+     *
196
+     * @return array an array of licenses each one containing these fields: ip(string)   ype(int) ­ license type (1,2,16)   registered(boolean) ­ true if server was registered in CLN with this license (CLN licenses only).    created(string) ­ license creation time
197
+     */
198
+    public function rest_list() {
199
+        $this->response = $this->getcurlpage($this->rest_url.'ipl/list.json?token='.$this->authToken(), '', $this->rest_options);
200
+        return json_decode($this->response, true);
201
+    }
202 202
 
203
-	/**
204
-	 * automatic authToken generator
205
-	 *
206
-	 * @return string the authToken
207
-	 */
208
-	public function authToken() {
209
-		$time = time();
210
-		try {
211
-			return $this->login . '|' . $time . '|' . sha1($this->key . $time);
212
-		} catch (Exception $e) {
213
-			$this->log('error', 'Caught exception code: ' . $e->getCode());
214
-			$this->log('error', 'Caught exception message: ' . $e->getMessage());
215
-			return false;
216
-		}
217
-	}
203
+    /**
204
+     * automatic authToken generator
205
+     *
206
+     * @return string the authToken
207
+     */
208
+    public function authToken() {
209
+        $time = time();
210
+        try {
211
+            return $this->login . '|' . $time . '|' . sha1($this->key . $time);
212
+        } catch (Exception $e) {
213
+            $this->log('error', 'Caught exception code: ' . $e->getCode());
214
+            $this->log('error', 'Caught exception message: ' . $e->getMessage());
215
+            return false;
216
+        }
217
+    }
218 218
 
219
-	/**
220
-	 * Register new IP license.
221
-	 *
222
-	 * @param string $ip IP Address
223
-	 * @param integer $type license type (1,2 or 16)
224
-	 * @throws XmlRpcException for critical errors
225
-	 * @return integer 0 on success, -1 on error
226
-	 */
227
-	public function license($ip, $type) {
228
-		$type = (int)$type;
229
-		try {
230
-			$this->log('error', 'Calling License(' . $this->authToken() . ',' . $ip . ',' . $type . ')');
231
-			$this->response = $this->xml_client->license($this->authToken(), $ip, $type);
232
-			$this->log('error', 'Response: ' . var_export($this->response, true));
233
-			return $this->response;
234
-		} catch (Exception $e) {
235
-			$this->log('error', 'Caught exception code: ' . $e->getCode());
236
-			$this->log('error', 'Caught exception message: ' . $e->getMessage());
237
-			return false;
238
-		}
239
-	}
219
+    /**
220
+     * Register new IP license.
221
+     *
222
+     * @param string $ip IP Address
223
+     * @param integer $type license type (1,2 or 16)
224
+     * @throws XmlRpcException for critical errors
225
+     * @return integer 0 on success, -1 on error
226
+     */
227
+    public function license($ip, $type) {
228
+        $type = (int)$type;
229
+        try {
230
+            $this->log('error', 'Calling License(' . $this->authToken() . ',' . $ip . ',' . $type . ')');
231
+            $this->response = $this->xml_client->license($this->authToken(), $ip, $type);
232
+            $this->log('error', 'Response: ' . var_export($this->response, true));
233
+            return $this->response;
234
+        } catch (Exception $e) {
235
+            $this->log('error', 'Caught exception code: ' . $e->getCode());
236
+            $this->log('error', 'Caught exception message: ' . $e->getMessage());
237
+            return false;
238
+        }
239
+    }
240 240
 
241
-	/**
242
-	 * Remove IP licenses with specified type for customer. Also un­registers from CLN server associated with IP.
243
-	 * or
244
-	 * Remove IP licenses with specified type for customer. Also un­registers from CLN server associated with IP.
245
-	 * @param string         $ip   ip address to remove
246
-	 * @param bool|false|int $type optional parameter to specify the type of license to remove (1,2, or 16)
247
-	 * @return integer 0 on success, -1 on error, Error will be returned also if account have no licenses for provided IP.
248
-	 */
249
-	public function remove_license($ip, $type = false) {
250
-		$this->log('info', "Calling CLoudLinux->xml_client->remove_license({$this->authToken()}, {$ip}, {$type})", __LINE__, __FILE__);
251
-		try {
252
-			if ($type === false)
253
-				return $this->response = $this->xml_client->remove_license($this->authToken(), $ip);
254
-			else
255
-				return $this->response = $this->xml_client->remove_license($this->authToken(), $ip, $type);
256
-		} catch (Exception $e) {
257
-			$this->log('error', 'Caught exception code: ' . $e->getCode());
258
-			$this->log('error', 'Caught exception message: ' . $e->getMessage());
259
-			return false;
260
-		}
261
-	}
241
+    /**
242
+     * Remove IP licenses with specified type for customer. Also un­registers from CLN server associated with IP.
243
+     * or
244
+     * Remove IP licenses with specified type for customer. Also un­registers from CLN server associated with IP.
245
+     * @param string         $ip   ip address to remove
246
+     * @param bool|false|int $type optional parameter to specify the type of license to remove (1,2, or 16)
247
+     * @return integer 0 on success, -1 on error, Error will be returned also if account have no licenses for provided IP.
248
+     */
249
+    public function remove_license($ip, $type = false) {
250
+        $this->log('info', "Calling CLoudLinux->xml_client->remove_license({$this->authToken()}, {$ip}, {$type})", __LINE__, __FILE__);
251
+        try {
252
+            if ($type === false)
253
+                return $this->response = $this->xml_client->remove_license($this->authToken(), $ip);
254
+            else
255
+                return $this->response = $this->xml_client->remove_license($this->authToken(), $ip, $type);
256
+        } catch (Exception $e) {
257
+            $this->log('error', 'Caught exception code: ' . $e->getCode());
258
+            $this->log('error', 'Caught exception message: ' . $e->getMessage());
259
+            return false;
260
+        }
261
+    }
262 262
 
263
-	/**
264
-	 * Check if IP license was registered by any customer. Arguments:
265
-	 *
266
-	 * @param string $ip ip address to remove
267
-	 * @param bool $checkAll True will search for any type of license. False ­ only for types 1 or 2
268
-	 * @throws XmlRpcException for critical errors
269
-	 * @return array (list<int>): List of registered license types or empty list if no license found
270
-	 */
271
-	public function is_licensed($ip, $checkAll = true) {
272
-		if ($this->api_type == 'xml')
273
-			return $this->xml_is_licensed($ip, $checkAll);
274
-		else
275
-			return $this->check($ip, $checkAll);
276
-	}
277
-	/**
278
-	 * Check if IP license was registered by any customer. Arguments:
279
-	 *
280
-	 * @param string $ip ip address to remove
281
-	 * @param bool $checkAll True will search for any type of license. False ­ only for types 1 or 2
282
-	 * @throws XmlRpcException for critical errors
283
-	 * @return array (list<int>): List of registered license types or empty list if no license found
284
-	 */
285
-	public function xml_is_licensed($ip, $checkAll = true) {
286
-		try {
287
-			return $this->response = $this->xml_client->is_licensed($this->authToken(), $ip, $checkAll);
288
-		} catch (Exception $e) {
289
-			$this->log('error', 'Caught exception code: ' . $e->getCode());
290
-			$this->log('error', 'Caught exception message: ' . $e->getMessage());
291
-			return false;
292
-		}
293
-	}
263
+    /**
264
+     * Check if IP license was registered by any customer. Arguments:
265
+     *
266
+     * @param string $ip ip address to remove
267
+     * @param bool $checkAll True will search for any type of license. False ­ only for types 1 or 2
268
+     * @throws XmlRpcException for critical errors
269
+     * @return array (list<int>): List of registered license types or empty list if no license found
270
+     */
271
+    public function is_licensed($ip, $checkAll = true) {
272
+        if ($this->api_type == 'xml')
273
+            return $this->xml_is_licensed($ip, $checkAll);
274
+        else
275
+            return $this->check($ip, $checkAll);
276
+    }
277
+    /**
278
+     * Check if IP license was registered by any customer. Arguments:
279
+     *
280
+     * @param string $ip ip address to remove
281
+     * @param bool $checkAll True will search for any type of license. False ­ only for types 1 or 2
282
+     * @throws XmlRpcException for critical errors
283
+     * @return array (list<int>): List of registered license types or empty list if no license found
284
+     */
285
+    public function xml_is_licensed($ip, $checkAll = true) {
286
+        try {
287
+            return $this->response = $this->xml_client->is_licensed($this->authToken(), $ip, $checkAll);
288
+        } catch (Exception $e) {
289
+            $this->log('error', 'Caught exception code: ' . $e->getCode());
290
+            $this->log('error', 'Caught exception message: ' . $e->getMessage());
291
+            return false;
292
+        }
293
+    }
294 294
 
295
-	/**
296
-	 * @return bool|mixed
297
-	 */
298
-	public function license_list() {
299
-		try {
300
-			return json_decode($this->getcurlpage($this->rest_url.'ipl/list.json?token=' . $this->authToken()));
301
-		} catch (Exception $e) {
302
-			$this->log('error', 'Caught exception code: ' . $e->getCode());
303
-			$this->log('error', 'Caught exception message: ' . $e->getMessage());
304
-			return false;
305
-		}
306
-	}
295
+    /**
296
+     * @return bool|mixed
297
+     */
298
+    public function license_list() {
299
+        try {
300
+            return json_decode($this->getcurlpage($this->rest_url.'ipl/list.json?token=' . $this->authToken()));
301
+        } catch (Exception $e) {
302
+            $this->log('error', 'Caught exception code: ' . $e->getCode());
303
+            $this->log('error', 'Caught exception message: ' . $e->getMessage());
304
+            return false;
305
+        }
306
+    }
307 307
 
308
-	/**
309
-	 * Return list of all IP licenses owned by authorized user
310
-	 *
311
-	 * @throws XmlRpcException for critical errors
312
-	 * @return array (list<structure>): List of structures or empty list. Each structure contains keys:
313
-	 * 	IP(string)
314
-	 * 	TYPE(int) ­ license type
315
-	 * 	REGISTERED(boolean) ­ True if server was registered in CLN with this license
316
-	 */
317
-	public function reconcile() {
318
-		try {
319
-			return $this->response = $this->xml_client->reconcile($this->authToken());
320
-		} catch (Exception $e) {
321
-			$this->log('error', 'Caught exception code: ' . $e->getCode());
322
-			$this->log('error', 'Caught exception message: ' . $e->getMessage());
323
-			return false;
324
-		}
325
-	}
308
+    /**
309
+     * Return list of all IP licenses owned by authorized user
310
+     *
311
+     * @throws XmlRpcException for critical errors
312
+     * @return array (list<structure>): List of structures or empty list. Each structure contains keys:
313
+     * 	IP(string)
314
+     * 	TYPE(int) ­ license type
315
+     * 	REGISTERED(boolean) ­ True if server was registered in CLN with this license
316
+     */
317
+    public function reconcile() {
318
+        try {
319
+            return $this->response = $this->xml_client->reconcile($this->authToken());
320
+        } catch (Exception $e) {
321
+            $this->log('error', 'Caught exception code: ' . $e->getCode());
322
+            $this->log('error', 'Caught exception message: ' . $e->getMessage());
323
+            return false;
324
+        }
325
+    }
326 326
 
327
-	/*
327
+    /*
328 328
 	public function getKeyInfo($Key) {
329 329
 	$this->response = $this->xml->__call('partner10.getKeyInfo', array(
330 330
 	$this->AuthInfo(),
Please login to merge, or discard this patch.