mirrored from git://git.rockbox.org/www.git
-
Notifications
You must be signed in to change notification settings - Fork 0
/
recentwiki.pl
executable file
·51 lines (42 loc) · 1.28 KB
/
recentwiki.pl
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
41
42
43
44
45
46
47
48
49
50
51
#!/usr/local/bin/perl
require "CGI.pm";
require "./nicedate.pm";
sub recentwiki
{
my @array;
my @ret;
my $max=$ARGV[0];
$max = 10 if (!$max);
my $i;
my %done;
open(FILE, "/home/rockbox/foswiki/data/Main/.changes");
for (<FILE>) {
my ($subject, $user, $date)=split("\t", $_);
$data{$date}=$_;
push @array, $date;
}
close(FILE);
@array=reverse sort {$a <=> $b} @array;
push @ret, "<table class='twikichanges'>\n";
push @ret, "<tr><th>when</th><th>what</th><th>who</th></tr>\n";
for ($i=0; $max>0 && $i<$#array; $i++) {
my ($subject, $user, $date)=split("\t", $data{$array[$i]});
next if ($subject =~ /WikiUsers/);
next if ($subject =~ /Registrations/);
if (!$done{$subject}) {
$max--;
$done{$subject}=1;
$uname=$user;
$uname =~ s/ / /g;
my $ulink="<a href=\"/wiki/".CGI::escape($user)."\">$uname</a>";
my $link="<a href=\"/wiki/".CGI::escape($subject)."\">$subject</a>";
push @ret, "<tr><td nowrap>";
push @ret, reltime($date,1);
push @ret, "</td>";
push @ret, "<td>$link</td><td>$ulink</td></tr>\n";
}
}
push @ret, "</table>";
return @ret;
}
print recentwiki;