SF.net SVN: postfixadmin:[499] trunk/edit-domain.php
Brought to you by:
christian_boltz,
gingerdog
From: <Gin...@us...> - 2008-12-12 20:55:36
|
Revision: 499 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=499&view=rev Author: GingerDog Date: 2008-12-12 20:55:32 +0000 (Fri, 12 Dec 2008) Log Message: ----------- edit-domain.php: fix bug where editing a domain nukes the transport field (we actually were not checking the config field properly to see whether transport control was turned on or not; this fixes https://sourceforge.net/tracker/index.php?func=detail&aid=2378038&group_id=191583&atid=937964 Modified Paths: -------------- trunk/edit-domain.php Modified: trunk/edit-domain.php =================================================================== --- trunk/edit-domain.php 2008-12-12 19:43:46 UTC (rev 498) +++ trunk/edit-domain.php 2008-12-12 20:55:32 UTC (rev 499) @@ -39,69 +39,74 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") { - if (isset ($_GET['domain'])) - { - $domain = escape_string ($_GET['domain']); - $domain_properties = get_domain_properties ($domain); + if (isset ($_GET['domain'])) + { + $domain = escape_string ($_GET['domain']); + $domain_properties = get_domain_properties ($domain); - $tDescription = $domain_properties['description']; - $tAliases = $domain_properties['aliases']; - $tMailboxes = $domain_properties['mailboxes']; - $tMaxquota = $domain_properties['maxquota']; - $tTransport = $domain_properties['transport']; - $tBackupmx = $domain_properties['backupmx']; - $tActive = $domain_properties['active']; - } + $tDescription = $domain_properties['description']; + $tAliases = $domain_properties['aliases']; + $tMailboxes = $domain_properties['mailboxes']; + $tMaxquota = $domain_properties['maxquota']; + $tTransport = $domain_properties['transport']; + $tBackupmx = $domain_properties['backupmx']; + $tActive = $domain_properties['active']; + } } if ($_SERVER['REQUEST_METHOD'] == "POST") { - if (isset ($_GET['domain'])) $domain = escape_string ($_GET['domain']); + if (isset ($_GET['domain'])) $domain = escape_string ($_GET['domain']); - if (isset ($_POST['fDescription'])) $fDescription = escape_string ($_POST['fDescription']); - if (isset ($_POST['fAliases'])) $fAliases = intval($_POST['fAliases']); - if (isset ($_POST['fMailboxes'])) $fMailboxes = intval($_POST['fMailboxes']); - if (isset ($_POST['fMaxquota'])) { - $fMaxquota = intval($_POST['fMaxquota']); - } else { - $fMaxquota = 0; - } - if (isset ($_POST['fTransport'])) $fTransport = escape_string ($_POST['fTransport']); - if (isset ($_POST['fBackupmx'])) $fBackupmx = escape_string ($_POST['fBackupmx']); - if (isset ($_POST['fActive'])) $fActive = escape_string ($_POST['fActive']); + if (isset ($_POST['fDescription'])) $fDescription = escape_string ($_POST['fDescription']); + if (isset ($_POST['fAliases'])) $fAliases = intval($_POST['fAliases']); + if (isset ($_POST['fMailboxes'])) $fMailboxes = intval($_POST['fMailboxes']); + if (isset ($_POST['fMaxquota'])) { + $fMaxquota = intval($_POST['fMaxquota']); + } else { + $fMaxquota = 0; + } - if ($fBackupmx == "on") - { - $fAliases = -1; - $fMailboxes = -1; - $fMaxquota = -1; - $fBackupmx = 1; - $sqlBackupmx = db_get_boolean(True); - } - else - { - $fBackupmx = 0; - $sqlBackupmx = db_get_boolean(False); - } + $fTransport = $CONF['transport_default']; + if($CONF['transport'] != 'NO' && isset ($_POST['fTransport'])) { + $fTransport = escape_string ($_POST['fTransport']); + } - if ($fActive == "on") { - $sqlActive = db_get_boolean(True); - } - else { - $sqlActive = db_get_boolean(False); - } + if (isset ($_POST['fBackupmx'])) $fBackupmx = escape_string ($_POST['fBackupmx']); + if (isset ($_POST['fActive'])) $fActive = escape_string ($_POST['fActive']); - - $result = db_query ("UPDATE $table_domain SET description='$fDescription',aliases=$fAliases,mailboxes=$fMailboxes,maxquota=$fMaxquota,transport='$fTransport',backupmx='$sqlBackupmx',active='$sqlActive',modified=NOW() WHERE domain='$domain'"); - if ($result['rows'] == 1) - { - header ("Location: list-domain.php"); - exit; - } - else - { - $tMessage = $PALANG['pAdminEdit_domain_result_error']; - } + if ($fBackupmx == "on") + { + $fAliases = -1; + $fMailboxes = -1; + $fMaxquota = -1; + $fBackupmx = 1; + $sqlBackupmx = db_get_boolean(True); + } + else + { + $fBackupmx = 0; + $sqlBackupmx = db_get_boolean(False); + } + + if ($fActive == "on") { + $sqlActive = db_get_boolean(True); + } + else { + $sqlActive = db_get_boolean(False); + } + + + $result = db_query ("UPDATE $table_domain SET description='$fDescription',aliases=$fAliases,mailboxes=$fMailboxes,maxquota=$fMaxquota,transport='$fTransport',backupmx='$sqlBackupmx',active='$sqlActive',modified=NOW() WHERE domain='$domain'"); + if ($result['rows'] == 1) + { + header ("Location: list-domain.php"); + exit; + } + else + { + $tMessage = $PALANG['pAdminEdit_domain_result_error']; + } } include ("templates/header.php"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |