From fda48016607cbddb786188ffb4df2c7871b67ddd Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 21 May 2009 08:53:35 -0400
Subject: [PATCH] Fixed: FS#732 - Fcgi 503 trouble if changing sites group

---
 interface/web/dns/dns_wizard.php |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/interface/web/dns/dns_wizard.php b/interface/web/dns/dns_wizard.php
index c4a7858..64a5736 100644
--- a/interface/web/dns/dns_wizard.php
+++ b/interface/web/dns/dns_wizard.php
@@ -36,12 +36,12 @@
 
 
 // Loading the template
-$app->uses('tpl');
+$app->uses('tpl,validate_dns');
 $app->tpl->newTemplate("form.tpl.htm");
 $app->tpl->setInclude('content_tpl','templates/dns_wizard.htm');
 
 // import variables
-$template_id = (isset($_POST['template_id']))?intval($_POST['template_id']):1;
+$template_id = (isset($_POST['template_id']))?intval($_POST['template_id']):0;
 $sys_groupid = (isset($_POST['client_group_id']))?intval($_POST['client_group_id']):0;
 
 // get the correct server_id
@@ -55,12 +55,16 @@
 
 
 // Load the templates
-$records = $app->db->queryAllRecords("SELECT * FROM dns_template WHERE visible = 'y'");
+$records = $app->db->queryAllRecords("SELECT * FROM dns_template WHERE visible = 'Y'");
 $template_id_option = '';
+$n = 0;
 foreach($records as $rec){
 	$checked = ($rec['template_id'] == $template_id)?' SELECTED':'';
 	$template_id_option .= '<option value="'.$rec['template_id'].'"'.$checked.'>'.$rec['name'].'</option>';
+	if($n == 0 && $template_id == 0) $template_id = $rec['template_id'];
+	$n++;
 }
+unset($n);
 $app->tpl->setVar("template_id_option",$template_id_option);
 
 // If the user is administrator
@@ -181,9 +185,10 @@
 		$minimum = $app->db->quote($vars['minimum']);
 		$ttl = $app->db->quote($vars['ttl']);
 		$xfer = $app->db->quote($vars['xfer']);
+		$serial = $app->validate_dns->increase_serial(0);
 		
 		$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`) VALUES 
-		('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$origin', '$ns', '$mbox', '1', '$refresh', '$retry', '$expire', '$minimum', '$ttl', 'Y', '$xfer')";
+		('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$origin', '$ns', '$mbox', '$serial', '$refresh', '$retry', '$expire', '$minimum', '$ttl', 'Y', '$xfer')";
 		$dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');
 		
 		// Insert the dns_rr records

--
Gitblit v1.9.1