Skip to content

Commit 63bb6fb

Browse files
committed
More refined lang and fix guest user email check
1 parent 3357bbf commit 63bb6fb

File tree

6 files changed

+59
-83
lines changed

6 files changed

+59
-83
lines changed

.editorconfig

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# This file is for standardising the coding style between different editors
2-
# http://editorconfig.org/
3-
4-
root = true
5-
6-
[*]
7-
end_of_line = lf
8-
indent_size = 4
9-
indent_style = tab
10-
insert_final_newline = true
11-
trim_trailing_whitespace = true
12-
13-
[*.md]
14-
trim_trailing_whitespace = false
15-
16-
[*.yml]
17-
indent_size = 4
1+
# This file is for standardising the coding style between different editors
2+
# http://editorconfig.org/
3+
4+
root = true
5+
6+
[*]
7+
end_of_line = lf
8+
indent_size = 4
9+
indent_style = tab
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
trim_trailing_whitespace = false
15+
16+
[*.yml]
17+
indent_size = 4
1818
indent_style = space

.gitattributes

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,9 @@
1-
.gitattributes export-ignore
2-
.gitignore export-ignore
3-
.travis.yml export-ignore
4-
.editorconfig export-ignore
5-
travis export-ignore
6-
*README.MD export-ignore
7-
8-
# Auto detect text files and perform LF normalization
9-
* text=false
10-
11-
# Custom for Visual Studio
12-
*.cs diff=csharp
13-
*.sln merge=union
14-
*.csproj merge=union
15-
*.vbproj merge=union
16-
*.fsproj merge=union
17-
*.dbproj merge=union
18-
19-
# Standard to msysgit
20-
*.doc diff=astextplain
21-
*.DOC diff=astextplain
22-
*.docx diff=astextplain
23-
*.DOCX diff=astextplain
24-
*.dot diff=astextplain
25-
*.DOT diff=astextplain
26-
*.pdf diff=astextplain
27-
*.PDF diff=astextplain
28-
*.rtf diff=astextplain
29-
*.RTF diff=astextplain
1+
tests/ export-ignore
2+
.github/ export-ignore
3+
.gitignore export-ignore
4+
.gitattributes export-ignore
5+
phpunit.xml.* export-ignore
6+
build.xml export-ignore
7+
composer.lock export-ignore
8+
README.md export-ignore
9+
.editorconfig export-ignore

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"type": "phpbb-extension",
44
"description": "Queries the stop forum spam database on registration and posting. Extension settings are found under the extension tab of the forum. This extension requires at least phpBB version 3.3.",
55
"homepage": "https://github.com/rmcgirr83/stopforumspam",
6-
"version": "1.4.7",
7-
"time": "2024-02-28",
6+
"version": "1.4.8",
7+
"time": "2025-04-27",
88
"license": "GPL-2.0-only",
99
"authors": [
1010
{

controller/admin_controller.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ protected function build_adminsmods()
367367

368368
$json_response = new json_response;
369369
$json_response->send($data);
370-
371370
}
372371

373372
/**

event/main_listener.php

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ private function stopforumspam_check($username, $ip, $email)
557557
{
558558
if ($sfs_log_message)
559559
{
560-
$this->log_message('user', $username, $ip, 'LOG_SFS_MESSAGE', $email, $username_freq, $ip_freq, $email_freq);
560+
$this->log_message($username, $ip, 'LOG_SFS_MESSAGE', $email, $username_freq, $ip_freq, $email_freq);
561561
}
562562
//user is a spammer
563563
return $spam_score;
@@ -573,11 +573,11 @@ private function stopforumspam_check($username, $ip, $email)
573573
{
574574
if ($this->config['sfs_down'])
575575
{
576-
$this->log_message('admin', $username, $ip, 'LOG_SFS_DOWN_USER_ALLOWED', $email);
576+
$this->log->add('admin', $username, $ip, 'LOG_SFS_DOWN_USER_ALLOWED', $email);
577577
}
578578
else
579579
{
580-
$this->log_message('admin', $username, $ip, 'LOG_SFS_DOWN', $email);
580+
$this->log->add('admin', $username, $ip, 'LOG_SFS_DOWN', $email);
581581
}
582582
}
583583
return 'sfs_down';
@@ -586,59 +586,58 @@ private function stopforumspam_check($username, $ip, $email)
586586

587587
/*
588588
* log_message function used in this class to inject messages into the logs
589-
* @param string $mode the mode that we are doing for the log either admin or user
590589
* @param string $username the users name
591590
* @param string $ip the users ip
592591
* @param string $message the message we are injecting
593592
* @param string $email email from the forum inputs
594593
* @return void
595594
* @access private
596595
*/
597-
private function log_message($mode, $username, $ip, $message, $email, $username_score = 0, $ip_score = 0, $email_score = 0)
596+
private function log_message($username, $ip, $message, $email, $username_score = 0, $ip_score = 0, $email_score = 0)
598597
{
599598

600599
$sfs_ip = $this->language->lang('SFS_IP_STOPPED', $ip);
601600
$sfs_username = $this->language->lang('SFS_USERNAME_STOPPED', $username);
602601
$sfs_email = $this->language->lang('SFS_EMAIL_STOPPED', $email);
603602

604-
if ($mode === 'admin')
603+
if ($this->config['sfs_by_name'] == false)
605604
{
606-
$this->log->add('admin', $this->user->data['user_id'], $ip, $message, false, [$sfs_username, $sfs_ip, $sfs_email]);
605+
$username_score = $this->language->lang('SFS_NOT_CHECKED');
607606
}
608607
else
609608
{
610-
if ($this->config['sfs_by_name'] == false)
611-
{
612-
$username_score = $this->language->lang('SFS_NOT_CHECKED');
613-
}
614-
else
615-
{
616-
$username_score = $this->language->lang('SFS_FREQUENCY', $username_score);
617-
}
609+
$username_score = $this->language->lang('SFS_FREQUENCY', $username_score);
610+
}
618611

619-
if ($this->config['sfs_by_email'] == false)
612+
if ($this->config['sfs_by_email'] == false)
613+
{
614+
$email_score = $this->language->lang('SFS_NOT_CHECKED');
615+
}
616+
else
617+
{
618+
if ($email_score == (int) 255)
620619
{
621-
$email_score = $this->language->lang('SFS_NOT_CHECKED');
620+
$email_score = $this->language->lang('SFS_MARKED_TOXIC');
622621
}
623622
else
624623
{
625624
$email_score = $this->language->lang('SFS_FREQUENCY', $email_score);
626625
}
626+
}
627627

628-
if ($this->config['sfs_by_ip'] == false)
629-
{
630-
$ip_score = $this->language->lang('SFS_NOT_CHECKED');
631-
}
632-
else
633-
{
634-
$ip_score = $this->language->lang('SFS_FREQUENCY', $ip_score);
635-
}
636-
$sfs_ip .= $ip_score;
637-
$sfs_username .= $username_score;
638-
$sfs_email .= $email_score;
639-
640-
$this->log->add('user', $this->user->data['user_id'], $ip, $message, false, ['reportee_id' => $this->user->data['user_id'], $sfs_username, $sfs_ip, $sfs_email]);
628+
if ($this->config['sfs_by_ip'] == false)
629+
{
630+
$ip_score = $this->language->lang('SFS_NOT_CHECKED');
631+
}
632+
else
633+
{
634+
$ip_score = $this->language->lang('SFS_FREQUENCY', $ip_score);
641635
}
636+
$sfs_ip .= $ip_score;
637+
$sfs_username .= $username_score;
638+
$sfs_email .= $email_score;
639+
640+
$this->log->add('user', $this->user->data['user_id'], $ip, $message, false, ['reportee_id' => $this->user->data['user_id'], $sfs_username, $sfs_ip, $sfs_email]);
642641
}
643642

644643
/*
@@ -649,7 +648,7 @@ private function log_message($mode, $username, $ip, $message, $email, $username_
649648
*/
650649
private function validate_email($email)
651650
{
652-
$error = phpbb_validate_email($email);
651+
$error = validate_user_email($email);
653652

654653
return $error;
655654
}

language/en/stopforumspam.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@
4646
'PM_NOT_EXIST' => 'PM doesn’t exist',
4747
'SFS_ANONYMIZED_IP' => 'The IP of the user has been anonymized, set to 127.0.0.1, probably due to an extension.',
4848
'SFS_MISSING_DATA' => 'Not all information is provided to report to Stop Forum Spam.',
49-
'SFS_IP_STOPPED' => '<a target="_blank" title="Check IP at StopForumSpam.com (opens in a new window)" href="http://www.stopforumspam.com/ipcheck/%1$s" rel="noreferrer noopener">%1$s</a>',
50-
'SFS_USERNAME_STOPPED' => '<a target="_blank" title="Check Username at StopForumSpam.com (opens in a new window)" href="http://www.stopforumspam.com/search/?q=%1$s" rel="noreferrer noopener">%1$s</a>',
51-
'SFS_EMAIL_STOPPED' => '<a target="_blank" title="Check Email at StopForumSpam.com (opens in a new window)" href="http://www.stopforumspam.com/search/?q=%1$s" rel="noreferrer noopener">%1$s</a>',
5249
'SFS_FREQUENCY' => ' » found in sfs database %d times',
5350
'SFS_IP_STOPPED' => '<a target="_blank" title="Check IP at StopForumSpam.com (opens in a new window)" href="http://www.stopforumspam.com/ipcheck/%1$s" rel="noreferrer noopener">%1$s</a>',
5451
'SFS_USERNAME_STOPPED' => '<a target="_blank" title="Check Username at StopForumSpam.com (opens in a new window)" href="http://www.stopforumspam.com/search/?q=%1$s" rel="noreferrer noopener">%1$s</a>',
@@ -58,6 +55,7 @@
5855
1 => 'Found in the Stop Forum Spam database once',
5956
2 => 'Found in the Stop Forum Spam database %d times',
6057
],
58+
'SFS_MARKED_TOXIC' => ' » Email domain marked as TOXIC',
6159
'SFS_USER_BANNED' => 'Banned due to a post on the forum',
6260
'SFS_REPORTED' => 'Post has already been reported',
6361
'SFS_PM_REPORTED' => 'PM has already been reported',

0 commit comments

Comments
 (0)