]> git.deb.at Git - pkg/blosxom.git/blobdiff - blosxom.cgi
Bug 1356997 <http://sourceforge.net/tracker/index.php?func=detail&aid=1356997&group_i...
[pkg/blosxom.git] / blosxom.cgi
index 1233ea4b55ed0a2a8cd56b5914ceff356e288018..43afa7df017ec0d4152adf1d6d2156e7a68ec7b0 100755 (executable)
@@ -2,8 +2,9 @@
 
 # Blosxom
 # Author: Rael Dornfest <rael@oreilly.com>
-# Version: 2.0
-# Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
+# Version: 2.0.1
+# Home/Docs/Licensing: http://www.blosxom.com/
+# Development/Downloads: http://sourceforge.net/projects/blosxom
 
 package blosxom;
 
@@ -220,10 +221,7 @@ $entries =
 my $tmp; foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('entries') and defined($tmp = $plugin->entries()) and $entries = $tmp and last; }
 
 my ($files, $indexes, $others) = &$entries();
-%files = %$files; %indexes = %$indexes; %others = ref $others ? %$others : ();
-
-# Plugins: Filter
-foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('filter') and $entries = $plugin->filter(\%files, \%others) }
+%indexes = %$indexes;
 
 # Static
 if (!$ENV{GATEWAY_INTERFACE} and param('-password') and $static_password and param('-password') eq $static_password) {
@@ -237,7 +235,6 @@ if (!$ENV{GATEWAY_INTERFACE} and param('-password') and $static_password and par
     foreach ( ('', split /\//, $path) ) {
       $p .= "/$_";
       $p =~ s!^/!!;
-      $path_info = $p;
       $done{$p}++ and next;
       (-d "$static_dir/$p" or $p =~ /\.$file_extension$/) or mkdir "$static_dir/$p", 0755;
       foreach $flavour ( @static_flavours ) {
@@ -247,10 +244,17 @@ if (!$ENV{GATEWAY_INTERFACE} and param('-password') and $static_password and par
         param('-quiet') or print "$fn.$flavour\n";
         my $fh_w = new FileHandle "> $static_dir/$fn.$flavour" or die "Couldn't open $static_dir/$p for writing: $!";  
         $output = '';
-        print $fh_w 
-          $indexes{$path} == 1
-            ? &generate('static', $p, '', $flavour, $content_type)
-            : &generate('static', '', $p, $flavour, $content_type);
+        if ($indexes{$path} == 1) {
+          # category
+          $path_info = $p;
+          print $fh_w &generate('static', $p, '', $flavour, $content_type);
+        } else {
+          # date
+          local ($path_info_yr,$path_info_mo,$path_info_da, $path_info) = 
+              split /\//, $p, 4;
+          unless (defined $path_info) {$path_info = ""};
+          print $fh_w &generate('static', '', $p, $flavour, $content_type);
+        }
         $fh_w->close;
       }
     }
@@ -274,6 +278,11 @@ foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('end')
 sub generate {
   my($static_or_dynamic, $currentdir, $date, $flavour, $content_type) = @_;
 
+  %files = %$files; %others = ref $others ? %$others : ();
+
+  # Plugins: Filter
+  foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('filter') and $entries = $plugin->filter(\%files, \%others) }
+
   my %f = %files;
 
   # Plugins: Skip