git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@144 a1433add-5e2c-0410-b055-b7f2511e0802
postfixadmin-2.3
David Goodwin 17 years ago
parent 31c73f9256
commit 94b033b97e

@ -57,13 +57,14 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
if ($_SERVER['REQUEST_METHOD'] == "POST") if ($_SERVER['REQUEST_METHOD'] == "POST")
{ {
if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']); if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']);
!empty ($_POST['fDescription']) ? $fDescription = escape_string ($_POST['fDescription']) : $fDescription = ""; foreach(array('fDescription' => '', 'fAliases' => '0', 'fMailboxes' => '0',
if (isset ($_POST['fAliases'])) $fAliases = escape_string ($_POST['fAliases']); 'fMaxquota' => '0', 'fTransport' => 'virtual',
if (isset ($_POST['fMailboxes'])) $fMailboxes = escape_string ($_POST['fMailboxes']); 'fDefaultaliases' => '0', 'fBackupmx' => '0') as $key => $default) {
!empty ($_POST['fMaxquota']) ? $fMaxquota = escape_string ($_POST['fMaxquota']) : $fMaxquota = "0"; if(isset($_POST[$key]) && !empty($POST[$key])) {
!empty ($_POST['fTransport']) ? $fTransport = escape_string ($_POST['fTransport']) : $fTransport = "virtual"; $$key = escape_string($_POST[$key]);
if (isset ($_POST['fDefaultaliases'])) $fDefaultaliases = escape_string ($_POST['fDefaultaliases']); }
isset ($_POST['fBackupmx']) ? $fBackupmx = escape_string ($_POST['fBackupmx']) : $fBackupmx = "0"; $$key = $default;
}
if (empty ($fDomain) or domain_exist ($fDomain) or !check_domain ($fDomain)) if (empty ($fDomain) or domain_exist ($fDomain) or !check_domain ($fDomain))
{ {
@ -99,8 +100,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$fBackupmx = 0; $fBackupmx = 0;
$sqlBackupmx = ('pgsql'==$CONF['database_type']) ? 'false' : 0; $sqlBackupmx = ('pgsql'==$CONF['database_type']) ? 'false' : 0;
} }
$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 ("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) if ($result['rows'] != 1)
{ {
$tMessage = $PALANG['pAdminCreate_domain_result_error'] . "<br />($fDomain)<br />"; $tMessage = $PALANG['pAdminCreate_domain_result_error'] . "<br />($fDomain)<br />";

Loading…
Cancel
Save