fix deletion of dns entry

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-12-07 13:50:54 +01:00
parent e10f77e219
commit fbac2f2bbc

View File

@@ -24,7 +24,7 @@ use Froxlor\Api\Commands\DomainZones as DomainZones;
// This file is being included in admin_domains and customer_domains // This file is being included in admin_domains and customer_domains
// and therefore does not need to require lib/init.php // and therefore does not need to require lib/init.php
$domain_id = isset($_GET['domain_id']) ? (int) $_GET['domain_id'] : null; $domain_id = isset($_GET['domain_id']) ? (int) $_GET['domain_id'] : (isset($_POST['domain_id']) ? (int)$_POST['domain_id'] : null);
$record = isset($_POST['record']['record']) ? trim($_POST['record']['record']) : null; $record = isset($_POST['record']['record']) ? trim($_POST['record']['record']) : null;
$type = isset($_POST['record']['type']) ? $_POST['record']['type'] : 'A'; $type = isset($_POST['record']['type']) ? $_POST['record']['type'] : 'A';
@@ -56,12 +56,11 @@ if ($action == 'add_record' && ! empty($_POST)) {
} }
} elseif ($action == 'delete') { } elseif ($action == 'delete') {
// remove entry // remove entry
$entry_id = isset($_GET['id']) ? (int) $_GET['id'] : 0; if ($id > 0) {
if ($entry_id > 0) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
DomainZones::getLocal($userinfo, array( DomainZones::getLocal($userinfo, array(
'entry_id' => $entry_id, 'entry_id' => $id,
'id' => $domain_id 'id' => $domain_id
))->delete(); ))->delete();
// success message (inline) // success message (inline)
@@ -73,7 +72,8 @@ if ($action == 'add_record' && ! empty($_POST)) {
\Froxlor\UI\HTML::askYesNo('dnsentry_reallydelete', $filename, array( \Froxlor\UI\HTML::askYesNo('dnsentry_reallydelete', $filename, array(
'page' => $page, 'page' => $page,
'action' => $action, 'action' => $action,
'id' => $id 'id' => $id,
'domain_id' => $domain_id
), $id); ), $id);
} }
} }