Changeset 547 for branches/stable/textrecs.cgi
- Timestamp:
- 12/11/13 15:45:18 (11 years ago)
- Location:
- branches/stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable
-
branches/stable/textrecs.cgi
r546 r547 31 31 use lib '.'; ##uselib## 32 32 33 use DNSDB qw(:ALL);33 use DNSDB; 34 34 35 35 # Let's do these templates right... … … 48 48 #$webvar{revrec} = 'n' if !$webvar{revrec}; # non-reverse (domain) records 49 49 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 } 50 my $dnsdb = new DNSDB; 57 51 58 52 # Check the session and if we have a zone ID to retrieve. Call a failure sub if not. 59 53 my $sid = ($webvar{sid} ? $webvar{sid} : undef); 60 my $session = new CGI::Session("driver:File", $sid, {Directory => $ config{sessiondir}})54 my $session = new CGI::Session("driver:File", $sid, {Directory => $dnsdb->{sessiondir}}) 61 55 or die CGI::Session->errstr(); 62 56 do_not_pass_go() if !$sid; 63 57 do_not_pass_go() if !$webvar{id}; 64 58 65 ##fixme: quit throwing the database handle around, and put all the SQL and direct DB fiddling into DNSDB.pm66 # 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 71 59 my $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'; 74 63 75 64 ##fixme: do we support both HTML-plain and true plaintext? could be done, with another $webvar{} … … 84 73 print qq(Press the "Back" button to return to the standard record list.\n\n); 85 74 86 my $reclist = getDomRecs($dbh, $webvar{defrec}, $webvar{id}, 0, 'all', 'type,host', 'ASC');87 75 my $reclist = $dnsdb->getDomRecs(defrec => $webvar{defrec}, revrec => $webvar{revrec}, id => $webvar{id}, 76 sortby => ($webvar{revrec} eq 'n' ? 'type,host' : 'type,val'), sortorder => 'ASC'); 88 77 foreach my $rec (@$reclist) { 89 78 $rec->{type} = $typemap{$rec->{type}};
Note:
See TracChangeset
for help on using the changeset viewer.