From 42539643c396f9d8865dcf9a51b13dc869709d16 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Wed, 13 Aug 2014 07:16:50 -0400
Subject: [PATCH] Merge remote-tracking branch 'ispc/stable-3.0.5' into stable-3.0.5

---
 server/plugins-available/bind_dlz_plugin.inc.php |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/server/plugins-available/bind_dlz_plugin.inc.php b/server/plugins-available/bind_dlz_plugin.inc.php
index f6d367f..63abcc4 100644
--- a/server/plugins-available/bind_dlz_plugin.inc.php
+++ b/server/plugins-available/bind_dlz_plugin.inc.php
@@ -188,7 +188,7 @@
 		//$_db = clone $app->db;
 		//$_db->dbName = 'named';
 
-		$app->db->query("DELETE FROM named.records WHERE ispconfig_id = {$data["old"]["id"]}");
+		$app->db->query( "DELETE FROM named.dns_records WHERE zone = '".substr($data['old']['origin'], 0, -1)."'");
 		//unset($_db);
 	}
 
@@ -252,6 +252,9 @@
 		if ($type == 'MX') {
 			$app->db->query("INSERT INTO named.records (zone, ttl, type, host, mx_priority, data, ispconfig_id)".
 				" VALUES ('$origin', $ttl, '$type', '$name', {$data["new"]["aux"]}, '$content', $ispconfig_id)");
+		} elseif ($type == 'SRV') {
+			$app->db->query("INSERT INTO named.records (zone, ttl, type, data, ispconfig_id)".
+				" VALUES ('$origin', $ttl, '$type', '{$data["new"]["aux"]} $content', $ispconfig_id)");
 		} else {
 			$app->db->query("INSERT INTO named.records (zone, ttl, type, host, data, ispconfig_id)".
 				" VALUES ('$origin', $ttl, '$type', '$name', '$content', $ispconfig_id)");
@@ -327,6 +330,9 @@
 				if ($type == 'MX') {
 					$app->db->query("UPDATE named.records SET zone = '$origin', ttl = $ttl, type = '$type', host = '$name', mx_priority = $prio, ".
 						"data = '$content' WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
+				} elseif ($type == 'SRV') {
+					$app->db->query("UPDATE named.records SET zone = '$origin', ttl = $ttl, type = '$type', ".
+						"data = '$prio $content' WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
 				} else {
 					$app->db->query("UPDATE named.records SET zone = '$origin', ttl = $ttl, type = '$type', host = '$name', ".
 						"data = '$content' WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
@@ -345,7 +351,7 @@
 		//$_db = clone $app->db;
 		//$_db->dbName = 'named';
 
-		$app->db->query("DELETE FROM named.records WHERE ispconfig_id = {$data["old"]["id"]} AND type != 'SOA'");
+		$app->db->query( "DELETE FROM named.dns_records WHERE type != 'SOA' AND zone = '".substr($data['old']['origin'], 0, -1)."'");
 		//unset($_db);
 	}
 

--
Gitblit v1.9.1