47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* vpanel-stack
|
|
* https://git.stack-source.com/msb/vpanel-stack
|
|
* Copyright (c) 2022 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
|
|
* GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
*/
|
|
|
|
namespace Panel\Vdns;
|
|
|
|
class ZonesDelete extends \Panel\Vdns {
|
|
|
|
function beforeRoute($f3) {
|
|
|
|
parent::beforeRoute($f3);
|
|
|
|
/* verify zone exists */
|
|
$zone = $f3->get('PARAMS.zone');
|
|
if (!$f3->call('\Panel\Vdns::verifyZoneExists', $zone)) {
|
|
$messages[] = "Zone '$zone' does not exist.";
|
|
$f3->set('SESSION.messages', $messages);
|
|
$f3->reroute("/DNS");
|
|
}
|
|
|
|
}
|
|
|
|
static function get($f3) {
|
|
|
|
$f3->set('confirm', 'true');
|
|
echo \Template::instance()->render('vdns/zones-delete.html');
|
|
|
|
}
|
|
|
|
function post($f3) {
|
|
|
|
/* run delete command here */
|
|
$zone = $f3->get('PARAMS.zone');
|
|
exec("/usr/local/bin/vdns-zone-del.sh -z $zone -x", $output, $result_code);
|
|
$messages[] = "Zone '$zone' has been deleted from DNS.";
|
|
$f3->set('SESSION.messages', $messages);
|
|
$f3->reroute("/DNS");
|
|
|
|
}
|
|
|
|
}
|