mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-04-20 20:13:40 +03:00
Fix all kind of development and trying code.
This commit is contained in:
parent
ccf90cab61
commit
a94d0e0b31
4 changed files with 32 additions and 24 deletions
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include_once('../config.inc.php');
|
include_once('includes/config.inc.php');
|
||||||
|
|
||||||
class ApiHandler {
|
class ApiHandler {
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
@ -89,11 +89,11 @@ class ApiHandler {
|
||||||
|
|
||||||
curl_setopt($this->curlh, CURLOPT_URL, $this->baseurl().$this->url);
|
curl_setopt($this->curlh, CURLOPT_URL, $this->baseurl().$this->url);
|
||||||
|
|
||||||
print "Here we go:\n";
|
//print "Here we go:\n";
|
||||||
print "Request: ".$this->method.' '.$this->baseurl().$this->url."\n";
|
//print "Request: ".$this->method.' '.$this->baseurl().$this->url."\n";
|
||||||
if ($this->content != '') {
|
//if ($this->content != '') {
|
||||||
print "Content: ".$this->content."\n";
|
// print "Content: ".$this->content."\n";
|
||||||
}
|
//}
|
||||||
|
|
||||||
$return = curl_exec($this->curlh);
|
$return = curl_exec($this->curlh);
|
||||||
$code = curl_getinfo($this->curlh, CURLINFO_HTTP_CODE);
|
$code = curl_getinfo($this->curlh, CURLINFO_HTTP_CODE);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include_once('apihandler.php');
|
include_once('ApiHandler.php');
|
||||||
|
|
||||||
class PdnsAPI {
|
class PdnsAPI {
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
@ -84,7 +84,7 @@ class PdnsAPI {
|
||||||
$ret = array();
|
$ret = array();
|
||||||
$api = clone $this->http;
|
$api = clone $this->http;
|
||||||
$api->method = 'GET';
|
$api->method = 'GET';
|
||||||
$api->url = "/servers/localhost/zones/$zoneid/cryptokeys"
|
$api->url = "/servers/localhost/zones/$zoneid/cryptokeys";
|
||||||
|
|
||||||
$api->call();
|
$api->call();
|
||||||
|
|
||||||
|
|
|
@ -25,23 +25,28 @@ class Zone {
|
||||||
$this->setaccount($data['account']);
|
$this->setaccount($data['account']);
|
||||||
$this->setserial($data['serial']);
|
$this->setserial($data['serial']);
|
||||||
$this->url = $data['url'];
|
$this->url = $data['url'];
|
||||||
$this->setsoaedit($data['soa_edit']);
|
if (isset($data['soa_edit']))
|
||||||
$this->setsoaeditapi($data['soa_edit_api']);
|
$this->setsoaedit($data['soa_edit']);
|
||||||
|
if (isset($data['soa_edit_api']))
|
||||||
|
$this->setsoaeditapi($data['soa_edit_api']);
|
||||||
|
|
||||||
foreach ($data['masters'] as $master) {
|
foreach ($data['masters'] as $master) {
|
||||||
$this->addmaster($master);
|
$this->addmaster($master);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($data['rrsets'] as $rrset) {
|
if (isset($data['rrsets'])) {
|
||||||
$toadd = new RRSet($rrset['name'], $rrset['type']);
|
foreach ($data['rrsets'] as $rrset) {
|
||||||
foreach ($rrset['comments'] as $comment) {
|
$toadd = new RRSet($rrset['name'], $rrset['type']);
|
||||||
$toadd->addComment($comment['content'], $comment['account'], $comment['modified_at']);
|
foreach ($rrset['comments'] as $comment) {
|
||||||
|
$toadd->addComment($comment['content'], $comment['account'], $comment['modified_at']);
|
||||||
|
}
|
||||||
|
foreach ($rrset['records'] as $record) {
|
||||||
|
$toadd->addRecord($record['content'], $record['disabled']);
|
||||||
|
}
|
||||||
|
$toadd->setttl($rrset['ttl']);
|
||||||
|
array_push($this->rrsets, $toadd);
|
||||||
}
|
}
|
||||||
foreach ($rrset['records'] as $record) {
|
}
|
||||||
$toadd->addRecord($record['content'], $record['disabled']);
|
|
||||||
}
|
|
||||||
$toadd->setttl($rrset['ttl']);
|
|
||||||
array_push($this->rrsets, $toadd); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setkeyinfo($info) {
|
public function setkeyinfo($info) {
|
||||||
|
|
13
zones.php
13
zones.php
|
@ -3,8 +3,8 @@
|
||||||
include_once('includes/config.inc.php');
|
include_once('includes/config.inc.php');
|
||||||
include_once('includes/session.inc.php');
|
include_once('includes/session.inc.php');
|
||||||
include_once('includes/misc.inc.php');
|
include_once('includes/misc.inc.php');
|
||||||
include_once('include/class/PdnsAPI.php');
|
include_once('includes/class/PdnsApi.php');
|
||||||
include_once('include/class/Zone.php');
|
include_once('includes/class/Zone.php');
|
||||||
|
|
||||||
if (!is_csrf_safe()) {
|
if (!is_csrf_safe()) {
|
||||||
header('Status: 403');
|
header('Status: 403');
|
||||||
|
@ -283,15 +283,18 @@ switch ($action) {
|
||||||
|
|
||||||
case "list":
|
case "list":
|
||||||
case "listslaves":
|
case "listslaves":
|
||||||
|
$return = Array();
|
||||||
$q = isset($_POST['domsearch']) ? $_POST['domsearch'] : false;
|
$q = isset($_POST['domsearch']) ? $_POST['domsearch'] : false;
|
||||||
foreach ($api->listzones($q) as $zone) {
|
foreach ($api->listzones($q) as $sresult) {
|
||||||
$zone->setaccount(get_zone_owner($zone['name'], 'admin'));
|
$zone = new Zone();
|
||||||
|
$zone->parse($sresult);
|
||||||
|
$zone->setaccount(get_zone_owner($zone->name, 'admin'));
|
||||||
|
|
||||||
if (!check_owner($zone))
|
if (!check_owner($zone))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ($action == "listslaves" and $zone->kind == "Slave") {
|
if ($action == "listslaves" and $zone->kind == "Slave") {
|
||||||
array_push($return, $zone);
|
array_push($return, $zone->export());
|
||||||
} elseif ($action == "list" and $zone->kind != "Slave") {
|
} elseif ($action == "list" and $zone->kind != "Slave") {
|
||||||
if ($zone->dnssec) {
|
if ($zone->dnssec) {
|
||||||
$zone->setkeyinfo($api->getzonekeys($zone->id));
|
$zone->setkeyinfo($api->getzonekeys($zone->id));
|
||||||
|
|
Loading…
Add table
Reference in a new issue