Changeset 481 for trunk/dns.cgi


Ignore:
Timestamp:
03/14/13 15:33:42 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Object conversion of DNSDB.pm, 14 of <mumble>. See #11.

  • record manipulation: getSOA(), getRecLine(), getDomRecs(), getRecCount(), addRec(), updateRec(), downconvert(), and delRec() and callers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r480 r481  
    443443
    444444  # prepopulate revpatt with the matching default record
    445 # getRecByName($dbh, (revrec => $webvar{revrec}, defrec => $webvar{defrec}, host => 'string'));
     445# $dnsdb->getRecByName(revrec => $webvar{revrec}, defrec => $webvar{defrec}, host => 'string');
    446446
    447447  if ($session->param('add_failed')) {
     
    543543    $page->param(curpage => $webvar{page});
    544544
    545     my $count = getRecCount($dbh, $webvar{defrec}, $webvar{revrec}, $webvar{id}, $filter);
     545    my $count = $dnsdb->getRecCount($webvar{defrec}, $webvar{revrec}, $webvar{id}, $filter);
    546546
    547547    $sortby = 'host';
     
    638638    $webvar{location} = $parloc unless ($permissions{admin} || $permissions{record_locchg});
    639639
    640     my @recargs = ($dbh,$webvar{defrec},$webvar{revrec},$webvar{parentid},
    641         \$webvar{name},\$webvar{type},\$webvar{address},$webvar{ttl},$webvar{location});
     640    my @recargs = ($webvar{defrec}, $webvar{revrec}, $webvar{parentid},
     641        \$webvar{name}, \$webvar{type}, \$webvar{address}, $webvar{ttl}, $webvar{location});
    642642    if ($webvar{type} == $reverse_typemap{MX} or $webvar{type} == $reverse_typemap{SRV}) {
    643643      push @recargs, $webvar{distance};
     
    648648    }
    649649
    650     my ($code,$msg) = addRec(@recargs);
     650    my ($code,$msg) = $dnsdb->addRec(@recargs);
    651651
    652652    if ($code eq 'OK' || $code eq 'WARN') {
     
    679679    $page->param(parentid       => $webvar{parentid});
    680680    $page->param(id             => $webvar{id});
    681     my $recdata = getRecLine($dbh, $webvar{defrec}, $webvar{revrec}, $webvar{id});
     681    my $recdata = $dnsdb->getRecLine($webvar{defrec}, $webvar{revrec}, $webvar{id});
    682682    $page->param(name           => $recdata->{host});
    683683    $page->param(address        => $recdata->{val});
     
    698698
    699699    # retain old location if user doesn't have permission to fiddle locations
    700     my $oldrec = getRecLine($dbh, $webvar{defrec}, $webvar{revrec}, $webvar{id});
     700    my $oldrec = $dnsdb->getRecLine($webvar{defrec}, $webvar{revrec}, $webvar{id});
    701701    $webvar{location} = $oldrec->{location} unless ($permissions{admin} || $permissions{record_locchg});
    702702
    703     my ($code,$msg) = updateRec($dbh,$webvar{defrec},$webvar{revrec},$webvar{id},$webvar{parentid},
    704         \$webvar{name},\$webvar{type},\$webvar{address},$webvar{ttl},$webvar{location},
    705         $webvar{distance},$webvar{weight},$webvar{port});
     703    my ($code,$msg) = $dnsdb->updateRec($webvar{defrec}, $webvar{revrec}, $webvar{id}, $webvar{parentid},
     704        \$webvar{name}, \$webvar{type}, \$webvar{address}, $webvar{ttl}, $webvar{location},
     705        $webvar{distance}, $webvar{weight}, $webvar{port});
    706706
    707707    if ($code eq 'OK' || $code eq 'WARN') {
     
    756756  if (!defined($webvar{del})) {
    757757    $page->param(del_getconf => 1);
    758     my $rec = getRecLine($dbh, $webvar{defrec}, $webvar{revrec}, $webvar{id});
     758    my $rec = $dnsdb->getRecLine($webvar{defrec}, $webvar{revrec}, $webvar{id});
    759759    $page->param(host => $rec->{host});
    760760    $page->param(ftype => $typemap{$rec->{type}});
    761761    $page->param(recval => $rec->{val});
    762762  } elsif ($webvar{del} eq 'ok') {
    763     my ($code,$msg) = delRec($dbh, $webvar{defrec}, $webvar{revrec}, $webvar{id});
     763    my ($code,$msg) = $dnsdb->delRec($webvar{defrec}, $webvar{revrec}, $webvar{id});
    764764    if ($code eq 'OK') {
    765765      changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec},
     
    816816        unless ($permissions{admin} || $permissions{domain_edit});
    817817
    818   my ($code, $msg) = updateSOA($dbh, $webvar{defrec}, $webvar{revrec},
     818  my ($code, $msg) = $dnsdb->updateSOA($webvar{defrec}, $webvar{revrec},
    819819        (contact => $webvar{contact}, prins => $webvar{prins}, refresh => $webvar{refresh},
    820820        retry => $webvar{retry}, expire => $webvar{expire}, minttl => $webvar{minttl},
     
    18631863  if ($preserve eq 'd') {
    18641864    # there are probably better ways to do this.  TMTOWTDI.
    1865     my $soa = getSOA($dbh,$defrec,$revrec,$id);
     1865    my $soa = $dnsdb->getSOA($defrec, $revrec, $id);
    18661866
    18671867    $page->param(prins  => ($soa->{prins} ? $soa->{prins} : $DNSDB::def{prins}));
     
    18891889
    18901890  # get the SOA first
    1891   my $soa = getSOA($dbh,$def,$rev,$id);
     1891  my $soa = $dnsdb->getSOA($def, $rev, $id);
    18921892
    18931893  $page->param(contact  => $soa->{contact});
     
    18991899  $page->param(ttl      => $soa->{ttl});
    19001900
    1901   my $foo2 = getDomRecs($dbh,(defrec => $def, revrec => $rev, id => $id, offset => $webvar{offset},
    1902         sortby => $sortby, sortorder => $sortorder, filter => $filter));
     1901  my $foo2 = $dnsdb->getDomRecs(defrec => $def, revrec => $rev, id => $id, offset => $webvar{offset},
     1902        sortby => $sortby, sortorder => $sortorder, filter => $filter);
    19031903
    19041904  foreach my $rec (@$foo2) {
     
    19411941  }
    19421942# retrieve the right ttl instead of falling (way) back to the hardcoded system default
    1943   my $soa = getSOA($dbh,$webvar{defrec},$webvar{revrec},$webvar{parentid});
     1943  my $soa = $dnsdb->getSOA($webvar{defrec}, $webvar{revrec}, $webvar{parentid});
    19441944  $page->param(ttl      => ($webvar{ttl} ? $webvar{ttl} : $soa->{minttl}));
    19451945}
Note: See TracChangeset for help on using the changeset viewer.