#!/usr/bin/perl # ------------------------------------------------------------------- # Program: swish-cgi.pl # Author : John Millard (millarj@muohio.edu) # # -------- User defined configuration variables ----------- # Optional parameters to pass to the SWISH searcher $params = " "; # The Full name of your organization -- Printed with Search Results # $organization = "Fornits Workshop"; # The full name of your department -- Printed with search Results # $department = "Swish-e Hack Shop"; # Open our Configuration file, you can edit this by running setup dbmopen(%Conf,"admin/conf/Init",undef); # Absolute path to your peaars installation $BasePath =$Conf{'PEAARSRoot'}; # Path to your http root for proper URL translation $httpRoot = $Conf{'HTTPRoot'}; # Absolute path and command to execute the SWISH searcher $swish = $Conf{'SwisheRoot'}; # URL of where you put this cgi $swishcgi = $ENV{'SCRIPT_NAME'};# $title = $Conf{'title'}; $head = `cat inc/head1.txt`; $body = `cat inc/body.txt`; $foot = `cat inc/foot.txt`; $dbase = $Conf{'dbase'}; $table = $Conf{'table'}; $imgpath = $Conf{'imgpath'}; $recipient = "curiosity\@fornits.com"; # ------ End of Configuration Variables ------------ use CGI qw(:all); #sub read_form # Read in form data if it exists read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the Name value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; push(@search_tags, $value), next if ($name eq 'search_tags'); $FORM{$name} = $value } if ($fetch=param('fetch')){ ## Compatability For the Old Peaars $BasePath =~ /$httpRoot(.*)/i; $tmp1 = $1; $swishcgi =~ /(^.*?)\/.*\..*/i; my $base="http://".$ENV{'HTTP_HOST'}.$tmp1.$1; dbmopen(%Articles,"OldArticleList",0775) || die $!; print "location: $base/$Articles{$fetch}\n\n"; exit; } if ($FORM{'query'}){ $query = $FORM{'query'}; $results =$FORM{'results'}; $month_limit= $FORM{'months'}; }elsif (param('query')){ $query = param('query'); #$FORM{'query'}; $results=0 unless $results = param('results'); #$FORM{'results'}; $month_limit=0 unless $month_limit=param('months');# $FORM{'months'}; }elsif (param('keywords')){ $query = param('keywords'); #$FORM{'query'}; $results=0 unless $results = param('results'); #$FORM{'results'}; $month_limit=0 unless $month_limit=param('months');# $FORM{'months'}; }else{ &html_header($head1," "); &print_form; &html_trailer; } if (@search_tags) { $tags = join("",@search_tags); $search_tags = "\-t $tags"; } else { $search_tags = ""; } if ($query){ &html_header($head1,"Your Search Results"); &print_form; &search_parse; &html_trailer; }else{ &html_header($head1," "); &print_form; &html_trailer; } sub print_form { my $count=0; @dir=<$BasePath/articles/*>; $month_options = "All\n"; foreach $dir (reverse(@dir)){ if (-d $dir){ ++$count; $month_options .= "$count\n"; } } # To change the form that get's generated on the fly, edit the HTML below. print <Search Form Enter word(s). You can connect terms with and or or Maximum # of Items No Limit 10 20 30 40 50 100 Months to go back $month_options and will find items that contain both terms or will find items that contain either word, but not necessarily both Search In the following Tags: Leave Blank to search everything Title Tags Heading Tags Comment Tags Emphasized Text or Browse the archive.
Maximum # of Items No Limit 10 20 30 40 50 100 Months to go back $month_options
and will find items that contain both terms or will find items that contain either word, but not necessarily both
or Browse the archive.