1: | <?php
|
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: |
|
14: | class Protector_postcommon_register_stopforumspam extends ProtectorFilterAbstract
|
15: | {
|
16: | |
17: | |
18: | |
19: |
|
20: | protected $minimumConfidence = 65.0;
|
21: |
|
22: | |
23: | |
24: |
|
25: | public function execute()
|
26: | {
|
27: |
|
28: | if ($_SERVER['REQUEST_METHOD'] !== 'POST'
|
29: | || !isset($_POST['email'])
|
30: | || !isset($_POST['uname'])
|
31: | ) {
|
32: | return true;
|
33: | }
|
34: |
|
35: | $report = array();
|
36: | $report['email'] = isset($_POST['email']) ? $_POST['email'] : null;
|
37: | $report['ip'] = $_SERVER['REMOTE_ADDR'];
|
38: | $report['uname'] = isset($_POST['uname']) ? $_POST['uname'] : null;
|
39: | $result = $this->protector->stopForumSpamLookup($report['email'], $report['ip'], $report['uname']);
|
40: | if (false === $result || isset($result['http_code'])) {
|
41: |
|
42: | $report['result'] = $result;
|
43: | $this->protector->message = json_encode($report);
|
44: | $this->protector->output_log('SFS-UNKNOWN');
|
45: | return true;
|
46: | }
|
47: | foreach ($result as $entry) {
|
48: | if (isset($entry['confidence']) && ((float) $entry['confidence'] > $this->minimumConfidence)) {
|
49: | $report['result'] = $result;
|
50: | $this->protector->message = json_encode($report);
|
51: | $this->protector->output_log('SFS SPAM Registration');
|
52: |
|
53: | echo 'This registration attempt has been denied. '
|
54: | . 'If you feel this is in error, please contact the site administrator.';
|
55: | exit;
|
56: | }
|
57: | }
|
58: | }
|
59: | }
|
60: | |