2 # Hooks to allow posting to Changelog.
5 # Mark Smith <mark@dreamwidth.org>
7 # Copyright (c) 2009 by Dreamwidth Studios, LLC.
9 # This program is free software; you may redistribute it and/or modify it under
10 # the same terms as Perl itself. For a copy of the license, please reference
11 # 'perldoc perlartistic' or 'perldoc perlgpl'.
14 package DW::Hooks::Changelog;;
19 LJ::Hooks::register_hook( 'post_noauth', sub {
23 return 0 unless $LJ::CHANGELOG{enabled};
25 # the user must be posting TO the changelog journal and the
26 # username must be in the allow list
27 return 0 unless $req->{usejournal} eq $LJ::CHANGELOG{community};
28 return 0 unless grep { $_ eq $req->{username} } @{ $LJ::CHANGELOG{allowed_posters} || [] };
30 # we also enforce that the IP the request is coming from be one of
31 # some small list of IPs
32 my $ip = BML::get_remote_ip();
33 return 0 unless grep { $_ eq $ip } @{ $LJ::CHANGELOG{allowed_ips} || [] };