Changeset 17 for trunk/DNSDB.pm


Ignore:
Timestamp:
09/30/09 16:54:10 (15 years ago)
Author:
Kris Deugau
Message:

/trunk

checkpoint
dns.cgi:

  • misc group-handling tweaks/fixme-fixes
  • misc code and SQL formatting normalizations
  • add group management list-the-groups page
  • extend common-template-parameters section

DNSDB.pm:

  • fix start point for returned records in record list
  • fix several return-on-error conditions for record add/update

templates/

  • add group management/comment to menu
  • use fpnla.tmpl in domlist.tmpl
  • misc minor fixups
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r16 r17  
    257257
    258258## DNSDB::grpName()
    259 # Return the domain name based on a domain ID
    260 # Takes a database handle and the domain ID
    261 # Returns the domain name or undef on failure
     259# Return the group name based on a group ID
     260# Takes a database handle and the group ID
     261# Returns the group name or undef on failure
    262262sub grpName {
    263263  $errstr = '';
     
    388388  $sql .= " and not type=$reverse_typemap{SOA} order by $order";
    389389##fixme:  need to set nstart properly (offset is not internally multiplied with limit)
    390   $sql .= " limit $nrecs offset $nstart" if $nstart ne 'all';
     390  $sql .= " limit $nrecs offset ".($nstart*$nrecs) if $nstart ne 'all';
    391391
    392392  my $sth = $dbh->prepare($sql);
     
    457457sub updateRec {
    458458  $errstr = '';
     459
    459460  my $dbh = shift;
    460461  my $defrec = shift;
     
    475476
    476477  if ($type == $reverse_typemap{MX} || $type == $reverse_typemap{SRV}) {
    477     $dist = shift
    478         or return ('FAIL',"MX or SRV requires distance");
     478    $dist = shift;
     479    return ('FAIL',"MX or SRV requires distance") if !defined($dist);
    479480    if ($type == $reverse_typemap{SRV}) {
    480       my $weight = shift
    481         or return ('FAIL',"SRV requires weight");
    482       my $port = shift
    483         or return ('FAIL',"SRV requires port");
     481      $weight = shift;
     482      return ('FAIL',"SRV requires weight") if !defined($weight);
     483      $port = shift;
     484      return ('FAIL',"SRV requires port") if !defined($port);
    484485    }
    485486  }
     
    490491  $sth->execute($host,$type,$val,$ttl,$dist,$weight,$port,$id);
    491492
    492   return ('FAIL',$sth->errstr) if $sth->err;
     493  return ('FAIL',$sth->errstr."<br>\n$errstr<br>\n") if $sth->err;
    493494
    494495  return ('OK','OK');
Note: See TracChangeset for help on using the changeset viewer.