diff options
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/aggregate.pm | 23 | ||||
-rw-r--r-- | IkiWiki/Plugin/blogspam.pm | 14 | ||||
-rw-r--r-- | IkiWiki/Plugin/comments.pm | 2 | ||||
-rw-r--r-- | IkiWiki/Plugin/editpage.pm | 10 | ||||
-rw-r--r-- | IkiWiki/Plugin/htmltidy.pm | 2 | ||||
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 4 | ||||
-rw-r--r-- | IkiWiki/Plugin/po.pm | 3 | ||||
-rw-r--r-- | IkiWiki/Plugin/transient.pm | 8 |
8 files changed, 45 insertions, 21 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 59185e97f..419b40fdb 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -162,10 +162,14 @@ sub migrate_to_internal { $config{aggregateinternal} = 0; my $oldname = "$config{srcdir}/".htmlfn($data->{page}); + if (! -e $oldname) { + $oldname = $IkiWiki::Plugin::transient::transientdir."/".htmlfn($data->{page}); + } + my $oldoutput = $config{destdir}."/".IkiWiki::htmlpage($data->{page}); $config{aggregateinternal} = 1; - my $newname = "$config{srcdir}/".htmlfn($data->{page}); + my $newname = $IkiWiki::Plugin::transient::transientdir."/".htmlfn($data->{page}); debug "moving $oldname -> $newname"; if (-e $newname) { @@ -385,13 +389,16 @@ sub garbage_collect () { foreach my $guid (values %guids) { # any guid whose feed is gone should be removed if (! exists $feeds{$guid->{feed}}) { - unlink "$config{srcdir}/".htmlfn($guid->{page}) - if exists $guid->{page}; + if (exists $guid->{page}) { + unlink $IkiWiki::Plugin::transient::transientdir."/".htmlfn($guid->{page}) + || unlink "$config{srcdir}/".htmlfn($guid->{page}); + } delete $guids{$guid->{guid}}; } # handle expired guids elsif ($guid->{expired} && exists $guid->{page}) { unlink "$config{srcdir}/".htmlfn($guid->{page}); + unlink $IkiWiki::Plugin::transient::transientdir."/".htmlfn($guid->{page}); delete $guid->{page}; delete $guid->{md5}; } @@ -611,6 +618,7 @@ sub add_page (@) { } my $c=""; while (exists $IkiWiki::pagecase{lc $page.$c} || + -e $IkiWiki::Plugin::transient::transientdir."/".htmlfn($page.$c) || -e "$config{srcdir}/".htmlfn($page.$c)) { $c++ } @@ -622,6 +630,8 @@ sub add_page (@) { $c=""; $page=$feed->{dir}."/item"; while (exists $IkiWiki::pagecase{lc $page.$c} || + -e $IkiWiki::Plugin::transient::transientdir."/".htmlfn($page.$c) || + -e "$config{srcdir}/".htmlfn($page.$c)) { $c++ } @@ -664,13 +674,14 @@ sub add_page (@) { if (ref $feed->{tags}) { $template->param(tags => [map { tag => $_ }, @{$feed->{tags}}]); } - writefile(htmlfn($guid->{page}), $config{srcdir}, - $template->output); + writefile(htmlfn($guid->{page}), + $IkiWiki::Plugin::transient::transientdir, $template->output); if (defined $mtime && $mtime <= time) { # Set the mtime, this lets the build process get the right # creation time on record for the new page. - utime $mtime, $mtime, "$config{srcdir}/".htmlfn($guid->{page}); + utime $mtime, $mtime, + $IkiWiki::Plugin::transient::transientdir."/".htmlfn($guid->{page}); # Store it in pagectime for expiry code to use also. $IkiWiki::pagectime{$guid->{page}}=$mtime unless exists $IkiWiki::pagectime{$guid->{page}}; diff --git a/IkiWiki/Plugin/blogspam.pm b/IkiWiki/Plugin/blogspam.pm index f0b6cb2a2..d32c2f169 100644 --- a/IkiWiki/Plugin/blogspam.pm +++ b/IkiWiki/Plugin/blogspam.pm @@ -61,12 +61,18 @@ sub checkcontent (@) { my %params=@_; my $session=$params{session}; - if (exists $config{blogspam_pagespec}) { - return undef - if ! pagespec_match($params{page}, $config{blogspam_pagespec}, - location => $params{page}); + my $spec='!admin()'; + if (exists $config{blogspam_pagespec} && + length $config{blogspam_pagespec}) { + $spec.=" and (".$config{blogspam_pagespec}.")"; } + my $user=$session->param("name"); + return undef unless pagespec_match($params{page}, $spec, + (defined $user ? (user => $user) : ()), + (defined $session->remote_addr() ? (ip => $session->remote_addr()) : ()), + location => $params{page}); + my $url=$defaulturl; $url = $config{blogspam_server} if exists $config{blogspam_server}; diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index d9183970d..6691dbafa 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -365,7 +365,7 @@ sub editcomment ($$) { # The untaint is OK (as in editpage) because we're about to pass # it to file_pruned and wiki_file_regexp anyway. - my $page = $form->field('page')=~/$config{wiki_file_regexp}/; + my ($page) = $form->field('page')=~/$config{wiki_file_regexp}/; $page = IkiWiki::possibly_foolish_untaint($page); if (! defined $page || ! length $page || IkiWiki::file_pruned($page)) { diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 8c78e853c..3d094c263 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -91,12 +91,15 @@ sub cgi_editpage ($$) { # This untaint is safe because we check file_pruned and # wiki_file_regexp. my ($page)=$form->field('page')=~/$config{wiki_file_regexp}/; - if (! defined $page || ! length $page || - file_pruned($page)) { + if (! defined $page) { error(gettext("bad page name")); } $page=possibly_foolish_untaint($page); my $absolute=($page =~ s#^/+##); # absolute name used to force location + if (! defined $page || ! length $page || + file_pruned($page)) { + error(gettext("bad page name")); + } my $baseurl = urlto($page); @@ -128,7 +131,8 @@ sub cgi_editpage ($$) { # favor the type of linking page $type=pagetype($pagesources{$from}); } - $type=$config{default_pageext} unless defined $type; + $type=$config{default_pageext} + if ! defined $type || $type=~/^_/; # not internal type $file=newpagefile($page, $type); if (! $form->submitted) { $form->field(name => "rcsinfo", value => "", force => 1); diff --git a/IkiWiki/Plugin/htmltidy.pm b/IkiWiki/Plugin/htmltidy.pm index 1108aeb89..da77e60f1 100644 --- a/IkiWiki/Plugin/htmltidy.pm +++ b/IkiWiki/Plugin/htmltidy.pm @@ -41,6 +41,8 @@ sub checkconfig () { sub sanitize (@) { my %params=@_; + return $params{content} unless defined $config{htmltidy}; + my $pid; my $sigpipe=0; $SIG{PIPE}=sub { $sigpipe=1 }; diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index d89e14197..285077204 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -294,11 +294,11 @@ sub preprocess_inline (@) { if ($feeds) { if ($rss) { $rssurl=abs2rel($feedbase."rss".$feednum, dirname(htmlpage($params{destpage}))); - $rssdesc = gettext("%s (RSS feed)", $desc); + $rssdesc = sprintf(gettext("%s (RSS feed)"), $desc); } if ($atom) { $atomurl=abs2rel($feedbase."atom".$feednum, dirname(htmlpage($params{destpage}))); - $atomdesc = gettext("%s (Atom feed)", $desc); + $atomdesc = sprintf(gettext("%s (Atom feed)"), $desc); } } diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 9ed4a1adb..4f8d5036e 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -38,7 +38,8 @@ memoize("percenttranslated"); sub import { hook(type => "getsetup", id => "po", call => \&getsetup); - hook(type => "checkconfig", id => "po", call => \&checkconfig); + hook(type => "checkconfig", id => "po", call => \&checkconfig, + last => 1); hook(type => "needsbuild", id => "po", call => \&needsbuild); hook(type => "scan", id => "po", call => \&scan, last => 1); hook(type => "filter", id => "po", call => \&filter); diff --git a/IkiWiki/Plugin/transient.pm b/IkiWiki/Plugin/transient.pm index c482b8552..9811aa010 100644 --- a/IkiWiki/Plugin/transient.pm +++ b/IkiWiki/Plugin/transient.pm @@ -25,10 +25,10 @@ sub getsetup () { our $transientdir; sub checkconfig () { - eval q{use Cwd 'abs_path'}; - error($@) if $@; - $transientdir = abs_path($config{wikistatedir})."/transient"; - add_underlay($transientdir); + $transientdir = $config{wikistatedir}."/transient"; + # add_underlay treats relative underlays as relative to the installed + # location, not the cwd. That's not what we want here. + IkiWiki::add_literal_underlay($transientdir); } sub change (@) { |