@@ -85,8 +85,6 @@ discard block |
||
85 | 85 | * gets a webpage via curl and returns the response. |
86 | 86 | * also it sets a mozilla type agent. |
87 | 87 | * @param string $url the url of the page you want |
88 | - * @param string $postfields postfields in the format of "v1=10&v2=20&v3=30" |
|
89 | - * @param string|array $options |
|
90 | 88 | * @return string the webpage |
91 | 89 | */ |
92 | 90 | public function getcurlpage($url) { |
@@ -103,6 +101,9 @@ discard block |
||
103 | 101 | return $return; |
104 | 102 | } |
105 | 103 | |
104 | + /** |
|
105 | + * @param string $level |
|
106 | + */ |
|
106 | 107 | public function log($level, $text, $line = '', $file = '') { |
107 | 108 | if (function_exists('myadmin_log')) |
108 | 109 | myadmin_log('cloudlinux', $level, $text, $line, $file); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function authToken() { |
79 | 79 | $time = time(); |
80 | - return $this->login . '|' . $time . '|' . sha1($this->key . $time); |
|
80 | + return $this->login.'|'.$time.'|'.sha1($this->key.$time); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | try { |
173 | 173 | $this->response = $xmlClient->is_licensed($this->authToken(), $ipAddress, $checkAll); |
174 | 174 | } catch (\Exception $e) { |
175 | - $this->log('error', 'Caught exception code: ' . $e->getCode()); |
|
176 | - $this->log('error', 'Caught exception message: ' . $e->getMessage()); |
|
175 | + $this->log('error', 'Caught exception code: '.$e->getCode()); |
|
176 | + $this->log('error', 'Caught exception message: '.$e->getMessage()); |
|
177 | 177 | return false; |
178 | 178 | } |
179 | 179 | return $this->response; |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | try { |
234 | 234 | $this->response = $this->remove($ipAddress, $type); |
235 | 235 | } catch (\Exception $e) { |
236 | - $this->log('error', 'Caught exception code: ' . $e->getCode()); |
|
237 | - $this->log('error', 'Caught exception message: ' . $e->getMessage()); |
|
236 | + $this->log('error', 'Caught exception code: '.$e->getCode()); |
|
237 | + $this->log('error', 'Caught exception message: '.$e->getMessage()); |
|
238 | 238 | return false; |
239 | 239 | } |
240 | 240 | return $this->response; |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function restList() { |
266 | 266 | try { |
267 | - $this->response = $this->getcurlpage($this->restUrl.'ipl/list.json?token=' . $this->authToken()); |
|
267 | + $this->response = $this->getcurlpage($this->restUrl.'ipl/list.json?token='.$this->authToken()); |
|
268 | 268 | } catch (\Exception $e) { |
269 | - $this->log('error', 'Caught exception code: ' . $e->getCode()); |
|
270 | - $this->log('error', 'Caught exception message: ' . $e->getMessage()); |
|
269 | + $this->log('error', 'Caught exception code: '.$e->getCode()); |
|
270 | + $this->log('error', 'Caught exception message: '.$e->getMessage()); |
|
271 | 271 | return false; |
272 | 272 | } |
273 | 273 | return json_decode($this->response, true); |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | try { |
285 | 285 | $this->response = $xmlClient->reconcile($this->authToken()); |
286 | 286 | } catch (\Exception $e) { |
287 | - $this->log('error', 'Caught exception code: ' . $e->getCode()); |
|
288 | - $this->log('error', 'Caught exception message: ' . $e->getMessage()); |
|
287 | + $this->log('error', 'Caught exception code: '.$e->getCode()); |
|
288 | + $this->log('error', 'Caught exception message: '.$e->getMessage()); |
|
289 | 289 | return false; |
290 | 290 | } |
291 | 291 | return $this->response; |
@@ -312,16 +312,16 @@ discard block |
||
312 | 312 | * @return false|integer 0 on success, -1 on error |
313 | 313 | */ |
314 | 314 | public function license($ipAddress, $type) { |
315 | - $type = (int)$type; |
|
315 | + $type = (int) $type; |
|
316 | 316 | $xmlClient = $this->xmlClient; |
317 | 317 | try { |
318 | - $this->log('error', 'Calling License(' . $this->authToken() . ',' . $ipAddress . ',' . $type . ')'); |
|
318 | + $this->log('error', 'Calling License('.$this->authToken().','.$ipAddress.','.$type.')'); |
|
319 | 319 | $this->response = $xmlClient->license($this->authToken(), $ipAddress, $type); |
320 | - $this->log('error', 'Response: ' . var_export($this->response, true)); |
|
320 | + $this->log('error', 'Response: '.var_export($this->response, true)); |
|
321 | 321 | return $this->response; |
322 | 322 | } catch (\Exception $e) { |
323 | - $this->log('error', 'Caught exception code: ' . $e->getCode()); |
|
324 | - $this->log('error', 'Caught exception message: ' . $e->getMessage()); |
|
323 | + $this->log('error', 'Caught exception code: '.$e->getCode()); |
|
324 | + $this->log('error', 'Caught exception message: '.$e->getMessage()); |
|
325 | 325 | return false; |
326 | 326 | } |
327 | 327 | } |