Changeset 516
- Timestamp:
- 05/24/13 16:58:49 (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r514 r516 1811 1811 my $state = shift; 1812 1812 return ('FAIL',"Domain status must be specified\n") if !defined($state); 1813 my $defloc = shift || ''; 1813 1814 1814 1815 $state = 1 if $state =~ /^active$/; … … 1838 1839 eval { 1839 1840 # insert the domain... 1840 $dbh->do("INSERT INTO domains (domain,group_id,status) VALUES (?,?,?)", undef, ($domain, $group, $state)); 1841 $dbh->do("INSERT INTO domains (domain,group_id,status,default_location) VALUES (?,?,?,?)", undef, 1842 ($domain, $group, $state, $defloc)); 1841 1843 1842 1844 # get the ID... … … 1849 1851 # ... and now we construct the standard records from the default set. NB: group should be variable. 1850 1852 my $sth = $dbh->prepare("SELECT host,type,val,distance,weight,port,ttl FROM default_records WHERE group_id=?"); 1851 my $sth_in = $dbh->prepare("INSERT INTO records (domain_id,host,type,val,distance,weight,port,ttl )".1852 " VALUES ($dom_id,?,?,?,?,?,?,? )");1853 my $sth_in = $dbh->prepare("INSERT INTO records (domain_id,host,type,val,distance,weight,port,ttl,location)". 1854 " VALUES ($dom_id,?,?,?,?,?,?,?,?)"); 1853 1855 $sth->execute($group); 1854 while (my ($host, $type,$val,$dist,$weight,$port,$ttl) = $sth->fetchrow_array()) {1856 while (my ($host, $type, $val, $dist, $weight, $port, $ttl) = $sth->fetchrow_array()) { 1855 1857 $host =~ s/DOMAIN/$domain/g; 1856 1858 $val =~ s/DOMAIN/$domain/g; 1857 $sth_in->execute($host, $type,$val,$dist,$weight,$port,$ttl);1859 $sth_in->execute($host, $type, $val, $dist, $weight, $port, $ttl, $defloc); 1858 1860 if ($typemap{$type} eq 'SOA') { 1859 1861 my @tmp1 = split /:/, $host; -
trunk/dns-rpc.cgi
r515 r516 192 192 _commoncheck(\%args, 'y'); 193 193 194 my ($code, $msg) = $dnsdb->addDomain($args{domain}, $args{group}, $args{state} );194 my ($code, $msg) = $dnsdb->addDomain($args{domain}, $args{group}, $args{state}, $args{location}); 195 195 die "$msg\n" if $code eq 'FAIL'; 196 196 return $msg; # domain ID -
trunk/dns.cgi
r513 r516 394 394 $webvar{group} = $curgroup if !$webvar{group}; 395 395 fill_grouplist("grouplist", $webvar{group}); 396 fill_loclist( );396 fill_loclist($curgroup, $webvar{defloc} ? $webvar{defloc} : ''); 397 397 398 398 if ($session->param('add_failed')) { … … 420 420 $webvar{makeactive} = 0 if !defined($webvar{makeactive}); 421 421 422 my ($code,$msg) = $dnsdb->addDomain($webvar{domain}, $webvar{group}, ($webvar{makeactive} eq 'on' ? 1 : 0)); 422 my ($code,$msg) = $dnsdb->addDomain($webvar{domain}, $webvar{group}, ($webvar{makeactive} eq 'on' ? 1 : 0), 423 $webvar{defloc}); 423 424 424 425 if ($code eq 'OK') { … … 430 431 $session->param('add_failed', 1); 431 432 ##fixme: domain a security risk for XSS? 432 changepage(page => "newdomain", domain => $webvar{domain}, errmsg => $msg,433 makeactive => ($webvar{makeactive} ? 'y' : 'n'), group => $webvar{group});433 changepage(page => "newdomain", errmsg => $msg, domain => $webvar{domain}, 434 group => $webvar{group}, makeactive => ($webvar{makeactive} ? 'y' : 'n'), defloc => $webvar{defloc}); 434 435 } 435 436 -
trunk/templates/newdomain.tmpl
r493 r516 32 32 <TMPL_IF location_view><TMPL_IF record_locchg> 33 33 <tr class="datalinelight"> 34 <td> Default location/view:</td>34 <td>Location/view:</td> 35 35 <td><select name="defloc"> 36 36 <TMPL_LOOP name=loclist> <option value="<TMPL_VAR NAME=loc>"<TMPL_IF selected> selected="selected"</TMPL_IF>><TMPL_VAR NAME=locname></option> -
trunk/templates/newrevzone.tmpl
r493 r516 26 26 </tr> 27 27 <tr class="datalinelight"> 28 <td>Default location/view:</td>29 <td align="left">30 <select name="location">31 <TMPL_LOOP loclist>32 <option value="<TMPL_VAR NAME=loc>"<TMPL_IF selected> selected</TMPL_IF>><TMPL_VAR NAME=locname></option>33 </TMPL_LOOP>34 </select>35 </td>36 </tr>37 <tr class="datalinelight">38 28 <td>Add reverse zone to group:</td> 39 29 <td><select name="group"> … … 45 35 <td>Make reverse zone active on next DNS propagation</td><td><input type="checkbox" name="makeactive" checked="checked" /></td> 46 36 </tr> 37 <TMPL_IF location_view><TMPL_IF record_locchg> 38 <tr class="datalinelight"> 39 <td>Location/view:</td> 40 <td align="left"> 41 <select name="location"> 42 <TMPL_LOOP loclist> 43 <option value="<TMPL_VAR NAME=loc>"<TMPL_IF selected> selected="selected"</TMPL_IF>><TMPL_VAR NAME=locname></option> 44 </TMPL_LOOP> 45 </select> 46 </td> 47 </tr> 48 </TMPL_IF></TMPL_IF> 47 49 <tr><td colspan="2" class="tblsubmit"><input type="submit" value="Add reverse zone" /></td></tr> 48 50 </table>
Note:
See TracChangeset
for help on using the changeset viewer.