1 # Blosxom Plugin: entries_index
2 # Author(s): Rael Dornfest <rael@oreilly.com>
4 # Documentation: See the bottom of this file or type: perldoc entries_index
8 # --- Configurable variables -----
10 # --------------------------------
15 use CGI qw/:standard/;
25 if ( open ENTRIES, "$blosxom::plugin_state_dir/.entries_index.index" ) {
26 my $index = join '', <ENTRIES>;
28 $index =~ /\$VAR1 = \{/ and eval($index) and !$@ and %files = %$VAR1;
32 for my $file (keys %files) { -f $file or do { $reindex++; delete $files{$file} }; }
37 my $curr_depth = $File::Find::dir =~ tr[/][];
38 if ( $blosxom::depth and $curr_depth > $blosxom::depth ) {
39 $files{$File::Find::name} and delete $files{$File::Find::name};
43 $File::Find::name =~ m!^$blosxom::datadir/(?:(.*)/)?(.+)\.$blosxom::file_extension$!
44 and $2 ne 'index' and $2 !~ /^\./ and (-r $File::Find::name)
45 # to show or not to show future entries
47 $blosxom::show_future_entries
48 or stat($File::Find::name)->mtime <= time
50 and ( $files{$File::Find::name} || ++$reindex )
51 and ( $files{$File::Find::name} = $files{$File::Find::name} || stat($File::Find::name)->mtime )
55 or !-f "$blosxom::static_dir/$1/index." . $blosxom::static_flavours[0]
56 or stat("$blosxom::static_dir/$1/index." . $blosxom::static_flavours[0])->mtime < stat($File::Find::name)->mtime
59 and $d = join('/', (blosxom::nice_date($files{$File::Find::name}))[5,2,3])
61 and $blosxom::static_entries and $indexes{ ($1 ? "$1/" : '') . "$2.$blosxom::file_extension" } = 1;
66 if ( open ENTRIES, "> $blosxom::plugin_state_dir/.entries_index.index" ) {
67 print ENTRIES Dumper \%files;
70 warn "couldn't > $blosxom::plugin_state_dir/.entries_index.index: $!\n";
74 return (\%files, \%indexes);
85 Blosxom Plug-in: entries_index
89 Purpose: Preserves original creation timestamp on weblog entries,
90 allowing for editing of entries without altering the original
93 Maintains an index ($blosxom::plugin_state_dir/.entries_index.index) of
94 filenames and their creation times. Adds new entries to the index
95 the first time Blosxom encounters them (read: is run after their
98 Replaces the default $blosxom::entries subroutine
104 Version number coincides with the version of Blosxom with which the
105 current version was first bundled.
109 Rael Dornfest <rael@oreilly.com>, http://www.raelity.org/
113 Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
115 Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
119 Address bug reports and comments to the Blosxom mailing list
120 [http://www.yahoogroups.com/group/blosxom].
124 Blosxom and this Blosxom Plug-in
125 Copyright 2003, Rael Dornfest
127 Permission is hereby granted, free of charge, to any person obtaining a
128 copy of this software and associated documentation files (the "Software"),
129 to deal in the Software without restriction, including without limitation
130 the rights to use, copy, modify, merge, publish, distribute, sublicense,
131 and/or sell copies of the Software, and to permit persons to whom the
132 Software is furnished to do so, subject to the following conditions:
134 The above copyright notice and this permission notice shall be included
135 in all copies or substantial portions of the Software.
137 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
138 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
139 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
140 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
141 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
142 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
143 OTHER DEALINGS IN THE SOFTWARE.