root/branches/release-41/lib/MT/Blocklist.pm @ 2747

Revision 2747, 1.4 kB (checked in by bchoate, 17 months ago)

Updated POD.

  • Property svn:keywords set to Author Date Id Revision
Line 
1# Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd.
2# This program is distributed under the terms of the
3# GNU General Public License, version 2.
4#
5# $Id$
6
7package MT::Blocklist;
8use strict;
9
10use MT::Object;
11@MT::Blocklist::ISA = qw( MT::Object );
12__PACKAGE__->install_properties({
13    columns => [
14       'id', 'blog_id', 'text', 'action'
15    ],
16    indexes => {
17        blog_id => 1,
18        text => 1,
19    },
20    audit => 1,
21    datasource => 'blocklist',
22    primary_key => 'id',
23});
24
25# valid 'action' values:
26#  * discard
27#  * moderate
28#  * nothing
29
30sub block_these {
31    my $class = shift;
32    my ($blog_id, $action, @urls) = @_;
33    foreach my $url (@urls) {
34        next if $class->exist({blog_id => $blog_id, text => $url});
35        my $this = $class->new();
36        $this->set_values({blog_id => $blog_id, text => $url,
37                           action => $action});
38        $this->save() or return $class->error($this->errstr());
39    }
40    1;
41}
42
431;
44
45__END__
46
47=head1 NAME
48
49MT::Blocklist - MT object class for storing rules for filtering content.
50
51=head1 METHODS
52
53=head2 MT::Blocklist->block_these($blog_id, $action, @urls)
54
55Adds the specified URLs to the blocklist table with the specified I<$action>
56and for the specified I<$blog_id>.
57
58=head1 LICENSE
59
60The license that applies is the one you agreed to when downloading
61Movable Type.
62
63=head1 AUTHOR & COPYRIGHT
64
65Except where otherwise noted, MT is Copyright 2001-2008 Six Apart.
66All rights reserved.
67
68=cut
Note: See TracBrowser for help on using the browser.