Fix for bug 103554: HTML generated by the PutHeader and GetCommandMenu…

Fix for bug 103554: HTML generated by the PutHeader and GetCommandMenu subroutines now validates as HTML 4.01 at W3C. Patch by Christian Reis <kiko@async.com.br> r= caillon, gerv, justdave
parent 3650c35d
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
# Dave Miller <justdave@syndicomm.com> # Dave Miller <justdave@syndicomm.com>
# Christopher Aillon <christopher@aillon.com> # Christopher Aillon <christopher@aillon.com>
# Gervase Markham <gerv@gerv.net> # Gervase Markham <gerv@gerv.net>
# Christian Reis <kiko@async.com.br>
# Contains some global routines used throughout the CGI scripts of Bugzilla. # Contains some global routines used throughout the CGI scripts of Bugzilla.
...@@ -333,7 +334,7 @@ sub ValidateBugID { ...@@ -333,7 +334,7 @@ sub ValidateBugID {
} else { } else {
DisplayError( DisplayError(
qq|You are not authorized to access bug #$id. To see this bug, you qq|You are not authorized to access bug #$id. To see this bug, you
must first <a href="show_bug.cgi?id=$id&GoAheadAndLogIn=1">log in must first <a href="show_bug.cgi?id=$id&amp;GoAheadAndLogIn=1">log in
to an account</a> with the appropriate permissions.| to an account</a> with the appropriate permissions.|
); );
} }
...@@ -555,7 +556,7 @@ sub make_selection_widget { ...@@ -555,7 +556,7 @@ sub make_selection_widget {
if ($type eq "CHECKBOX") { if ($type eq "CHECKBOX") {
$popup .= "<INPUT NAME=$groupname type=checkbox VALUE=\"$item\" CHECKED>$displaytext<br>"; $popup .= "<INPUT NAME=$groupname type=checkbox VALUE=\"$item\" CHECKED>$displaytext<br>";
} elsif ($type eq "RADIO") { } elsif ($type eq "RADIO") {
$popup .= "<INPUT NAME=$groupname type=radio VALUE=\"$item\" check>$displaytext<br>"; $popup .= "<INPUT NAME=$groupname type=radio VALUE=\"$item\" CHECKED>$displaytext<br>";
} else { } else {
$popup .= "<OPTION SELECTED VALUE=\"$item\">$displaytext\n"; $popup .= "<OPTION SELECTED VALUE=\"$item\">$displaytext\n";
} }
...@@ -1133,26 +1134,32 @@ sub PutHeader { ...@@ -1133,26 +1134,32 @@ sub PutHeader {
$jscript = ""; $jscript = "";
} }
print "<HTML><HEAD>\n<TITLE>$title</TITLE>\n"; print qq|
print Param("headerhtml") . "\n$jscript\n</HEAD>\n"; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
print "<BODY " . Param("bodyhtml") . " $extra>\n"; <HTML>
<HEAD>
print PerformSubsts(Param("bannerhtml"), undef); <TITLE>$title</TITLE>
| . Param("headerhtml") . qq|
print "<TABLE BORDER=0 CELLSPACING=0 WIDTH=\"100%\">\n"; $jscript
print " <TR>\n"; </HEAD>
print " <TD WIDTH=10% VALIGN=TOP ALIGN=LEFT>\n"; <BODY | . Param("bodyhtml") . qq| $extra>
print " <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=2>\n"; | . PerformSubsts(Param("bannerhtml"), undef) . qq|
print " <TR><TD VALIGN=TOP ALIGN=LEFT NOWRAP>\n"; <TABLE BORDER="0" CELLSPACING="0">
print " <FONT SIZE=+1><B>$h1</B></FONT>"; <TR>
print " </TD></TR>\n"; <TD VALIGN="TOP" ALIGN="LEFT">
print " </TABLE>\n"; <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="2">
print " </TD>\n"; <TR><TD VALIGN="TOP" ALIGN="LEFT">
print " <TD VALIGN=CENTER>&nbsp;</TD>\n"; <FONT SIZE="+1">
print " <TD VALIGN=CENTER ALIGN=LEFT>\n"; <B>$h1</B>
</FONT>
print "$h2\n"; </TD></TR>
print "</TD></TR></TABLE>\n"; </TABLE>
</TD>
<TD VALIGN="MIDDLE">&nbsp;</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">
$h2
</TD></TR></TABLE>
|;
if (Param("shutdownhtml")) { if (Param("shutdownhtml")) {
# If we are dealing with the params page, we want # If we are dealing with the params page, we want
...@@ -1275,7 +1282,7 @@ sub DumpBugActivity { ...@@ -1275,7 +1282,7 @@ sub DumpBugActivity {
my $incomplete_data = 0; my $incomplete_data = 0;
while (@row = FetchSQLData()) { while (@row = FetchSQLData()) {
my ($field,$attachid,$when,$removed,$added,$who) = (@row); my ($field,$attachid,$when,$removed,$added,$who) = (@row);
$field =~ s/^Attachment/<a href="attachment.cgi?id=$attachid&action=view">Attachment #$attachid<\/a>/ $field =~ s/^Attachment/<a href="attachment.cgi?id=$attachid&amp;action=view">Attachment #$attachid<\/a>/
if (Param('useattachmenttracker') && $attachid); if (Param('useattachmenttracker') && $attachid);
$removed = html_quote($removed); $removed = html_quote($removed);
$added = html_quote($added); $added = html_quote($added);
...@@ -1310,26 +1317,27 @@ sub GetCommandMenu { ...@@ -1310,26 +1317,27 @@ sub GetCommandMenu {
if (!defined $::anyvotesallowed) { if (!defined $::anyvotesallowed) {
GetVersionTable(); GetVersionTable();
} }
my $html = ""; my $html = qq {
$html .= <<"--endquote--"; <FORM METHOD="GET" ACTION="show_bug.cgi">
<FORM METHOD=GET ACTION="show_bug.cgi">
<TABLE width="100%"><TR><TD> <TABLE width="100%"><TR><TD>
Actions: Actions:
</TD><TD VALIGN="middle" NOWRAP> </TD><TD VALIGN="middle" NOWRAP>
<a href='enter_bug.cgi'>New</a> | <a href='query.cgi'>Query</a> | <a href="enter_bug.cgi">New</a> |
--endquote-- <a href="query.cgi">Query</a> |
};
if (-e "query2.cgi") { if (-e "query2.cgi") {
$html .= "[<a href='query2.cgi'>beta</a>]"; $html .= "[<a href=\"query2.cgi\">beta</a>]";
} }
$html .= $html .= qq{
qq{ <INPUT TYPE=SUBMIT VALUE="Find"> bug \# <INPUT NAME=id SIZE=6>}; <INPUT TYPE="SUBMIT" VALUE="Find"> bug \#
<INPUT NAME="id" SIZE="6">
$html .= " | <a href='reports.cgi'>Reports</a>"; | <a href="reports.cgi">Reports</a>
};
if ($loggedin) { if ($loggedin) {
if ($::anyvotesallowed) { if ($::anyvotesallowed) {
$html .= " | <A HREF=\"showvotes.cgi\">My votes</A>"; $html .= " | <A HREF=\"showvotes.cgi\">My votes</A>\n";
} }
} }
if ($loggedin) { if ($loggedin) {
...@@ -1339,41 +1347,48 @@ Actions: ...@@ -1339,41 +1347,48 @@ Actions:
my ($mybugslink, $userid, $blessgroupset) = (FetchSQLData()); my ($mybugslink, $userid, $blessgroupset) = (FetchSQLData());
#Begin settings #Begin settings
$html .= "</TD><TD>&nbsp;</TD><TD VALIGN=middle><NOBR>Edit <a href='userprefs.cgi'>prefs</a></NOBR>"; $html .= qq{
</TD><TD>
&nbsp;
</TD><TD VALIGN="middle">
Edit <a href="userprefs.cgi">prefs</a>
};
if (UserInGroup("tweakparams")) { if (UserInGroup("tweakparams")) {
$html .= ", <a href=editparams.cgi>parameters</a>"; $html .= ", <a href=\"editparams.cgi\">parameters</a>\n";
} }
if (UserInGroup("editusers") || $blessgroupset) { if (UserInGroup("editusers") || $blessgroupset) {
$html .= ", <a href=editusers.cgi>users</a>"; $html .= ", <a href=\"editusers.cgi\">users</a>\n";
} }
if (UserInGroup("editcomponents")) { if (UserInGroup("editcomponents")) {
$html .= ", <a href=editproducts.cgi>components</a>"; $html .= ", <a href=\"editproducts.cgi\">components</a>\n";
$html .= ", <a href=editattachstatuses.cgi><NOBR>attachment statuses</NOBR></a>" $html .= ", <a href=\"editattachstatuses.cgi\">
if Param('useattachmenttracker'); attachment&nbsp;statuses</a>\n" if Param('useattachmenttracker');
} }
if (UserInGroup("creategroups")) { if (UserInGroup("creategroups")) {
$html .= ", <a href=editgroups.cgi>groups</a>"; $html .= ", <a href=\"editgroups.cgi\">groups</a>\n";
} }
if (UserInGroup("editkeywords")) { if (UserInGroup("editkeywords")) {
$html .= ", <a href=editkeywords.cgi>keywords</a>"; $html .= ", <a href=\"editkeywords\".cgi>keywords</a>\n";
} }
if (UserInGroup("tweakparams")) { if (UserInGroup("tweakparams")) {
$html .= " | <a href=sanitycheck.cgi><NOBR>Sanity check</NOBR></a>"; $html .= "| <a href=\"sanitycheck.cgi\">Sanity&nbsp;check</a> |\n";
} }
$html .= " | <NOBR><a href=relogin.cgi>Log out</a> $::COOKIE{'Bugzilla_login'}</NOBR>"; $html .= qq{
$html .= "</TD></TR>"; | <a href="relogin.cgi">Log&nbsp;out</a> $::COOKIE{'Bugzilla_login'}
</TD></TR>
};
#begin preset queries #begin preset queries
my $mybugstemplate = Param("mybugstemplate"); my $mybugstemplate = Param("mybugstemplate");
my %substs; my %substs;
$substs{'userid'} = url_quote($::COOKIE{"Bugzilla_login"}); $substs{'userid'} = url_quote($::COOKIE{"Bugzilla_login"});
$html .= "<TR>"; $html .= "<TR>";
$html .= "<TD>Preset Queries: </TD>"; $html .= "<TD>Preset&nbsp;Queries: </TD>";
$html .= "<TD colspan=3>\n"; $html .= "<TD colspan=3>\n";
if ($mybugslink) { if ($mybugslink) {
my $mybugsurl = PerformSubsts($mybugstemplate, \%substs); my $mybugsurl = PerformSubsts($mybugstemplate, \%substs);
$html = $html . "<A HREF='$mybugsurl'><NOBR>My bugs</NOBR></A>"; $html = $html . "<A HREF=\"$mybugsurl\">My&nbsp;bugs</A>\n";
} }
SendSQL("SELECT name FROM namedqueries " . SendSQL("SELECT name FROM namedqueries " .
"WHERE userid = $userid AND linkinfooter"); "WHERE userid = $userid AND linkinfooter");
...@@ -1382,16 +1397,17 @@ Actions: ...@@ -1382,16 +1397,17 @@ Actions:
my ($name) = (FetchSQLData()); my ($name) = (FetchSQLData());
if ($anynamedqueries || $mybugslink) { $html .= " | " } if ($anynamedqueries || $mybugslink) { $html .= " | " }
$anynamedqueries = 1; $anynamedqueries = 1;
$html .= "<A HREF=\"buglist.cgi?&cmdtype=runnamed&namedcmd=" . $name =~ s/ /&nbsp;/g;
url_quote($name) . "\"><NOBR>$name</NOBR></A>"; $html .= "<A HREF=\"buglist.cgi?cmdtype=runnamed&amp;namedcmd=" .
url_quote($name) . "\">$name</A>\n";
} }
$html .= "</TD></TR>\n"; $html .= "</TD></TR>\n";
} else { } else {
$html .= "</TD><TD>&nbsp;</TD><TD valign=middle align=right>\n"; $html .= "</TD><TD>&nbsp;</TD><TD valign=\"middle\" align=\"right\">\n";
$html .= $html .=
" <a href=\"createaccount.cgi\"><NOBR>New account</NOBR></a>\n"; " <a href=\"createaccount.cgi\">New&nbsp;account</a>\n";
$html .= $html .=
" | <NOBR><a href=query.cgi?GoAheadAndLogIn=1>Log in</a></NOBR>"; " | <a href=\"query.cgi?GoAheadAndLogIn=1\">Log&nbsp;in</a>";
$html .= "</TD></TR>"; $html .= "</TD></TR>";
} }
$html .= "</TABLE>"; $html .= "</TABLE>";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment