diff --git a/en/cgi/dosendpr.cgi b/en/cgi/dosendpr.cgi index 39715f2276..68e8c79450 100755 --- a/en/cgi/dosendpr.cgi +++ b/en/cgi/dosendpr.cgi @@ -1,105 +1,106 @@ #!/usr/bin/perl # # Send-pr perl script to send a pr. # # Copyright (c) 1996 Free Range Media # # Copying and distribution permitted under the conditions of the # GNU General Public License Version 2. # (http://www.gnu.ai.mit.edu/copyleft/gpl.html) # +# $FreeBSD$ require "html.pl"; sub prerror { &html_title ("Problem Report Error"); &html_body(); print "There is an error in the configuration of the problem\n", "report form genator. Please back up one page and report\n", "the problem to the owner of that page. Report @_[0]."; &html_end(); exit (1); } &www_content ("text","html"); &cgi_form_in(); $gndb = $cgi_data{'gndb'}; if (-e "$gndb.def") { require "$gndb.def"; } else { &prerror("gndb problem"); } # Configuration if ($gnhow eq "mail") { if (-e "/usr/lib/sendmail") { $submitprog = "/usr/lib/sendmail -t" }; if (-e "/usr/sbin/sendmail") { $submitprog = "/usr/sbin/sendmail -t" }; } else { if (-e "$gnroot/queue-pr") { $submitprog = "$gnroot/queue-pr -q" }; } if (!$submitprog) { &prerror("submit program problem"); } &html_title ($gnspreptitle); &html_body ($gnsprepbody); # Verify the data ... if (!$cgi_data{'email'} || !$cgi_data{'originator'} || !$cgi_data{'synopsis'}) { if ($gnsprepbad && -e $gnsprepbad ) { print `cat $gnsprepbad`; } else { print "

Bad Data

\nYou need to specify at least your ", "electronic mail address, your name and a synopsis of the ", "of the problem.\n Please return to the form and add the ", "missing information. Thank you.\n"; } &html_end(); exit(1); } # Build the PR. $pr = "To: $gnemail\n" . "From: $cgi_data{'email'}\n" . "Subject: $cgi_data{'synopsis'}\n" . "X-Send-Pr-Version: www-1.0\n\n" . ">Submitter-Id:\t$cgi_data{'submitterid'}\n" . ">Originator:\t$cgi_data{'originator'}\n" . ">Organization:\t$cgi_data{'organization'}\n" . ">Confidential:\t$cgi_data{'confidential'}\n" . ">Synopsis:\t$cgi_data{'synopsis'}\n" . ">Severity:\t$cgi_data{'severity'}\n" . ">Priority:\t$cgi_data{'priority'}\n" . ">Category:\t$cgi_data{'category'}\n" . ">Class:\t\t$cgi_data{'class'}\n" . ">Release:\t$cgi_data{'release'}\n" . ">Environment:\t$cgi_data{'environment'}\n" . ">Description:\n$cgi_data{'description'}\n" . ">How-To-Repeat:\n$cgi_data{'howtorepeat'}\n" . ">Fix:\n$cgi_data{'fix'}\n"; # remove any carrage returns that appear in the report. $pr =~ s/\r//g; #print "
$submitprog\n\n$pr\n
"; if (open (SUBMIT, "|$submitprog")){ print SUBMIT $pr; close (SUBMIT); if ($gnspreppage && -e $gnspreppage ) { print `cat $gnspreppage`; } else { print "

Thank You

", "Thank you for the problem report. You should receive confirmation", " of your report by electronic mail within a day."; } } else { print "

Error

An error occured processing your problem report."; } &html_end(); diff --git a/en/cgi/ftp.cgi b/en/cgi/ftp.cgi index 575f4fbb55..d8e48ecd7b 100755 --- a/en/cgi/ftp.cgi +++ b/en/cgi/ftp.cgi @@ -1,35 +1,37 @@ #!/usr/bin/perl +# +# $FreeBSD$ require 'cgi-lib.pl'; require 'cgi-style.pl'; $newloc = "http://www.FreeBSD.org/"; print &html_header("FTP Download"); open (MIRRORS, "ftp.mirrors"); print "

Download $ARGV[0] from one of the following mirror sites:

\n"; $oldplace = ""; while () { if (/.*:.*:/ && !/^#/) { ($place, $site, $root) = split(':',$_); chop $root; $root =~ s/ *$//; if ($place ne $oldplace) { if ($oldplace ne "") { print "\n"; } print "$place\n\n"; print &html_footer; diff --git a/en/cgi/html.pl b/en/cgi/html.pl index 6496252a2a..b61ab22447 100755 --- a/en/cgi/html.pl +++ b/en/cgi/html.pl @@ -1,211 +1,212 @@ # $NetBSD: html.pl,v 1.2 1996/06/14 19:52:38 thorpej Exp $ # # perl routines to help generate html from cgi scripts in perl. # # written by Philip A. Nelson, 1995 and 1996. # # Copyright (c) 1995, 1996 Philip A. Nelson. # # Last modified: May 13, 1996. # # Copying and distribution permitted under the conditions of the # GNU General Public License Version 2. # (http://www.gnu.ai.mit.edu/copyleft/gpl.html) # +# $FreeBSD$ # # typical use is &www_content ("text","html"); # Should be the first output from a cgi script. # sub www_content { print "Content-type: $_[0]/$_[1]\n\n"; } # # &html_title ( title, other_head_html ) # Starts the html with a head and title. # sub html_title { print "\n\n$_[0]\n$_[1]\n\n"; } # # &html_body (Body_tag_attributes); # sub html_body { print "\n"; } # # Last call to end a complete html page. # &html_end(); # sub html_end { print "\n\n"; } # # &www_href (URL, link text, anchor_name) # link text and anchor name are optional. # If no link text, no is generated. # sub html_href { print ""; } } # # &cgi_form_in(); # # Form support: # Defines: # $cgi_data{$key} the data indexed by the key. # keys repeated twice gets data collected in # $cgi_data{$key} separated by "|"s. # # @keys (sequential list of keys) # @vals (sequential list of values) # $cgi_method # sub cgi_form_in { local ($data); $cgi_method = $ENV{'REQUEST_METHOD'}; if ($cgi_method eq 'GET') { $data = $ENV{'QUERY_STRING'}; } else { read(STDIN,$data,$ENV{'CONTENT_LENGTH'}); } @lines = split (/&/, $data); $nkeys = 0; foreach $line (@lines) { ($key,$val) = split (/=/, $line); $val =~ s/\+/ /g; $val =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack("C",hex($1))/eg ; if ($cgi_data{$key}) { $cgi_data{$key} = $cgi_data{$key}."|".$val; } else { $cgi_data{$key} = $val; } push (@keys, "$key"); push (@vals, "$val"); $nkeys += 1; } } # # Form creation routines # # # &html_form (action) - form with post method # sub html_form { print "
\n"; } # # &html_getform (action) - form with get method # sub html_getform { print "\n"; } # # &html_endform(); # sub html_endform { print "
\n"; } # # &html_input (type, name, value, size, maxlength, checked) # sub html_input { local ($type, $name, $value, $size, $maxlength, $checked) = @_; print "\n"; } # # &html_radio (name, value_list) # sub html_radio { local ($name, @values) = @_; foreach $val (@values) { &html_input ("radio", $name, $val); } } # # &html_checkbox (name, values) # checked values include a : which is removed. # sub html_checkbox { local ($name, @values) = @_; foreach $val (@values) { $val1 = $val; $val1 =~ s/://; if ($val eq $val1) { &html_input ("checkbox", $name, $val); } else { &html_input ("checkbox", $name, $val1,"" ,"" ,"checked"); } print $val1; } } # # &htlm_select (name, options ...) # # options including : are selected and the : is removed. # sub html_select { local ($name, @options) = @_; print "\n"; } # # &htlm_selectmult (name, options ...) # # allow multiple selections # sub html_selectmult { local ($name, @options) = @_; print "\n"; } # # &html_textarea (name, rows, cols, value); # sub html_textarea { local ($name, $rows, $cols, $value) = @_; print ""; } # return true! 1; diff --git a/en/cgi/reg.cgi b/en/cgi/reg.cgi index 6933253a97..93064cc8c0 100755 --- a/en/cgi/reg.cgi +++ b/en/cgi/reg.cgi @@ -1,106 +1,107 @@ #!/usr/bin/perl - +# # Perl program to send mail. - +# +# $FreeBSD$ $mailprog = '/usr/sbin/sendmail'; print "Content-type: text/html\n\n"; if ($ENV{'REQUEST_METHOD'} eq "get") { $buffer = $ENV{'QUERY_STRING'}; } else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } @nvpairs = split(/&/, $buffer); foreach $pair (@nvpairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } if ($FORM{"emaila"} eq "") { print "\n"; print "\n"; print "Entry Error: Email Field Blank\n"; print "\n"; print "\n"; print "\n"; print "

Your email address was left blank. Please enter it.\n"; print "\n"; print "\n"; exit(0); } $recipient = $FORM{'recipient'}; exit(0) if $recipient !~ /^[a-z_\.\-]+\@freebsd\.org$/io; $sub_recipient = "majordomo\@FreeBSD.org"; # # format the mail file format MAIL = ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $value . # Open the mail file and write to it open (MAIL, "|$mailprog $recipient") || die "$mailprog not available.\n"; print MAIL "From: $FORM{'emaila'}\n"; print MAIL "Subject: FreeBSD Registration from $FORM{'emaila'}\n\n"; print MAIL "\n"; print MAIL "$FORM{'First'}\n"; print MAIL "$FORM{'Last'}\n"; print MAIL "$FORM{'emaila'}\n"; print MAIL "

$FORM{'Address'}
\n"; print MAIL "$FORM{'City'}\n"; print MAIL "$FORM{'State'}\n"; print MAIL "$FORM{'Zip'}\n"; print MAIL ""; print MAIL " \n"; print MAIL "$FORM{'version'}\n"; print MAIL "\n"; print MAIL "\n"; close (MAIL); # Open the mail file and write to it # if user is subscribing to maillist if ($FORM{"announce"} eq "yes") { open (MAIL, "|$mailprog $sub_recipient") || die "$mailprog not available.\n"; print MAIL "From: $FORM{'emaila'}\n"; print MAIL "Subject: subscribe freebsd-announce $FORM{'emaila'}\n\n"; print MAIL "subscribe freebsd-announce $FORM{'emaila'}\n"; close (MAIL); } print "\n"; print "\n"; print "Mail Sent\n"; print "\n"; print "\n"; print " \n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "

Thank you, $FORM{'First'} $FORM{'Last'}, for your registration.\n"; print "
It has been submitted.\n"; if ($FORM{"announce"} eq "yes") { print "
As you requested, you have also been subscribed to announce\@FreeBSD.org.\n"; } print "

\n"; print "\n"; 1; diff --git a/en/cgi/search.cgi b/en/cgi/search.cgi index 25766db7c3..b2e3cc87a5 100755 --- a/en/cgi/search.cgi +++ b/en/cgi/search.cgi @@ -1,259 +1,261 @@ #!/usr/bin/perl # # mail-archive.pl -- a CGI interface to a wais indexed maling list archive. # # Origin: # Tony Sanders , Nov 1993 # # Hacked beyond recognition by: # John Fieber , Nov 1994 # # Format the mail messages a little nicer. # Add code to check database status before searching. # John Fieber , Aug 1996 # # Disclaimer: # This is pretty ugly in places. +# +# $FreeBSD$ $server_root = '/usr/local/www'; $waisq = "/usr/local/www/bin/waisq"; $sourcepath = "$server_root/db/index"; $hints = "/search/searchhints.html"; $searchpage = '/search/search.html'; $myurl = $ENV{'SCRIPT_NAME'}; require "open2.pl"; require "cgi-lib.pl"; require "cgi-style.pl"; @months = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); sub do_wais { &ReadParse; @FORM_words = split(/ /, $in{"words"}); @FORM_source = split(/\0/, $in{"source"}); $FORM_max = $in{"max"}; $FORM_docnum = $in{"docnum"}; if ($#FORM_words < 0) { print &html_header("Mail Archive Search") . "

No search term given."; print "

\nPlease return to the " . "search page and fill out the 'Search for' field!\n"; print &html_footer; exit 0; } @AVAIL_source = &checksource(@FORM_source); if ($#FORM_source != $#AVAIL_source) { $j = 0; $k = 0; foreach $i (0 .. $#FORM_source) { if ($FORM_source[$i] ne $AVAIL_source[$j]) { $badsource[$k] = $FORM_source[$i]; $k++; } else { $j++; } } $badsource = join(", ", @badsource); $badsource =~ s/,([^,]*)$/ and $1/; if ($#FORM_source - $#AVAIL_source > 1) { $availmsg = "

[The $badsource archives are currently unavailable.]

"; } else { $availmsg = "

[The $badsource archive is currently unavailable.]

"; } } if ($#AVAIL_source < 0) { $i = join("
, ", @FORM_source); $i =~ s/,([^,]*)$/ and $1/; print &html_header("Mail Archive Search") . "

None of the archives you requested ($i) are " . " available at this time.

\n"; print "

Please try again later, or return to the " . "search page and select a different archive.

\n"; print &html_footer; exit 0; } # Now we formulate the question to ask the server foreach $i (@AVAIL_source) { $w_sources .= "(:source-id\n :filename \"$i.src\"\n ) "; } $w_question = "\n (:question :version 2 :seed-words \"@FORM_words\" :relevant-documents ( ) :sourcepath \"$sourcepath/:\" :sources ( $w_sources ) :maximum-results $FORM_max :result-documents ( ) )\n"; # # First case, no document number so this is a regular search # print &html_header("Search Results"); print $availmsg; if ($#AVAIL_source > 0) { $src = join("
, ", @AVAIL_source); $src =~ s/,([^,]*)$/ and $1/; print "

The archives $src contain "; } else { print "The archive @AVAIL_source contains "; } print " the following items relevant to \`@FORM_words\':\n"; print "

    \n"; &open2(WAISOUT, WAISIN, $waisq, "-g"); print WAISIN $w_question; local(@mylist) = (); local($hits, $score, $headline, $lines, $bytes, $docid, $date, $file); while () { /:original-local-id.*#\(\s+([^\)]*)/ && ($docid = pack("C*", split(/\s+/, $1)), $docid =~ s/\s+/+/g); /:score\s+(\d+)/ && ($score = $1); /:filename "(.*)"/ && ($file = $1); /:number-of-lines\s+(\d+)/ && ($lines = $1); /:number-of-bytes\s+(\d+)/ && ($bytes = $1); /:headline "(.*)"/ && ($headline = $1, $headline =~ s/[Rr]e://); # XXX /:date "(\d+)"/ && ($date = $1, $hits++, push(@mylist, join("\t", $date, $headline, $docid, $bytes, $lines, $file, $score, $hits))); } if ($in{'sort'} eq "date") { foreach (reverse sort {$a <=> $b} @mylist) { ($date, $headline, $docid, $bytes, $lines, $file, $score, $hits) = split("\t"); &docdone; } } elsif ($in{'sort'} eq "subject") { local(@a, @c, $b, $d); foreach (@mylist) { @a = split("\t"); $b = $a[0]; # swap date and subject if ($a[1] =~ /(^[^:]+)(Re:.*)/) { $a[0] = "$2\t$1"; } else { $a[0] = "$a[1]\t."; } $a[1] = $b; push(@c, join("\t", @a)); } local($subject, $author); foreach (sort {$a cmp $b} @c) { ($subject, $author, $date, $docid, $bytes, $lines, $file, $score, $hits) = split("\t"); $headline = $author . $subject; &docdone; } } elsif ($in{'sort'} eq "author") { local(@a, @c, $b); foreach (@mylist) { @a = split("\t"); # swap date and subject $b = $a[0]; $a[0] = $a[1]; $a[1] = $b; push(@c, join("\t", @a)); } foreach (sort {$a cmp $b} @c) { ($headline, $date, $docid, $bytes, $lines, $file, $score, $hits) = split("\t"); &docdone; } } else { foreach (@mylist) { ($date, $headline, $docid, $bytes, $lines, $file, $score, $hits) = split("\t"); &docdone; } } #print qq[in: $in{'sort'}\n]; print "
\n"; print "

Didn't get what you expected? "; print "Look here for searching hints.

"; print qq{

Return to the search page

\n}; if ($hits == 0) { print "Nothing found.\n"; } print &html_footer; close(WAISOUT); close(WAISIN); } # Given an array of sources (sans .src extension), this routine # checks to see if they actually exist, and if they do, if they # are currently available (ie, not being updated). It returns # an array of sources that are actually available. sub checksource { local (@sources) = @_; $j = 0; foreach $i (@sources) { if (stat("$sourcepath/$i.src")) { if (!stat("$sourcepath/$i.update.lock")) { $goodsources[$j] = $i; $j++; } } } return(@goodsources); } sub htmlescape { local ($data) = @_; $data =~ s/&/&/g; $data =~ s/The archive $file contains no relevant documents.

" } else { $headline = &htmlescape($headline); $headline =~ s/\\"/\"/g; if ($file eq "www") { print "
  • $headline\n"; } else { print "
  • $headline\n"; } print "
    "; # print ""; print "Score: $score; "; $_ = $date; /(..)(..)(..)/ && ($yr = $1 + 1900, $mo = $months[$2 - 1], $dy = $3); print "Lines: $lines; "; print "${dy}-${mo}-${yr}; "; print "Archive: $file"; print "

  • \n"; } # $score = $headline = $lines = $bytes = $docid = $date = $file = ''; } $| = 1; open (STDERR,"> /dev/null"); eval '&do_wais';