Ignore:
Timestamp:
08/13/25 17:40:34 (45 hours ago)
Author:
Kris Deugau
Message:

/branches/secondaryzones

Add first part of secondary zone edit page. See #86.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/secondaryzones/DNSDB.pm

    r915 r916  
    30893089
    30903090
     3091## DNSDB::secondaryName()
     3092# Return the secondary zone name based on a zone ID
     3093# Takes the zone ID, and as with revName() an optional flag to force return
     3094# of the logical CIDR zone instead of the formal .arpa zone name
     3095# Returns the zone name or undef on failure
     3096sub secondaryName {
     3097  $errstr = '';
     3098  my $self = shift;
     3099  my $dbh = $self->{dbh};
     3100  my $zoneid = shift;
     3101  my $cidrflag = shift || 'n';
     3102  my ($zone) = $dbh->selectrow_array("SELECT zone FROM secondaryzones WHERE secondary_id=?", undef, ($zoneid) );
     3103  $errstr = $DBI::errstr if !$zone;
     3104  my $tmp = new NetAddr::IP $zone;
     3105  $zone = _ZONE($tmp, 'ZONE', 'r', '.').($tmp->{isv6} ? '.ip6.arpa' : '.in-addr.arpa')
     3106        if ($self->{showrev_arpa} eq 'zone' || $self->{showrev_arpa} eq 'all') && $cidrflag eq 'n';
     3107  return $zone if $zone;
     3108} # end secondaryName()
     3109
     3110
    30913111## DNSDB::domainID()
    30923112# Takes a domain name and default location
     
    43394359  my $loc = shift;
    43404360
    4341   my $sth = $dbh->prepare("SELECT group_id,iplist,description,comments FROM locations WHERE location=?");
    4342   $sth->execute($loc);
    4343   return $sth->fetchrow_hashref();
     4361  if (defined($loc) && $loc eq '') {
     4362    my %ret = (group_id => 1, iplist => '', description => 'Default/All', comments => '');
     4363    return \%ret;
     4364  } else {
     4365    my $sth = $dbh->prepare("SELECT group_id,iplist,description,comments FROM locations WHERE location=?");
     4366    $sth->execute($loc);
     4367    return $sth->fetchrow_hashref();
     4368  }
    43444369} # end getLoc()
    43454370
     
    44934518  return $ret;
    44944519} # end getSOA()
     4520
     4521
     4522## DNSDB::getSecondaryDetails
     4523# Retrieve primary server(s) and location/view of a secondary zone
     4524sub getSecondaryDetails {
     4525  $errstr = '';
     4526  my $self = shift;
     4527  my $dbh = $self->{dbh};
     4528  my $id = shift;
     4529
     4530  my $sql = "SELECT primaryserver, default_location FROM secondaryzones WHERE secondary_id = ?";
     4531  my $ret = $dbh->selectrow_hashref($sql, undef, ($id) );
     4532  return if !$ret;
     4533
     4534  return $ret;
     4535} # end getSecondaryDetails()
    44954536
    44964537
Note: See TracChangeset for help on using the changeset viewer.