summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/Config.pm6
-rwxr-xr-xchecksetup.pl11
-rwxr-xr-xpage.cgi30
-rw-r--r--template/en/default/global/user-error.html.tmpl6
4 files changed, 22 insertions, 31 deletions
diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm
index a2c334a16..3ebcb91c6 100644
--- a/Bugzilla/Config.pm
+++ b/Bugzilla/Config.pm
@@ -51,9 +51,9 @@ Bugzilla::Config - Configuration parameters for Bugzilla
use Bugzilla::Config qw(:db);
print "Connecting to $db_name as $db_user with $db_pass\n";
- # These variables do not belong in localconfig, and need to go
+ # This variable does not belong in localconfig, and needs to go
# somewhere better
- use Bugzilla::Config($contenttypes $pages)
+ use Bugzilla::Config($contenttypes)
=head1 DESCRIPTION
@@ -75,7 +75,7 @@ use Bugzilla::Util;
# when it shouldn't
# ChmodDataFile is here until that stuff all moves out of globals.pl
# into this file
-@Bugzilla::Config::EXPORT_OK = qw($contenttypes $pages ChmodDataFile);
+@Bugzilla::Config::EXPORT_OK = qw($contenttypes ChmodDataFile);
%Bugzilla::Config::EXPORT_TAGS =
(
admin => [qw(GetParamList UpdateParams SetParam WriteParams)],
diff --git a/checksetup.pl b/checksetup.pl
index 3f3fcb999..803d64d14 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -568,17 +568,6 @@ $contenttypes = {
-LocalVar('pages', '
-#
-# A mapping from tags to template names for the general page display system,
-# page.cgi.
-#
-%pages = (
-);
-');
-
-
-
if ($newstuff ne "") {
print "\nThis version of Bugzilla contains some variables that you may want\n",
"to change and adapt to your local settings. Please edit the file\n",
diff --git a/page.cgi b/page.cgi
index 2fcf1b9b7..3494b68dd 100755
--- a/page.cgi
+++ b/page.cgi
@@ -23,9 +23,9 @@
###############################################################################
# This CGI is a general template display engine. To display templates using it,
-# add them to the %pages hash in localconfig with a tag to refer to them by,
-# then call page.cgi?page=<tag> . Tags may only contain the letters A-Z (in
-# either case), numbers 0-9, the underscore "_" and the hyphen "-".
+# put them in the "pages" subdirectory of template/en/default, call them
+# "foo.<ctype>.tmpl" and use the URL page.cgi?id=foo.<ctype> , where <ctype> is
+# a content-type, e.g. html.
###############################################################################
use strict;
@@ -33,21 +33,23 @@ use strict;
use lib ".";
require "CGI.pl";
-use vars qw($template $vars %pages);
+use vars qw($template $vars);
ConnectToDatabase();
quietly_check_login();
if (defined $::FORM{'id'}) {
- $::FORM{'id'} =~ s/[^\w-]//g;
-
- if ($pages{$::FORM{'id'}}) {
- print "Content-Type: text/html\n\n";
- $template->process($pages{$::FORM{'id'}}, $vars)
- || ThrowTemplateError($template->error());
- exit;
- }
-}
+ $::FORM{'id'} =~ s/[^\w-\.]//g;
+ $::FORM{'id'} =~ /(.*)(\.(.*))?/;
+
+ my $format = GetFormat($1, undef, $3);
+
+ print "Content-Type: $format->{'ctype'}\n\n";
-ThrowUserError("page_not_found");
+ $template->process("pages/$format->{'template'}", $vars)
+ || ThrowTemplateError($template->error());
+}
+else {
+ ThrowUserError("no_page_specified");
+}
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index 4edacf2c8..6c0b37021 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -217,9 +217,9 @@
[% title = "No New Quips" %]
This site does not permit the addition of new quips.
- [% ELSIF error == "page_not_found" %]
- [% title = "Page not found" %]
- The page you requested cannot be found.
+ [% ELSIF error == "no_page_specified" %]
+ [% title = "No Page Specified" %]
+ You did not specify the id of a page to display.
[% ELSIF error == "reassign_to_empty" %]
[% title = "Illegal Reassignment" %]