Index: /trunk/DNSDB/ExportBIND.pm
===================================================================
--- /trunk/DNSDB/ExportBIND.pm	(revision 881)
+++ /trunk/DNSDB/ExportBIND.pm	(revision 882)
@@ -111,5 +111,5 @@
                 "stampactive='t' AND @(extract(epoch from stamp-now())) < 600", undef, $revid))[0] ) {
           $changed = 1;
-          $dnsdb->_updateserial(domain_id => $domid);
+          $dnsdb->_updateserial(rdns_id => $revid);
         }
 #  - we are not using the cache
@@ -324,6 +324,4 @@
           $soasth->execute($domid);
           my ($soa_host, $soa_val, $soa_ttl, $soa_id, $soa_loc) = $soasth->fetchrow_array;
-$dnsdb->{dbh}->selectrow_array(
-            "SELECT host,val,ttl,record_id,location FROM records WHERE domain_id=? AND type=6");
 
 ##fixme: do we even need @loclist passed in?
@@ -445,5 +443,5 @@
       }
       print BINDCONF "};\n\n";
-      print "};\n\n";
+#      print "};\n\n";
     } # foreach @$viewlist
     rename $tmpconf, $dnsdb->{bind_zone_conf};
@@ -460,15 +458,4 @@
   my ($zonefiles, $loclist, $recid, $revrec, $recflags, $zone, $host, $type, $val, $distance, $weight, $port, $ttl,
 	$loc, $stamp, $expires, $stampactive) = @_;
-
-# make sure "global" records get into all the right per-view zone files, without having to do this loop in each record-print location
-##fixme:  maybe exclude the template types?  those may be more expensive to export
-## *ponder*  may be more efficient to loop in each record print due to substitution and manipulation from stored data to formal
-## record for .arpa zones for all records
-  if ($loc eq '') {
-    foreach my $subloc (@{$loclist}) {
-      printrec_bind($dnsdb, $zonefiles, $loclist, $recid, $revrec, $recflags, $zone, $host, $type, $val,
-        $distance, $weight, $port, $ttl, $subloc, $stamp, $expires, $stampactive);
-    }
-  }
 
   # Just In Case something is lingering in the DB
@@ -502,12 +489,12 @@
 
     # Prepare the body of the record
-    my $recdata = "$ttl        IN      SOA     $primary        $email  ( $serial $refresh $retry $expire $min_ttl )\n";
+    my $recdata = "$ttl	IN	SOA	$primary	$email	( $serial $refresh $retry $expire $min_ttl )\n";
 
     # ... and prepend the zone name FQDN
     if ($revrec eq 'y') {
       my $zone2 = DNSDB::_ZONE($zone, 'ZONE', 'r', '.').($zone->{isv6} ? '.ip6.arpa' : '.in-addr.arpa');
-      $recdata = "$zone2.      $recdata";
-    } else {
-      $recdata = "$zone.       $recdata";
+      $recdata = "$zone2.	$recdata";
+    } else {
+      $recdata = "$zone.	$recdata";
     }
 
@@ -590,9 +577,10 @@
        # A and/or PTR records" irrespective of template records
     $$recflags{$val} = 'ptr';
+    return if $host eq '%blank%';
+
     if ($revrec eq 'y') {
 
       if ($val =~ /\.arpa$/) {
         # someone put in the formal .arpa name.  humor them.
-#        print {$zonefiles->{$loc}} "$val	$ttl	IN	PTR	$host\n" or die $!;
         my $recdata = "$val.	$ttl	IN	PTR	$host.\n";
         __recprint($zonefiles, $loclist, $loc, $recdata);
@@ -602,7 +590,4 @@
           # sub-octet v4 zone
           ($val) = ($val =~ /\.(\d+)$/);
-#          print {$zonefiles->{$loc}} "$val.".DNSDB::_ZONE($zone, 'ZONE', 'r', '.').'.in-addr.arpa'.
-#		"	$ttl	IN	PTR	$host\n"
-#            or die $!;
           my $recdata = "$val.".DNSDB::_ZONE($zone, 'ZONE', 'r', '.').".in-addr.arpa.	$ttl	IN	PTR	$host.\n";
           __recprint($zonefiles, $loclist, $loc, $recdata);
@@ -610,7 +595,4 @@
           # not going to care about strange results if $val is not an IP value and is resolveable in DNS
           $val = NetAddr::IP->new($val);
-#          print {$zonefiles->{$loc}} DNSDB::_ZONE($val, 'ZONE', 'r', '.').($val->{isv6} ? '.ip6.arpa' : '.in-addr.arpa').
-#		"	$ttl	IN	PTR	$host\n"
-#            or die $!;
           my $recdata = DNSDB::_ZONE($val, 'ZONE', 'r', '.').($val->{isv6} ? '.ip6.arpa' : '.in-addr.arpa').
 		".	$ttl	IN	PTR	$host.\n";
@@ -636,5 +618,5 @@
     if ($revrec eq 'y') {
       printrec_bind($dnsdb, $zonefiles, $loclist, $recid, $revrec, $recflags, $zone, $host, 12, $val,
-       $distance, $weight, $port, $ttl, $loc, $stamp, $expires, $stampactive);
+        $distance, $weight, $port, $ttl, $loc, $stamp, $expires, $stampactive);
 # ... but we need to tweak it for this case?  so the A record gets published...
 #$$recflags{$val} = 'a+ptr';
