# Copyright (C) 2006 Alex Schroeder # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # TODO referers and refeRrers use strict; use v5.10; AddModuleDescription('referrer-rss.pl', 'Comments on Automatic Link Back'); our (%Action, $LastUpdate, $ScriptName, $RssStyleSheet, $RssImageUrl, $SiteName, $SiteDescription, %Referers); $Action{"refer-rss"} = \&DoRefererRss; sub DoRefererRss { my $url = QuoteHtml($ScriptName); my $date = TimeToRFC822($LastUpdate); my $limit = GetParam("rsslimit", 15); # Only take the first 15 entries my $count = 0; print GetHttpHeader('application/xml'); print qq{}; if ($RssStyleSheet =~ /\.(xslt?|xml)$/) { print qq{}; } elsif ($RssStyleSheet) { print qq{}; } print qq{ http://blogs.law.harvard.edu/tech/rss }; print "" . QuoteHtml($SiteName) . " " . T("Referrers") . "\n"; print "$url?action=refer\n"; print "" . QuoteHtml($SiteDescription) . "\n"; print "" . $date. "\n"; print "" . $date . "\n"; print "Oddmuse\n"; if ($RssImageUrl) { print "\n"; print "" . $RssImageUrl . "\n"; print "" . QuoteHtml($SiteName) . "\n"; print "" . $url . "\n"; print "\n"; } my %when = (); my %where = (); for my $id (AllPagesList()) { ReadReferers($id); # $Referers{url} = time for each $id foreach my $url (keys %Referers) { # $where{$url} = HomePage, AlexSchroeder, What_Is_A_Wiki push(@{$where{$url}}, $id); # $when{$url} = last time $when{$url} = $Referers{$url} if $when{$url} < $Referers{$url}; } } foreach my $url (sort { $when{$b} <=> $when{$a} } keys %when) { print "\n\n"; print "" . QuoteHtml($url) . "\n"; print "" . QuoteHtml($url) . "\n"; print "" . join(", ", map { QuoteHtml(GetPageLink($_)); } @{$where{$url}}) . ", " . CalcDay($when{$url}) . " " . CalcTime($when{$url}) . "\n"; print "" . $date . "\n"; print "\n"; } print "\n\n"; }