52 lines
1.2 KiB
PHP
52 lines
1.2 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\Vmail;
|
||
|
|
||
|
class MboxesDelete extends \Panel\Vmail {
|
||
|
|
||
|
function beforeRoute($f3) {
|
||
|
|
||
|
parent::beforeRoute($f3);
|
||
|
|
||
|
/* verify domain exists */
|
||
|
|
||
|
}
|
||
|
|
||
|
static function get($f3) {
|
||
|
|
||
|
$f3->set('confirm', 'true');
|
||
|
echo \Template::instance()->render('vmail/mboxes-delete.html');
|
||
|
|
||
|
}
|
||
|
|
||
|
function post($f3) {
|
||
|
|
||
|
/* run delete command here */
|
||
|
$domain = $f3->get('PARAMS.domain');
|
||
|
$mbox = $f3->get('PARAMS.mbox');
|
||
|
$messages = array();
|
||
|
exec("/usr/local/bin/vmail-mboxes-del.sh -e $mbox@$domain -x", $output, $result_code);
|
||
|
if ($result_code == 0) {
|
||
|
$messages[] = "Email account '$mbox@$domain' has been deleted.";
|
||
|
} else {
|
||
|
$messages[] = "Error deleting email account '$mbox@$domain'.";
|
||
|
}
|
||
|
$f3->set('SESSION.messages', $messages);
|
||
|
$mapping = $f3->get('NAV.mapping');
|
||
|
if ($mapping == 'vmail') {
|
||
|
$f3->reroute("/Accounts");
|
||
|
} else {
|
||
|
$f3->reroute("/Email/$domain/Accounts");
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|