]> git.deb.at Git - deb/packages.git/blobdiff - lib/Packages/CGI.pm
Replace non working volatile mirror debian.domainmail.org with mirror.csclub.uwaterloo.ca
[deb/packages.git] / lib / Packages / CGI.pm
index 34d7a5f341636414d0175e089561fd241c9c5823..beb4e255e9844bc68b4a32006db528e1354e9bd6 100644 (file)
@@ -4,7 +4,6 @@ use strict;
 use warnings;
 
 use Exporter;
-use Packages::Config;
 
 our @ISA = qw( Exporter );
 our @EXPORT = qw( DEBUG debug fatal_error get_mime );
@@ -20,20 +19,24 @@ my %mime_types = (
                  'txt.gz' => 'text/plain',
                  html => 'text/html',
                  rss => 'application/rss+xml',
+                 rfc822 => 'text/plain',
                  );
 
 sub get_mime {
     return $mime_types{$_[0]} || $_[1] || 'text/html';
 }
 
-our (@fatal_errors, @errors, @debug, @msgs, @hints, @notes);
+our (@fatal_errors, @errors, @debug, @hints);
+our $http_code;
 
 sub reset {
-    @fatal_errors = @errors = @debug = @msgs = @hints = @notes = ();
+    @fatal_errors = @errors = @debug = @hints = ();
+    $http_code = 200;
 }
 
 sub fatal_error {
     push @fatal_errors, $_[0];
+    $http_code = $_[1] if $_[1];
 }
 sub error {
     push @errors, $_[0];
@@ -45,27 +48,17 @@ sub debug {
     my $lvl = $_[1] || 0;
     push(@debug, $_[0]) if $debug > $lvl;
 }
-sub msg {
-    push @msgs, $_[0];
-}
-sub note {
-    push @notes, [ @_ ];
-}
 sub get_errors { (@fatal_errors, @errors) }
 sub get_debug {
     return unless $debug && @debug;
     return @debug;
 }
-sub get_msgs { @msgs };
 sub get_hints { @hints };
-sub get_notes { @notes };
 sub get_all_messages {
     return {
        errors => [ @fatal_errors, @errors ],
        debugs => $debug ? \@debug : [],
-       msgs => \@msgs,
        hints => \@hints,
-       notes => \@notes,
     };
 }
 
@@ -95,7 +88,7 @@ sub parse_params {
 
     foreach my $param ( keys %params ) {
        
-       debug( "Param <strong>$param</strong>", 2 ) if DEBUG;
+       debug( "Param $param", 2 ) if DEBUG;
 
        my $p_value_orig = $cgi->param($param);
 
@@ -345,8 +338,8 @@ sub printindexline {
 
 sub string2id {
     my $string = "@_";
-    
-    $string =~ s/[^\w]/_/g;
+
+    $string =~ s/[^\w:.-]/_/g;
     return $string;
 }