<?php
require_once('session/start.php');
require_once('vmail.php');
require_once("inc/debug.php");
global $debugmode;
require_role(ROLE_SYSTEMUSER);
check_form_token('vmail_domainchange');
foreach ($_POST as $key => $value) {
if (strpos($key, "option-") === 0) {
$id = substr($key, 7);
$type = 'virtual';
if ($value == 'manual') {
$type = 'auto';
} elseif ($value == 'off') {
$type = 'none';
}
DEBUG('MAILCONFIG change request for id #'.$id.' to '.$value);
change_domain($id, $type);
}
if (strpos($key, "dkim-") === 0) {
$id = substr($key, 5);
$type = 'none';
if ($value == 'dkim') {
$type = 'dkim';
} elseif ($value == 'dmarc') {
$type = 'dmarc';
}
DEBUG('DKIM change request for id #'.$id.' to '.$value);
change_domain_dkim($id, $type);
}
}
if (!$debugmode) {
header('Location: domains');
die();