-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmoderation.html
116 lines (93 loc) · 2.32 KB
/
moderation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<%args>
$request_type => undef
$details => 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;
my $recaptcha_response = $ARGS{'g-recaptcha-response'};
</%init>
% unless(defined($request_type)) {
<font size="+3">
Writing A Moderation Request
</font>
<hr />
<form method="post" action="moderation.html">
<%perl>
# Don't bother making logged in users captcha
if( ! defined($session{'userid'}) ) {
# reCaptcha Output form
# Public key
print $c->get_html_v2( '6Lf1RwAAAAAAANZIsJS0Ra-ycdARlCNMTzOkkC-v' );
}
</%perl>
<table>
<tr>
<td>Request Type</td>
<td>
<select name="request_type">
<option value="New Account Request">New Account Request
<option value="valsi Change">valsi Change
<option value="valsi Deletion">valsi Deletion
<option value="Natlang Word Change">Natlang Word Change
<option value="Natlang Word Deletion">Natlang Word Deletion
<option value="Definition Change">Definition Change
<option value="Definition Deletion">Definition Deletion
<option value="Other">Other
</select>
</td>
</tr>
<tr>
<td>Details</td>
<td>
<textarea rows="4" cols="60" name="details"></textarea>
</td>
</tr>
<tr>
<td><input type="submit"></td>
</tr>
</table>
</form>
<%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_v2(
# Private key
'6Lf1RwAAAAAAAP6IcWCSHjdtZ5yh1y2muHE7f1Zy', $recaptcha_response, $ENV{'REMOTE_ADDR'}
);
}
if ( $result->{is_valid} || defined($session{'userid'}) ) {
</%perl>
<font size="+3">
Thank you for submitting your request.
</font>
<%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>
<font size="+3">
Captcha failed. <pre><% Dumper($result) %>, <% $recaptcha_response %></pre>
</font>
<%perl>
}
}
</%perl>