]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Merge branch 'master' into po
authorJoey Hess <joey@gnu.kitenet.net>
Mon, 26 Jan 2009 18:05:38 +0000 (13:05 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Mon, 26 Jan 2009 18:05:38 +0000 (13:05 -0500)
1  2 
IkiWiki.pm
IkiWiki/Plugin/blogspam.pm
IkiWiki/Plugin/editpage.pm
IkiWiki/Plugin/remove.pm

diff --combined IkiWiki.pm
index 08017635fa8e809d07dce783df45f806664d2318,66fea4369b1326903f0bce26ed019a288e12788e..5df1151047ab2720099625224cc9b325ff0c5d72
@@@ -21,7 -21,7 +21,7 @@@ our @EXPORT = qw(hook debug error templ
                   bestlink htmllink readfile writefile pagetype srcfile pagename
                   displaytime will_render gettext urlto targetpage
                 add_underlay pagetitle titlepage linkpage newpagefile
 -               inject
 +               inject warning
                   %config %links %pagestate %wikistate %renderedfiles
                   %pagesources %destsources);
  our $VERSION = 3.00; # plugin interface version, next is ikiwiki version
@@@ -174,7 -174,7 +174,7 @@@ sub getsetup () 
        verbose => {
                type => "boolean",
                example => 1,
-               description => "display verbose messages when building?",
+               description => "display verbose messages?",
                safe => 1,
                rebuild => 0,
        },
@@@ -579,10 -579,6 +579,10 @@@ sub error ($;$) 
        die $message."\n";
  }
  
 +sub warning ($) {
 +      return log_message(warning => @_);
 +}
 +
  sub debug ($) {
        return unless $config{verbose};
        return log_message(debug => @_);
@@@ -1733,7 -1729,7 +1733,7 @@@ sub pagespec_translate ($) 
                                $code.="IkiWiki::PageSpec::match_$1(\$page, ".safequote($2).", \@_)";
                        }
                        else {
-                               $code.=' 0';
+                               $code.="IkiWiki::FailReason->new(".safequote(qq{unknown function in pagespec "$word"}).")";
                        }
                }
                else {
        }
  
        if (! length $code) {
-               $code=0;
+               $code="IkiWiki::FailReason->new('empty pagespec')";
        }
  
        no warnings;
index d4b5b36d51e4417f497c234ced17f56482851091,cbd9859a533cf58dba27e1af20dc04368ab66e5e..58303418f7b4a137d43264879d20b209a13c4e93
@@@ -62,11 -62,11 +62,11 @@@ sub checkcontent (@) 
        }
  
        my $url=$defaulturl;
-       $url = $params{blogspam_server} if exists $params{blogspam_server};
+       $url = $config{blogspam_server} if exists $config{blogspam_server};
        my $client = RPC::XML::Client->new($url);
  
-       my @options = split(",", $params{blogspam_options})
-               if exists $params{blogspam_options};
+       my @options = split(",", $config{blogspam_options})
+               if exists $config{blogspam_options};
  
        # Allow short comments and whitespace-only edits, unless the user
        # has overridden min-words themselves.
        # and "buy".
        push @options, "exclude=stopwords";
  
-       my $res = $client->send_request('testComment', {
+       my %req=(
                ip => $ENV{REMOTE_ADDR},
 -              comment => $params{content},
 +              comment => defined $params{diff} ? $params{diff} : $params{content},
                subject => defined $params{subject} ? $params{subject} : "",
                name => defined $params{author} ? $params{author} : "",
                link => exists $params{url} ? $params{url} : "",
                options => join(",", @options),
                site => $config{url},
                version => "ikiwiki ".$IkiWiki::version,
-       });
+       );
+       my $res = $client->send_request('testComment', \%req);
  
        if (! ref $res || ! defined $res->value) {
                debug("failed to get response from blogspam server ($url)");
                return undef;
        }
        elsif ($res->value =~ /^SPAM:(.*)/) {
+               eval q{use Data::Dumper};
+               debug("blogspam server reports ".$res->value.": ".Dumper(\%req));
                return gettext("Sorry, but that looks like spam to <a href=\"http://blogspam.net/\">blogspam</a>: ").$1;
        }
        elsif ($res->value ne 'OK') {
-               debug(gettext("blogspam server failure: ").$res->value);
+               debug("blogspam server failure: ".$res->value);
                return undef;
        }
        else {
index cfed51afde08fa40461866f9e0f951b167d5b9f2,c206d96a44f521200861271bd2256a03b49ccfa2..480e82804a3beb599df3969d788508dd550bccb6
@@@ -93,7 -93,7 +93,7 @@@ sub check_content (@) 
                foreach my $line (split("\n", $params{content})) {
                        push @diff, $line if ! exists $old{$_};
                }
 -              $params{content}=join("\n", @diff);
 +              $params{diff}=join("\n", @diff);
        }
  
        my $ok;
                                $ok=1;
                        }
                        elsif (ref $ret eq 'CODE') {
-                               $ret->();
+                               $ret->() unless $params{nonfatal};
                                $ok=0;
                        }
                        elsif (defined $ret) {
-                               error($ret);
+                               error($ret) unless $params{nonfatal};
+                               $ok=0;
                        }
                }
  
diff --combined IkiWiki/Plugin/remove.pm
index 2e3614cca7dde3bfcffab25ffefe82591e4eafaa,ee5784f2026db29ac4d48041f6cd355c2356bf1a..f62bfb1d75d55d0f78096567085e9f993a194307
@@@ -54,26 -54,6 +54,26 @@@ sub check_canremove ($$$) 
                        error("renaming of attachments is not allowed");
                }
        }
 +
 +      my $canremove;
 +      IkiWiki::run_hooks(canremove => sub {
 +              return if defined $canremove;
 +              my $ret=shift->($page, $q, $session);
 +              if (defined $ret) {
 +                      if ($ret eq "") {
 +                              $canremove=1;
 +                      }
 +                      elsif (ref $ret eq 'CODE') {
 +                              $ret->();
 +                              $canremove=0;
 +                      }
 +                      elsif (defined $ret) {
 +                              error($ret);
 +                              $canremove=0;
 +                      }
 +              }
 +      });
 +      return $canremove;
  }
  
  sub formbuilder_setup (@) {
@@@ -238,7 -218,7 +238,7 @@@ sub sessioncgi ($$) 
                        }
                }
                else {
-                       IkiWiki::showform($form, $buttons, $session, $q);
+                       removal_confirm($q, $session, 0, $q->param("page"));
                }
  
                exit 0;