- add_depends($params{page}, $params{pages});
- # Explicitly add all currently displayed pages as dependencies, so
- # that if they are removed or otherwise changed, the inline will be
- # sure to be updated.
- add_depends($params{page}, join(" or ", @list));
+ if ($feeds && exists $params{feedpages}) {
+ @feedlist = pagespec_match_list(
+ $params{page}, "($params{pages}) and ($params{feedpages})",
+ deptype => deptype($quick ? "presence" : "content"),
+ list => \@feedlist,
+ );
+ }
+
+ my ($feedbase, $feednum);
+ if ($feeds) {
+ # Ensure that multiple feeds on a page go to unique files.
+
+ # Feedfile can lead to conflicts if usedirs is not enabled,
+ # so avoid supporting it in that case.
+ delete $params{feedfile} if ! $config{usedirs};
+ # Tight limits on legal feedfiles, to avoid security issues
+ # and conflicts.
+ if (defined $params{feedfile}) {
+ if ($params{feedfile} =~ /\// ||
+ $params{feedfile} !~ /$config{wiki_file_regexp}/) {
+ error("illegal feedfile");
+ }
+ $params{feedfile}=possibly_foolish_untaint($params{feedfile});
+ }
+ $feedbase=targetpage($params{destpage}, "", $params{feedfile});
+
+ my $feedid=join("\0", $feedbase, map { $_."\0".$params{$_} } sort keys %params);
+ if (exists $knownfeeds{$feedid}) {
+ $feednum=$knownfeeds{$feedid};
+ }
+ else {
+ if (exists $page_numfeeds{$params{destpage}}{$feedbase}) {
+ if ($feeds) {
+ $feednum=$knownfeeds{$feedid}=++$page_numfeeds{$params{destpage}}{$feedbase};
+ }
+ }
+ else {
+ $feednum=$knownfeeds{$feedid}="";
+ if ($feeds) {
+ $page_numfeeds{$params{destpage}}{$feedbase}=1;
+ }
+ }
+ }
+ }
+
+ my $rssurl=abs2rel($feedbase."rss".$feednum, dirname(htmlpage($params{destpage}))) if $feeds && $rss;
+ my $atomurl=abs2rel($feedbase."atom".$feednum, dirname(htmlpage($params{destpage}))) if $feeds && $atom;