--- /dev/null
+# Blosxom plugin: fix-static-url
+# Author(s): Barijaona Ramaholimihaso
+# Version: 2004-08-22blosxom2
+# Documentation: see bottom of file or perldoc title
+
+package fix_static_url;
+# ------------------ Configuration variables ---------------
+
+use vars qw($static_url);
+
+# Define here the url of your blog i.e. http://homepage.mac.com/barijaona
+# alternatively, use the prefs plugin to define $fix_static_url::static_url
+$static_url = "" ;
+
+# ---------------------------------------------------------
+
+
+sub start {
+ if ( $blosxom::static_or_dynamic eq 'static') {
+ $saveurl = $blosxom::url;
+ $blosxom::url = '*DEFANG_STATIC_URL*';
+ return 1;
+ }
+ else {return 0 };
+}
+
+sub head {
+ $blosxom::url= $static_url;
+}
+
+sub last {
+ # for plugins who use $url before the head sub
+ $blosxom::output =~ s>\*DEFANG_STATIC_URL\*>$static_url>g;
+ 1;
+}
+
+1;
+__END__
+=head1 NAME
+
+Blosxom Plug-in: fix_static_url
+
+=head1 SYNOPSIS
+
+This plugin corrects the $blosxom::url variable for static rendering.
+
+When you use blosxom for rendering static pages, the $url variable refers to your local machine, which is rarely acurate, especially if you intend to upload the static files to a different server... You have to explicitly assign the $url variable in the source of blosxom, or you can use this plugin as an alternative.
+
+You can assign the $static_url variable in the config section, or use the prefs plugin (the alternative to the config plugin for static rendering) to define
+$fix_static_url::static_url.
+
+=head1 VERSION
+
+2004-08-22blosxom2
+
+=head2 CHANGES
+
+2004-08-22blosxom2 : First published version
+
+=head1 AUTHOR
+
+Barijaona Ramaholimihaso <http://homepage.mac.com/barijaona>
+
+=head1 SEE ALSO
+
+Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
+
+Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
+
+=head1 COPYRIGHT
+
+This program is free software; you can redistribute
+it and/or modify it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+# Blosxom plugin: pagetype
+# Author(s): Barijaona Ramaholimihaso
+# Version: 2006-01-01blosxom2
+# Documentation: see bottom of file or perldoc title
+
+package pagetype;
+
+# ------------------ Config variables ---------------------
+
+use vars qw($pagetype $static);
+$pagetype = "" ;
+
+# ---------------------------------------------------------
+sub start {
+$static = ($blosxom::static_or_dynamic eq 'static');
+1; }
+
+sub skip {
+
+ if ($blosxom::path_info_yr ne '' )
+ {$pagetype = 'chrono' ; }
+ elsif ($static && ( $blosxom::path_info =~ m!^(\d{4})!))
+ {$pagetype = 'chrono' ; }
+ elsif (($blosxom::path_info =~ /$blosxom::flavour$/) or (($blosxom::path_info =~ /$blosxom::file_extension$/) && $static))
+ {$pagetype = 'story' ; }
+ elsif ($blosxom::path_info eq "")
+ {$pagetype = 'main' ; }
+ else
+ { $pagetype = 'category';};
+
+ # let blosxom continue
+ return undef;
+}
+
+
+1;
+
+__END__
+=head1 NAME
+
+Blosxom Plug-in: pagetype
+
+=head1 SYNOPSIS
+
+The variable $pagetype::pagetype is to be used with interpolate_fancy.
+
+You can test it in your templates to know what kind of page Blosxom is currently rendering :
+
+main : the root of the blog
+category : a category archive page
+chrono : a chronological archive page (per year, per month, per day...)
+story : an individual story page
+
+=head1 VERSION
+
+2004-08-22blosxom2
+
+=head2 CHANGES
+
+2006-01-01blosxom2 : take into account the corrections of $path_info in recent versions of blosxom.cgi
+
+2004-08-22blosxom2 : First published version
+
+=head1 AUTHOR
+
+Barijaona Ramaholimihaso <http://homepage.mac.com/barijaona>
+
+=head1 SEE ALSO
+
+Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
+
+Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
+
+=head1 COPYRIGHT
+
+This program is free software; you can redistribute
+it and/or modify it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+# Blosxom Plugin: prefs
+# Author(s): Barijaona Ramaholimihaso <prefs@barijaona.com>
+# based on config plugin authored by Rael Dornfest <rael@oreilly.com>
+# Version: 2005-11-20
+# Documentation: See the bottom of this file or type: perldoc prefs
+
+# WARNING: DO NOT PUT PREFERENCE FILES IN WORLD-READABLE PLACES SUCH AS WITHIN
+# YOUR DOCUMENT ROOT. IF YOUR $DATADIR IS LOCATED WITHIN YOUR DOCUMENT ROOT,
+# I HEARTILY ADVISE THAT YOU MOVE IT. WHILE MOST OF THE CONFIGURATION
+# DIRECTIVES ARE INNOCUOUS ENOUGH, IT'S A SLIPPERY SLOPE AND YOU MIGHT WELL
+# FIND YOU'VE EXPOSED YOUR STATIC PASSWORD OR INTERNAL DIRECTORY STRUCTURE
+# TO ANYONE WITH A WEB BROWSER!
+
+package prefs;
+
+# --- Configurable variables -----
+# where are located the preference files
+
+# I prefer to have mines in my flavour directory
+# $basepath = "/Users/barijaon/blosxom/flavours";
+
+$basepath = $blosxom::datadir unless defined $basepath ;
+# --------------------------------
+
+sub start {
+ 1;
+}
+
+sub head {
+
+$path='/';
+$path_find = $blosxom::path_info ;
+do {
+ $file = "$basepath$path"."pageprefs";
+ if (-r $file) { unless ($return = do $file) {
+ warn "Couldn't parse $file: $@" if $@;
+ }}
+
+
+ $file .= ".$blosxom::flavour";
+ if (-r $file) { unless ($return = do $file) {
+ warn "Couldn't parse $file: $@" if $@;
+ }}
+ }
+ while ($path_find =~ s#/?([^/]*)##) and $1 and ($path .= $1."/" );
+1;
+}
+
+sub story {
+
+my ($pkg, $path_find, $filename, $story_ref, $title_ref, $body_ref)= @_;
+$path='/';
+do {
+ $file = "$basepath$path"."storyprefs";
+ if (-r $file) { unless ($return = do $file) {
+ warn "Couldn't parse $file: $@" if $@;
+ }}
+
+
+ $file .= ".$blosxom::flavour";
+ if (-r $file) { unless ($return = do $file) {
+ warn "Couldn't parse $file: $@" if $@;
+ }}
+ }
+ while ($path_find =~ s#/?([^/]*)##) and $1 and ($path .= $1."/" );
+1;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Blosxom Plug-in: prefs
+
+=head1 SYNOPSIS
+
+Override Blosxom's inline configuration settings on a per-directory, per-flavour, and per-directory-per-flavour basis.
+
+For each generated page, looks for B<pageprefs> and B<pageprefs.flavour> files which should contain valid Perl instructions.
+
+For each story, looks for B<storyprefs> and B<storyprefs.flavour> files which should contain valid Perl instructions.
+
+Prefs has a purpose very similar to Rael Dornfest's B<config> plugin, but was written because in static rendering, B<config> uses the same config file for all pages.
+
+When Blosxom process a page or a story, all prefs files (pageprefs, pageprefs.flavour, storyprefs, storyprefs.flavour) in the directory tree for this page or story are executed. Prefs files for a specific flavour override prefs files applying to all flavours, and prefs files in subdirectories override prefs files in their parents.
+
+pageprefs are executed once per page (when the head of the page is generated), and storyprefs are executed once per story (allowing a per story tuning inside a page).
+
+It is recommanded that you prefix the name of the plugin with a number (for instance, naming it 10prefs) so that it loads before other Blosxom plugins (but after the B<meta> plugin if you use it).
+
+=head1 VERSION
+
+2005-11-20
+
+Version number is the date on which this version of the plug-in was created.
+
+=head1 AUTHOR
+
+Barijaona Ramaholimihaso <prefs@barijaona.com>
+
+Prefs is based on the config plugin written by Rael Dornfest <rael@oreilly.com>, http://www.raelity.org/
+
+
+=head1 SEE ALSO
+
+Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
+
+Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
+
+=head1 BUGS
+
+Address bug reports and comments to <prefs@barijaona.com> or to the Blosxom mailing list
+[http://www.yahoogroups.com/group/blosxom].
+
+=head1 LICENSE
+
+Prefs plugin
+Copyright 2003-2005, Barijaona Ramaholimihaso
+
+Blosxom and config Plug-in
+Copyright 2003, Rael Dornfest
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+# Blosxom Plugin: prevnexstory
+# Author(s): Barijaona Ramaholimihaso
+# Based on chrono_nav plugin by Victor Ganata <aswang@fatoprofugus.net>
+# and tree plug-in by Ryan Schram
+# Ideas From: Tatsuhiko Miyagawa
+# Version: 2006-01-01blosxom2
+# Documentation: See the bottom of this file or type: perldoc tree
+
+package prevnextstory;
+
+
+use strict;
+use vars qw($prevlink $nextlink $prevtitle $nexttitle $prevdate $nextdate @file_info @dir_info $files_ref @monthname @monthabbr);
+# --- Configuration Variables ---
+
+@monthname = qw/January February March
+ April May June
+ July August September
+ October November December/ if ($#monthname != 11);
+@monthabbr = qw/Jan Feb Mar
+ Apr May Jun
+ Jul Aug Sep
+ Oct Nov Dec/ if ($#monthabbr != 11);
+
+# -------------------------------------------------------------------
+
+$prevlink;
+$nextlink;
+$prevtitle;
+$nexttitle;
+$prevdate;
+$nextdate;
+@file_info;
+@dir_info;
+
+sub start {
+ return 1;
+}
+
+sub skip {
+ %$files_ref = %blosxom::files;
+ # Take %files and find all the places blosxom will generate a story page.
+ @file_info = sort { $files_ref->{$b} <=> $files_ref->{$a} } keys %$files_ref;
+0;
+}
+
+
+
+sub head {
+ if (($blosxom::path_info =~ /$blosxom::flavour$/) or (($blosxom::path_info =~ /$blosxom::file_extension$/) && ($blosxom::static_or_dynamic eq "static"))) {
+ # It's an individual story file.
+ my %path2idx = map { $file_info[$_] => $_ } 0..$#file_info;
+
+ my $key = "$blosxom::datadir/$blosxom::path_info";
+ $key =~ s#$blosxom::flavour#$blosxom::file_extension#;
+ my $index = $path2idx{"$key"};
+ if ($index < $#file_info ){ ($prevlink , $prevtitle, $prevdate) = make_link($index + 1) ;}
+ else {undef $prevlink};
+ if ($index > 0 ){ ($nextlink , $nexttitle, $nextdate) = make_link($index - 1) ;}
+ else {undef $nextlink;};
+
+ }
+ elsif (($blosxom::path_info eq "") && ($blosxom::path_info_yr eq "")) {
+ # it's the blog main page
+ if ($blosxom::num_entries <= $#file_info ){($prevlink, $prevtitle, $prevdate) = make_link($blosxom::num_entries) ;}
+ else { undef $prevlink ;};
+
+
+ }
+ else
+ {undef $prevlink;
+ undef $nextlink;};
+1;
+}
+
+sub make_link {
+ my ($array_index) = @_;
+ my $file = $file_info[$array_index];
+ my($path, $fn) = $file =~ m!^$blosxom::datadir/(?:(.*)/)?(.*)\.$blosxom::file_extension!;
+ my $title='';
+
+ my $fh = FileHandle->new();
+ if (-f $file && $fh->open("< $file")) {
+ chomp($title = <$fh>);
+ $fh->close;
+ }
+ $path = $path . ( $path ne "" ? "/" : "") ;
+ my @date = localtime($files_ref->{$file_info[$array_index]});
+ my $mday = $date[3];
+ my $month = $date[4];
+ my $year = $date[5] + 1900;
+
+ #here we format the date as a text
+ my $datetext = $mday." ".$monthname[$month]." ".$year ;
+ return (qq($blosxom::url/$path$fn.$blosxom::flavour), $title, $datetext);
+}
+
+
+
+
+1;
+
+
+__END__
+
+=head1 NAME
+
+Blosxom Plug-in: chrono_nav
+
+=head1 SYNOPSIS
+
+Populates the prevnexstory namespace with links for pointing to preceding
+and following stories (arranged chronologically). I suggest you use it with interpolate_fancy for testing whether $prevnextstory::prevlink and $prevnextstory::nextlink are defined to avoid spurious links to appear when there is no older or fresher story.
+
+=head1 INSTALLATION
+
+Drop this plugin into your plugin directory. Place substitution
+variables $prevnextstory::prevlink and $prevnextstory::nextlink in your flavour file as an href value for an anchor element. You can also use $prevnextstory::prevtitle and $prevnextstory::nextlink to get the titles of those stories, and $prevnextstory::prevdate and $prevnextstory::nextdate to get their publication dates. If you need the dates, you will have to adapt the @monthname and @monthabbr lists to your needs, and in some cases modify the formatting performed by the make_list subroutine (default date format is DD/MM/YYYY, with month names in French).
+
+=head1 VERSION
+
+2005-02-12blosxom2
+
+Version number is the date on which this version of the plug-in was created.
+
+=head2 CHANGES
+
+2006-01-01blosxom2 : take into account the corrections of $path_info in recent versions of blosxom.cgi
+
+2004-08-22blosxom2 : First published version
+
+=head1 AUTHOR(S)
+
+Barijaona Ramaholimihaso
+Based on chrono_nav plugin by Victor Ganata (<aswang@fatoprofugus.net>, http://blog.fatoprofugus.net )
+which was itself based on tree plugin by Ryan Schram (http://www.rschram.org)
+with inspiration and some code techniques used in prevnextentry from Tatsuhiko Miyagawa (http://www.bulknews.net)
+
+=head1 SEE ALSO
+
+Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
+
+Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
+
+=head1 BUGS
+
+Address bug reports and comments to the Blosxom mailing list
+[http://www.yahoogroups.com/group/blosxom].
+
+=head1 LICENSE
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+# Blosxom Plugin: static_file
+# Author(s): Barijaona Ramaholimihaso <static_file@barijaona.com>
+# original idea by Raffi Krikorian <r@bitwaste.com> (binary plugin)
+# Version: 2004-09-19
+# Documentation: See the bottom of this file or type: perldoc static_file
+
+package static_file;
+use lib qq{$blosxom::plugin_dir/lib};
+use CGI qw/:standard :netscape/;
+use File::Copy;
+use File::Cat;
+use File::Find;
+use File::Path;
+use FileHandle;
+use MIME::Types;
+
+
+# --- Configuration Variables ---
+
+# You may want to hide from the public some kind of files,
+# for instance the files Blosxom renders, generally .txt files.
+# Files whose filename extension is in the following list
+# will be ignored in dynamic rendering
+@exclude_extensions_dynamic = ();
+
+# Files whose filename extension is in the following list
+# will be ignored in static rendering
+@exclude_extensions_static = ("$blosxom::file_extension", txt_);
+
+# This is the MIME type that will be used if nothing else
+# can be found. If your server contains mostly text or HTML
+# documents, "text/plain" is a good value. If most of your
+# content is binary, such as applications or images, you may
+# want to use "application/octet-stream" instead to keep browsers
+# from trying to display binary files as though they are text.
+$default_type="text/plain";
+
+# --------------------------------
+
+sub start {
+ 1;
+}
+
+sub skip {
+ if( $blosxom::static_or_dynamic eq "dynamic" ) {
+ # if Blosxom is being dynamically generated -- then we have to
+ # see if the URL requested specifies a file that is on the
+ # filesystem, then it will return that file with the right
+ # Content-Type header
+ if( ( $blosxom::path_info =~ m!^(.*?/?)([^/]*?\.?)([^\.]*?)$! ) &&
+ ( -e "$blosxom::datadir/$1$2$3" ) && (! -d "$blosxom::datadir/$1$2$3" ) )
+ {
+ # access path and name, name and extension of the file
+ $fileaccess = "$blosxom::datadir/$1$2$3" ;
+ # adequate file extension ?
+ if ( grep(/$3/, @exclude_extensions_dynamic) ) {return 0 ;}
+ my MIME::Types $types = MIME::Types->new;
+ my MIME::Type $mimetype = $types->mimeTypeOf($blosxom::flavour);
+ $blosxom::header =
+ header( { -type=>
+ ( $mimetype ) ?
+ $mimetype->mediaType . "/" . $mimetype->subType :
+ $default_type } );
+ my @data = stat( $fileaccess );
+ # forge some HTTP header stuff
+ print("Accept-Ranges: bytes\nContent-Length: $data[7]\n$blosxom::header");
+ cat( $fileaccess, \*STDOUT);
+ # empty what blosxom main script may use
+ $blosxom::header= "";
+ $blosxom::output='';
+ # tell blosxom main script to end processing for this file
+ return 1;
+ }
+ return 0 ;
+ }
+ return 0;
+}
+
+sub end {
+ # if we are statically rendering the blog, then we have to copy
+ # over the entire data tree to the static tree so that it can be
+ # served out of there
+ if( $blosxom::static_or_dynamic eq "static" ) {
+ find(
+ sub {
+ if( $File::Find::name =~
+ m!^$blosxom::datadir(.*?/?)([^/]*?\.?)([^\.]*?)$! ) {
+ # do we have to create a directory ?
+ if ( ( ! -e "$blosxom::static_dir$1$2$3")
+ && (-d $File::Find::name) ) {
+ mkpath ("$blosxom::static_dir$1$2$3");}
+ # is it a file to be updated ?
+ elsif ( ! grep(/$3/, @exclude_extensions_static) ) {
+ my @static = stat( "$blosxom::static_dir$1$2$3" );
+ my @data = stat( $File::Find::name );
+ ( ( ! -e "$blosxom::static_dir$1$2$3" ) ||
+ ( ( ( $static[9] < $data[9] ) ||
+ ( $static[7] != $data[7] ) ) ) ) &&
+ copy( $File::Find::name,
+ "$blosxom::static_dir$1$2$3" );
+ }
+ }
+ }, $blosxom::datadir );
+
+ }
+
+ 1;
+
+}
+
+
+
+1;
+
+__END__
+
+=head1 NAME
+
+Blosxom Plug-in: static_file
+
+=head1 SYNOPSIS
+
+Cause Blosxom to see if the URL requested actually exists on the filesystem. If it does, then return the file, and then exit the script allowing for binary file serves. If the file does not exist, then the Bloxsom script will continue noting whether it needs to do a flavour translation on the data file, etc.
+
+This allows you to integrate existing webpages to a Blosxom site.
+
+Another convinience of this is that when you wish to include an image or anything besides just the blog entry, you can place the file in the same directory as your text file, and reference it with a <$url /><$path /> (supposing you are using interpolate_fancy and its ability to interpolate variables in stories).
+
+=head1 VERSION
+
+2004-09-19
+
+Version number is the date on which this version of the plug-in was created.
+
+=head1 AUTHOR
+
+Barijaona Ramaholimihaso <static_file@barijaona.com>
+
+Original idea by Raffi Krikorian <r@bitwaste.com>, http://www.bitwaste.com/, author of the binary plugin.
+
+=head1 SEE ALSO
+
+Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
+
+Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
+
+=head1 NOTES
+
+If you are using this plugin in Blosxom's dynamic mode, you might consider creating a custom B<error> flavour, because Blosxom's default B<error> flavour could be confusing for the user.
+
+It is recommanded, for performance optimization, to put a number in front of the name of this plugin, for instance to name it B<00static_file>, so that it loads among the first.
+
+=head1 LICENSE
+
+static_file Blosxom plugin
+Copyright 2003, Barijaona Ramaholimihaso
+Copyright 2003, Raffi Krikorian
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.