From 9488a8906592564ec2e7601041f3ea5484cde3cc Mon Sep 17 00:00:00 2001 From: "bbaetz%acm.org" <> Date: Mon, 5 May 2003 08:15:19 +0000 Subject: Bug 201816 - use CGI.pm for header output r=joel, a=justdave --- votes.cgi | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'votes.cgi') diff --git a/votes.cgi b/votes.cgi index e386d5422..aa2352f4a 100755 --- a/votes.cgi +++ b/votes.cgi @@ -26,14 +26,17 @@ use strict; use lib "."; -require "CGI.pl"; +use Bugzilla; +require "CGI.pl"; # Use global template variables use vars qw($template $vars); ConnectToDatabase(); +my $cgi = Bugzilla->cgi; + # If the action is show_bug, you need a bug_id. # If the action is show_user, you can supply a userid to show the votes for # another user, otherwise you see your own. @@ -86,6 +89,8 @@ exit; # Display the names of all the people voting for this one bug. sub show_bug { + my $cgi = Bugzilla->cgi; + my $bug_id = $::FORM{'bug_id'} || ThrowCodeError("missing_bug_id"); @@ -107,7 +112,7 @@ sub show_bug { $vars->{'users'} = \@users; $vars->{'total'} = $total; - print "Content-type: text/html\n\n"; + print $cgi->header(); $template->process("bug/votes/list-for-bug.html.tmpl", $vars) || ThrowTemplateError($template->error()); } @@ -117,6 +122,8 @@ sub show_bug { sub show_user { GetVersionTable(); + my $cgi = Bugzilla->cgi; + # If a bug_id is given, and we're editing, we'll add it to the votes list. my $bug_id = $::FORM{'bug_id'} || ""; @@ -213,7 +220,7 @@ sub show_user { $vars->{'voting_user'} = { "login" => $name }; $vars->{'products'} = \@products; - print "Content-type: text/html\n\n"; + print $cgi->header(); $template->process("bug/votes/list-for-user.html.tmpl", $vars) || ThrowTemplateError($template->error()); } @@ -224,6 +231,8 @@ sub record_votes { # Begin Data/Security Validation ############################################################################ + my $cgi = Bugzilla->cgi; + # Build a list of bug IDs for which votes have been submitted. Votes # are submitted in form fields in which the field names are the bug # IDs and the field values are the number of votes. @@ -233,13 +242,13 @@ sub record_votes { # that their votes will get nuked if they continue. if (scalar(@buglist) == 0) { if (!defined($::FORM{'delete_all_votes'})) { - print "Content-type: text/html\n\n"; + print $cgi->header(); $template->process("bug/votes/delete-all.html.tmpl", $vars) || ThrowTemplateError($template->error()); exit(); } elsif ($::FORM{'delete_all_votes'} == 0) { - print "Location: votes.cgi\n\n"; + print $cgi->redirect("votes.cgi"); exit(); } } -- cgit v1.2.3-24-g4f1b