-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.php
164 lines (134 loc) · 5.99 KB
/
settings.php
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
if (!defined("PHORUM_ADMIN")) return;
require_once("./mods/stopforumspam/defaults.php");
// Save settings.
if (count($_POST))
{
$PHORUM["mod_stopforumspam"] = array
(
// Whether or not to enable event logging.
'log_events' => isset($_POST['log_events']) ? 1 : 0,
'block_action' => $_POST['block_action'],
'check_ip' => (!empty($_POST['check_ip']))?1:0,
'check_username' => (!empty($_POST['check_username']))?1:0,
'check_email' => (!empty($_POST['check_email']))?1:0,
'force_generic' => (!empty($_POST['force_generic']))?1:0,
'freq_min' => (!empty($_POST['freq_min'])) ? (int)($_POST['freq_min']) : 1,
'apikey' => $_POST['apikey'],
);
if($PHORUM["mod_stopforumspam"]["freq_min"] < 1)
$PHORUM["mod_stopforumspam"]["freq_min"] = 1;
phorum_db_update_settings(array(
"mod_stopforumspam" => $PHORUM["mod_stopforumspam"]
));
phorum_admin_okmsg('The settings were successfully saved');
}
?>
<div style="font-size: xx-large; font-weight: bold">Stopforumspam Module</div>
<div style="padding-bottom: 15px; font-size: large">
Use data from <a href="http://stopforumspam.com">stopforumspam.com</a> to decide if a new user is a suspected spammer!
</div>
<br style="clear:both" />
<?php
include_once "./include/admin/PhorumInputForm.php";
$frm = new PhorumInputForm ("", "post", "Save");
$frm->hidden("module", "modsettings");
$frm->hidden("mod", "stopforumspam");
// ----------------------------------------------------------------------
// Configure general settings
// ----------------------------------------------------------------------
$frm->addrow(
'API Key<small> (Get it from <a href="http://www.stopforumspam.com/#">http://www.stopforumspam.com/#</a>)</small>',
$frm->text_box('apikey',$PHORUM["mod_stopforumspam"]['apikey'])
);
$row = $frm->addrow("Minimum Frequency Score:", $frm->text_box("freq_min", $PHORUM["mod_stopforumspam"]["freq_min"]));
$frm->addhelp(
$row, "Spam score threshold",
"If the total number of times the checked fields appear in the
stopforumspam database exceeds this number, the registration
will be considered spammy. Adjust according to your checks
and watch the event log for fale positives.<br/>
<br/>
Set to 1 for maximum protection."
);
// ----------------------------------------------------------------------
// Configure log settings
// ----------------------------------------------------------------------
$frm->addbreak("Log settings");
if (!file_exists('./mods/event_logging')) {
$check = '<span style="color:red">The Event Logging module ' .
'is currently not installed; logging cannot ' .
'be enabled</span>';
$disabled = 'disabled="disabled"';
$PHORUM["mod_stopforumspam"]["log_events"] = 0;
} elseif (empty($PHORUM['mods']['event_logging'])) {
$check = '<span style="color:red">The Event Logging module ' .
'is currently not activated; logging cannot ' .
'be enabled</span>';
$disabled = 'disabled="disabled"';
$PHORUM["mod_stopforumspam"]["log_events"] = 0;
} else {
$check = '<span style="color:darkgreen">The Event Logging module ' .
'is activated; events can be logged by enabling the ' .
'feature below</span>';
$disabled = '';
}
$frm->addrow($check, '');
$row = $frm->addrow(
'Log blocked form posts to the Event Logging module?',
$frm->checkbox(
"log_events", 1, "Yes",
$PHORUM["mod_stopforumspam"]["log_events"],
$disabled
)
);
$url = phorum_admin_build_url(array(
'module=modsettings',
'mod=event_logging',
'el_action=logviewer'
));
$frm->addhelp(
$row, "Log blocked form posts to the Event Logging module?",
"When both this feature and the Event Logging module are enabled,
then the Stopforumspam module will log information about blocked
registrations to the Phorum Event Log. To view this log, go to
<a href=\"$url\">the Event Log viewer</a>"
);
// ----------------------------------------------------------------------
// Configure spam hurdles for posting messages
// ----------------------------------------------------------------------
$frm->addbreak("Action done");
$row = $frm->addrow(
'What action has to be taken when a spammy registration is suspected?',
$frm->select_tag(
'block_action',
array(
'blockerror' => 'Fully block and show an error',
'unapprove' => 'Accept, but make unapproved'
),
$PHORUM['mod_stopforumspam']['block_action']
)
);
$frm->addhelp(
$row, "Action when a spam message is suspected",
"You can choose whether you want to fully block suspected spammy registrations
or that you want to have them saved in a moderated state, so they
will need approval by a moderator.<br/>
<br/>
A message is suspicious if it one of the selected checks fails."
);
$row = $frm->addrow('Return Generic Error',$frm->checkbox('force_generic',1,'Yes',$PHORUM['mod_stopforumspam']['force_generic']));
$frm->addhelp(
$row, "Message type shown to blocked user",
"Enabling this option will return a generic error message to the suspected spammer
that does not contain any hints as to the source or reason for the block."
);
// ----------------------------------------------------------------------
// Configure spam hurdles for user registration
// ----------------------------------------------------------------------
$frm->addbreak("Checks done");
$frm->addrow('Check IP address',$frm->checkbox('check_ip',1,'Yes',$PHORUM['mod_stopforumspam']['check_ip']));
$frm->addrow('Check Username',$frm->checkbox('check_username',1,'Yes',$PHORUM['mod_stopforumspam']['check_username']));
$frm->addrow('Check Email address',$frm->checkbox('check_email',1,'Yes',$PHORUM['mod_stopforumspam']['check_email']));
$frm->show();
#print "<pre>"; print_r($PHORUM['mod_stopforumspam']); print "</pre>";