Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
detain committed Apr 4, 2019
1 parent edbe5c6 commit 5cb19c7
Showing 1 changed file with 36 additions and 30 deletions.
66 changes: 36 additions & 30 deletions src/Fantastico.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,13 @@ public function getIpList($type = self::ALL_TYPES)
return false;
}
$this->connect();
\StatisticClient::tick('Fantastico', 'getIpList');
\StatisticClient::tick('Fantastico', 'getIpList');
$this->cache['getIpList_'.$type] = json_decode($this->soapClient->getIpList($this->getHash(), $type), true);
if ($this->cache['getIpList_'.$type] === false)
\StatisticClient::report('Fantastico', 'getIpList', false, 1, 'Soap Client Error', STATISTICS_SERVER);
else
\StatisticClient::report('Fantastico', 'getIpList', true, 0, '', STATISTICS_SERVER);
if ($this->cache['getIpList_'.$type] === false) {
\StatisticClient::report('Fantastico', 'getIpList', false, 1, 'Soap Client Error', STATISTICS_SERVER);
} else {
\StatisticClient::report('Fantastico', 'getIpList', true, 0, '', STATISTICS_SERVER);
}
myadmin_log('fantastico', 'debug', json_encode($this->cache['getIpList_'.$type]), __LINE__, __FILE__);
return $this->cache['getIpList_'.$type];
}
Expand Down Expand Up @@ -239,12 +240,13 @@ public function getIpListDetailed($type = self::ALL_TYPES)
}
$this->connect();
//try {
\StatisticClient::tick('Fantastico', 'getIpListDetailed');
\StatisticClient::tick('Fantastico', 'getIpListDetailed');
$response = json_decode($this->soapClient->__soapCall('getIpListDetailed', [$this->getHash(), $type]), true);
if ($response === false)
\StatisticClient::report('Fantastico', 'getIpListDetailed', false, 1, 'Soap Client Error', STATISTICS_SERVER);
else
\StatisticClient::report('Fantastico', 'getIpListDetailed', true, 0, '', STATISTICS_SERVER);
if ($response === false) {
\StatisticClient::report('Fantastico', 'getIpListDetailed', false, 1, 'Soap Client Error', STATISTICS_SERVER);
} else {
\StatisticClient::report('Fantastico', 'getIpListDetailed', true, 0, '', STATISTICS_SERVER);
}
myadmin_log('fantastico', 'debug', json_encode($response), __LINE__, __FILE__);
//echo '<pre>';echo print_r($response, TRUE);echo '</pre>';
//$this->cache['getIpListDetailed_'.$type] = $this->cache['getIpListDetailed_'.$type]->Licenses;
Expand Down Expand Up @@ -323,12 +325,13 @@ public function getIpDetails($ipAddress)
return $this->cache['getIpDetails_'.$ipAddress];
}
$this->connect();
\StatisticClient::tick('Fantastico', 'getIpDetails');
\StatisticClient::tick('Fantastico', 'getIpDetails');
$this->cache['getIpDetails_'.$ipAddress] = json_decode($this->soapClient->getIpDetails($this->getHash(), $ipAddress), true);
if ($this->cache['getIpDetails_'.$ipAddress] === false)
\StatisticClient::report('Fantastico', 'getIpDetails', false, 1, 'Soap Client Error', STATISTICS_SERVER);
else
\StatisticClient::report('Fantastico', 'getIpDetails', true, 0, '', STATISTICS_SERVER);
if ($this->cache['getIpDetails_'.$ipAddress] === false) {
\StatisticClient::report('Fantastico', 'getIpDetails', false, 1, 'Soap Client Error', STATISTICS_SERVER);
} else {
\StatisticClient::report('Fantastico', 'getIpDetails', true, 0, '', STATISTICS_SERVER);
}
myadmin_log('fantastico', 'debug', json_encode($this->cache['getIpDetails_'.$ipAddress]), __LINE__, __FILE__);
return $this->cache['getIpDetails_'.$ipAddress];
}
Expand Down Expand Up @@ -407,12 +410,13 @@ public function editIp($ipAddress, $newip)
$response = ['faultcode' => 2, 'fault' => 'Invalid IP Address '.$newip];
} else {
$this->connect();
\StatisticClient::tick('Fantastico', 'editIp');
\StatisticClient::tick('Fantastico', 'editIp');
$response = json_decode($this->soapClient->editIp($this->getHash(), $ipAddress, $newip), true);
if ($response === false)
\StatisticClient::report('Fantastico', 'editIp', false, 1, 'Soap Client Error', STATISTICS_SERVER);
else
\StatisticClient::report('Fantastico', 'editIp', true, 0, '', STATISTICS_SERVER);
if ($response === false) {
\StatisticClient::report('Fantastico', 'editIp', false, 1, 'Soap Client Error', STATISTICS_SERVER);
} else {
\StatisticClient::report('Fantastico', 'editIp', true, 0, '', STATISTICS_SERVER);
}
myadmin_log('fantastico', 'debug', json_encode($response), __LINE__, __FILE__);
if (isset($response['fault '])) {
$response['fault'] = $response['fault '];
Expand Down Expand Up @@ -491,12 +495,13 @@ public function addIp($ipAddress, $type)
$response = ['faultcode' => 1, 'fault' => 'Invalid IP Address '.$ipAddress];
} else {
$this->connect();
\StatisticClient::tick('Fantastico', 'addIp');
\StatisticClient::tick('Fantastico', 'addIp');
$response = json_decode($this->soapClient->addIp($this->getHash(), $ipAddress, $type), true);
if ($response === false)
\StatisticClient::report('Fantastico', 'addIp', false, 1, 'Soap Client Error', STATISTICS_SERVER);
else
\StatisticClient::report('Fantastico', 'addIp', true, 0, '', STATISTICS_SERVER);
if ($response === false) {
\StatisticClient::report('Fantastico', 'addIp', false, 1, 'Soap Client Error', STATISTICS_SERVER);
} else {
\StatisticClient::report('Fantastico', 'addIp', true, 0, '', STATISTICS_SERVER);
}
myadmin_log('fantastico', 'debug', json_encode($response), __LINE__, __FILE__);
if (isset($response['fault '])) {
$response['fault'] = $response['fault '];
Expand All @@ -518,12 +523,13 @@ private function soapIpFunction($function, $ipAddress)
return ['faultcode' => 1, 'fault ' => 'Invalid IP Address '.$ipAddress];
}
$this->connect();
\StatisticClient::tick('Fantastico', $function);
\StatisticClient::tick('Fantastico', $function);
$response = json_decode($this->soapClient->$function($this->getHash(), $ipAddress), true);
if ($response === false)
\StatisticClient::report('Fantastico', $function, false, 1, 'Soap Client Error', STATISTICS_SERVER);
else
\StatisticClient::report('Fantastico', $function, true, 0, '', STATISTICS_SERVER);
if ($response === false) {
\StatisticClient::report('Fantastico', $function, false, 1, 'Soap Client Error', STATISTICS_SERVER);
} else {
\StatisticClient::report('Fantastico', $function, true, 0, '', STATISTICS_SERVER);
}
myadmin_log('fantastico', 'debug', json_encode($response), __LINE__, __FILE__);
$this->cache = [];
return $response;
Expand Down

0 comments on commit 5cb19c7

Please sign in to comment.