X-Git-Url: https://git.deb.at/?p=pkg%2Fblosxom.git;a=blobdiff_plain;f=blosxom.cgi;h=2a3665681f79377153139c14bf6050df03024c1a;hp=2fd086149ff63fd7838de45be2f1c6a431901f4f;hb=0019751b63e72de049e624534f69570ca8b22e6a;hpb=724889277de88cc8d63e4516d74564cf1ba2ac11;ds=sidebyside diff --git a/blosxom.cgi b/blosxom.cgi index 2fd0861..2a36656 100755 --- a/blosxom.cgi +++ b/blosxom.cgi @@ -2,8 +2,8 @@ # Blosxom # Author: Rael Dornfest -# Version: 2.0.1 -# Home/Docs/Licensing: http://www.blosxom.com/ +# Version: 2.0.2 +# Home/Docs/Licensing: http://blosxom.sourceforge.net/ # Development/Downloads: http://sourceforge.net/projects/blosxom package blosxom; @@ -76,7 +76,7 @@ use File::stat; use Time::localtime; use CGI qw/:standard :netscape/; -$version = "2.0"; +$version = "2.0.2"; my $fh = new FileHandle; @@ -163,13 +163,23 @@ while () { # Plugins: Start if ( $plugin_dir and opendir PLUGINS, $plugin_dir ) { - foreach my $plugin ( grep { /^\w+$/ && -f "$plugin_dir/$_" } sort readdir(PLUGINS) ) { + unshift @INC, $plugin_dir; + foreach my $plugin ( grep { /^[\w:]+$/ && -f "$plugin_dir/$_" } sort readdir(PLUGINS) ) { next if ($plugin =~ /~$/); # Ignore emacs backups - my($plugin_name, $off) = $plugin =~ /^\d*(\w+?)(_?)$/; + my($plugin_name, $off) = $plugin =~ /^\d*([\w:]+?)(_?)$/; my $on_off = $off eq '_' ? -1 : 1; - require "$plugin_dir/$plugin"; + # Allow perl module plugins + if ($plugin =~ m/::/ && -z "$plugin_dir/$plugin") { + # For Blosxom::Plugin::Foo style plugins, we need to use a string require + eval "require $plugin_name"; + } + else { + eval { require $plugin }; + } + $@ and warn "error finding or loading blosxom plugin $plugin_name - skipping\n" and next; $plugin_name->start() and ( $plugins{$plugin_name} = $on_off ) and push @plugins, $plugin_name; } + shift @INC; closedir PLUGINS; } @@ -183,7 +193,7 @@ sub load_template { return &$template(@_); } -# Define default find subroutine +# Define default entries subroutine $entries = sub { my(%files, %indexes, %others); @@ -363,7 +373,7 @@ sub generate { ($path,$fn) = $path_file =~ m!^$datadir/(?:(.*)/)?(.*)\.$file_extension!; # Only stories in the right hierarchy - $path =~ /^$currentdir(?=$|\/)/ or $path_file eq "$datadir/$currentdir" or next; + $path =~ /^$currentdir/ or $path_file eq "$datadir/$currentdir" or next; # Prepend a slash for use in templates only if a path exists $path &&= "/$path"; @@ -481,7 +491,7 @@ html date

$dw, $da $mo $yr

html foot html foot

html foot

-html foot +html foot html foot
html foot html foot