@@ -16,536 +16,536 @@ |
||
| 16 | 16 | class Fantastico |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * All fantastico license types |
|
| 21 | - */ |
|
| 22 | - const ALL_TYPES = 0; |
|
| 19 | + /** |
|
| 20 | + * All fantastico license types |
|
| 21 | + */ |
|
| 22 | + const ALL_TYPES = 0; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Normal/Server license types |
|
| 26 | - */ |
|
| 27 | - const NORMAL_TYPES = 1; |
|
| 24 | + /** |
|
| 25 | + * Normal/Server license types |
|
| 26 | + */ |
|
| 27 | + const NORMAL_TYPES = 1; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * VPS license types |
|
| 31 | - */ |
|
| 32 | - const VPS_TYPES = 2; |
|
| 29 | + /** |
|
| 30 | + * VPS license types |
|
| 31 | + */ |
|
| 32 | + const VPS_TYPES = 2; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * the WSDL API file |
|
| 36 | - */ |
|
| 37 | - public $wsdl = 'https://netenberg.com/api/netenberg.wsdl'; |
|
| 34 | + /** |
|
| 35 | + * the WSDL API file |
|
| 36 | + */ |
|
| 37 | + public $wsdl = 'https://netenberg.com/api/netenberg.wsdl'; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * the username to use for API access |
|
| 41 | - */ |
|
| 42 | - private $api_username; |
|
| 39 | + /** |
|
| 40 | + * the username to use for API access |
|
| 41 | + */ |
|
| 42 | + private $api_username; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * the password to use for api access |
|
| 46 | - */ |
|
| 47 | - private $api_password; |
|
| 44 | + /** |
|
| 45 | + * the password to use for api access |
|
| 46 | + */ |
|
| 47 | + private $api_password; |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * this will hold the soap client, which hopefully we can reuse for multiple queries if need be |
|
| 51 | - */ |
|
| 52 | - private $soapClient; |
|
| 49 | + /** |
|
| 50 | + * this will hold the soap client, which hopefully we can reuse for multiple queries if need be |
|
| 51 | + */ |
|
| 52 | + private $soapClient; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * this will hold responses from the API for future caching use |
|
| 56 | - */ |
|
| 57 | - private $cache; |
|
| 54 | + /** |
|
| 55 | + * this will hold responses from the API for future caching use |
|
| 56 | + */ |
|
| 57 | + private $cache; |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * this holds an array of possible license types you can use and there descriptions |
|
| 61 | - * note the ALL_TYPES is only for listing, you cant buy one thats all_types |
|
| 62 | - */ |
|
| 63 | - public $types = array( |
|
| 64 | - self::ALL_TYPES => 'All IPs', |
|
| 65 | - self::NORMAL_TYPES => 'Normal Licenses', |
|
| 66 | - self::VPS_TYPES => 'VPS Licenses'); |
|
| 59 | + /** |
|
| 60 | + * this holds an array of possible license types you can use and there descriptions |
|
| 61 | + * note the ALL_TYPES is only for listing, you cant buy one thats all_types |
|
| 62 | + */ |
|
| 63 | + public $types = array( |
|
| 64 | + self::ALL_TYPES => 'All IPs', |
|
| 65 | + self::NORMAL_TYPES => 'Normal Licenses', |
|
| 66 | + self::VPS_TYPES => 'VPS Licenses'); |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Fantastico::__construct() |
|
| 70 | - * Starts an instance of the fantastico license API. |
|
| 71 | - * @param string $username username to connect to fantastico api with |
|
| 72 | - * @param string $password password to connect to fantastico api with |
|
| 73 | - * @return \Fantastico |
|
| 74 | - */ |
|
| 75 | - public function __construct($username, $password) { |
|
| 76 | - $this->cache = array(); |
|
| 77 | - $this->soapClient = null; |
|
| 78 | - $this->api_username = $username; |
|
| 79 | - $this->api_password = $password; |
|
| 80 | - } |
|
| 68 | + /** |
|
| 69 | + * Fantastico::__construct() |
|
| 70 | + * Starts an instance of the fantastico license API. |
|
| 71 | + * @param string $username username to connect to fantastico api with |
|
| 72 | + * @param string $password password to connect to fantastico api with |
|
| 73 | + * @return \Fantastico |
|
| 74 | + */ |
|
| 75 | + public function __construct($username, $password) { |
|
| 76 | + $this->cache = array(); |
|
| 77 | + $this->soapClient = null; |
|
| 78 | + $this->api_username = $username; |
|
| 79 | + $this->api_password = $password; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Fantastico::connect() |
|
| 84 | - * function called automatically to ensure that we're connected to the API |
|
| 85 | - * |
|
| 86 | - * @return void |
|
| 87 | - */ |
|
| 88 | - public function connect() { |
|
| 89 | - if (is_null($this->soapClient)) { |
|
| 90 | - ini_set('soap.wsdl_cache_enabled', '0'); |
|
| 91 | - ini_set('max_execution_time', 1000); |
|
| 92 | - ini_set('default_socket_timeout', 1000); |
|
| 93 | - $this->soapClient = new \SoapClient($this->wsdl, array( |
|
| 82 | + /** |
|
| 83 | + * Fantastico::connect() |
|
| 84 | + * function called automatically to ensure that we're connected to the API |
|
| 85 | + * |
|
| 86 | + * @return void |
|
| 87 | + */ |
|
| 88 | + public function connect() { |
|
| 89 | + if (is_null($this->soapClient)) { |
|
| 90 | + ini_set('soap.wsdl_cache_enabled', '0'); |
|
| 91 | + ini_set('max_execution_time', 1000); |
|
| 92 | + ini_set('default_socket_timeout', 1000); |
|
| 93 | + $this->soapClient = new \SoapClient($this->wsdl, array( |
|
| 94 | 94 | |
| 95 | - 'soap_version' => SOAP_1_1, |
|
| 96 | - 'connection_timeout' => 1000, |
|
| 97 | - 'trace' => 1, |
|
| 98 | - 'exception' => 1)); |
|
| 99 | - //require_once (INCLUDE_ROOT . '/../vendor/detain/nusoap/lib/nusoap.php'); |
|
| 100 | - //$this->soapClient = new \nusoap_client($this->wsdl); |
|
| 101 | - } |
|
| 102 | - } |
|
| 95 | + 'soap_version' => SOAP_1_1, |
|
| 96 | + 'connection_timeout' => 1000, |
|
| 97 | + 'trace' => 1, |
|
| 98 | + 'exception' => 1)); |
|
| 99 | + //require_once (INCLUDE_ROOT . '/../vendor/detain/nusoap/lib/nusoap.php'); |
|
| 100 | + //$this->soapClient = new \nusoap_client($this->wsdl); |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Fantastico::get_ip_types() |
|
| 106 | - * returns an array of the possible license types in the format of |
|
| 107 | - * ID => Description |
|
| 108 | - * where ID is the Type ID you need to pass to various functions asking for a license type |
|
| 109 | - * |
|
| 110 | - * @return array returns an array of possible license types and descriptions of them |
|
| 111 | - */ |
|
| 112 | - public function get_ip_types() { |
|
| 113 | - return $this->types; |
|
| 114 | - } |
|
| 104 | + /** |
|
| 105 | + * Fantastico::get_ip_types() |
|
| 106 | + * returns an array of the possible license types in the format of |
|
| 107 | + * ID => Description |
|
| 108 | + * where ID is the Type ID you need to pass to various functions asking for a license type |
|
| 109 | + * |
|
| 110 | + * @return array returns an array of possible license types and descriptions of them |
|
| 111 | + */ |
|
| 112 | + public function get_ip_types() { |
|
| 113 | + return $this->types; |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Fantastico::is_type() |
|
| 118 | - * a check to make sure the passed type is valid |
|
| 119 | - * |
|
| 120 | - * @param mixed the license type your trying to validate |
|
| 121 | - * @return bool whether or not its a valid fantastico license type |
|
| 122 | - */ |
|
| 123 | - public function is_type($type) { |
|
| 124 | - return array_key_exists($type, $this->types); |
|
| 125 | - } |
|
| 116 | + /** |
|
| 117 | + * Fantastico::is_type() |
|
| 118 | + * a check to make sure the passed type is valid |
|
| 119 | + * |
|
| 120 | + * @param mixed the license type your trying to validate |
|
| 121 | + * @return bool whether or not its a valid fantastico license type |
|
| 122 | + */ |
|
| 123 | + public function is_type($type) { |
|
| 124 | + return array_key_exists($type, $this->types); |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * Fantastico::getHash() |
|
| 129 | - * returns the login hash |
|
| 130 | - * |
|
| 131 | - * @return string the login hash |
|
| 132 | - */ |
|
| 133 | - private function getHash() { |
|
| 134 | - return md5($this->api_username . $this->api_password); |
|
| 135 | - } |
|
| 127 | + /** |
|
| 128 | + * Fantastico::getHash() |
|
| 129 | + * returns the login hash |
|
| 130 | + * |
|
| 131 | + * @return string the login hash |
|
| 132 | + */ |
|
| 133 | + private function getHash() { |
|
| 134 | + return md5($this->api_username . $this->api_password); |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - /** |
|
| 138 | - * Fantastico::getIpList() |
|
| 139 | - * returns a list of all license types. |
|
| 140 | - * |
|
| 141 | - * Sample Return Output |
|
| 142 | - * Array |
|
| 143 | - * ( |
|
| 144 | - * [0] => 130.253.175.32 |
|
| 145 | - * [1] => 140.99.16.206 |
|
| 146 | - * [2] => 150.101.195.140 |
|
| 147 | - * ) |
|
| 148 | - * |
|
| 149 | - * @param mixed $type one of the possible fantastico license types, defaults to {@link self::ALL_TYPES} |
|
| 150 | - * @return false|array returns false on error or an array of license details |
|
| 151 | - */ |
|
| 152 | - public function getIpList($type = self::ALL_TYPES) { |
|
| 153 | - if (isset($this->cache['getIpList_' . $type])) { |
|
| 154 | - return $this->cache['getIpList_' . $type]; |
|
| 155 | - } |
|
| 156 | - if (!$this->is_type($type)) { |
|
| 157 | - return false; |
|
| 158 | - } |
|
| 159 | - $this->connect(); |
|
| 160 | - $this->cache['getIpList_' . $type] = json_decode($this->soapClient->getIpList($this->getHash(), $type), true); |
|
| 161 | - return $this->cache['getIpList_' . $type]; |
|
| 162 | - } |
|
| 137 | + /** |
|
| 138 | + * Fantastico::getIpList() |
|
| 139 | + * returns a list of all license types. |
|
| 140 | + * |
|
| 141 | + * Sample Return Output |
|
| 142 | + * Array |
|
| 143 | + * ( |
|
| 144 | + * [0] => 130.253.175.32 |
|
| 145 | + * [1] => 140.99.16.206 |
|
| 146 | + * [2] => 150.101.195.140 |
|
| 147 | + * ) |
|
| 148 | + * |
|
| 149 | + * @param mixed $type one of the possible fantastico license types, defaults to {@link self::ALL_TYPES} |
|
| 150 | + * @return false|array returns false on error or an array of license details |
|
| 151 | + */ |
|
| 152 | + public function getIpList($type = self::ALL_TYPES) { |
|
| 153 | + if (isset($this->cache['getIpList_' . $type])) { |
|
| 154 | + return $this->cache['getIpList_' . $type]; |
|
| 155 | + } |
|
| 156 | + if (!$this->is_type($type)) { |
|
| 157 | + return false; |
|
| 158 | + } |
|
| 159 | + $this->connect(); |
|
| 160 | + $this->cache['getIpList_' . $type] = json_decode($this->soapClient->getIpList($this->getHash(), $type), true); |
|
| 161 | + return $this->cache['getIpList_' . $type]; |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - /** |
|
| 165 | - * Fantastico::getIpListDetailed() |
|
| 166 | - * returns a list of all license types and details about each one |
|
| 167 | - * |
|
| 168 | - * Sample Return Output |
|
| 169 | - * |
|
| 170 | - * |
|
| 171 | - * Array |
|
| 172 | - * ( |
|
| 173 | - * [0] => { |
|
| 174 | - * Array |
|
| 175 | - * ( |
|
| 176 | - * [ipAddress] => 130.253.175.32 |
|
| 177 | - * [addedOn] => 2010-03-01 00:00:00 |
|
| 178 | - * [isVPS] => ( Yes || No ) |
|
| 179 | - * [status] => ( Active || Inactive ) |
|
| 180 | - * ) |
|
| 181 | - * } |
|
| 182 | - * [1] => { |
|
| 183 | - * Array |
|
| 184 | - * ( |
|
| 185 | - * [ipAddress] => 131.253.175.32 |
|
| 186 | - * [addedOn] => 2011-03-01 00:00:00 |
|
| 187 | - * [isVPS] => ( Yes || No ) |
|
| 188 | - * [status] => ( Active || Inactive ) |
|
| 189 | - * ) |
|
| 190 | - * } |
|
| 191 | - * [2] => { |
|
| 192 | - * Array |
|
| 193 | - * ( |
|
| 194 | - * [ipAddress] => 132.253.175.32 |
|
| 195 | - * [addedOn] => 2012-03-01 00:00:00 |
|
| 196 | - * [isVPS] => ( Yes || No ) |
|
| 197 | - * [status] => ( Active || Inactive ) |
|
| 198 | - * ) |
|
| 199 | - * } |
|
| 200 | - * ) |
|
| 201 | - * |
|
| 202 | - * @param mixed $type one of the possible fantastico license types, defaults to {@link self::ALL_TYPES} |
|
| 203 | - * @return false|array returns false on error or an array of license details |
|
| 204 | - */ |
|
| 205 | - public function getIpListDetailed($type = self::ALL_TYPES) { |
|
| 206 | - if (!$this->is_type($type)) { |
|
| 207 | - return false; |
|
| 208 | - } |
|
| 209 | - if (isset($this->cache['getIpListDetailed_' . $type])) { |
|
| 210 | - return $this->cache['getIpListDetailed_' . $type]; |
|
| 211 | - } |
|
| 212 | - $this->connect(); |
|
| 213 | - //try { |
|
| 214 | - $response = json_decode($this->soapClient->__soapCall('getIpListDetailed', array($this->getHash(), $type)), true); |
|
| 215 | - //echo '<pre>';echo print_r($response, true);echo '</pre>'; |
|
| 216 | - //$this->cache['getIpListDetailed_' . $type] = $this->cache['getIpListDetailed_' . $type]->Licenses; |
|
| 217 | - $this->cache['getIpListDetailed_' . $type] = array(); |
|
| 218 | - $this->cache['getIpList_' . $type] = array(); |
|
| 219 | - foreach ($response['Licenses'] as $idx => $data) { |
|
| 220 | - $tdata = array( |
|
| 221 | - 'ipAddress' => $data[0], |
|
| 222 | - 'addedOn' => $data[1], |
|
| 223 | - 'isVPS' => $data[2], |
|
| 224 | - 'status' => $data[3]); |
|
| 225 | - $this->cache['getIpListDetailed_' . $type][] = $tdata; |
|
| 226 | - $this->cache['getIpList_' . $type][] = $tdata['ipAddress']; |
|
| 227 | - $this->cache['getIpDetails_' . $tdata['ipAddress']] = $tdata; |
|
| 228 | - } |
|
| 229 | - //} catch (SoapFault $fault) { |
|
| 230 | - //var_dump($fault); |
|
| 231 | - //var_dump($this->soapClient->__getLastRequest()); |
|
| 232 | - //var_dump($this->soapClient->__getLastResponse()); |
|
| 233 | - //} |
|
| 164 | + /** |
|
| 165 | + * Fantastico::getIpListDetailed() |
|
| 166 | + * returns a list of all license types and details about each one |
|
| 167 | + * |
|
| 168 | + * Sample Return Output |
|
| 169 | + * |
|
| 170 | + * |
|
| 171 | + * Array |
|
| 172 | + * ( |
|
| 173 | + * [0] => { |
|
| 174 | + * Array |
|
| 175 | + * ( |
|
| 176 | + * [ipAddress] => 130.253.175.32 |
|
| 177 | + * [addedOn] => 2010-03-01 00:00:00 |
|
| 178 | + * [isVPS] => ( Yes || No ) |
|
| 179 | + * [status] => ( Active || Inactive ) |
|
| 180 | + * ) |
|
| 181 | + * } |
|
| 182 | + * [1] => { |
|
| 183 | + * Array |
|
| 184 | + * ( |
|
| 185 | + * [ipAddress] => 131.253.175.32 |
|
| 186 | + * [addedOn] => 2011-03-01 00:00:00 |
|
| 187 | + * [isVPS] => ( Yes || No ) |
|
| 188 | + * [status] => ( Active || Inactive ) |
|
| 189 | + * ) |
|
| 190 | + * } |
|
| 191 | + * [2] => { |
|
| 192 | + * Array |
|
| 193 | + * ( |
|
| 194 | + * [ipAddress] => 132.253.175.32 |
|
| 195 | + * [addedOn] => 2012-03-01 00:00:00 |
|
| 196 | + * [isVPS] => ( Yes || No ) |
|
| 197 | + * [status] => ( Active || Inactive ) |
|
| 198 | + * ) |
|
| 199 | + * } |
|
| 200 | + * ) |
|
| 201 | + * |
|
| 202 | + * @param mixed $type one of the possible fantastico license types, defaults to {@link self::ALL_TYPES} |
|
| 203 | + * @return false|array returns false on error or an array of license details |
|
| 204 | + */ |
|
| 205 | + public function getIpListDetailed($type = self::ALL_TYPES) { |
|
| 206 | + if (!$this->is_type($type)) { |
|
| 207 | + return false; |
|
| 208 | + } |
|
| 209 | + if (isset($this->cache['getIpListDetailed_' . $type])) { |
|
| 210 | + return $this->cache['getIpListDetailed_' . $type]; |
|
| 211 | + } |
|
| 212 | + $this->connect(); |
|
| 213 | + //try { |
|
| 214 | + $response = json_decode($this->soapClient->__soapCall('getIpListDetailed', array($this->getHash(), $type)), true); |
|
| 215 | + //echo '<pre>';echo print_r($response, true);echo '</pre>'; |
|
| 216 | + //$this->cache['getIpListDetailed_' . $type] = $this->cache['getIpListDetailed_' . $type]->Licenses; |
|
| 217 | + $this->cache['getIpListDetailed_' . $type] = array(); |
|
| 218 | + $this->cache['getIpList_' . $type] = array(); |
|
| 219 | + foreach ($response['Licenses'] as $idx => $data) { |
|
| 220 | + $tdata = array( |
|
| 221 | + 'ipAddress' => $data[0], |
|
| 222 | + 'addedOn' => $data[1], |
|
| 223 | + 'isVPS' => $data[2], |
|
| 224 | + 'status' => $data[3]); |
|
| 225 | + $this->cache['getIpListDetailed_' . $type][] = $tdata; |
|
| 226 | + $this->cache['getIpList_' . $type][] = $tdata['ipAddress']; |
|
| 227 | + $this->cache['getIpDetails_' . $tdata['ipAddress']] = $tdata; |
|
| 228 | + } |
|
| 229 | + //} catch (SoapFault $fault) { |
|
| 230 | + //var_dump($fault); |
|
| 231 | + //var_dump($this->soapClient->__getLastRequest()); |
|
| 232 | + //var_dump($this->soapClient->__getLastResponse()); |
|
| 233 | + //} |
|
| 234 | 234 | |
| 235 | - //foreach ($this->cache['getIpListDetailed_' . $type] as $idx => $data) |
|
| 236 | - //{ |
|
| 237 | - //$this->cache['getIpList_' . $type][] = $data['ipAddress']; |
|
| 238 | - //$this->cache['getIpDetails_' . $data['ipAddress']] = $data; |
|
| 239 | - //} |
|
| 240 | - //echo '<pre>';print_r($this->cache);echo '</pre>'; |
|
| 241 | - return $this->cache['getIpListDetailed_' . $type]; |
|
| 242 | - } |
|
| 235 | + //foreach ($this->cache['getIpListDetailed_' . $type] as $idx => $data) |
|
| 236 | + //{ |
|
| 237 | + //$this->cache['getIpList_' . $type][] = $data['ipAddress']; |
|
| 238 | + //$this->cache['getIpDetails_' . $data['ipAddress']] = $data; |
|
| 239 | + //} |
|
| 240 | + //echo '<pre>';print_r($this->cache);echo '</pre>'; |
|
| 241 | + return $this->cache['getIpListDetailed_' . $type]; |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | - /** |
|
| 245 | - * Fantastico::valid_ip() |
|
| 246 | - * validates the IP address |
|
| 247 | - * |
|
| 248 | - * @param string $ip IP Address to validate |
|
| 249 | - * @return bool whether or not the ip was validated |
|
| 250 | - */ |
|
| 251 | - public function valid_ip($ip) { |
|
| 252 | - return ip2long($ip) !== false; |
|
| 253 | - } |
|
| 244 | + /** |
|
| 245 | + * Fantastico::valid_ip() |
|
| 246 | + * validates the IP address |
|
| 247 | + * |
|
| 248 | + * @param string $ip IP Address to validate |
|
| 249 | + * @return bool whether or not the ip was validated |
|
| 250 | + */ |
|
| 251 | + public function valid_ip($ip) { |
|
| 252 | + return ip2long($ip) !== false; |
|
| 253 | + } |
|
| 254 | 254 | |
| 255 | - /** |
|
| 256 | - * Fantastico::getIpDetails() |
|
| 257 | - * get details about a license |
|
| 258 | - * |
|
| 259 | - * Output Success |
|
| 260 | - * Array |
|
| 261 | - * ( |
|
| 262 | - * [ipAddress] => 130.253.175.32 |
|
| 263 | - * [addedOn] => 2010-03-01 00:00:00 |
|
| 264 | - * [isVPS] => ( Yes || No ) |
|
| 265 | - * [status] => ( Active || Inactive ) |
|
| 266 | - * ) |
|
| 267 | - * |
|
| 268 | - * |
|
| 269 | - * Output Error |
|
| 270 | - * |
|
| 271 | - * Array |
|
| 272 | - * ( |
|
| 273 | - * [faultcode] => 1801 |
|
| 274 | - * [fault ]=> "The IP Address that you have specified does not exist." |
|
| 275 | - * ) |
|
| 276 | - * |
|
| 277 | - * @param string $ip ip address to get details for |
|
| 278 | - * @return mixed returns false on invalid IP, or an array of the details. |
|
| 279 | - */ |
|
| 280 | - public function getIpDetails($ip) { |
|
| 281 | - if (!$this->valid_ip($ip)) { |
|
| 282 | - return array('faultcode' => 1, 'fault ' => 'Invalid IP Address ' . $ip); |
|
| 283 | - } |
|
| 284 | - if (isset($this->cache['getIpDetails_' . $ip])) { |
|
| 285 | - return $this->cache['getIpDetails_' . $ip]; |
|
| 286 | - } |
|
| 287 | - $this->connect(); |
|
| 288 | - $this->cache['getIpDetails_' . $ip] = $this->soapClient->getIpDetails($this->getHash(), $ip); |
|
| 289 | - return $this->cache['getIpDetails_' . $ip]; |
|
| 290 | - } |
|
| 255 | + /** |
|
| 256 | + * Fantastico::getIpDetails() |
|
| 257 | + * get details about a license |
|
| 258 | + * |
|
| 259 | + * Output Success |
|
| 260 | + * Array |
|
| 261 | + * ( |
|
| 262 | + * [ipAddress] => 130.253.175.32 |
|
| 263 | + * [addedOn] => 2010-03-01 00:00:00 |
|
| 264 | + * [isVPS] => ( Yes || No ) |
|
| 265 | + * [status] => ( Active || Inactive ) |
|
| 266 | + * ) |
|
| 267 | + * |
|
| 268 | + * |
|
| 269 | + * Output Error |
|
| 270 | + * |
|
| 271 | + * Array |
|
| 272 | + * ( |
|
| 273 | + * [faultcode] => 1801 |
|
| 274 | + * [fault ]=> "The IP Address that you have specified does not exist." |
|
| 275 | + * ) |
|
| 276 | + * |
|
| 277 | + * @param string $ip ip address to get details for |
|
| 278 | + * @return mixed returns false on invalid IP, or an array of the details. |
|
| 279 | + */ |
|
| 280 | + public function getIpDetails($ip) { |
|
| 281 | + if (!$this->valid_ip($ip)) { |
|
| 282 | + return array('faultcode' => 1, 'fault ' => 'Invalid IP Address ' . $ip); |
|
| 283 | + } |
|
| 284 | + if (isset($this->cache['getIpDetails_' . $ip])) { |
|
| 285 | + return $this->cache['getIpDetails_' . $ip]; |
|
| 286 | + } |
|
| 287 | + $this->connect(); |
|
| 288 | + $this->cache['getIpDetails_' . $ip] = $this->soapClient->getIpDetails($this->getHash(), $ip); |
|
| 289 | + return $this->cache['getIpDetails_' . $ip]; |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * Fantastico::editIp() |
|
| 294 | - * changes the IP address of a license |
|
| 295 | - * |
|
| 296 | - * |
|
| 297 | - * Output Success |
|
| 298 | - * |
|
| 299 | - * Array |
|
| 300 | - * ( |
|
| 301 | - * ["ip"]=>"130.253.175.32" |
|
| 302 | - * ["new_ip"]=>"130.253.175.33" |
|
| 303 | - * |
|
| 304 | - * ) |
|
| 305 | - * |
|
| 306 | - * |
|
| 307 | - * Output Error |
|
| 308 | - * |
|
| 309 | - * Array |
|
| 310 | - * ( |
|
| 311 | - * [faultcode] => 1704 |
|
| 312 | - * [fault ]=> "The new IP Address that you have specified is not a valid cPanel IP Address." |
|
| 313 | - * ) |
|
| 314 | - * |
|
| 315 | - * Array |
|
| 316 | - * ( |
|
| 317 | - * [faultcode] => 1705 |
|
| 318 | - * [fault ]=> "The new IP Address that you have specified is not a valid cPanel IP Address." |
|
| 319 | - * ) |
|
| 320 | - * |
|
| 321 | - * Array |
|
| 322 | - * ( |
|
| 323 | - * [faultcode] => 1703 |
|
| 324 | - * [fault ]=> "The IP Address that you have specified is not a valid VPS IP Address." |
|
| 325 | - * ) |
|
| 326 | - * |
|
| 327 | - * Array |
|
| 328 | - * ( |
|
| 329 | - * [faultcode] => 1804 |
|
| 330 | - * [fault ]=> "The IP Address that you have specified already exists." |
|
| 331 | - * ) |
|
| 332 | - * |
|
| 333 | - * Array |
|
| 334 | - * ( |
|
| 335 | - * [faultcode] => 1801 |
|
| 336 | - * [fault ]=> "The IP Address that you have specified does not exist." |
|
| 337 | - * ) |
|
| 338 | - * |
|
| 339 | - * |
|
| 340 | - * |
|
| 341 | - * Array |
|
| 342 | - * ( |
|
| 343 | - * [faultcode] => 1401 |
|
| 344 | - * [fault ]=> "You are trying to access the API from a server whose IP Address is not authorized." |
|
| 345 | - * ) |
|
| 346 | - * |
|
| 347 | - * Array |
|
| 348 | - * ( |
|
| 349 | - * [faultcode] => 1302 |
|
| 350 | - * [fault ]=> "You have specified an invalid hash." |
|
| 351 | - * ) |
|
| 352 | - * |
|
| 353 | - * |
|
| 354 | - * @param mixed $ip old ip address currently licensed |
|
| 355 | - * @param mixed $newip new ip address to change i tot |
|
| 356 | - * @return array returns an array of ip and newip or a fault and faultcode |
|
| 357 | - */ |
|
| 358 | - public function editIp($ip, $newip) { |
|
| 359 | - if (!$this->valid_ip($ip)) { |
|
| 360 | - $response = ['faultcode' => 1, 'fault' => 'Invalid IP Address ' . $ip]; |
|
| 361 | - } elseif (!$this->valid_ip($newip)) { |
|
| 362 | - $response = ['faultcode' => 2, 'fault' => 'Invalid IP Address ' . $newip]; |
|
| 363 | - } else { |
|
| 364 | - $this->connect(); |
|
| 365 | - $response = $this->soapClient->editIp($this->getHash(), $ip, $newip); |
|
| 366 | - if (isset($response['fault '])) { |
|
| 367 | - $response['fault'] = $response['fault ']; |
|
| 368 | - unset($response['fault ']); |
|
| 369 | - } |
|
| 370 | - } |
|
| 371 | - $this->cache = []; |
|
| 372 | - return $response; |
|
| 373 | - } |
|
| 292 | + /** |
|
| 293 | + * Fantastico::editIp() |
|
| 294 | + * changes the IP address of a license |
|
| 295 | + * |
|
| 296 | + * |
|
| 297 | + * Output Success |
|
| 298 | + * |
|
| 299 | + * Array |
|
| 300 | + * ( |
|
| 301 | + * ["ip"]=>"130.253.175.32" |
|
| 302 | + * ["new_ip"]=>"130.253.175.33" |
|
| 303 | + * |
|
| 304 | + * ) |
|
| 305 | + * |
|
| 306 | + * |
|
| 307 | + * Output Error |
|
| 308 | + * |
|
| 309 | + * Array |
|
| 310 | + * ( |
|
| 311 | + * [faultcode] => 1704 |
|
| 312 | + * [fault ]=> "The new IP Address that you have specified is not a valid cPanel IP Address." |
|
| 313 | + * ) |
|
| 314 | + * |
|
| 315 | + * Array |
|
| 316 | + * ( |
|
| 317 | + * [faultcode] => 1705 |
|
| 318 | + * [fault ]=> "The new IP Address that you have specified is not a valid cPanel IP Address." |
|
| 319 | + * ) |
|
| 320 | + * |
|
| 321 | + * Array |
|
| 322 | + * ( |
|
| 323 | + * [faultcode] => 1703 |
|
| 324 | + * [fault ]=> "The IP Address that you have specified is not a valid VPS IP Address." |
|
| 325 | + * ) |
|
| 326 | + * |
|
| 327 | + * Array |
|
| 328 | + * ( |
|
| 329 | + * [faultcode] => 1804 |
|
| 330 | + * [fault ]=> "The IP Address that you have specified already exists." |
|
| 331 | + * ) |
|
| 332 | + * |
|
| 333 | + * Array |
|
| 334 | + * ( |
|
| 335 | + * [faultcode] => 1801 |
|
| 336 | + * [fault ]=> "The IP Address that you have specified does not exist." |
|
| 337 | + * ) |
|
| 338 | + * |
|
| 339 | + * |
|
| 340 | + * |
|
| 341 | + * Array |
|
| 342 | + * ( |
|
| 343 | + * [faultcode] => 1401 |
|
| 344 | + * [fault ]=> "You are trying to access the API from a server whose IP Address is not authorized." |
|
| 345 | + * ) |
|
| 346 | + * |
|
| 347 | + * Array |
|
| 348 | + * ( |
|
| 349 | + * [faultcode] => 1302 |
|
| 350 | + * [fault ]=> "You have specified an invalid hash." |
|
| 351 | + * ) |
|
| 352 | + * |
|
| 353 | + * |
|
| 354 | + * @param mixed $ip old ip address currently licensed |
|
| 355 | + * @param mixed $newip new ip address to change i tot |
|
| 356 | + * @return array returns an array of ip and newip or a fault and faultcode |
|
| 357 | + */ |
|
| 358 | + public function editIp($ip, $newip) { |
|
| 359 | + if (!$this->valid_ip($ip)) { |
|
| 360 | + $response = ['faultcode' => 1, 'fault' => 'Invalid IP Address ' . $ip]; |
|
| 361 | + } elseif (!$this->valid_ip($newip)) { |
|
| 362 | + $response = ['faultcode' => 2, 'fault' => 'Invalid IP Address ' . $newip]; |
|
| 363 | + } else { |
|
| 364 | + $this->connect(); |
|
| 365 | + $response = $this->soapClient->editIp($this->getHash(), $ip, $newip); |
|
| 366 | + if (isset($response['fault '])) { |
|
| 367 | + $response['fault'] = $response['fault ']; |
|
| 368 | + unset($response['fault ']); |
|
| 369 | + } |
|
| 370 | + } |
|
| 371 | + $this->cache = []; |
|
| 372 | + return $response; |
|
| 373 | + } |
|
| 374 | 374 | |
| 375 | - /** |
|
| 376 | - * Fantastico::addIp() |
|
| 377 | - * adds a new license into the system |
|
| 378 | - * |
|
| 379 | - * Output Success |
|
| 380 | - * |
|
| 381 | - * Array |
|
| 382 | - * ( |
|
| 383 | - * ["ip"]=>"130.253.175.32" |
|
| 384 | - * ["id"]=>"112461" * |
|
| 385 | - * ) |
|
| 386 | - * |
|
| 387 | - * |
|
| 388 | - * Output Error |
|
| 389 | - * |
|
| 390 | - * Array |
|
| 391 | - * ( |
|
| 392 | - * [faultcode] => 1704 |
|
| 393 | - * [fault ]=> "The new IP Address that you have specified is not a valid cPanel IP Address." |
|
| 394 | - * ) |
|
| 395 | - * |
|
| 396 | - * Array |
|
| 397 | - * ( |
|
| 398 | - * [faultcode] => 1705 |
|
| 399 | - * [fault ]=> "The new IP Address that you have specified is not a valid cPanel IP Address." |
|
| 400 | - * ) |
|
| 401 | - * |
|
| 402 | - * Array |
|
| 403 | - * ( |
|
| 404 | - * [faultcode] => 1703 |
|
| 405 | - * [fault ]=> "The IP Address that you have specified is not a valid VPS IP Address." |
|
| 406 | - * ) |
|
| 407 | - * |
|
| 408 | - * Array |
|
| 409 | - * ( |
|
| 410 | - * [faultcode] => 1804 |
|
| 411 | - * [fault ]=> "The IP Address that you have specified already exists." |
|
| 412 | - * ) |
|
| 413 | - * |
|
| 414 | - * Array |
|
| 415 | - * ( |
|
| 416 | - * [faultcode] => 1603 |
|
| 417 | - * [fault ]=> "You are not allowed to add any more IP Addresses because you have reached your IP Address quota." |
|
| 418 | - * ) |
|
| 419 | - * |
|
| 420 | - * Array |
|
| 421 | - * ( |
|
| 422 | - * [faultcode] => 1401 |
|
| 423 | - * [fault ]=> "You are trying to access the API from a server whose IP Address is not authorized." |
|
| 424 | - * ) |
|
| 425 | - * |
|
| 426 | - * Array |
|
| 427 | - * ( |
|
| 428 | - * [faultcode] => 1302 |
|
| 429 | - * [fault ]=> "You have specified an invalid hash." |
|
| 430 | - * ) |
|
| 431 | - * |
|
| 432 | - * |
|
| 433 | - * @param string $ip ip address |
|
| 434 | - * @param integer $type license type |
|
| 435 | - * @return array response array containing a faultcode and fault, or ip and id on success |
|
| 436 | - */ |
|
| 437 | - public function addIp($ip, $type) { |
|
| 438 | - if (!$this->valid_ip($ip)) { |
|
| 439 | - $response = ['faultcode' => 1, 'fault' => 'Invalid IP Address ' . $ip]; |
|
| 440 | - } else { |
|
| 441 | - $this->connect(); |
|
| 442 | - $response = $this->soapClient->addIp($this->getHash(), $ip, $type); |
|
| 443 | - if (isset($response['fault '])) { |
|
| 444 | - $response['fault'] = $response['fault ']; |
|
| 445 | - unset($response['fault ']); |
|
| 446 | - } |
|
| 447 | - } |
|
| 448 | - $this->cache = []; |
|
| 449 | - return $response; |
|
| 450 | - } |
|
| 375 | + /** |
|
| 376 | + * Fantastico::addIp() |
|
| 377 | + * adds a new license into the system |
|
| 378 | + * |
|
| 379 | + * Output Success |
|
| 380 | + * |
|
| 381 | + * Array |
|
| 382 | + * ( |
|
| 383 | + * ["ip"]=>"130.253.175.32" |
|
| 384 | + * ["id"]=>"112461" * |
|
| 385 | + * ) |
|
| 386 | + * |
|
| 387 | + * |
|
| 388 | + * Output Error |
|
| 389 | + * |
|
| 390 | + * Array |
|
| 391 | + * ( |
|
| 392 | + * [faultcode] => 1704 |
|
| 393 | + * [fault ]=> "The new IP Address that you have specified is not a valid cPanel IP Address." |
|
| 394 | + * ) |
|
| 395 | + * |
|
| 396 | + * Array |
|
| 397 | + * ( |
|
| 398 | + * [faultcode] => 1705 |
|
| 399 | + * [fault ]=> "The new IP Address that you have specified is not a valid cPanel IP Address." |
|
| 400 | + * ) |
|
| 401 | + * |
|
| 402 | + * Array |
|
| 403 | + * ( |
|
| 404 | + * [faultcode] => 1703 |
|
| 405 | + * [fault ]=> "The IP Address that you have specified is not a valid VPS IP Address." |
|
| 406 | + * ) |
|
| 407 | + * |
|
| 408 | + * Array |
|
| 409 | + * ( |
|
| 410 | + * [faultcode] => 1804 |
|
| 411 | + * [fault ]=> "The IP Address that you have specified already exists." |
|
| 412 | + * ) |
|
| 413 | + * |
|
| 414 | + * Array |
|
| 415 | + * ( |
|
| 416 | + * [faultcode] => 1603 |
|
| 417 | + * [fault ]=> "You are not allowed to add any more IP Addresses because you have reached your IP Address quota." |
|
| 418 | + * ) |
|
| 419 | + * |
|
| 420 | + * Array |
|
| 421 | + * ( |
|
| 422 | + * [faultcode] => 1401 |
|
| 423 | + * [fault ]=> "You are trying to access the API from a server whose IP Address is not authorized." |
|
| 424 | + * ) |
|
| 425 | + * |
|
| 426 | + * Array |
|
| 427 | + * ( |
|
| 428 | + * [faultcode] => 1302 |
|
| 429 | + * [fault ]=> "You have specified an invalid hash." |
|
| 430 | + * ) |
|
| 431 | + * |
|
| 432 | + * |
|
| 433 | + * @param string $ip ip address |
|
| 434 | + * @param integer $type license type |
|
| 435 | + * @return array response array containing a faultcode and fault, or ip and id on success |
|
| 436 | + */ |
|
| 437 | + public function addIp($ip, $type) { |
|
| 438 | + if (!$this->valid_ip($ip)) { |
|
| 439 | + $response = ['faultcode' => 1, 'fault' => 'Invalid IP Address ' . $ip]; |
|
| 440 | + } else { |
|
| 441 | + $this->connect(); |
|
| 442 | + $response = $this->soapClient->addIp($this->getHash(), $ip, $type); |
|
| 443 | + if (isset($response['fault '])) { |
|
| 444 | + $response['fault'] = $response['fault ']; |
|
| 445 | + unset($response['fault ']); |
|
| 446 | + } |
|
| 447 | + } |
|
| 448 | + $this->cache = []; |
|
| 449 | + return $response; |
|
| 450 | + } |
|
| 451 | 451 | |
| 452 | - /** |
|
| 453 | - * deactivateIp() |
|
| 454 | - * Deactivates a Fantastico IP License |
|
| 455 | - * Output Success |
|
| 456 | - * Array |
|
| 457 | - * ( |
|
| 458 | - * [ipAddress] => 130.253.175.32 |
|
| 459 | - * [addedOn] => 2010-03-01 00:00:00 |
|
| 460 | - * [isVPS] => ( Yes || No ) |
|
| 461 | - * [status] => ( Active || Inactive ) |
|
| 462 | - * ) |
|
| 463 | - * |
|
| 464 | - * Output Error |
|
| 465 | - * Array |
|
| 466 | - * ( |
|
| 467 | - * [faultcode] => 1801 |
|
| 468 | - * [fault ]=> "The IP Address that you have specified does not exist." |
|
| 469 | - * ) |
|
| 470 | - * |
|
| 471 | - * @param mixed $ip |
|
| 472 | - * @return void |
|
| 473 | - */ |
|
| 474 | - public function deactivateIp($ip) { |
|
| 475 | - if (!$this->valid_ip($ip)) { |
|
| 476 | - return array('faultcode' => 1, 'fault ' => 'Invalid IP Address ' . $ip); |
|
| 477 | - } |
|
| 478 | - $this->connect(); |
|
| 479 | - $response = $this->soapClient->deactivateIp($this->getHash(), $ip); |
|
| 480 | - $this->cache = array(); |
|
| 481 | - return $response; |
|
| 452 | + /** |
|
| 453 | + * deactivateIp() |
|
| 454 | + * Deactivates a Fantastico IP License |
|
| 455 | + * Output Success |
|
| 456 | + * Array |
|
| 457 | + * ( |
|
| 458 | + * [ipAddress] => 130.253.175.32 |
|
| 459 | + * [addedOn] => 2010-03-01 00:00:00 |
|
| 460 | + * [isVPS] => ( Yes || No ) |
|
| 461 | + * [status] => ( Active || Inactive ) |
|
| 462 | + * ) |
|
| 463 | + * |
|
| 464 | + * Output Error |
|
| 465 | + * Array |
|
| 466 | + * ( |
|
| 467 | + * [faultcode] => 1801 |
|
| 468 | + * [fault ]=> "The IP Address that you have specified does not exist." |
|
| 469 | + * ) |
|
| 470 | + * |
|
| 471 | + * @param mixed $ip |
|
| 472 | + * @return void |
|
| 473 | + */ |
|
| 474 | + public function deactivateIp($ip) { |
|
| 475 | + if (!$this->valid_ip($ip)) { |
|
| 476 | + return array('faultcode' => 1, 'fault ' => 'Invalid IP Address ' . $ip); |
|
| 477 | + } |
|
| 478 | + $this->connect(); |
|
| 479 | + $response = $this->soapClient->deactivateIp($this->getHash(), $ip); |
|
| 480 | + $this->cache = array(); |
|
| 481 | + return $response; |
|
| 482 | 482 | |
| 483 | - } |
|
| 483 | + } |
|
| 484 | 484 | |
| 485 | - /** |
|
| 486 | - * reactivateIp() |
|
| 487 | - * Deactivates a Fantastico IP License |
|
| 488 | - * Output Success |
|
| 489 | - * Array |
|
| 490 | - * ( |
|
| 491 | - * [ipAddress] => 130.253.175.32 |
|
| 492 | - * [addedOn] => 2010-03-01 00:00:00 |
|
| 493 | - * [isVPS] => ( Yes || No ) |
|
| 494 | - * [status] => ( Active || Inactive ) |
|
| 495 | - * ) |
|
| 496 | - * |
|
| 497 | - * Output Error |
|
| 498 | - * Array |
|
| 499 | - * ( |
|
| 500 | - * [faultcode] => 1801 |
|
| 501 | - * [fault ]=> "The IP Address that you have specified does not exist." |
|
| 502 | - * ) |
|
| 503 | - * |
|
| 504 | - * @param mixed $ip |
|
| 505 | - * @return void |
|
| 506 | - */ |
|
| 507 | - public function reactivateIp($ip) { |
|
| 508 | - if (!$this->valid_ip($ip)) { |
|
| 509 | - return array('faultcode' => 1, 'fault ' => 'Invalid IP Address ' . $ip); |
|
| 510 | - } |
|
| 511 | - $this->connect(); |
|
| 512 | - $response = $this->soapClient->reactivateIp($this->getHash(), $ip); |
|
| 513 | - $this->cache = array(); |
|
| 514 | - return $response; |
|
| 485 | + /** |
|
| 486 | + * reactivateIp() |
|
| 487 | + * Deactivates a Fantastico IP License |
|
| 488 | + * Output Success |
|
| 489 | + * Array |
|
| 490 | + * ( |
|
| 491 | + * [ipAddress] => 130.253.175.32 |
|
| 492 | + * [addedOn] => 2010-03-01 00:00:00 |
|
| 493 | + * [isVPS] => ( Yes || No ) |
|
| 494 | + * [status] => ( Active || Inactive ) |
|
| 495 | + * ) |
|
| 496 | + * |
|
| 497 | + * Output Error |
|
| 498 | + * Array |
|
| 499 | + * ( |
|
| 500 | + * [faultcode] => 1801 |
|
| 501 | + * [fault ]=> "The IP Address that you have specified does not exist." |
|
| 502 | + * ) |
|
| 503 | + * |
|
| 504 | + * @param mixed $ip |
|
| 505 | + * @return void |
|
| 506 | + */ |
|
| 507 | + public function reactivateIp($ip) { |
|
| 508 | + if (!$this->valid_ip($ip)) { |
|
| 509 | + return array('faultcode' => 1, 'fault ' => 'Invalid IP Address ' . $ip); |
|
| 510 | + } |
|
| 511 | + $this->connect(); |
|
| 512 | + $response = $this->soapClient->reactivateIp($this->getHash(), $ip); |
|
| 513 | + $this->cache = array(); |
|
| 514 | + return $response; |
|
| 515 | 515 | |
| 516 | - } |
|
| 516 | + } |
|
| 517 | 517 | |
| 518 | - /** |
|
| 519 | - * deleteIp() |
|
| 520 | - * Deletes a Fantastico IP License |
|
| 521 | - * |
|
| 522 | - * Output Success |
|
| 523 | - * |
|
| 524 | - * Array |
|
| 525 | - * ( |
|
| 526 | - * [ip] => 130.253.175.32 |
|
| 527 | - * [deleted] => "Yes" |
|
| 528 | - * ) |
|
| 529 | - * |
|
| 530 | - * Output Error |
|
| 531 | - * |
|
| 532 | - * Array |
|
| 533 | - * ( |
|
| 534 | - * [faultcode] => 1801 |
|
| 535 | - * [fault ]=> "The IP Address that you have specified does not exist." |
|
| 536 | - * ) |
|
| 537 | - * |
|
| 538 | - * @param mixed $ip |
|
| 539 | - * @return void |
|
| 540 | - */ |
|
| 541 | - public function deleteIp($ip) { |
|
| 542 | - if (!$this->valid_ip($ip)) { |
|
| 543 | - return array('faultcode' => 1, 'fault ' => 'Invalid IP Address ' . $ip); |
|
| 544 | - } |
|
| 545 | - $this->connect(); |
|
| 546 | - $response = $this->soapClient->deleteIp($this->getHash(), $ip); |
|
| 547 | - $this->cache = array(); |
|
| 548 | - return $response; |
|
| 549 | - } |
|
| 518 | + /** |
|
| 519 | + * deleteIp() |
|
| 520 | + * Deletes a Fantastico IP License |
|
| 521 | + * |
|
| 522 | + * Output Success |
|
| 523 | + * |
|
| 524 | + * Array |
|
| 525 | + * ( |
|
| 526 | + * [ip] => 130.253.175.32 |
|
| 527 | + * [deleted] => "Yes" |
|
| 528 | + * ) |
|
| 529 | + * |
|
| 530 | + * Output Error |
|
| 531 | + * |
|
| 532 | + * Array |
|
| 533 | + * ( |
|
| 534 | + * [faultcode] => 1801 |
|
| 535 | + * [fault ]=> "The IP Address that you have specified does not exist." |
|
| 536 | + * ) |
|
| 537 | + * |
|
| 538 | + * @param mixed $ip |
|
| 539 | + * @return void |
|
| 540 | + */ |
|
| 541 | + public function deleteIp($ip) { |
|
| 542 | + if (!$this->valid_ip($ip)) { |
|
| 543 | + return array('faultcode' => 1, 'fault ' => 'Invalid IP Address ' . $ip); |
|
| 544 | + } |
|
| 545 | + $this->connect(); |
|
| 546 | + $response = $this->soapClient->deleteIp($this->getHash(), $ip); |
|
| 547 | + $this->cache = array(); |
|
| 548 | + return $response; |
|
| 549 | + } |
|
| 550 | 550 | |
| 551 | 551 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * @return string the login hash |
| 132 | 132 | */ |
| 133 | 133 | private function getHash() { |
| 134 | - return md5($this->api_username . $this->api_password); |
|
| 134 | + return md5($this->api_username.$this->api_password); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -150,15 +150,15 @@ discard block |
||
| 150 | 150 | * @return false|array returns false on error or an array of license details |
| 151 | 151 | */ |
| 152 | 152 | public function getIpList($type = self::ALL_TYPES) { |
| 153 | - if (isset($this->cache['getIpList_' . $type])) { |
|
| 154 | - return $this->cache['getIpList_' . $type]; |
|
| 153 | + if (isset($this->cache['getIpList_'.$type])) { |
|
| 154 | + return $this->cache['getIpList_'.$type]; |
|
| 155 | 155 | } |
| 156 | 156 | if (!$this->is_type($type)) { |
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | 159 | $this->connect(); |
| 160 | - $this->cache['getIpList_' . $type] = json_decode($this->soapClient->getIpList($this->getHash(), $type), true); |
|
| 161 | - return $this->cache['getIpList_' . $type]; |
|
| 160 | + $this->cache['getIpList_'.$type] = json_decode($this->soapClient->getIpList($this->getHash(), $type), true); |
|
| 161 | + return $this->cache['getIpList_'.$type]; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -206,25 +206,25 @@ discard block |
||
| 206 | 206 | if (!$this->is_type($type)) { |
| 207 | 207 | return false; |
| 208 | 208 | } |
| 209 | - if (isset($this->cache['getIpListDetailed_' . $type])) { |
|
| 210 | - return $this->cache['getIpListDetailed_' . $type]; |
|
| 209 | + if (isset($this->cache['getIpListDetailed_'.$type])) { |
|
| 210 | + return $this->cache['getIpListDetailed_'.$type]; |
|
| 211 | 211 | } |
| 212 | 212 | $this->connect(); |
| 213 | 213 | //try { |
| 214 | 214 | $response = json_decode($this->soapClient->__soapCall('getIpListDetailed', array($this->getHash(), $type)), true); |
| 215 | 215 | //echo '<pre>';echo print_r($response, true);echo '</pre>'; |
| 216 | 216 | //$this->cache['getIpListDetailed_' . $type] = $this->cache['getIpListDetailed_' . $type]->Licenses; |
| 217 | - $this->cache['getIpListDetailed_' . $type] = array(); |
|
| 218 | - $this->cache['getIpList_' . $type] = array(); |
|
| 217 | + $this->cache['getIpListDetailed_'.$type] = array(); |
|
| 218 | + $this->cache['getIpList_'.$type] = array(); |
|
| 219 | 219 | foreach ($response['Licenses'] as $idx => $data) { |
| 220 | 220 | $tdata = array( |
| 221 | 221 | 'ipAddress' => $data[0], |
| 222 | 222 | 'addedOn' => $data[1], |
| 223 | 223 | 'isVPS' => $data[2], |
| 224 | 224 | 'status' => $data[3]); |
| 225 | - $this->cache['getIpListDetailed_' . $type][] = $tdata; |
|
| 226 | - $this->cache['getIpList_' . $type][] = $tdata['ipAddress']; |
|
| 227 | - $this->cache['getIpDetails_' . $tdata['ipAddress']] = $tdata; |
|
| 225 | + $this->cache['getIpListDetailed_'.$type][] = $tdata; |
|
| 226 | + $this->cache['getIpList_'.$type][] = $tdata['ipAddress']; |
|
| 227 | + $this->cache['getIpDetails_'.$tdata['ipAddress']] = $tdata; |
|
| 228 | 228 | } |
| 229 | 229 | //} catch (SoapFault $fault) { |
| 230 | 230 | //var_dump($fault); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | //$this->cache['getIpDetails_' . $data['ipAddress']] = $data; |
| 239 | 239 | //} |
| 240 | 240 | //echo '<pre>';print_r($this->cache);echo '</pre>'; |
| 241 | - return $this->cache['getIpListDetailed_' . $type]; |
|
| 241 | + return $this->cache['getIpListDetailed_'.$type]; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -279,14 +279,14 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | public function getIpDetails($ip) { |
| 281 | 281 | if (!$this->valid_ip($ip)) { |
| 282 | - return array('faultcode' => 1, 'fault ' => 'Invalid IP Address ' . $ip); |
|
| 282 | + return array('faultcode' => 1, 'fault ' => 'Invalid IP Address '.$ip); |
|
| 283 | 283 | } |
| 284 | - if (isset($this->cache['getIpDetails_' . $ip])) { |
|
| 285 | - return $this->cache['getIpDetails_' . $ip]; |
|
| 284 | + if (isset($this->cache['getIpDetails_'.$ip])) { |
|
| 285 | + return $this->cache['getIpDetails_'.$ip]; |
|
| 286 | 286 | } |
| 287 | 287 | $this->connect(); |
| 288 | - $this->cache['getIpDetails_' . $ip] = $this->soapClient->getIpDetails($this->getHash(), $ip); |
|
| 289 | - return $this->cache['getIpDetails_' . $ip]; |
|
| 288 | + $this->cache['getIpDetails_'.$ip] = $this->soapClient->getIpDetails($this->getHash(), $ip); |
|
| 289 | + return $this->cache['getIpDetails_'.$ip]; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
@@ -357,9 +357,9 @@ discard block |
||
| 357 | 357 | */ |
| 358 | 358 | public function editIp($ip, $newip) { |
| 359 | 359 | if (!$this->valid_ip($ip)) { |
| 360 | - $response = ['faultcode' => 1, 'fault' => 'Invalid IP Address ' . $ip]; |
|
| 360 | + $response = ['faultcode' => 1, 'fault' => 'Invalid IP Address '.$ip]; |
|
| 361 | 361 | } elseif (!$this->valid_ip($newip)) { |
| 362 | - $response = ['faultcode' => 2, 'fault' => 'Invalid IP Address ' . $newip]; |
|
| 362 | + $response = ['faultcode' => 2, 'fault' => 'Invalid IP Address '.$newip]; |
|
| 363 | 363 | } else { |
| 364 | 364 | $this->connect(); |
| 365 | 365 | $response = $this->soapClient->editIp($this->getHash(), $ip, $newip); |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | */ |
| 437 | 437 | public function addIp($ip, $type) { |
| 438 | 438 | if (!$this->valid_ip($ip)) { |
| 439 | - $response = ['faultcode' => 1, 'fault' => 'Invalid IP Address ' . $ip]; |
|
| 439 | + $response = ['faultcode' => 1, 'fault' => 'Invalid IP Address '.$ip]; |
|
| 440 | 440 | } else { |
| 441 | 441 | $this->connect(); |
| 442 | 442 | $response = $this->soapClient->addIp($this->getHash(), $ip, $type); |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | */ |
| 474 | 474 | public function deactivateIp($ip) { |
| 475 | 475 | if (!$this->valid_ip($ip)) { |
| 476 | - return array('faultcode' => 1, 'fault ' => 'Invalid IP Address ' . $ip); |
|
| 476 | + return array('faultcode' => 1, 'fault ' => 'Invalid IP Address '.$ip); |
|
| 477 | 477 | } |
| 478 | 478 | $this->connect(); |
| 479 | 479 | $response = $this->soapClient->deactivateIp($this->getHash(), $ip); |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | */ |
| 507 | 507 | public function reactivateIp($ip) { |
| 508 | 508 | if (!$this->valid_ip($ip)) { |
| 509 | - return array('faultcode' => 1, 'fault ' => 'Invalid IP Address ' . $ip); |
|
| 509 | + return array('faultcode' => 1, 'fault ' => 'Invalid IP Address '.$ip); |
|
| 510 | 510 | } |
| 511 | 511 | $this->connect(); |
| 512 | 512 | $response = $this->soapClient->reactivateIp($this->getHash(), $ip); |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | */ |
| 541 | 541 | public function deleteIp($ip) { |
| 542 | 542 | if (!$this->valid_ip($ip)) { |
| 543 | - return array('faultcode' => 1, 'fault ' => 'Invalid IP Address ' . $ip); |
|
| 543 | + return array('faultcode' => 1, 'fault ' => 'Invalid IP Address '.$ip); |
|
| 544 | 544 | } |
| 545 | 545 | $this->connect(); |
| 546 | 546 | $response = $this->soapClient->deleteIp($this->getHash(), $ip); |