| @@ -57,8 +57,9 @@ discard block | ||
| 57 | 57 | $this->login = $login; | 
| 58 | 58 | $this->key = $key; | 
| 59 | 59 | $this->apiType = $apiType; | 
| 60 | - if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) | |
| 61 | -			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input'); | |
| 60 | +		if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) { | |
| 61 | +					$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input'); | |
| 62 | + } | |
| 62 | 63 |  		//if ($this->apiType == 'xml') { | 
| 63 | 64 |  			include_once('XML/RPC2/Client.php'); | 
| 64 | 65 | $this->xmlOptions['prefix'] = $this->prefix; | 
| @@ -108,10 +109,11 @@ discard block | ||
| 108 | 109 | } | 
| 109 | 110 | |
| 110 | 111 |  	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); | |
| 112 | +		if (function_exists('myadmin_log')) { | |
| 113 | +					myadmin_log('cloudlinux', $level, $text, $line, $file); | |
| 114 | +		} else { | |
| 115 | + error_log($text); | |
| 116 | + } | |
| 115 | 117 | } | 
| 116 | 118 | |
| 117 | 119 | /** | 
| @@ -143,10 +145,11 @@ discard block | ||
| 143 | 145 |  	public function check($ipAddress) { | 
| 144 | 146 | $this->response = $this->getcurlpage($this->restUrl.'ipl/check.json?ip='.$ipAddress.'&token='.$this->authToken(), '', $this->restOptions); | 
| 145 | 147 | $response = json_decode($this->response, true); | 
| 146 | - if ($response['success'] == 1) | |
| 147 | - return $response['data']; | |
| 148 | - else | |
| 149 | - return false; | |
| 148 | +		if ($response['success'] == 1) { | |
| 149 | + return $response['data']; | |
| 150 | +		} else { | |
| 151 | + return false; | |
| 152 | + } | |
| 150 | 153 | } | 
| 151 | 154 | |
| 152 | 155 | /** | 
| @@ -169,10 +172,11 @@ discard block | ||
| 169 | 172 | * @return bool | 
| 170 | 173 | */ | 
| 171 | 174 |  	public function restRemove($ipAddress, $type = 0) { | 
| 172 | - if ($type != 0) | |
| 173 | - $this->response = $this->getcurlpage($this->restUrl.'ipl/remove.json?ip='.$ipAddress.'&type='.$type.'&token='.$this->authToken(), '', $this->restOptions); | |
| 174 | - else | |
| 175 | - $this->response = $this->getcurlpage($this->restUrl.'ipl/remove.json?ip='.$ipAddress.'&token='.$this->authToken(), '', $this->restOptions); | |
| 175 | +		if ($type != 0) { | |
| 176 | + $this->response = $this->getcurlpage($this->restUrl.'ipl/remove.json?ip='.$ipAddress.'&type='.$type.'&token='.$this->authToken(), '', $this->restOptions); | |
| 177 | +		} else { | |
| 178 | + $this->response = $this->getcurlpage($this->restUrl.'ipl/remove.json?ip='.$ipAddress.'&token='.$this->authToken(), '', $this->restOptions); | |
| 179 | + } | |
| 176 | 180 | return json_decode($this->response, true); | 
| 177 | 181 | } | 
| 178 | 182 | |
| @@ -184,10 +188,11 @@ discard block | ||
| 184 | 188 | * @return bool | 
| 185 | 189 | */ | 
| 186 | 190 |  	public function remove($ipAddress, $type = 0) { | 
| 187 | - if ($this->apiType == 'xml') | |
| 188 | - return $this->removeLicense($ipAddress, $type); | |
| 189 | - else | |
| 190 | - return $this->restRemove($ipAddress, $type); | |
| 191 | +		if ($this->apiType == 'xml') { | |
| 192 | + return $this->removeLicense($ipAddress, $type); | |
| 193 | +		} else { | |
| 194 | + return $this->restRemove($ipAddress, $type); | |
| 195 | + } | |
| 191 | 196 | } | 
| 192 | 197 | |
| 193 | 198 | /** | 
| @@ -249,10 +254,11 @@ discard block | ||
| 249 | 254 |  	public function removeLicense($ipAddress, $type = false) { | 
| 250 | 255 |  		$this->log('info', "Calling CLoudLinux->xmlClient->removeLicense({$this->authToken()}, {$ipAddress}, {$type})", __LINE__, __FILE__); | 
| 251 | 256 |  		try { | 
| 252 | - if ($type === false) | |
| 253 | - return $this->response = $this->remove($ipAddress); | |
| 254 | - else | |
| 255 | - return $this->response = $this->remove($ipAddress, $type); | |
| 257 | +			if ($type === false) { | |
| 258 | + return $this->response = $this->remove($ipAddress); | |
| 259 | +			} else { | |
| 260 | + return $this->response = $this->remove($ipAddress, $type); | |
| 261 | + } | |
| 256 | 262 |  		} catch (Exception $e) { | 
| 257 | 263 |  			$this->log('error', 'Caught exception code: ' . $e->getCode()); | 
| 258 | 264 |  			$this->log('error', 'Caught exception message: ' . $e->getMessage()); | 
| @@ -269,10 +275,11 @@ discard block | ||
| 269 | 275 | * @return array (list<int>): List of registered license types or empty list if no license found | 
| 270 | 276 | */ | 
| 271 | 277 |  	public function isLicensed($ipAddress, $checkAll = true) { | 
| 272 | - if ($this->apiType == 'xml') | |
| 273 | - return $this->xmlIsLicensed($ipAddress, $checkAll); | |
| 274 | - else | |
| 275 | - return $this->check($ipAddress, $checkAll); | |
| 278 | +		if ($this->apiType == 'xml') { | |
| 279 | + return $this->xmlIsLicensed($ipAddress, $checkAll); | |
| 280 | +		} else { | |
| 281 | + return $this->check($ipAddress, $checkAll); | |
| 282 | + } | |
| 276 | 283 | } | 
| 277 | 284 | /** | 
| 278 | 285 | * Check if IP license was registered by any customer. Arguments: |