diff --git a/en/cgi/cgi-style.pl b/en/cgi/cgi-style.pl index b81af319fb..a5ece6697e 100644 --- a/en/cgi/cgi-style.pl +++ b/en/cgi/cgi-style.pl @@ -1,87 +1,84 @@ -# $FreeBSD: www/en/cgi/cgi-style.pl,v 1.18 2004/10/13 10:55:55 keramida Exp $ +# $FreeBSD: www/en/cgi/cgi-style.pl,v 1.19 2005/02/12 13:13:14 ceri Exp $ # # Perl routines to encapsulate various elements of HTML page style. # For future reference, when is now? ($se,$mn,$hr,$md,$mo,$yr,$wd,$yd,$dst) = localtime(time); $yr += 1900; $mo += 1; $timestamp = "$mo-$md-$yr"; -# Colors for the body -$t_body = "
"; - -# This can be set to either a string containing an inline CSS stylesheet -# or to a element that references an external CSS stylesheet, to -# make local modifications to the style of a CGI script's output. -$t_style = ""; - if (!defined($hsty_base)) { $hsty_base = ".."; } if (!defined($hsty_email)) { $hsty_email = "www\@FreeBSD.org"; } if (!defined($hsty_author)) { $hsty_author = "$hsty_email"; } if (!defined($hsty_date)) { $hsty_date = ""; } +# This can be set to either a string containing an inline CSS stylesheet +# or to a element that references an external CSS stylesheet, to +# make local modifications to the style of a CGI script's output. +$t_style = ""; + $i_topbar = " "; if (!defined($hsty_home)) { $hsty_home = ""; } sub html_header { local ($title) = @_; return "Content-type: text/html\n\n" . "\nPlease 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?Invalid problem report number: $pr
\n"; print &html_footer; exit 0; } unless (open(Q, "$query_pr -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(:?\.(:?real|web))?: /) { print &html_header("FreeBSD problem report"); if ($_ !~ /^query-pr(:?\.(:?real|web))?: no PRs matched$/) { print "query-pr said:\n"; print "
$_\n"; print\n"; } else { print "; print "No PR found matching $pr\n"; } print &html_footer; exit; } elsif (/^lockf: /) { print &html_header("FreeBSD problem report"); print "
The PR database is currently busy; please try ", "your query again."; 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 &html_header("Problem Report $cat/$number: $syn"); 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(@splitline) = split(/((?:https?|ftp):\/\/[^\s"\(\)<>,;]+)/, shift); local($isurl) = 0; foreach (@splitline) { if ($isurl) { local($href) = local($html) = $_; $href =~ s/&/%26/g; $html =~ s/&/&/g; $_ = "$html"; } else { s/&/&/g; s/</g; s/>/>/g; s%(\WPR[:s# \t]+)([a-z3486]+\/)?([0-9]+)%$1$2$3%ig; } $isurl = ! $isurl; } return &srcref(join('', @splitline)); }- $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 "