]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/blogspam.pm
ikiwiki behind a nginx proxy
[git.ikiwiki.info.git] / IkiWiki / Plugin / blogspam.pm
index f0b6cb2a2742519a2796bce8a863500f34d0d5f0..d32c2f169d643a7db9e9fffc292201a4bf93276e 100644 (file)
@@ -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};