Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
detain committed Jun 16, 2017
1 parent 3d3f6ce commit bde4e77
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/Cloudlinux.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
*
* @access public
*/
class Cloudlinux
{
class Cloudlinux {
private $login = '';
private $key = '';
public $prefix = 'registration.';
Expand Down Expand Up @@ -78,7 +77,7 @@ public function __construct($login, $key, $apiType = 'rest') {
*/
public function authToken() {
$time = time();
return $this->login . '|' . $time . '|' . sha1($this->key . $time);
return $this->login.'|'.$time.'|'.sha1($this->key.$time);
}

/**
Expand Down Expand Up @@ -169,8 +168,8 @@ public function xmlIsLicensed($ipAddress, $checkAll = true) {
try {
return $this->response = $xmlClient->is_licensed($this->authToken(), $ipAddress, $checkAll);
} catch (\Exception $e) {
$this->log('error', 'Caught exception code: ' . $e->getCode());
$this->log('error', 'Caught exception message: ' . $e->getMessage());
$this->log('error', 'Caught exception code: '.$e->getCode());
$this->log('error', 'Caught exception message: '.$e->getMessage());
return false;
}
}
Expand Down Expand Up @@ -229,8 +228,8 @@ public function removeLicense($ipAddress, $type = 0) {
try {
return $this->response = $this->xmlClient->remove_license($this->authToken(), $ipAddress, $type);
} catch (\Exception $e) {
$this->log('error', 'Caught exception code: ' . $e->getCode());
$this->log('error', 'Caught exception message: ' . $e->getMessage());
$this->log('error', 'Caught exception code: '.$e->getCode());
$this->log('error', 'Caught exception message: '.$e->getMessage());
return false;
}
}
Expand Down Expand Up @@ -258,7 +257,7 @@ public function removeLicense($ipAddress, $type = 0) {
* @return false|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
*/
public function restList() {
$this->response = $this->getcurlpage($this->restUrl.'ipl/list.json?token=' . $this->authToken());
$this->response = $this->getcurlpage($this->restUrl.'ipl/list.json?token='.$this->authToken());
return json_decode($this->response, true);
}

Expand Down Expand Up @@ -294,14 +293,14 @@ public function licenseList() {
* @return false|integer 0 on success, -1 on error
*/
public function license($ipAddress, $type) {
$type = (int)$type;
$type = (int) $type;
$xmlClient = $this->xmlClient;
try {
$this->log('error', 'Calling License(' . $this->authToken() . ',' . $ipAddress . ',' . $type . ')');
$this->log('error', 'Calling License('.$this->authToken().','.$ipAddress.','.$type.')');
return $this->response = $xmlClient->license($this->authToken(), $ipAddress, $type);
} catch (\Exception $e) {
$this->log('error', 'Caught exception code: ' . $e->getCode());
$this->log('error', 'Caught exception message: ' . $e->getMessage());
$this->log('error', 'Caught exception code: '.$e->getCode());
$this->log('error', 'Caught exception message: '.$e->getMessage());
return false;
}
}
Expand Down

0 comments on commit bde4e77

Please sign in to comment.