]> git.deb.at Git - deb/packages.git/blobdiff - lib/Packages/CGI.pm
Add a missing </a>
[deb/packages.git] / lib / Packages / CGI.pm
index 9a8584fe6bd51b4cf784ad1dc37d522215ab4e33..34d7a5f341636414d0175e089561fd241c9c5823 100644 (file)
@@ -7,15 +7,25 @@ use Exporter;
 use Packages::Config;
 
 our @ISA = qw( Exporter );
-our @EXPORT = qw( DEBUG debug fatal_error );
+our @EXPORT = qw( DEBUG debug fatal_error get_mime );
 our @EXPORT_OK = qw( error hint msg note get_all_messages
                     make_url make_search_url );
 
-
 # define this to 0 in production mode
 use constant DEBUG => 1;
 our $debug = 0;
 
+my %mime_types = (
+                 txt => 'text/plain',
+                 'txt.gz' => 'text/plain',
+                 html => 'text/html',
+                 rss => 'application/rss+xml',
+                 );
+
+sub get_mime {
+    return $mime_types{$_[0]} || $_[1] || 'text/html';
+}
+
 our (@fatal_errors, @errors, @debug, @msgs, @hints, @notes);
 
 sub reset {
@@ -333,6 +343,13 @@ sub printindexline {
 #    return ( $start, $end );
 #}
 
+sub string2id {
+    my $string = "@_";
+    
+    $string =~ s/[^\w]/_/g;
+    return $string;
+}
+
 our ( %url_params, %query_params );
 
 sub init_url {