Commit 1809e275 authored by gerv%gerv.net's avatar gerv%gerv.net

Bug 162151 - Fix page.cgi's method of finding templates. It now looks in a…

Bug 162151 - Fix page.cgi's method of finding templates. It now looks in a "pages" subdirectory of the template directory. Patch by gerv; r=bbaetz.
parent f48775a9
...@@ -51,9 +51,9 @@ Bugzilla::Config - Configuration parameters for Bugzilla ...@@ -51,9 +51,9 @@ Bugzilla::Config - Configuration parameters for Bugzilla
use Bugzilla::Config qw(:db); use Bugzilla::Config qw(:db);
print "Connecting to $db_name as $db_user with $db_pass\n"; 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 # somewhere better
use Bugzilla::Config($contenttypes $pages) use Bugzilla::Config($contenttypes)
=head1 DESCRIPTION =head1 DESCRIPTION
...@@ -75,7 +75,7 @@ use Bugzilla::Util; ...@@ -75,7 +75,7 @@ use Bugzilla::Util;
# when it shouldn't # when it shouldn't
# ChmodDataFile is here until that stuff all moves out of globals.pl # ChmodDataFile is here until that stuff all moves out of globals.pl
# into this file # into this file
@Bugzilla::Config::EXPORT_OK = qw($contenttypes $pages ChmodDataFile); @Bugzilla::Config::EXPORT_OK = qw($contenttypes ChmodDataFile);
%Bugzilla::Config::EXPORT_TAGS = %Bugzilla::Config::EXPORT_TAGS =
( (
admin => [qw(GetParamList UpdateParams SetParam WriteParams)], admin => [qw(GetParamList UpdateParams SetParam WriteParams)],
......
...@@ -568,17 +568,6 @@ $contenttypes = { ...@@ -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 "") { if ($newstuff ne "") {
print "\nThis version of Bugzilla contains some variables that you may want\n", 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", "to change and adapt to your local settings. Please edit the file\n",
......
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
############################################################################### ###############################################################################
# This CGI is a general template display engine. To display templates using it, # 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, # put them in the "pages" subdirectory of template/en/default, call them
# then call page.cgi?page=<tag> . Tags may only contain the letters A-Z (in # "foo.<ctype>.tmpl" and use the URL page.cgi?id=foo.<ctype> , where <ctype> is
# either case), numbers 0-9, the underscore "_" and the hyphen "-". # a content-type, e.g. html.
############################################################################### ###############################################################################
use strict; use strict;
...@@ -33,21 +33,23 @@ use strict; ...@@ -33,21 +33,23 @@ use strict;
use lib "."; use lib ".";
require "CGI.pl"; require "CGI.pl";
use vars qw($template $vars %pages); use vars qw($template $vars);
ConnectToDatabase(); ConnectToDatabase();
quietly_check_login(); quietly_check_login();
if (defined $::FORM{'id'}) { if (defined $::FORM{'id'}) {
$::FORM{'id'} =~ s/[^\w-]//g; $::FORM{'id'} =~ s/[^\w-\.]//g;
$::FORM{'id'} =~ /(.*)(\.(.*))?/;
if ($pages{$::FORM{'id'}}) { my $format = GetFormat($1, undef, $3);
print "Content-Type: text/html\n\n";
$template->process($pages{$::FORM{'id'}}, $vars) print "Content-Type: $format->{'ctype'}\n\n";
$template->process("pages/$format->{'template'}", $vars)
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
exit;
}
} }
else {
ThrowUserError("page_not_found"); ThrowUserError("no_page_specified");
}
...@@ -217,9 +217,9 @@ ...@@ -217,9 +217,9 @@
[% title = "No New Quips" %] [% title = "No New Quips" %]
This site does not permit the addition of new quips. This site does not permit the addition of new quips.
[% ELSIF error == "page_not_found" %] [% ELSIF error == "no_page_specified" %]
[% title = "Page not found" %] [% title = "No Page Specified" %]
The page you requested cannot be found. You did not specify the id of a page to display.
[% ELSIF error == "reassign_to_empty" %] [% ELSIF error == "reassign_to_empty" %]
[% title = "Illegal Reassignment" %] [% title = "Illegal Reassignment" %]
......
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