Changeset 22 for trunk


Ignore:
Timestamp:
08/30/10 15:13:38 (14 years ago)
Author:
Kris Deugau
Message:

/trunk/dnsbl

Extend browse listing in reporting to indicate containing blocks
and repeat-offender IPs, as well as show containing block on report
finalize page

Location:
trunk/dnsbl
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/dnsbl/dnsbl.cgi

    r19 r22  
    8989  $page->param(ip => $webvar{ip});
    9090  $page->param(err => $err);
     91
     92  $page->param(browsebits => browse($dbh,$webvar{ip}));
    9193}
    9294print $page->output;
     
    101103  my $dbh = shift;
    102104  my $ip = shift;
     105  my $ipcidr = new NetAddr::IP $ip;
    103106
    104107  my $basesql = "SELECT b.block,o.orgname,b.listme,o.listme,b.comments,o.comments ".
     
    118121  $sth0->execute($ip);
    119122  while (my ($block0,$org0,$listmeb0,$listmeo0,$bcomments0,$ocomments0) = $sth0->fetchrow_array) {
    120     $tmpl0->param(lvlclass => 'lvl0'.($dnsbl->autolist_block($block0) ? ' auto0' : ''));
     123    my $block0cidr = new NetAddr::IP $block0;
     124    $tmpl0->param(lvlclass => 'lvl0'.($dnsbl->autolist_block($block0) ? ' auto0' : '').
     125        ( $ipcidr->within($block0cidr) ? ' inhere' : ''));
    121126    $tmpl0->param(netclass => ($listmeb0 ? 'b0list' : ''));
    122127    $tmpl0->param(net => $block0);
     
    129134    if ($sth1->rows > 0) {
    130135      while (my ($block1,$org1,$listmeb1,$listmeo1,$bcomments1,$ocomments1) = $sth1->fetchrow_array) {
     136        my $block1cidr = new NetAddr::IP $block1;
    131137        my $tmpl1 = new HTML::Template(filename => 'templates/browse-block.tmpl');
    132         $tmpl1->param(lvlclass => 'lvl1'.($dnsbl->autolist_block($block1) ? ' auto1' : ''));
     138        $tmpl1->param(lvlclass => 'lvl1'.($dnsbl->autolist_block($block1) ? ' auto1' : '').
     139                ( $ipcidr->within($block1cidr) ? ' inhere' : ''));
    133140        $tmpl1->param(netclass => ($listmeb1 ? 'b1list' : ''));
    134141        $tmpl1->param(net => $block1);
     
    142149        if ($sth2->rows > 0) {
    143150          while (my ($block2,$org2,$listmeb2,$listmeo2,$bcomments2,$ocomments2) = $sth2->fetchrow_array) {
     151            my $block2cidr = new NetAddr::IP $block2;
    144152            my $tmpl2 = new HTML::Template(filename => 'templates/browse-block.tmpl');
    145             $tmpl2->param(lvlclass => 'lvl2'.($dnsbl->autolist_block($block2) ? ' auto2' : ''));
     153            $tmpl2->param(lvlclass => 'lvl2'.($dnsbl->autolist_block($block2) ? ' auto2' : '').
     154                ( $ipcidr->within($block2cidr) ? ' inhere' : ''));
    146155            $tmpl2->param(netclass => ($listmeb2 ? 'b2list' : ''));
    147156            $tmpl2->param(net => $block2);
     
    158167              $iprow{ipcount} = $data4[1];
    159168              $iprow{indent} = '    ';
     169              $iprow{repeater} = 1 if $ip eq $data4[0];
    160170#       ip        | count | s4list |             added
    161171              push @iprows, \%iprow;
     
    175185          $iprow{ipcount} = $data4[1];
    176186          $iprow{indent} = '  ';
     187          $iprow{repeater} = 1 if $ip eq $data4[0];
    177188#       ip        | count | s4list |             added
    178189          push @iprows, \%iprow;
     
    193204      $iprow{ipcount} = $data4[1];
    194205      $iprow{indent} = '';
     206      $iprow{repeater} = 1 if $ip eq $data4[0];
    195207#       ip        | count | s4list |             added
    196208      push @iprows, \%iprow;
  • trunk/dnsbl/templates/browse-block.tmpl

    r20 r22  
    44<TMPL_IF subs><TMPL_VAR NAME=subs>
    55</TMPL_IF><TMPL_IF iplist><TMPL_VAR NAME=indent>  <div class=iplist>
    6 <TMPL_LOOP NAME=iplist><TMPL_VAR NAME=indent>    <TMPL_VAR NAME=ip> (<TMPL_VAR NAME=ipcount>)<br>
     6<TMPL_LOOP NAME=iplist><TMPL_VAR NAME=indent>    <span<TMPL_IF repeater> class="repeater"</TMPL_IF>><TMPL_VAR NAME=ip> (<TMPL_VAR NAME=ipcount>)</span><br>
    77</TMPL_LOOP>
    88<TMPL_VAR NAME=indent>  </div></TMPL_IF>
  • trunk/dnsbl/templates/dbreport.tmpl

    r11 r22  
    22<head>
    33<title>added <TMPL_VAR NAME=ip></title>
     4<link rel="stylesheet" type="text/css" href="templates/dnsbl.css" />
    45</head>
    56<body>
     7<table><tr><td valign=top>
    68added <TMPL_VAR NAME=ip>
    79<TMPL_IF org0><br>added <TMPL_VAR NAME=org0></TMPL_IF>
     
    1315<TMPL_IF err><hr><TMPL_VAR NAME=err></TMPL_IF>
    1416<hr><a href="/">Back</a>
     17<TMPL_IF NAME=browsebits>
     18<td valign=top>
     19<TMPL_VAR NAME=browsebits>
     20</td>
     21</TMPL_IF>
     22</td></tr></table>
    1523</body>
    1624</html>
  • trunk/dnsbl/templates/dnsbl.css

    r19 r22  
    7676  width: 150px;
    7777}
     78/*.inhere {
     79  font-weight: bold;
     80}*/
    7881.inhere {
     82  border: 3px solid #ff0000;
     83}
     84.repeater {
    7985  font-weight: bold;
    8086}
  • trunk/dnsbl/templates/index.tmpl

    r2 r22  
    66<table>
    77<form action="dnsbl.cgi"><input type=hidden name=page value=report>
    8 <tr><td>Enter an IP:</td>
     8<tr><td>Add an IP:</td>
    99<td><input name=ip></td></tr>
    1010<tr><td><input type=submit></td></tr>
Note: See TracChangeset for help on using the changeset viewer.