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