]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/CGI.pm
use maintainer instead of maint
[debbugs.git] / Debbugs / CGI.pm
index d97dc2b940fa4a25390deb0c7ecee751fd413513..c39a6caba347de5399015577081528398acc4b7a 100644 (file)
@@ -17,8 +17,6 @@ Debbugs::CGI -- General routines for the cgi scripts
 
 use Debbugs::CGI qw(:url :html);
 
-html_escape(bug_url($ref,mbox=>'yes',mboxstatus=>'yes'));
-
 =head1 DESCRIPTION
 
 This module is a replacement for parts of common.pl; subroutines in
@@ -36,36 +34,15 @@ use strict;
 use vars qw($VERSION $DEBUG %EXPORT_TAGS @EXPORT_OK @EXPORT);
 use Exporter qw(import);
 
-use Debbugs::URI;
-use HTML::Entities;
-use Debbugs::Common qw(getparsedaddrs make_list);
-use Params::Validate qw(validate_with :types);
-
-use Debbugs::Config qw(:config);
-use Debbugs::Status qw(splitpackages isstrongseverity);
-use Debbugs::User qw();
-
-use Mail::Address;
-use POSIX qw(ceil);
-use Storable qw(dclone);
-
-use List::Util qw(max);
-use File::stat;
-use Digest::MD5 qw(md5_hex);
-use Carp;
-
-use Debbugs::Text qw(fill_in_template);
-
 our %URL_PARAMS = ();
 
-
 BEGIN{
      ($VERSION) = q$Revision: 1.3 $ =~ /^Revision:\s+([^\s+])/;
      $DEBUG = 0 unless defined $DEBUG;
 
      @EXPORT = ();
-     %EXPORT_TAGS = (url    => [qw(bug_url bug_links bug_linklist maybelink),
-                               qw(set_url_params pkg_url version_url),
+     %EXPORT_TAGS = (url    => [qw(bug_links bug_linklist maybelink),
+                               qw(set_url_params version_url),
                                qw(submitterurl mainturl munge_url),
                                qw(package_links bug_links),
                               ],
@@ -86,6 +63,26 @@ BEGIN{
      $EXPORT_TAGS{all} = [@EXPORT_OK];
 }
 
+use Debbugs::URI;
+use HTML::Entities;
+use Debbugs::Common qw(getparsedaddrs make_list);
+use Params::Validate qw(validate_with :types);
+
+use Debbugs::Config qw(:config);
+use Debbugs::Status qw(splitpackages isstrongseverity);
+use Debbugs::User qw();
+
+use Mail::Address;
+use POSIX qw(ceil);
+use Storable qw(dclone);
+
+use List::AllUtils qw(max);
+use File::stat;
+use Digest::MD5 qw(md5_hex);
+use Carp;
+
+use Debbugs::Text qw(fill_in_template);
+
 
 
 =head2 set_url_params
@@ -108,44 +105,6 @@ sub set_url_params{
 }
 
 
-=head2 bug_url
-
-     bug_url($ref,mbox=>'yes',mboxstat=>'yes');
-
-Constructs urls which point to a specific
-
-XXX use Params::Validate
-
-=cut
-
-sub bug_url{
-     my $ref = shift;
-     my %params;
-     if (@_ % 2) {
-         shift;
-         %params = (%URL_PARAMS,@_);
-     }
-     else {
-         %params = @_;
-     }
-     carp "bug_url is deprecated, use bug_links instead";
-
-     return munge_url('bugreport.cgi?',%params,bug=>$ref);
-}
-
-sub pkg_url{
-     my %params;
-     if (@_ % 2) {
-         shift;
-         %params = (%URL_PARAMS,@_);
-     }
-     else {
-         %params = @_;
-     }
-     carp "pkg_url is deprecated, use package_links instead";
-     return munge_url('pkgreport.cgi?',%params);
-}
-
 =head2 munge_url
 
      my $url = munge_url($url,%params_to_munge);
@@ -292,7 +251,9 @@ sub cgi_parameters {
 
 
 sub quitcgi {
-    my $msg = shift;
+    my ($msg, $status) = @_;
+    $status //= '500 Internal Server Error';
+    print "Status: $status\n";
     print "Content-Type: text/html\n\n";
     print fill_in_template(template=>'cgi/quit',
                           variables => {msg => $msg}
@@ -614,7 +575,7 @@ sub emailfromrfc822{
      return $addr;
 }
 
-sub mainturl { package_links(maint => $_[0], links_only => 1); }
+sub mainturl { package_links(maintainer => $_[0], links_only => 1); }
 sub submitterurl { package_links(submitter => $_[0], links_only => 1); }
 sub htmlize_maintlinks {
     my ($prefixfunc, $maints) = @_;
@@ -622,10 +583,6 @@ sub htmlize_maintlinks {
     return htmlize_addresslinks($prefixfunc, \&mainturl, $maints);
 }
 
-
-our $_maintainer;
-our $_maintainer_rev;
-
 =head2 bug_linklist
 
      bug_linklist($separator,$class,@bugs)
@@ -635,8 +592,7 @@ link class C<$class>.
 
 XXX Use L<Params::Validate>; we want to be able to support query
 arguments here too; we should be able to combine bug_links and this
-function into one. [Hell, bug_url should be one function with this one
-too.]
+function into one.
 
 =cut
 
@@ -841,7 +797,6 @@ sub option_form{
      for my $key (keys %{$param{form_option}}) {
          # strip out leader; shouldn't be anything here without one,
          # but skip stupid things anyway
-         my $o_key = $key;
          next unless $key =~ s/^\Q$form_option_leader\E//;
          if ($key =~ /^add_(.+)$/) {
               # this causes a specific parameter to be added
@@ -959,7 +914,7 @@ sub calculate_etags {
                     );
     my @additional_data = @{$param{additional_data}};
     for my $file (@{$param{files}}) {
-       my $st = stat($file) or warn "Unable to stat $file:: $!";
+       my $st = stat($file) or warn "Unable to stat $file: $!";
        push @additional_data,$st->mtime;
        push @additional_data,$st->size;
     }