mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-04-18 19:59:30 +03:00
Fixed from paulgiordanozethcon suggestion in https://github.com/tuxis-ie/nsedit/issues/162
This commit is contained in:
parent
ebd12ebeb2
commit
805176648d
2 changed files with 11 additions and 10 deletions
|
@ -29,11 +29,12 @@ class ApiHandler {
|
|||
private function apiurl() {
|
||||
$tmp = new ApiHandler();
|
||||
|
||||
$tmp->url = '/api';
|
||||
$tmp->url = '/api/v1/servers/localhost';
|
||||
$tmp->go();
|
||||
|
||||
if ($tmp->json[0]['version'] <= 1) {
|
||||
$this->apiurl = $tmp->json[0]['url'];
|
||||
$v = intval(substr($tmp->json["version"],0,1));
|
||||
if ($v == 4) {
|
||||
$this->apiurl = $tmp->json["url"];
|
||||
} else {
|
||||
throw new Exception("Unsupported API version");
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class PdnsAPI {
|
|||
$api = clone $this->http;
|
||||
$api->method = 'GET';
|
||||
if ($q) {
|
||||
$api->url = "/servers/localhost/search-data?q=*".$q."*&max=25";
|
||||
$api->url = "/search-data?q=*".$q."*&max=25";
|
||||
$api->call();
|
||||
$ret = Array();
|
||||
$seen = Array();
|
||||
|
@ -28,7 +28,7 @@ class PdnsAPI {
|
|||
|
||||
return $ret;
|
||||
}
|
||||
$api->url = "/servers/localhost/zones";
|
||||
$api->url = "/zones";
|
||||
$api->call();
|
||||
|
||||
return $api->json;
|
||||
|
@ -37,7 +37,7 @@ class PdnsAPI {
|
|||
public function loadzone($zoneid) {
|
||||
$api = clone $this->http;
|
||||
$api->method = 'GET';
|
||||
$api->url = "/servers/localhost/zones/$zoneid";
|
||||
$api->url = "/zones/$zoneid";
|
||||
$api->call();
|
||||
|
||||
return $api->json;
|
||||
|
@ -46,7 +46,7 @@ class PdnsAPI {
|
|||
public function exportzone($zoneid) {
|
||||
$api = clone $this->http;
|
||||
$api->method = 'GET';
|
||||
$api->url = "/servers/localhost/zones/$zoneid/export";
|
||||
$api->url = "/zones/$zoneid/export";
|
||||
$api->call();
|
||||
|
||||
return $api->json;
|
||||
|
@ -64,7 +64,7 @@ class PdnsAPI {
|
|||
|
||||
if (!isset($zone['serial']) or gettype($zone['serial']) != 'integer') {
|
||||
$api->method = 'POST';
|
||||
$api->url = '/servers/localhost/zones';
|
||||
$api->url = '/localhost/zones';
|
||||
$api->content = json_encode($zonedata);
|
||||
$api->call();
|
||||
|
||||
|
@ -88,7 +88,7 @@ class PdnsAPI {
|
|||
public function deletezone($zoneid) {
|
||||
$api = clone $this->http;
|
||||
$api->method = 'DELETE';
|
||||
$api->url = "/servers/localhost/zones/$zoneid";
|
||||
$api->url = "/zones/$zoneid";
|
||||
$api->call();
|
||||
|
||||
return $api->json;
|
||||
|
@ -98,7 +98,7 @@ class PdnsAPI {
|
|||
$ret = array();
|
||||
$api = clone $this->http;
|
||||
$api->method = 'GET';
|
||||
$api->url = "/servers/localhost/zones/$zoneid/cryptokeys";
|
||||
$api->url = "/zones/$zoneid/cryptokeys";
|
||||
|
||||
$api->call();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue