Ignore:
Timestamp:
12/11/13 15:45:18 (10 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Merge reverse DNS work and object conversion from /trunk, 4 of mumble

Includes changes through r492 with a few minor conflicts.

Location:
branches/stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/stable

  • branches/stable/textrecs.cgi

    r546 r547  
    3131use lib '.';    ##uselib##
    3232
    33 use DNSDB qw(:ALL);
     33use DNSDB;
    3434
    3535# Let's do these templates right...
     
    4848#$webvar{revrec} = 'n' if !$webvar{revrec};     # non-reverse (domain) records
    4949
    50 # load some local system defaults (mainly DB connect info)
    51 # note this is not *absolutely* fatal, since there's a default dbname/user/pass in DNSDB.pm
    52 # we'll catch a bad DB connect string once we get to trying that
    53 ##fixme:  pass params to loadConfig, and use them there, to allow one codebase to support multiple sites
    54 if (!loadConfig()) {
    55   warn "Using default configuration;  unable to load custom settings: $DNSDB::errstr";
    56 }
     50my $dnsdb = new DNSDB;
    5751
    5852# Check the session and if we have a zone ID to retrieve.  Call a failure sub if not.
    5953my $sid = ($webvar{sid} ? $webvar{sid} : undef);
    60 my $session = new CGI::Session("driver:File", $sid, {Directory => $config{sessiondir}})
     54my $session = new CGI::Session("driver:File", $sid, {Directory => $dnsdb->{sessiondir}})
    6155        or die CGI::Session->errstr();
    6256do_not_pass_go() if !$sid;
    6357do_not_pass_go() if !$webvar{id};
    6458
    65 ##fixme: quit throwing the database handle around, and put all the SQL and direct DB fiddling into DNSDB.pm
    66 # dbname, user, pass, host (optional)
    67 my ($dbh,$msg) = connectDB($config{dbname}, $config{dbuser}, $config{dbpass}, $config{dbhost});
    68 # Load config pieces from the database.  Ideally all but the DB user/pass/etc should be loaded here.
    69 initGlobals($dbh);
    70 
    7159my $zone;
    72 $zone = domainName($dbh, $webvar{id}) if $webvar{defrec} eq 'n';
    73 $zone = "group ".groupName($dbh, $webvar{id}) if $webvar{defrec} eq 'y';
     60$zone = ($webvar{revrec} eq 'n' ? $dnsdb->domainName($webvar{id}) : $dnsdb->revName($webvar{id}))
     61        if $webvar{defrec} eq 'n';
     62$zone = "group ".$dnsdb->groupName($webvar{id}) if $webvar{defrec} eq 'y';
    7463
    7564##fixme:  do we support both HTML-plain and true plaintext?  could be done, with another $webvar{}
     
    8473print qq(Press the "Back" button to return to the standard record list.\n\n);
    8574
    86 my $reclist = getDomRecs($dbh, $webvar{defrec}, $webvar{id}, 0, 'all', 'type,host', 'ASC');
    87 
     75my $reclist = $dnsdb->getDomRecs(defrec => $webvar{defrec}, revrec => $webvar{revrec}, id => $webvar{id},
     76        sortby => ($webvar{revrec} eq 'n' ? 'type,host' : 'type,val'), sortorder => 'ASC');
    8877foreach my $rec (@$reclist) {
    8978  $rec->{type} = $typemap{$rec->{type}};
Note: See TracChangeset for help on using the changeset viewer.