]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Fix for bug 238865-v1: remove %FORM from page.cgi. Does so, fixing the
authorkiko%async.com.br <>
Mon, 12 Apr 2004 04:31:44 +0000 (04:31 +0000)
committerkiko%async.com.br <>
Mon, 12 Apr 2004 04:31:44 +0000 (04:31 +0000)
linked page template and adding a code error for the "bad id provided"
case. r=vladd, a=myk.

page.cgi
template/en/default/global/code-error.html.tmpl
template/en/default/pages/linked.html.tmpl

index b68a9313b4853e61ae50fb2e22838a9c69952b09..6e78317fc06f88cf215de5da79df44848aae115b 100755 (executable)
--- a/page.cgi
+++ b/page.cgi
@@ -42,14 +42,19 @@ Bugzilla->login();
 
 my $cgi = Bugzilla->cgi;
 
-if ($::FORM{'id'}) {
+my $id = $cgi->param('id');
+if ($id) {
     # Remove all dodgy chars, and split into name and ctype.
-    $::FORM{'id'} =~ s/[^\w\-\.]//g;
-    $::FORM{'id'} =~ /(.*)\.(.*)/;
+    $id =~ s/[^\w\-\.]//g;
+    $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);
     
-    $vars->{'form'} = \%::FORM; 
+    $cgi->param('id', $id);
 
     print $cgi->header($format->{'ctype'});
 
index 342d67102d17c560231b2664bb8000839e942938..c5233b8e88dfd90443e3f86703f6073f18805e4b 100644 (file)
   [% ELSIF error == "authres_unhandled" %]
     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" %]
     Trying to retrieve [% terms.bug %] [%+ bug.bug_id FILTER html %] returned 
     the error [% bug.error FILTER html %].
index 2a3521a35810c5fec4aaea482f6022c63c1dc274..fcb5ee9d0dd41b8003a564ede9d78e861650dd3c 100644 (file)
@@ -21,6 +21,8 @@
   #%]
 
 [% INCLUDE global/header.html.tmpl title = "Your Linkified Text" %]
+[% USE Bugzilla %]
+[% cgi = Bugzilla.cgi %]
 
 <p>
   Copy and paste the text below:
@@ -30,7 +32,7 @@
 
 <p>
 <pre>
-[%- form.text FILTER quoteUrls FILTER html -%]
+[%- cgi.param("text") FILTER quoteUrls FILTER html -%]
 </pre>
 </p>
 
@@ -45,7 +47,7 @@
 
 <p>
 <pre>
-[%- form.text FILTER quoteUrls -%]
+[%- cgi.param("text") FILTER quoteUrls -%]
 </pre>
 </p>