Correct some problems formatting links in query-pr.cgi's output.

The patch is from [1], and the problem was reported in both of the
following

PR:		www/51607, www/53530 [1]
Submitted by:	anholt, eik [1]
This commit is contained in:
Ceri Davies 2003-11-12 20:58:13 +00:00
parent 23e5dc855a
commit 750c390701
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=18819

View file

@ -1,5 +1,5 @@
#!/usr/bin/perl -T
# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.34 2003/06/08 20:59:51 ceri Exp $
# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.35 2003/06/09 14:58:00 ceri Exp $
$ENV{'PATH'} = "/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin";
@ -219,13 +219,23 @@ sub srcref {
}
sub fixline {
local($line) = shift;
$line =~ s/&/&/g;
$line =~ s/</&lt;/g;
$line =~ s/>/&gt;/g;
$line =~ s%((http|ftp)://[^\s"\)\>,;]+)%<A HREF="$1">$1</A>%gi;
$line =~ s%(\WPR[:s# \t]+)([a-z3486]+\/)?([0-9]+)%$1<A HREF="query-pr.cgi?pr=$3">$2$3</A>%ig;
return &srcref($line);
local(@splitline) = split(/((?:https?|ftp):\/\/[^\s"\(\)<>,;]+)/, shift);
local($isurl) = 0;
foreach (@splitline) {
if ($isurl) {
local($href) = local($html) = $_;
$href =~ s/&/%26/g;
$html =~ s/&/&amp;/g;
$_ = "<A HREF=\"$href\">$html</A>";
} else {
s/&/&amp;/g;
s/</&lt;/g;
s/>/&gt;/g;
s%(\WPR[:s# \t]+)([a-z3486]+\/)?([0-9]+)%$1<A HREF="query-pr.cgi?pr=$3">$2$3</A>%ig;
}
$isurl = ! $isurl;
}
return &srcref(join('', @splitline));
}