* GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) */ namespace Panel\Vmail; class DkimDelete extends \Panel\Vmail { function beforeRoute($f3) { parent::beforeRoute($f3); } static function get($f3) { $f3->set('confirm', 'true'); echo \Template::instance()->render('vmail/dkim-delete.html'); } static function post($f3) { if ($f3->exists('PARAMS.domain')) { $domain = $f3->get('PARAMS.domain'); if ($f3->call('\Panel::validateDomain', $domain)) { if ($f3->call('\Panel::verifyDkimExists', $domain)) { /* delete the dkim keys */ exec("/usr/local/bin/vmail-dkim-del.sh -d $domain", $output, $result_code); $messages = $f3->get('SESSION.messages'); if ($result_code == 0) { $messages[] = "DKIM keys for $domain have been deleted."; $messages[] = "Note that you probably want to delete the associated DNS record now too."; } else { $messages[] = "Error deleting DKIM keys for $domain."; } } else { $messages = $f3->get('SESSION.messages'); $messages[] = "DKIM keys for $domain not found."; } } else { $messages = $f3->get('SESSION.messages'); $messages[] = "Invalid domain name ($domain)."; } } $f3->set('SESSION.messages', $messages); $mapping = $f3->get('NAV.mapping'); if ($mapping == 'vmail') { $f3->reroute("/"); } else { $f3->reroute("/Email/$domain"); } } }