%args>
$request_type => undef
$details => undef
$recaptcha_challenge_field => undef
$recaptcha_response_field => undef
%args>
<%method title>
Sending A Moderation Request
%method>
<%init>
our($dbh,%session);
use utils;
use Unicode::String;
$r->content_type("text/html; charset=utf-8");
use Captcha::reCAPTCHA;
my $c = Captcha::reCAPTCHA->new;
%init>
% unless(defined($request_type)) {
Writing A Moderation Request
<%perl>
# Check the form results (both of them)
} else {
my $result;
# Verify submission
# Don't bother making logged in users captcha
if( ! defined($session{'userid'}) ) {
$result = $c->check_answer(
# Private key
'6Lf1RwAAAAAAAP6IcWCSHjdtZ5yh1y2muHE7f1Zy', $ENV{'REMOTE_ADDR'},
$recaptcha_challenge_field, $recaptcha_response_field
);
}
if ( $result->{is_valid} || defined($session{'userid'}) ) {
%perl>
Thank you for submitting your request.
<%perl>
my $recipient = $m->base_comp->attr('admin_email');
my $mailtext = "
Request Type: $request_type
Remote IP address: $ENV{'REMOTE_ADDR'}
Details: $details
";
#Now send mail to $recipient
utils::sendemail( [ $recipient ], "jbovlaste Moderation Request",
$mailtext, $session{'username'} );
} else {
%perl>
Captcha failed.
<% $recaptcha_challenge_field %>,
<% $recaptcha_response_field %>
<%perl>
}
}
%perl>