mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-04-19 20:09:14 +03:00
Add record and catch Exceptions
This commit is contained in:
parent
e2034c5861
commit
5161f7102b
1 changed files with 8 additions and 3 deletions
11
zones.php
11
zones.php
|
@ -277,6 +277,7 @@ if (isset($_GET['action'])) {
|
||||||
jtable_respond(null, 'error', 'No action given');
|
jtable_respond(null, 'error', 'No action given');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
$api = new PdnsAPI;
|
$api = new PdnsAPI;
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
|
@ -442,10 +443,11 @@ case "update":
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "createrecord":
|
case "createrecord":
|
||||||
$zone = get_zone_by_url(isset($_GET['zoneurl']) ? $_GET['zoneurl'] : '');
|
$zone = new Zone();
|
||||||
$record = create_record($zone, $_POST);
|
$zone->parse($api->loadzone($_GET['zoneid']));
|
||||||
|
$record = $zone->addrecord($_POST['name'], $_POST['type'], $_POST['content'], $_POST['disabled'], $_POST['ttl']);
|
||||||
|
$api->savezone($zone->export());
|
||||||
|
|
||||||
$record['id'] = json_encode($record);
|
|
||||||
jtable_respond($record, 'single');
|
jtable_respond($record, 'single');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -524,3 +526,6 @@ default:
|
||||||
jtable_respond(null, 'error', 'No such action');
|
jtable_respond(null, 'error', 'No such action');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
jtable_respond(null, 'error', $e->getMessage());
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue