From 4f4b91f5d030756f4b50634cdd978c97dd16bb8d Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Sat, 11 Aug 2007 08:42:22 -0400
Subject: [PATCH] Improved the DNS manager.

---
 interface/web/dns/dns_mx_edit.php    |   18 ++++
 interface/web/dns/dns_ns_edit.php    |   18 ++++
 interface/web/dns/dns_srv_edit.php   |   18 ++++
 install/sql/ispconfig3.sql           |   19 +---
 interface/web/dns/dns_a_edit.php     |   19 ++++
 interface/web/dns/dns_alias_edit.php |   18 ++++
 interface/web/dns/dns_txt_edit.php   |   18 ++++
 interface/web/dns/dns_ptr_edit.php   |   18 ++++
 interface/web/dns/dns_hinfo_edit.php |   18 ++++
 interface/web/dns/dns_rp_edit.php    |   18 ++++
 interface/web/dns/dns_cname_edit.php |   18 ++++
 11 files changed, 188 insertions(+), 12 deletions(-)

diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index 1c5ad5c..61f7cd3 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -77,20 +77,17 @@
   `sys_perm_user` varchar(5) NOT NULL,
   `sys_perm_group` varchar(5) NOT NULL,
   `sys_perm_other` varchar(5) NOT NULL,
+  `server_id` int(11) NOT NULL default '1',
   `zone` int(10) unsigned NOT NULL,
   `name` char(64) NOT NULL,
-  `type` enum('A','AAAA','CNAME','HINFO','MX','NAPTR','NS','PTR','RP','SRV','TXT') default NULL,
+  `type` enum('A','AAAA','ALIAS','CNAME','HINFO','MX','NAPTR','NS','PTR','RP','SRV','TXT') default NULL,
   `data` char(128) NOT NULL,
-  `aux` int(10) unsigned NOT NULL,
+  `aux` int(10) unsigned NOT NULL default '0',
   `ttl` int(10) unsigned NOT NULL default '86400',
+  `active` enum('N','Y') NOT NULL default 'Y',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `rr` (`zone`,`name`,`type`,`data`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-
--- 
--- Daten f�r Tabelle `dns_rr`
--- 
-
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
 
 -- --------------------------------------------------------
 
@@ -105,6 +102,7 @@
   `sys_perm_user` varchar(5) NOT NULL,
   `sys_perm_group` varchar(5) NOT NULL,
   `sys_perm_other` varchar(5) NOT NULL,
+  `server_id` int(11) NOT NULL default '1',
   `origin` char(255) NOT NULL,
   `ns` char(255) NOT NULL,
   `mbox` char(255) NOT NULL,
@@ -119,11 +117,8 @@
   PRIMARY KEY  (`id`),
   UNIQUE KEY `origin` (`origin`),
   KEY `active` (`active`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
 
--- 
--- Daten f�r Tabelle `dns_soa`
--- 
 
 
 -- --------------------------------------------------------
diff --git a/interface/web/dns/dns_a_edit.php b/interface/web/dns/dns_a_edit.php
index ed14342..c5a24d1 100644
--- a/interface/web/dns/dns_a_edit.php
+++ b/interface/web/dns/dns_a_edit.php
@@ -105,6 +105,25 @@
 		
 		parent::onSubmit();
 	}
+	
+	function onAfterInsert() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
+	
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_alias_edit.php b/interface/web/dns/dns_alias_edit.php
index f08280d..f359fec 100644
--- a/interface/web/dns/dns_alias_edit.php
+++ b/interface/web/dns/dns_alias_edit.php
@@ -105,6 +105,24 @@
 		
 		parent::onSubmit();
 	}
+	
+	function onAfterInsert() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_cname_edit.php b/interface/web/dns/dns_cname_edit.php
index 7ea775c..8ad00dc 100644
--- a/interface/web/dns/dns_cname_edit.php
+++ b/interface/web/dns/dns_cname_edit.php
@@ -105,6 +105,24 @@
 		
 		parent::onSubmit();
 	}
+	
+	function onAfterInsert() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_hinfo_edit.php b/interface/web/dns/dns_hinfo_edit.php
index b2286c2..fd9341e 100644
--- a/interface/web/dns/dns_hinfo_edit.php
+++ b/interface/web/dns/dns_hinfo_edit.php
@@ -105,6 +105,24 @@
 		
 		parent::onSubmit();
 	}
+	
+	function onAfterInsert() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_mx_edit.php b/interface/web/dns/dns_mx_edit.php
index d21a99f..90544da 100644
--- a/interface/web/dns/dns_mx_edit.php
+++ b/interface/web/dns/dns_mx_edit.php
@@ -105,6 +105,24 @@
 		
 		parent::onSubmit();
 	}
+	
+	function onAfterInsert() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_ns_edit.php b/interface/web/dns/dns_ns_edit.php
index 17e4667..6e77708 100644
--- a/interface/web/dns/dns_ns_edit.php
+++ b/interface/web/dns/dns_ns_edit.php
@@ -105,6 +105,24 @@
 		
 		parent::onSubmit();
 	}
+	
+	function onAfterInsert() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_ptr_edit.php b/interface/web/dns/dns_ptr_edit.php
index 1250523..4335648 100644
--- a/interface/web/dns/dns_ptr_edit.php
+++ b/interface/web/dns/dns_ptr_edit.php
@@ -105,6 +105,24 @@
 		
 		parent::onSubmit();
 	}
+	
+	function onAfterInsert() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_rp_edit.php b/interface/web/dns/dns_rp_edit.php
index a97574a..e8cb684 100644
--- a/interface/web/dns/dns_rp_edit.php
+++ b/interface/web/dns/dns_rp_edit.php
@@ -105,6 +105,24 @@
 		
 		parent::onSubmit();
 	}
+	
+	function onAfterInsert() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_srv_edit.php b/interface/web/dns/dns_srv_edit.php
index 200c03c..f6d362f 100644
--- a/interface/web/dns/dns_srv_edit.php
+++ b/interface/web/dns/dns_srv_edit.php
@@ -105,6 +105,24 @@
 		
 		parent::onSubmit();
 	}
+	
+	function onAfterInsert() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_txt_edit.php b/interface/web/dns/dns_txt_edit.php
index d8e7da1..ab923eb 100644
--- a/interface/web/dns/dns_txt_edit.php
+++ b/interface/web/dns/dns_txt_edit.php
@@ -105,6 +105,24 @@
 		
 		parent::onSubmit();
 	}
+	
+	function onAfterInsert() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
+	
+	function onAfterUpdate() {
+		global $app, $conf;
+		
+		// Update the serial number of the SOA record
+		$soa_id = intval($_POST["zone"]);
+		$serial = time();
+		$app->db->query("UPDATE dns_soa SET serial = $serial WHERE id = $soa_id");
+	}
 }
 
 $page = new page_action;

--
Gitblit v1.9.1