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/
111 This plugin is now maintained by the Blosxom Sourceforge Team,
112 <blosxom-devel@lists.sourceforge.net>.
116 Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
118 Blosxom Plugin Docs: http://blosxom.sourceforge.net/documentation/users/plugins.html
122 None known; please send bug reports and feedback to the Blosxom
123 development mailing list <blosxom-devel@lists.sourceforge.net>.
127 Blosxom and this Blosxom Plug-in
128 Copyright 2003, Rael Dornfest
130 Permission is hereby granted, free of charge, to any person obtaining a
131 copy of this software and associated documentation files (the "Software"),
132 to deal in the Software without restriction, including without limitation
133 the rights to use, copy, modify, merge, publish, distribute, sublicense,
134 and/or sell copies of the Software, and to permit persons to whom the
135 Software is furnished to do so, subject to the following conditions:
137 The above copyright notice and this permission notice shall be included
138 in all copies or substantial portions of the Software.
140 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
141 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
142 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
143 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
144 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
145 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
146 OTHER DEALINGS IN THE SOFTWARE.