From f82147a268f0409932b815588134a36feed36d84 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Fri, 3 Oct 2008 08:27:22 +0000 Subject: [PATCH] create-domain.php: reindent; applied patch from http://sourceforge.net/tracker/?func=detail&atid=937964&aid=2143861&group_id=191583 - thanks fabiobon - this enables the $CONF[transport] parameter again git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@463 a1433add-5e2c-0410-b055-b7f2511e0802 --- create-domain.php | 136 ++++++++++++++++++++++++---------------------- 1 file changed, 72 insertions(+), 64 deletions(-) diff --git a/create-domain.php b/create-domain.php index 425f195b..bb3f88c6 100644 --- a/create-domain.php +++ b/create-domain.php @@ -43,81 +43,89 @@ authentication_require_role('global-admin'); if ($_SERVER['REQUEST_METHOD'] == "GET") { - $tAliases = $CONF['aliases']; - $tMailboxes = $CONF['mailboxes']; - $tMaxquota = $CONF['maxquota']; - $tTransport = $CONF['transport_default']; + $tAliases = $CONF['aliases']; + $tMailboxes = $CONF['mailboxes']; + $tMaxquota = $CONF['maxquota']; + $tTransport = $CONF['transport_default']; } if ($_SERVER['REQUEST_METHOD'] == "POST") { - if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']); - $form_fields = array('fDescription' => '', 'fAliases' => '0', 'fMailboxes' => '0', - 'fMaxquota' => '0', 'fTransport' => 'virtual', 'fDefaultaliases' => '0', - 'fBackupmx' => '0'); - foreach($form_fields as $key => $default) { - if(isset($_POST[$key]) && (!empty($_POST[$key]))) { - $$key = escape_string($_POST[$key]); - } - else { - $$key = $default; - } - } + if (isset($_POST['fDomain'])) { + $fDomain = escape_string($_POST['fDomain']); + } + $form_fields = array( + 'fDescription' => '', + 'fAliases' => '0', + 'fMailboxes' => '0', + 'fMaxquota' => '0', + 'fTransport' => $CONF['transport_default'], + 'fDefaultaliases' => '0', + 'fBackupmx' => '0' ); + foreach($form_fields as $key => $default) { + if(isset($_POST[$key]) && (!empty($_POST[$key]))) { + $$key = escape_string($_POST[$key]); + } + else { + $$key = $default; + } + } - if (empty ($fDomain) or domain_exist ($fDomain) or !check_domain ($fDomain)) - { - $error = 1; - $tDomain = escape_string ($_POST['fDomain']); - $tDescription = escape_string ($_POST['fDescription']); - $tAliases = escape_string ($_POST['fAliases']); - $tMailboxes = escape_string ($_POST['fMailboxes']); - if (isset ($_POST['fMaxquota'])) $tMaxquota = escape_string ($_POST['fMaxquota']); - if (isset ($_POST['fTransport'])) $tTransport = escape_string ($_POST['fTransport']); - if (isset ($_POST['fDefaultaliases'])) $tDefaultaliases = escape_string ($_POST['fDefaultaliases']); - if (isset ($_POST['fBackupmx'])) $tBackupmx = escape_string ($_POST['fBackupmx']); + + if (empty($fDomain) or domain_exist($fDomain) or !check_domain($fDomain)) + { + $error = 1; + $tDomain = escape_string ($_POST['fDomain']); + $tDescription = escape_string ($_POST['fDescription']); + $tAliases = escape_string ($_POST['fAliases']); + $tMailboxes = escape_string ($_POST['fMailboxes']); + if (isset ($_POST['fMaxquota'])) $tMaxquota = escape_string ($_POST['fMaxquota']); + if (isset ($_POST['fTransport'])) $tTransport = escape_string ($_POST['fTransport']); + if (isset ($_POST['fDefaultaliases'])) $tDefaultaliases = escape_string ($_POST['fDefaultaliases']); + if (isset ($_POST['fBackupmx'])) $tBackupmx = escape_string ($_POST['fBackupmx']); /* if (empty ($fDomain) or !check_domain ($fDomain)) */ $pAdminCreate_domain_domain_text = $PALANG['pAdminCreate_domain_domain_text_error2']; - if (domain_exist ($fDomain)) $pAdminCreate_domain_domain_text = $PALANG['pAdminCreate_domain_domain_text_error']; - } + if (domain_exist ($fDomain)) $pAdminCreate_domain_domain_text = $PALANG['pAdminCreate_domain_domain_text_error']; + } - if ($error != 1) - { - $tAliases = $CONF['aliases']; - $tMailboxes = $CONF['mailboxes']; - $tMaxquota = $CONF['maxquota']; + if ($error != 1) + { + $tAliases = $CONF['aliases']; + $tMailboxes = $CONF['mailboxes']; + $tMaxquota = $CONF['maxquota']; - if ($fBackupmx == "on") - { - $fAliases = -1; - $fMailboxes = -1; - $fMaxquota = -1; - $fBackupmx = 1; - $sqlBackupmx = db_get_boolean(true); - } - else - { - $fBackupmx = 0; - $sqlBackupmx = db_get_boolean(false); - } - $sql_query = "INSERT INTO $table_domain (domain,description,aliases,mailboxes,maxquota,transport,backupmx,created,modified) VALUES ('$fDomain','$fDescription',$fAliases,$fMailboxes,$fMaxquota,'$fTransport',$sqlBackupmx,NOW(),NOW())"; - $result = db_query($sql_query); - if ($result['rows'] != 1) - { - $tMessage = $PALANG['pAdminCreate_domain_result_error'] . "
($fDomain)
"; - } - else - { - if ($fDefaultaliases == "on") - { - foreach ($CONF['default_aliases'] as $address=>$goto) + if ($fBackupmx == "on") + { + $fAliases = -1; + $fMailboxes = -1; + $fMaxquota = -1; + $fBackupmx = 1; + $sqlBackupmx = db_get_boolean(true); + } + else + { + $fBackupmx = 0; + $sqlBackupmx = db_get_boolean(false); + } + $sql_query = "INSERT INTO $table_domain (domain,description,aliases,mailboxes,maxquota,transport,backupmx,created,modified) VALUES ('$fDomain','$fDescription',$fAliases,$fMailboxes,$fMaxquota,'$fTransport',$sqlBackupmx,NOW(),NOW())"; + $result = db_query($sql_query); + if ($result['rows'] != 1) + { + $tMessage = $PALANG['pAdminCreate_domain_result_error'] . "
($fDomain)
"; + } + else + { + if ($fDefaultaliases == "on") { - $address = $address . "@" . $fDomain; - $result = db_query ("INSERT INTO $table_alias (address,goto,domain,created,modified) VALUES ('$address','$goto','$fDomain',NOW(),NOW())"); + foreach ($CONF['default_aliases'] as $address=>$goto) + { + $address = $address . "@" . $fDomain; + $result = db_query ("INSERT INTO $table_alias (address,goto,domain,created,modified) VALUES ('$address','$goto','$fDomain',NOW(),NOW())"); + } } - } - $tMessage = $PALANG['pAdminCreate_domain_result_success'] . "
($fDomain)
"; - } - } + $tMessage = $PALANG['pAdminCreate_domain_result_success'] . "
($fDomain)
"; + } + } } include ("templates/header.php");