Changeset 309 for trunk


Ignore:
Timestamp:
04/18/12 17:29:02 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Minor code review

  • remove a dangling variable and comment in addDomain()
  • fix useless but syntactically correct (ebbeh?) use of grep() in getZoneList()
  • fix handling for unknown sortby in getZoneList()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r307 r309  
    14631463  return ('FAIL',"Need domain status") if !defined($state);
    14641464
    1465   my %userinfo = @_;    # remaining bits.
    1466 # user ID, username, user full name
    1467 
    14681465  $state = 1 if $state =~ /^active$/;
    14691466  $state = 1 if $state =~ /^on$/;
     
    18871884  my @zonelist;
    18881885
    1889   $args{sortorder} = 'ASC' if !grep $args{sortorder}, ('ASC','DESC');
     1886  $args{sortorder} = 'ASC' if !grep /^$args{sortorder}$/, ('ASC','DESC');
    18901887  $args{offset} = 0 if !$args{offset} || $args{offset} !~ /^(?:all|\d+)$/;
    18911888
     
    18991896  # Not as compact, and fix-me-twice if the common bits get wrong, but much easier to read
    19001897  if ($args{revrec} eq 'n') {
    1901     $args{sortby} = 'domain' if !grep $args{sortby}, ('revnet','group','status');
     1898    $args{sortby} = 'domain' if !grep /^$args{sortby}$/, ('domain','group','status');
    19021899    $sql = "SELECT domain_id,domain,status,groups.group_name AS group FROM domains".
    19031900        " INNER JOIN groups ON domains.group_id=groups.group_id".
     
    19071904  } else {
    19081905##fixme:  arguably startwith here is irrelevant.  depends on the UI though.
    1909     $args{sortby} = 'revnet' if !grep $args{sortby}, ('domain','group','status');
     1906    $args{sortby} = 'revnet' if !grep /^$args{sortby}$/, ('revnet','group','status');
    19101907    $sql = "SELECT rdns_id,revnet,status,groups.group_name AS group FROM revzones".
    19111908        " INNER JOIN groups ON revzones.group_id=groups.group_id".
     
    33473344
    33483345    if ($rev eq 'n') {
    3349 
    33503346##fixme:  serial
    33513347      $dbh->do("INSERT INTO domains (domain,group_id,status) VALUES (?,?,?)", undef, ($zone,$group,$status) );
Note: See TracChangeset for help on using the changeset viewer.