forked from bentglasstube/blosxom-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfakecat-v0i1
40 lines (34 loc) · 825 Bytes
/
fakecat-v0i1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Copyright 2004 Anthony Towns <[email protected]>
# Use/modify/distribute under GNU General Public License v2.
package fakecat;
$catfile = "${blosxom::datadir}/${blosxom::path_info}.cat";
$path = $blosxom::path_info;
@cats = ();
sub start {
if (-e $catfile) {
$blosxom::path_info = "";
open(CATFILE, "<$catfile") or return 0;
while (my $c = <CATFILE>) { chomp $c; push @cats, $c; }
close(CATFILE);
return 1;
}
0;
}
sub filter {
my ($files, $others) = @_;
foreach $q (keys %$others) {
my $path = "";
$path = $1
if ($q =~ m!^$blosxom::datadir/(?:(.*)/)?.*\.$blosxom::file_extension!);
my $ok = 0;
foreach $cat (@cats) {
if ($path =~ /^$cat/ or $q eq "$blosxom::datadir/$cat") {
$ok = 1;
last;
}
}
$ok or delete $others->{$q};
}
1;
}
1;