diff --git a/en/cgi/query-pr-summary.cgi b/en/cgi/query-pr-summary.cgi index 07d72ddae3..630e103978 100755 --- a/en/cgi/query-pr-summary.cgi +++ b/en/cgi/query-pr-summary.cgi @@ -1,602 +1,602 @@ #!/usr/bin/perl -T -# $FreeBSD: www/en/cgi/query-pr-summary.cgi,v 1.37 2002/04/23 17:15:40 kuriyama Exp $ +# $FreeBSD: www/en/cgi/query-pr-summary.cgi,v 1.38 2003/01/16 02:02:40 keramida Exp $ sub escape($) { $_ = $_[0]; s/&/&/g; s/</g; s/>/>/g; $_; } $html_mode = 1 if $ENV{'DOCUMENT_ROOT'}; $self_ref = $ENV{'SCRIPT_NAME'}; ($query_pr_ref = $self_ref) =~ s/-summary//; $ENV{'PATH'} = '/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin'; $project = "FreeBSD"; $mail_prefix = "freebsd-"; $mail_unass = "freebsd-bugs"; $closed_too = 0; require "./cgi-lib.pl"; require "./cgi-style.pl"; require "getopts.pl"; if ($ENV{'QUERY_STRING'} eq 'query') { print &html_header("Query $project problem reports"); &displayform; print &html_footer; exit(0); } if ($html_mode) { $query_args = '--restricted '; &ReadParse(*input) if $html_mode; } else { &Getopts('CcqRr:s:'); $input{"responsible"} = "summary" if $opt_R; if ($opt_r) { ($input{"responsible"}) = ($opt_r =~ m/^(\^?[-_a-zA-Z0-9@.]*\$?)$/); die "Insecure args" if ($input{"responsible"} ne $opt_r) } if ($opt_s) { ($input{"state"}) = ($opt_s =~ m/^([a-zA-Z]*)$/); die "Insecure args" if ($input{"state"} ne $opt_s) } $input{"quiet"} = "yes" if $opt_q; if ($opt_C) { $query_args = '--confidential=yes '; } elsif (!$opt_c) { $query_args = '--restricted '; } } $closed_too = 1 if $input{'state'} eq 'closed' || $input{'closedtoo'}; #------------------------------------------------------------------------ %mons = ('Jan', '01', 'Feb', '02', 'Mar', '03', 'Apr', '04', 'May', '05', 'Jun', '06', 'Jul', '07', 'Aug', '08', 'Sep', '09', 'Oct', '10', 'Nov', '11', 'Dec', '12'); if ($html_mode) { $h1 = "
" ; $p_e = "
"; $br = ""; $pr_e = ""; $dl = "
) { chop; local ($cat, $desc, $responsible, $notify) = split(/:/); push(@categories, $cat); $catdesc{$cat} = $desc; } } sub get_states { @states = (); - open(Q, "query-pr --list-states 2>/dev/null |") || + open(Q, "query-pr.web --list-states 2>/dev/null |") || die "Cannot get states\n"; while() { chop; local ($state, $type, $desc) = split(/:/); push(@states, $state); $statedesc{$state} = $desc; } } sub get_classes { @classes = (); - open(Q, "query-pr --list-classes 2>/dev/null |") || + open(Q, "query-pr.web --list-classes 2>/dev/null |") || die "Cannot get classes\n"; while() { chop; local ($class, $type, $desc) = split(/:/); push(@classes, $class); $classdesc{$class} = $desc; } } sub read_gnats { local($report) = @_[0]; - open(Q, "query-pr $report 2>/dev/null |") || die "Cannot query the PR's\n"; + open(Q, "query-pr.web $report 2>/dev/null |") || die "Cannot query the PR's\n"; while() { chop; if(/^>Number:/) { $number = &getline($_); } elsif (/Arrival-Date:/) { $date = &getline($_); # strip timezone if any (between HH:MM:SS and YYYY at end of line): $date =~ s/(\d\d:\d\d:\d\d)\D+(\d{4})$/\1 \2/; ($dow,$mon,$day,$time,$year,$xtra) = split(/[ \t]+/, $date); $day = "0$day" if $day =~ /^[0-9]$/; $date = "$year/$mons{$mon}/$day"; } elsif (/>Last-Modified:/) { $lastmod = &getline($_); if ($lastmod =~ /^[ ]*$/) { $lastmod = $date; } else { # strip timezone if any (between HH:MM:SS and YYYY at end of line): $lastmod =~ s/(\d\d:\d\d:\d\d)\D+(\d{4})$/\1 \2/; ($dow,$mon,$day,$time,$year,$xtra) = split(/[ \t]+/, $lastmod); $day = "0$day" if $day =~ /^[0-9]$/; $lastmod = "$year/$mons{$mon}/$day"; } } elsif (/>Category:/) { $cat = &getline($_); } elsif (/>Severity:/) { $sev = &getline($_); } elsif (/>Responsible:/) { $resp = &getline($_); $resp =~ s/@.*//; $resp =~ tr/A-Z/a-z/; $resp = "" if ($resp =~ /$mail_unass/); $resp =~ s/^$mail_prefix//; } elsif (/>State:/) { $status = &getline($_); $status =~ s/(.).*/\1/; } elsif (/>Synopsis:/) { $syn = &getline($_); $syn =~ s/[\t]+/ /g; } elsif (/^$/) { $_ = sprintf("%s/%s", $cat, $number); $status{$_} = $status; $date{$_} = $date; $resp{$_} = $resp; $syn{$_} = $syn; $sev{$_} = $sev; $lastmod{$_} = $lastmod; push(@prs,$_); } } close(Q); } sub gnats_summary { local($report) = @_[0]; local($htmlmode) = @_[1]; local($counter) = 0; local($iteration)= 0; foreach (@prs) { $state = $status{$_}; $date = $date{$_}; $resp = $resp{$_}; $syn = $syn{$_}; $severity = $sev{$_}; ($cat, $number) = m|^([^/]+)/(\d+)$|; next if (($report ne '') && (eval($report) == 0)); print "${pr}\nS Submitted Tracker Resp. Description${hr}" if ($iteration++ == 0); $syn = &html_fixline($syn) if $htmlmode; if ($htmlmode) { $title = '' . $_ . ' '; } else { $title = $_; } print "$state [$date] $title" . (' ' x (12 - length($_))) . $resp . (' ' x (12 - length($resp))) . ($htmlmode ? $syn : substr($syn,0,41)) . "\n"; ++$counter; } print "${pr_e}\n" if $iteration; $counter; } sub displayform { print qq` Please select the items you wish to search for. Multiple items are AND'ed together.`; } diff --git a/en/cgi/query-pr.cgi b/en/cgi/query-pr.cgi index 7af2b77d96..6d285c8753 100755 --- a/en/cgi/query-pr.cgi +++ b/en/cgi/query-pr.cgi @@ -1,227 +1,227 @@ #!/usr/bin/perl -T -# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.28 2002/08/04 22:24:29 wosch Exp $ +# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.29 2002/08/05 19:05:29 wosch Exp $ $ENV{'PATH'} = "/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin"; %mons = ('Jan', '01', 'Feb', '02', 'Mar', '03', 'Apr', '04', 'May', '05', 'Jun', '06', 'Jul', '07', 'Aug', '08', 'Sep', '09', 'Oct', '10', 'Nov', '11', 'Dec', '12'); require "./cgi-lib.pl"; require "./cgi-style.pl"; require "getopts.pl"; &Getopts('p:'); if ($opt_p) { $input{'pr'} = $opt_p; } else { if (! &ReadParse(*input)) { print &html_header("PR Query Interface"); print "
Please enter the PR number you wish to query:
\n"; ($scriptname = $ENV{'SCRIPT_NAME'}) =~ s|^/?|/|; $scriptname =~ s|/$||; ($summary = $scriptname) =~ s/query-pr/query-pr-summary/; print "\n"; print "See also the PR summary
\n"; print &html_footer; exit 0; } } # allow query-pr.cgi?queries if (!($pr = $input{'pr'}) && &MethGet) { $pr = $ENV{'QUERY_STRING'}; } # be tolerant to / queries $pr =~ s%^.+/%%; # remove / part if ($pr =~ /(\d+)/) { $pr = $1; } else { $pr = 0; } $pr = int($pr); # numeralize: "0123" -> 123 if ($pr < 1 || $pr > 499999) { print &html_header("FreeBSD Problem Report"); print " Invalid problem report number: $pr
\n"; print &html_footer; exit 0; } -unless (open(Q, "query-pr --restricted -F $pr 2>&1 |")) { +unless (open(Q, "query-pr.web --restricted -F $pr 2>&1 |")) { print &html_header("Server error"); print "Unable to open PR database.
\n"; print &html_footer; die "Unable to query PR's"; } if ($input{'f'} eq 'raw') { print "Content-Type: text/plain\r\n\r\n"; print; close(Q); exit 0; } $inhdr = 1; $multiline = 0; $from = ""; $replyto = ""; while() { chop; $html_fixup = 1; if (/^query-pr: /) { print &html_header("FreeBSD problem report"); if ($_ ne "query-pr: no PRs matched") { print "query-pr said:\n"; print "
$_\n"; print\n"; - } elsif (($* = 1) && `query-pr $pr 2>&1` =~ /^>Confidential:\s+yes/) { + } elsif (($* = 1) && `query-pr.web $pr 2>&1` =~ /^>Confidential:\s+yes/) { print "; print "Sorry, PR $pr exists but is confidential\n"; } else { print "
No PR found matching $pr\n"; } print &html_footer; exit; } # In e-mail header if ($inhdr && /^From:\s*(.*)$/i) { $from = $1; $from =~ s/.*<(.*)>.*/$1/; $from =~ s/\s*\(.*\)\s*//; } if ($inhdr && /^Reply-to:\s*(.*)$/i) { $replyto = $1; $replyto =~ s/.*<(.*)>.*/$1/; $replyto =~ s/\s*\(.*\)\s*//; } # End of e-mail header if ($inhdr && /^$/) { $from = $replyto if ($replyto); $email = $from; $email .= '@FreeBSD.org' unless ($email =~ /@/); $inhdr = 0; } if (/^>Responsible:/) { $_ = &getline($_); s/\(.*\)//; # remove personal name s/\s+//g; $_ = $_ . '@FreeBSD.org' if !/@/; $_ = '>Responsible:' . $_ . ''; $html_fixup = 0; } s/^>Last-Modified:\s*$/>Last-Modified: never/; if (/^>Number:/) { $number = &getline($_); } elsif (/^>Category:/) { $cat = &getline($_); } elsif (/^>Synopsis:/) { $syn = &getline($_); $syn =~ s/[\t]+/ /g; $origsyn = $syn; $syn = &fixline($syn); print &short_html_header("Problem Report $cat/$number: $syn"); print "
Problem Report $cat/$number
\n"; print "$syn\n
\n"; } else { next if $inhdr; if (/^>(\S+):\s*(.*)/) { print $trailer . "\n" unless ($blank); $trailer = "
"; $origsyn =~ s/[^a-zA-Z+.@-]/"%" . sprintf("%02X", unpack("C", $&))/eg; $email =~ s/[^a-zA-Z+.@-]/"%" . sprintf("%02X", unpack("C", $&))/eg; print qq`Submit Followup | Raw PR\n`; print &html_footer; # Sleep 0.35 seconds to avoid DoS attacks from broken robots select undef, undef, undef, 0.35; exit 0; sub getline { local($_) = @_; ($tag,$remainder) = split(/[ \t]+/, $_, 2); return $remainder; } sub cvsweb { local($file) = shift; $file =~ s/[,.;]$//; return 'http://cvsweb.FreeBSD.org/' . $file; } sub srcref { local($_) = shift; local($rev) = '(rev\.?|revision):?\s+[0-9]\.[0-9.]+(\s+of)?'; local($src) = '((src|www|doc|ports)/[^\s]+)'; if (m%$rev\s*$src%oi || m%$src\s*$rev%) { s#$src#sprintf("%s", 34, &cvsweb($1), 34, $1)#ge; } return $_; } sub fixline { local($line) = shift; $line =~ s/&/&/g; $line =~ s/</g; $line =~ s/>/>/g; $line =~ s%((http|ftp)://[^\s"\)\>,;]+)%$1%gi; $line =~ s%(\WPR[:s# \t]+)([a-z386]+\/)?([0-9]+)%$1$2$3%ig; return &srcref($line); }- $1
- \n"; if ($html_fixup) { $trailer .= &fixline($2); } else { $trailer .= $2; } if ($1 eq "Originator" && $from ne "") { # add email address $trailer .= " <" . &fixline($from) . ">"; } $blank = !($2); $multiline = 0; } else { unless ($multiline) { next if /^\s*$/; print $trailer . "\n
\n"; } $multiline = 1; $blank = 0; print $html_fixup ? &fixline($_) : $_ , "\n"; $trailer = ""; } } } close(Q); print "$trailer\n" unless ($blank); print "