Changeset 1117
- Timestamp:
- 08/03/07 20:16:51 (16 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 modified
-
Build.PL (modified) (2 diffs)
-
Changes (modified) (1 diff)
-
MANIFEST (modified) (2 diffs)
-
lib/OpenGuides.pm (modified) (2 diffs)
-
lib/OpenGuides/Config.pm (modified) (5 diffs)
-
t/79_host_blacklist.t (added)
-
templates/blacklisted_host.tt (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Build.PL
r1093 r1117 106 106 licence_name licence_url licence_info_url moderation_requires_password 107 107 enable_node_image enable_common_categories enable_common_locales 108 spam_detector_module static_path static_url send_moderation_notifications 108 spam_detector_module host_checker_module static_path static_url 109 send_moderation_notifications 109 110 ) ) { 110 111 my $q_method = $var . "__qu"; … … 333 334 "backlink_results.tt", 334 335 "banner.tt", 336 "blacklisted_host.tt", 335 337 "delete_confirm.tt", 336 338 "delete_done.tt", -
trunk/Changes
r1116 r1117 2 2 3 3 More detailed changelogs can be found at 4 http://dev.openguides.org/log/trunk 4 <http://dev.openguides.org/log/trunk>. 5 5 6 6 0.62 7 7 Ensure that all modules we ship are versioned. 8 Added experimental support for local IP blacklisting modules; see the 9 display_node method in "perldoc OpenGuides" for details. 8 10 9 11 0.61 4 July 2007 -
trunk/MANIFEST
r1096 r1117 31 31 templates/backlink_results.tt 32 32 templates/banner.tt 33 templates/blacklisted_host.tt 33 34 templates/delete_confirm.tt 34 35 templates/delete_done.tt … … 143 144 t/77_send_email.t 144 145 t/78_about.t 146 t/79_host_blacklist.t 145 147 t/templates/15_test.tt 146 148 wiki.cgi -
trunk/lib/OpenGuides.pm
r1105 r1117 177 177 parameter was passed.) 178 178 179 If you have specified the C<host_checker_module> option in your 180 C<wiki.conf>, this method will attempt to call the <blacklisted_host> 181 method of that module to determine whether the host requesting the node 182 has been blacklisted. If this method returns true, then the 183 C<blacklisted_host.tt> template will be used to display an error message. 184 185 The C<blacklisted_host> method will be passed a scalar containing the host's 186 IP address. 187 179 188 =cut 180 189 … … 191 200 192 201 my %tt_vars; 202 203 # If we can, check to see if requesting host is blacklisted. 204 my $host_checker = $config->host_checker_module; 205 my $is_blacklisted; 206 if ( $host_checker ) { 207 eval { 208 eval "require $host_checker"; 209 $is_blacklisted = $host_checker->blacklisted_host(CGI->new->remote_host); 210 }; 211 } 212 213 if ( $is_blacklisted ) { 214 my $output = OpenGuides::Template->output( 215 wiki => $self->wiki, 216 config => $config, 217 template => "blacklisted_host.tt", 218 vars => { 219 not_editable => 1, 220 }, 221 ); 222 return $output if $return_output; 223 print $output; 224 return; 225 } 193 226 194 227 $tt_vars{home_name} = $self->config->home_name; -
trunk/lib/OpenGuides/Config.pm
r1116 r1117 4 4 5 5 use vars qw( $VERSION ); 6 $VERSION = '0.0 1';6 $VERSION = '0.02'; 7 7 8 8 use Carp qw( croak ); … … 25 25 licence_name licence_url licence_info_url moderation_requires_password 26 26 enable_node_image enable_common_categories enable_common_locales 27 spam_detector_module static_path static_url send_moderation_notifications 27 spam_detector_module host_checker_module static_path static_url 28 send_moderation_notifications 28 29 ); 29 30 my @questions = map { $_ . "__qu" } @variables; … … 112 113 licence_info_url => "", 113 114 spam_detector_module => "", 115 host_checker_module => "", 114 116 static_path => "/usr/local/share/openguides/static", 115 117 send_moderation_notifications => 1 … … 195 197 licence_info_url => "What is the URL to your local page about your licensing policy?", 196 198 spam_detector_module => "What module would you like to use for spam detection? (optional)", 199 host_checker_module => "What module would you like to use to run an IP blacklist? (optional)", 197 200 static_path => "What directory should we install static content (CSS, images, javascript) to?", 198 201 static_url => "What is the URL corresponding to the static content?", … … 324 327 =item * spam_detector_module 325 328 329 =item * host_checker_module 330 326 331 =item * static_path 327 332
