) {
next unless /Keywords:/;
last if (/^Keywords: ([\w,]*)$/) && ($keys=$1);
}
# the slightly obscure bit above is because $1 does not survive outside the while block
close (RFC);
@keywords=split(/,/,$keys);
@keywords=('',@keywords);
print "Select by",br,"keyword ",popup_menu('select_keywords',\@keywords,'');
print "keyword ",popup_menu('select_keywords2',\@keywords,'');
print "status ",popup_menu('select_status',['','Informational','Experimental','Historic',
'Best_Current_Practice','Draft_Standard','Proposed_Standard','Standard'],''),br;
print "RFC title contains ",textfield(-name=>'title_search',-default=>'',-size=>20)," case sensitive",br;
print "Display as ",radio_group(-name=>'DisplayAs',-values=>[List,Table,Raw],-default=>'List');
print " - URLs in table mode are ",radio_group(-name=>'TableURL',-values=>[Local,Global],-default=>'Local');
print p,submit,end_form,p,"This rfc indexing cgi script (version $version) was written by John.Lines",
"Documentation and the latest version can be found at
http://www.paladin.demon.co.uk/tag-types/rfc/",p,hr,p;
if (param) {
# untaint localonly
$p_localonly=param('localonly');
$p_localonly =~ /^([\w]*)$/;
$p_localonly=$1;
$selectlocal="";
$selectlocal="| $tagbindir/tagextract -m X-local-url -exists " if ($p_localonly eq "on");
$p_obs=param('Hide_Obsoleted');
$p_obs =~ /^([\w]*)$/;
$p_obs=$1;
$hide_obsoleted="";
$hide_obsoleted="| $tagbindir/tagextract -v -m Obsoleted-by -exists " if ($p_obs eq "on" );
$selectkeywd="";
$keyword=param('select_keywords');
#
# security - keyword must be a single word (at present) - for taint checks
# - note that this may need to be revised for more complex patterns
if ( $keyword =~ /^([\w]*)$/ ) {
$keyword = $1;
}
else {
die "Bad data in keyword $keyword!\n";
}
$selectkeywd="| $tagbindir/tagextract -m Keywords -contains $keyword" if ($keyword ne "");
$selectkeywd2="";
$keyword=param('select_keywords2');
if ( $keyword =~ /^([\w]*)$/ ) {
$keyword = $1;
}
else {
die "Bad data in keyword $keyword!\n";
}
$selectkeywd2="| $tagbindir/tagextract -m Keywords -contains $keyword" if ($keyword ne "");
$p_sts=param('select_status');
$p_sts =~ /^([\w]*)$/;
$p_sts=$1;
$selectsts="";
$selectsts="| $tagbindir/tagextract -m Status -eq $p_sts " if ($p_sts ne "");
$p_titlesearch=param('title_search');
$p_titlesearch =~ /^([\w ]*)$/;
$p_titlesearch=$1;
$searchtitle="";
$searchtitle="| $tagbindir/tagextract -m Title -contains '$p_titlesearch'" if ($p_titlesearch ne "");
$p_urlmode=param('TableURL');
$p_urlmode =~ /^([\w]*)$/;
$p_urlmode=$1;
$urlfield="Url";
$urlfield="X-local-url" if ($p_urlmode eq "Local");
$p_disp=param('DisplayAs');
$p_disp =~ /^([\w]*)$/;
$p_disp=$1;
if ($p_disp eq "Table") {
$display_cmd="| $tagbindir/tag2html -o border -t Rfc Title -u $urlfield";
} elsif ($p_disp eq "List") {
$display_cmd="| $tagbindir/tag2html -u Url -u X-local-url";
} elsif ($p_disp eq "Raw") {
# for the moment we will just write it out as preformatted text, would like
# to do something more useful here - such as switch mime types
print "\n";
$display_cmd="";
}
system("$cat $rfc_file $hide_obsoleted $selectlocal $selectkeywd $selectkeywd2 $selectsts $searchtitle $display_cmd");
print "\n" if ($p_disp eq "Raw");
}
print end_html;
exit;