Changeset 62


Ignore:
Timestamp:
02/12/16 15:45:59 (9 years ago)
Author:
Kris Deugau
Message:

/trunk/uribl

Commit accumulated tweaks and fixes from production:

  • add "use Encode;" and set the HTTP charset header to deal with non-ASCII more sanely
  • reorder mangling of request-URI components a little so we can symlink index.cgi -> uridb.cgi
  • collapse results from extract-data showing a hit on some other DNSBL into a single field rather than just treating it as "another domain" that needs to be hand-reflagged as "don't list"
  • use POST for form submissions; mainly to clean up the working URL
Location:
trunk/uribl
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/uribl/Makefile

    r42 r62  
    77
    88PKGNAME=uridb
    9 VERSION=0.1
     9VERSION=0.1.2
    1010
    1111# bloody stupid Debian config puts OS-provided packaged sitelib under
     
    2929        rm -rf $(PKGNAME)-$(VERSION)
    3030        # gpg --detach-sign $(PKGNAME)-$(VERSION).tar.gz
    31 
  • trunk/uribl/templates/index.tmpl

    r27 r62  
    66<TMPL_VAR NAME=pgcomment>
    77<!-- <TMPL_VAR NAME=uridbsiteroot> -->
    8 <form action="<TMPL_VAR NAME=cgiself>">
     8<form action="<TMPL_VAR NAME=cgiself>" method="POST">
    99<input type=hidden name=page value=report>
    1010<table>
  • trunk/uribl/templates/report.tmpl

    r27 r62  
    77<TMPL_VAR NAME=pgcomment><br>
    88<a href="<TMPL_VAR NAME=uridbsiteroot>">Back</a>
    9 <form action="<TMPL_VAR NAME=cgiself>">
     9<form action="<TMPL_VAR NAME=cgiself>" method="POST">
    1010<input type=hidden name=page value="dbreport">
    1111<table border=1>
    12 <tr><td>&nbsp;</td><td colspan=4 align=center>List as:</td></tr>
    13 <tr><td>Domain</td><td>Don't list</td><td>Black</td><td>Grey</td><td>URL shortener</td><td>Comment</td></tr>
     12<tr><td colspan=2>&nbsp;</td><td colspan=4 align=center>List as:</td></tr>
     13<tr><td>Domain</td><td>Other lists</td><td>Don't list</td><td>Black</td><td>Grey</td><td>URL shortener</td><td>Comment</td></tr>
    1414<TMPL_LOOP NAME=domlist>
    1515<tr>
    1616<td><TMPL_VAR NAME=domain><input type=hidden name=dom<TMPL_VAR NAME=domindex> value="<TMPL_VAR NAME=domain>"></td>
     17<td><TMPL_VAR NAME=otherlists></td>
    1718<td align="center"><input type=radio name=dom<TMPL_VAR NAME=domindex>type value="0"></td>
    1819<td align="center"><input type=radio name=dom<TMPL_VAR NAME=domindex>type value="2" checked></td>
  • trunk/uribl/uridb.cgi

    r41 r62  
    2525use CGI::Simple;
    2626use HTML::Template;
     27use Encode;
     28
    2729use URIdb;
    2830
     
    4042my $uridb = new URIdb;
    4143
    42 print "Content-type: text/html\n\n";
     44print $q->header(-charset=>'utf8');
    4345
    4446# default DB info - all other settings should be loaded from the DB.
     
    7173
    7274my $page;
    73 my $templatedir = $ENV{SCRIPT_FILENAME};
    74 $templatedir =~ s/uridb\.cgi//;
    75 $templatedir .= "templates";
    76 $ENV{HTML_TEMPLATE_ROOT} = $templatedir;
    7775
    7876my $cgiself = $ENV{SCRIPT_FILENAME};
    7977$cgiself =~ s|.+/([^/]+\.cgi)$|$1|;
     78
     79my $templatedir = $ENV{SCRIPT_FILENAME};
     80$templatedir =~ s/$cgiself//;
     81$templatedir .= "templates";
     82$ENV{HTML_TEMPLATE_ROOT} = $templatedir;
    8083
    8184my %config;
     
    98101
    99102my $uridbsiteroot = $ENV{REQUEST_URI};
    100 $uridbsiteroot =~ s|/uridb\.cgi\?.+|/|;
     103$uridbsiteroot =~ s|/$cgiself\?.+|/|;
    101104$page->param(uridbsiteroot => $uridbsiteroot);
    102105
     
    108111  foreach my $domain (@dombase) {
    109112    my %row;
    110     $row{domindex} = $domcount++;
    111113    ($domain) = split /:/, $domain;
    112114    $domain =~ s/^\+//;
    113115    $domain =~ s/\.uribl.company.com//;
    114116    chomp $domain;
     117    # now, see if it's multilisted
     118    if ($domain =~ / on (\w+)\s*$/) {
     119      my $sub = $1;
     120      #$domain =~ s/ on \w+\s*$//;
     121      $domlist[$domcount-1]->{otherlists} .= ",$sub";
     122      next;
     123    }
     124    $row{domindex} = $domcount++;
    115125    $row{domain} = $domain;
    116126    push @domlist, \%row;
    117127  }
     128
    118129  $page->param(domlist => \@domlist);
    119130
Note: See TracChangeset for help on using the changeset viewer.