Changeset 85

Show
Ignore:
Timestamp:
04/11/05 11:36:46
Author:
brad
Message:

Added default check to make sure entry/category is still accepting pings.
Fixed bug where moderated TrackBack is lost.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plugins/spamlookup/spamlookup.pl

    r68 r85  
    223223 
    224224    my @tests; 
     225    push @tests, [\&validping_check, 'ALlowed ping check'] 
     226        if ($data->{__type} ne 'ping') && ($method ne 'Despam') && ($method ne 'Test'); 
    225227    push @tests, [\&commentpass_check, 'Comment Passphrase'] 
    226228        if $data->{commentpass_enabled} && ($data->{__type} eq 'comment') 
     
    283285                # MT-Moderate: 
    284286                $obj->created_by(1); 
     287                $obj->save;  # save this now since we're returning 0 
    285288            } else { 
    286289                # trackbacks can't be moderated right now... 
     
    337340## to ignore, allowing the next test to run. 
    338341 
     342sub validping_check { 
     343    my ($eh, $app, $obj, $data) = @_; 
     344 
     345    require MT::Trackback; 
     346    my $tb = MT::Trackback->load( $obj->tb_id ); 
     347    if (!$tb) { 
     348        # this is merely a redundant assertion since MT does this 
     349        # check for us. 
     350        return BLOCK; 
     351    } 
     352 
     353    if ($tb->entry_id) { 
     354        my $entry = MT::Entry->load($tb->entry_id); 
     355        if ($entry && !$entry->allow_pings) { 
     356            $eh->error("Blocking ".$data->{__type}." on blog id ".$obj->blog_id." for entry id ".$tb->entry_id." since it no longer allows pings."); 
     357            return BLOCK; 
     358        } 
     359    } elsif ($tb->category_id) { 
     360        my $cat = MT::Category->load($tb->category_id); 
     361        if ($cat && !$cat->allow_pings) { 
     362            $eh->error("Blocking ".$data->{__type}." on blog id ".$obj->blog_id." for category id ".$tb->category_id." since it no longer allows pings."); 
     363            return BLOCK; 
     364        } 
     365    } 
     366    IGNORE; 
     367} 
     368 
    339369sub wordlist_check { 
    340370    my ($eh, $app, $obj, $data) = @_;