vpanel-stack/panel/classes/Panel/Vmail/DomainsDelete.php
Matthew Saunders Brown fd94a4e3c4 initial commit
2022-07-01 15:24:26 -07:00

43 lines
993 B
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\Vmail;
class DomainsDelete extends \Panel\Vmail {
function beforeRoute($f3) {
parent::beforeRoute($f3);
/* verify domain exists */
$domain = $f3->get('PARAMS.domain');
$f3->call('\Panel::vGet', "vmail-domains-get.sh -d $domain -c");
}
static function get($f3) {
$f3->set('confirm', 'true');
echo \Template::instance()->render('vmail/domains-delete.html');
}
function post($f3) {
/* run delete command here */
$domain = $f3->get('PARAMS.domain');
exec("/usr/local/bin/vmail-domains-del.sh -d $domain", $output, $result_code);
$messages[] = "Email domain '$domain' has been deleted.";
$f3->set('SESSION.messages', $messages);
$f3->reroute("/Email");
}
}