projects
/
matthijs
/
upstream
/
blosxom.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Simplify default entries sub, removing hanging $1/$2 refs.
[matthijs/upstream/blosxom.git]
/
blosxom.cgi
diff --git
a/blosxom.cgi
b/blosxom.cgi
index fef5750e3d07ba7370ab01fac21bac8a6190c795..f6473743edd2d5e229b24526b00583902e3c3fa4 100755
(executable)
--- a/
blosxom.cgi
+++ b/
blosxom.cgi
@@
-550,22
+550,18
@@
sub load_template {
# Define default entries subroutine
$entries = sub {
my ( %files, %indexes, %others );
# Define default entries subroutine
$entries = sub {
my ( %files, %indexes, %others );
+ my $param_all = param('-all');
find(
sub {
find(
sub {
- my $d;
my $curr_depth = $File::Find::dir =~ tr[/][];
return if $depth and $curr_depth > $depth;
my $curr_depth = $File::Find::dir =~ tr[/][];
return if $depth and $curr_depth > $depth;
+ return if !-r $File::Find::name;
- if (
-
- # a match
- $File::Find::name
- =~ m!^$datadir/(?:(.*)/)?(.+)\.$file_extension$!
-
- # not an index, .file, and is readable
- and $2 ne 'index' and $2 !~ /^\./ and ( -r $File::Find::name )
- )
+ # if a $file_extension file and not a .file or an index
+ if ( m/^([^.].*)\.$file_extension$/
+ and $1 ne 'index' )
{
{
+ my $basename_noext = $1;
# read modification time
my $mtime = stat($File::Find::name)->mtime or return;
# read modification time
my $mtime = stat($File::Find::name)->mtime or return;
@@
-577,22
+573,23
@@
$entries = sub {
$files{$File::Find::name} = $mtime;
# static rendering bits
$files{$File::Find::name} = $mtime;
# static rendering bits
+ (my $dirname = $File::Find::dir) =~ s!^$datadir/?!!;
my $static_file
my $static_file
- = "$static_dir/$
1/index." . $static_flavours[0]
;
- if (
param('-all')
+ = "$static_dir/$
{dirname}index.$static_flavours[0]"
;
+ if (
$param_all
or !-f $static_file
or stat($static_file)->mtime < $mtime )
{
or !-f $static_file
or stat($static_file)->mtime < $mtime )
{
- $indexes{$
1
} = 1;
- $d = join( '/', ( nice_date($mtime) )[ 5, 2, 3 ] );
+ $indexes{$
dirname
} = 1;
+
my
$d = join( '/', ( nice_date($mtime) )[ 5, 2, 3 ] );
$indexes{$d} = $d;
$indexes{$d} = $d;
- $indexes{
( $1 ? "$1/" : '' ) . "$2.$file_extension"
} = 1
+ $indexes{
"$dirname$basename_noext.$file_extension"
} = 1
if $static_entries;
}
}
# not an entries match
if $static_entries;
}
}
# not an entries match
- elsif ( !-d $File::Find::name
and -r $File::Find::name
) {
+ elsif ( !-d $File::Find::name ) {
$others{$File::Find::name} = stat($File::Find::name)->mtime;
}
},
$others{$File::Find::name} = stat($File::Find::name)->mtime;
}
},
@@
-618,11
+615,7
@@
my ( $files, $indexes, $others ) = &$entries();
%indexes = %$indexes;
# Static
%indexes = %$indexes;
# Static
-if ( !$ENV{GATEWAY_INTERFACE}
- and param('-password')
- and $static_password
- and param('-password') eq $static_password )
-{
+if ( $static_or_dynamic eq 'static' ) {
param('-quiet') or print "Blosxom is generating static index pages...\n";
param('-quiet') or print "Blosxom is generating static index pages...\n";