Added functionality for native zones

This commit is contained in:
Lukas Metzger 2016-05-03 17:42:34 +02:00
parent d14c64043c
commit 3a3855e939
5 changed files with 17 additions and 3 deletions

View file

@ -23,6 +23,8 @@ require_once '../lib/soa-mail.php';
$input = json_decode(file_get_contents('php://input'));
error_log($input->type);
if(!isset($input->csrfToken) || $input->csrfToken !== $_SESSION['csrfToken']) {
echo "Permission denied!";
exit();
@ -47,8 +49,8 @@ if(isset($input->action) && $input->action == "addDomain") {
$db->autocommit(false);
$stmt = $db->prepare("INSERT INTO domains(name,type) VALUES (?,'MASTER')");
$stmt->bind_param("s", $input->name);
$stmt = $db->prepare("INSERT INTO domains(name,type) VALUES (?,?)");
$stmt->bind_param("ss", $input->name, $input->type);
$stmt->execute();
$stmt->close();

View file

@ -85,7 +85,14 @@ limitations under the License.
</table>
<?php if($_SESSION['type'] == "admin") echo '<a class="btn btn-success" href="add-domain.php">Add</a>'; ?>
<?php
if($_SESSION['type'] == "admin") {
echo '<div class="row">';
echo '<a class="btn btn-success" href="add-domain.php#MASTER">Add MASTER</a>';
echo '<a class="btn btn-primary margin-left-20" href="add-domain.php#NATIVE">Add NATIVE</a>';
echo '</div>';
}
?>
</div>
<div class="modal fade" id="deleteConfirm" tabindex="-1" role="dialog">

View file

@ -9,6 +9,8 @@
.vspacer-100 { height: 100px; }
.vspacer-150 { height: 150px; }
.margin-left-20 { margin-left: 20px; }
.defaulthidden { display: none; }
.cursor-pointer {cursor: pointer; }

View file

@ -64,6 +64,7 @@ function saveData(callback) {
retry: $('#zone-retry').val(),
expire: $('#zone-expire').val(),
ttl: $('#zone-ttl').val(),
type: window.location.hash.substring(1),
action: "addDomain",
csrfToken: $('#csrfToken').text()
};

View file

@ -101,6 +101,8 @@ function recreateTable(data) {
if(type == 'MASTER') {
location.assign('edit-master.php#' + id);
} else if(type == 'NATIVE') {
location.assign('edit-master.php#' + id);
}
});