@@ -108,6 +108,9 @@ |
||
108 | 108 | return $ret; |
109 | 109 | } |
110 | 110 | |
111 | + /** |
|
112 | + * @param string $level |
|
113 | + */ |
|
111 | 114 | public function log($level, $text, $line = '', $file = '') { |
112 | 115 | if (function_exists('myadmin_log')) |
113 | 116 | myadmin_log('cloudlinux', $level, $text, $line, $file); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if (is_array($postfields)) { |
91 | 91 | $postdata = []; |
92 | 92 | foreach ($postfields as $field => $value) { |
93 | - $postdata[] = $field . '=' . urlencode($value); |
|
93 | + $postdata[] = $field.'='.urlencode($value); |
|
94 | 94 | } |
95 | 95 | curl_setopt($curl, CURLOPT_POSTFIELDS, implode('&', $postdata)); |
96 | 96 | } else { |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | public function authToken() { |
210 | 210 | $time = time(); |
211 | 211 | try { |
212 | - return $this->login . '|' . $time . '|' . sha1($this->key . $time); |
|
212 | + return $this->login.'|'.$time.'|'.sha1($this->key.$time); |
|
213 | 213 | } catch (\Exception $e) { |
214 | - $this->log('error', 'Caught exception code: ' . $e->getCode()); |
|
215 | - $this->log('error', 'Caught exception message: ' . $e->getMessage()); |
|
214 | + $this->log('error', 'Caught exception code: '.$e->getCode()); |
|
215 | + $this->log('error', 'Caught exception message: '.$e->getMessage()); |
|
216 | 216 | return false; |
217 | 217 | } |
218 | 218 | } |
@@ -226,16 +226,16 @@ discard block |
||
226 | 226 | * @return false|integer 0 on success, -1 on error |
227 | 227 | */ |
228 | 228 | public function license($ipAddress, $type) { |
229 | - $type = (int)$type; |
|
229 | + $type = (int) $type; |
|
230 | 230 | $xmlClient = $this->xmlClient; |
231 | 231 | try { |
232 | - $this->log('error', 'Calling License(' . $this->authToken() . ',' . $ipAddress . ',' . $type . ')'); |
|
232 | + $this->log('error', 'Calling License('.$this->authToken().','.$ipAddress.','.$type.')'); |
|
233 | 233 | $this->response = $xmlClient->license($this->authToken(), $ipAddress, $type); |
234 | - $this->log('error', 'Response: ' . var_export($this->response, true)); |
|
234 | + $this->log('error', 'Response: '.var_export($this->response, true)); |
|
235 | 235 | return $this->response; |
236 | 236 | } catch (\Exception $e) { |
237 | - $this->log('error', 'Caught exception code: ' . $e->getCode()); |
|
238 | - $this->log('error', 'Caught exception message: ' . $e->getMessage()); |
|
237 | + $this->log('error', 'Caught exception code: '.$e->getCode()); |
|
238 | + $this->log('error', 'Caught exception message: '.$e->getMessage()); |
|
239 | 239 | return false; |
240 | 240 | } |
241 | 241 | } |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | try { |
254 | 254 | return $this->response = $this->remove($ipAddress, $type); |
255 | 255 | } catch (\Exception $e) { |
256 | - $this->log('error', 'Caught exception code: ' . $e->getCode()); |
|
257 | - $this->log('error', 'Caught exception message: ' . $e->getMessage()); |
|
256 | + $this->log('error', 'Caught exception code: '.$e->getCode()); |
|
257 | + $this->log('error', 'Caught exception message: '.$e->getMessage()); |
|
258 | 258 | return false; |
259 | 259 | } |
260 | 260 | } |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | try { |
287 | 287 | return $this->response = $xmlClient->isLicensed($this->authToken(), $ipAddress, $checkAll); |
288 | 288 | } catch (\Exception $e) { |
289 | - $this->log('error', 'Caught exception code: ' . $e->getCode()); |
|
290 | - $this->log('error', 'Caught exception message: ' . $e->getMessage()); |
|
289 | + $this->log('error', 'Caught exception code: '.$e->getCode()); |
|
290 | + $this->log('error', 'Caught exception message: '.$e->getMessage()); |
|
291 | 291 | return false; |
292 | 292 | } |
293 | 293 | } |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | */ |
298 | 298 | public function licenseList() { |
299 | 299 | try { |
300 | - return json_decode($this->getcurlpage($this->restUrl.'ipl/list.json?token=' . $this->authToken())); |
|
300 | + return json_decode($this->getcurlpage($this->restUrl.'ipl/list.json?token='.$this->authToken())); |
|
301 | 301 | } catch (\Exception $e) { |
302 | - $this->log('error', 'Caught exception code: ' . $e->getCode()); |
|
303 | - $this->log('error', 'Caught exception message: ' . $e->getMessage()); |
|
302 | + $this->log('error', 'Caught exception code: '.$e->getCode()); |
|
303 | + $this->log('error', 'Caught exception message: '.$e->getMessage()); |
|
304 | 304 | return false; |
305 | 305 | } |
306 | 306 | } |
@@ -316,8 +316,8 @@ discard block |
||
316 | 316 | try { |
317 | 317 | return $this->response = $xmlClient->reconcile($this->authToken()); |
318 | 318 | } catch (\Exception $e) { |
319 | - $this->log('error', 'Caught exception code: ' . $e->getCode()); |
|
320 | - $this->log('error', 'Caught exception message: ' . $e->getMessage()); |
|
319 | + $this->log('error', 'Caught exception code: '.$e->getCode()); |
|
320 | + $this->log('error', 'Caught exception message: '.$e->getMessage()); |
|
321 | 321 | return false; |
322 | 322 | } |
323 | 323 | } |