summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/aggregate.pm18
-rw-r--r--IkiWiki/Plugin/comments.pm18
-rw-r--r--IkiWiki/Plugin/git.pm10
-rw-r--r--IkiWiki/Plugin/img.pm7
-rw-r--r--IkiWiki/Plugin/openid.pm1
-rw-r--r--IkiWiki/Plugin/po.pm2
6 files changed, 52 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index 5a9eb433d..7789c4c2a 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -298,7 +298,7 @@ sub loadstate () {
return if $state_loaded;
$state_loaded=1;
if (-e "$config{wikistatedir}/aggregate") {
- open(IN, "$config{wikistatedir}/aggregate") ||
+ open(IN, "<", "$config{wikistatedir}/aggregate") ||
die "$config{wikistatedir}/aggregate: $!";
while (<IN>) {
$_=IkiWiki::possibly_foolish_untaint($_);
@@ -335,7 +335,7 @@ sub savestate () {
garbage_collect();
my $newfile="$config{wikistatedir}/aggregate.new";
my $cleanup = sub { unlink($newfile) };
- open (OUT, ">$newfile") || error("open $newfile: $!", $cleanup);
+ open (OUT, ">", $newfile) || error("open $newfile: $!", $cleanup);
foreach my $data (values %feeds, values %guids) {
my @line;
foreach my $field (keys %$data) {
@@ -356,6 +356,20 @@ sub savestate () {
close OUT || error("save $newfile: $!", $cleanup);
rename($newfile, "$config{wikistatedir}/aggregate") ||
error("rename $newfile: $!", $cleanup);
+
+ my $timestamp=undef;
+ foreach my $feed (keys %feeds) {
+ my $t=$feeds{$feed}->{lastupdate}+$feeds{$feed}->{updateinterval};
+ if (! defined $timestamp || $timestamp > $t) {
+ $timestamp=$t;
+ }
+ }
+ $newfile=~s/\.new$/time/;
+ open (OUT, ">", $newfile) || error("open $newfile: $!", $cleanup);
+ if (defined $timestamp) {
+ print OUT $timestamp."\n";
+ }
+ close OUT || error("save $newfile: $!", $cleanup);
}
sub garbage_collect () {
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index d34951570..f0eec9ace 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -22,6 +22,7 @@ sub import {
hook(type => "checkconfig", id => 'comments', call => \&checkconfig);
hook(type => "getsetup", id => 'comments', call => \&getsetup);
hook(type => "preprocess", id => 'comment', call => \&preprocess);
+ hook(type => "preprocess", id => 'commentmoderation', call => \&preprocess_moderation);
# here for backwards compatability with old comments
hook(type => "preprocess", id => '_comment', call => \&preprocess);
hook(type => "sessioncgi", id => 'comment', call => \&sessioncgi);
@@ -251,6 +252,22 @@ sub preprocess {
return $content;
}
+sub preprocess_moderation {
+ my %params = @_;
+
+ $params{desc}=gettext("Comment Moderation")
+ unless defined $params{desc};
+
+ if (length $config{cgiurl}) {
+ return '<a href="'.
+ IkiWiki::cgiurl(do => 'commentmoderation').
+ '">'.$params{desc}.'</a>';
+ }
+ else {
+ return $params{desc};
+ }
+}
+
sub sessioncgi ($$) {
my $cgi=shift;
my $session=shift;
@@ -569,6 +586,7 @@ sub commentmoderation ($$) {
my $added=0;
foreach my $id (keys %vars) {
if ($id =~ /(.*)\._comment(?:_pending)?$/) {
+ $id=decode_utf8($id);
my $action=$cgi->param($id);
next if $action eq 'Defer' && ! $rejectalldefer;
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
index 992c6226b..cb3437e18 100644
--- a/IkiWiki/Plugin/git.pm
+++ b/IkiWiki/Plugin/git.pm
@@ -41,6 +41,7 @@ sub checkconfig () {
push @{$config{wrappers}}, {
wrapper => $config{git_wrapper},
wrappermode => (defined $config{git_wrappermode} ? $config{git_wrappermode} : "06755"),
+ wrapper_background_command => $config{git_wrapper_background_command},
};
}
@@ -78,6 +79,13 @@ sub getsetup () {
safe => 0, # file
rebuild => 0,
},
+ git_wrapper_background_command => {
+ type => "string",
+ example => "git push github",
+ description => "shell command for git_wrapper to run, in the background",
+ safe => 0, # command
+ rebuild => 0,
+ },
git_wrappermode => {
type => "string",
example => '06755',
@@ -509,6 +517,8 @@ sub rcs_commit_staged (@) {
}
if (defined $params{session}->param("nickname")) {
$u=encode_utf8($params{session}->param("nickname"));
+ $u=~s/\s+/_/g;
+ $u=~s/[^-_0-9[:alnum:]]+//g;
}
if (defined $u) {
$ENV{GIT_AUTHOR_EMAIL}="$u\@web";
diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm
index eb1b68124..2375ead89 100644
--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -156,6 +156,13 @@ sub preprocess (@) {
$imgurl="$config{url}/$imglink";
}
+ if (exists $params{class}) {
+ $params{class}.=" img";
+ }
+ else {
+ $params{class}="img";
+ }
+
my $attrs='';
foreach my $attr (qw{alt title class id hspace vspace}) {
if (exists $params{$attr}) {
diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm
index d393afd23..b1a9a7a15 100644
--- a/IkiWiki/Plugin/openid.pm
+++ b/IkiWiki/Plugin/openid.pm
@@ -211,7 +211,6 @@ sub auth ($$) {
}
}
if (defined $nickname) {
- $nickname=~s/\s+/_/g;
$session->param(nickname => $nickname);
}
}
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index 29945da33..cadc13ba1 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -1296,7 +1296,7 @@ sub match_needstranslation ($$;@) {
my $percenttranslated=IkiWiki::Plugin::po::percenttranslated($page);
if ($percenttranslated eq 'N/A') {
- return IkiWiki::FailReason->new("file is not a translation page");
+ return IkiWiki::FailReason->new("file is not a translatable page");
}
elsif ($percenttranslated < 100) {
return IkiWiki::SuccessReason->new("file has $percenttranslated translated");