You need to sign in or sign up before continuing.

Bug 238865: removing %::FORM from page.cgi in favor of $cgi->param

Patch by kiko, r=vlad, justdave, a=justdave
parent bfa503a0
...@@ -42,14 +42,19 @@ Bugzilla->login(); ...@@ -42,14 +42,19 @@ Bugzilla->login();
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
if ($::FORM{'id'}) { my $id = $cgi->param('id');
if ($id) {
# Remove all dodgy chars, and split into name and ctype. # Remove all dodgy chars, and split into name and ctype.
$::FORM{'id'} =~ s/[^\w\-\.]//g; $id =~ s/[^\w\-\.]//g;
$::FORM{'id'} =~ /(.*)\.(.*)/; $id =~ /(.*)\.(.*)/;
if (!$2) {
# if this regexp fails to match completely, something bad came in
ThrowCodeError("bad_page_cgi_id", { "page_id" => $id });
}
my $format = GetFormat("pages/$1", undef, $2); my $format = GetFormat("pages/$1", undef, $2);
$vars->{'form'} = \%::FORM; $cgi->param('id', $id);
print $cgi->header($format->{'ctype'}); print $cgi->header($format->{'ctype'});
......
...@@ -56,6 +56,11 @@ ...@@ -56,6 +56,11 @@
[% ELSIF error == "authres_unhandled" %] [% ELSIF error == "authres_unhandled" %]
An authorization handler return value was not handled by the login code. An authorization handler return value was not handled by the login code.
[% ELSIF error == "bad_page_cgi_id" %]
[% title = "Invalid Page ID" %]
The ID <code>[% page_id FILTER html %]</code> is not a
valid page identifier.
[% ELSIF error == "bug_error" %] [% ELSIF error == "bug_error" %]
Trying to retrieve [% terms.bug %] [%+ bug.bug_id FILTER html %] returned Trying to retrieve [% terms.bug %] [%+ bug.bug_id FILTER html %] returned
the error [% bug.error FILTER html %]. the error [% bug.error FILTER html %].
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#%] #%]
[% INCLUDE global/header.html.tmpl title = "Your Linkified Text" %] [% INCLUDE global/header.html.tmpl title = "Your Linkified Text" %]
[% USE Bugzilla %]
[% cgi = Bugzilla.cgi %]
<p> <p>
Copy and paste the text below: Copy and paste the text below:
...@@ -30,7 +32,7 @@ ...@@ -30,7 +32,7 @@
<p> <p>
<pre> <pre>
[%- form.text FILTER quoteUrls FILTER html -%] [%- cgi.param("text") FILTER quoteUrls FILTER html -%]
</pre> </pre>
</p> </p>
...@@ -45,7 +47,7 @@ ...@@ -45,7 +47,7 @@
<p> <p>
<pre> <pre>
[%- form.text FILTER quoteUrls -%] [%- cgi.param("text") FILTER quoteUrls -%]
</pre> </pre>
</p> </p>
......
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