Advertisement:

Author Topic: Stop Spammer  (Read 811687 times)

Online Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 59,304
  • Gender: Male
    • Kindred-999 on GitHub
Re: Stop Spammer
« Reply #2080 on: December 06, 2019, 03:57:57 PM »
changing the files will not have any effect on the data (which is in the database)

Additionally, always take a backup (of files AND database) before klutzing around. :)
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Nodaz

  • Full Member
  • ***
  • Posts: 456
Re: Stop Spammer
« Reply #2081 on: December 08, 2019, 09:08:59 PM »
changing the files will not have any effect on the data (which is in the database)

Additionally, always take a backup (of files AND database) before klutzing around. :)
Back up in progress, thanks for the patience and advice advice .

Offline KittyGalore

  • Charter Member
  • Semi-Newbie
  • *
  • Posts: 58
    • Big Brother TV Backup
Re: Stop Spammer
« Reply #2082 on: January 18, 2020, 06:47:59 AM »
This mod is fantastic but upon installation it gives errors. Can it be updated. I currently use it on my forum but not sure at the time when it gave errors did i install it or do something but on a test forum new install of smf no mods this gives one error in the mangemembers.php file.
SMF Curve 2.0x

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,495
  • Gender: Male
    • i30 Owners Club
Re: Stop Spammer
« Reply #2083 on: January 18, 2020, 07:34:19 AM »
Quote from: KittyGalore
This mod is fantastic but upon installation it gives errors.
Installation into which version of SMF ?

What, exactly, are the errors you're seeing?

Offline KittyGalore

  • Charter Member
  • Semi-Newbie
  • *
  • Posts: 58
    • Big Brother TV Backup
Re: Stop Spammer
« Reply #2084 on: January 18, 2020, 08:58:39 AM »
Quote from: KittyGalore
This mod is fantastic but upon installation it gives errors.
Installation into which version of SMF ?

What, exactly, are the errors you're seeing?
Sorry i thought i had included the version SMF 2.0.17
This is the code it's trying to replace in the Source ManageMembers.php

Code: (Find) [Select]
Code: [Select]
if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST))
Code: (Replace) [Select]
Code: [Select]
if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && (empty($_POST) || ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['delete']))))
This is the only code i could find from a fresh copy of the file that matches some parts of it.

Code: [Select]
if ($context['sub_action'] == 'query' && empty($_POST))
{
if (!empty($_REQUEST['params']))
{
$_POST += safe_unserialize(base64_decode($_REQUEST['params']));
}
elseif ($context['browser']['is_ie'] && !empty($_SESSION['params']))
{
$_POST += $_SESSION['params'];
unset($_SESSION['params']);
}
}
SMF Curve 2.0x

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,495
  • Gender: Male
    • i30 Owners Club
Re: Stop Spammer
« Reply #2085 on: January 18, 2020, 01:24:33 PM »
This is covered already in this very thread.

Eg:  https://www.simplemachines.org/community/index.php?topic=283309.msg3957547#msg3957547


... and in several other places, also in this very thread.

Offline KittyGalore

  • Charter Member
  • Semi-Newbie
  • *
  • Posts: 58
    • Big Brother TV Backup
Re: Stop Spammer
« Reply #2086 on: January 18, 2020, 02:56:39 PM »
This is covered already in this very thread.

Eg:  https://www.simplemachines.org/community/index.php?topic=283309.msg3957547#msg3957547


... and in several other places, also in this very thread.
Thank you i see the codes now i will edit them in. :)
SMF Curve 2.0x

Offline smartmouse

  • Full Member
  • ***
  • Posts: 594
Re: Stop Spammer
« Reply #2087 on: March 03, 2020, 05:10:17 AM »
Hello, since SMF 2.1 is in RC2... do you plan to update this mod to make it working with 2.1?
I tried to install the mod, but I had a lot of errors... so I did not install it.

Offline Scooter Trash

  • Semi-Newbie
  • *
  • Posts: 34
Re: Stop Spammer
« Reply #2088 on: March 21, 2020, 09:58:22 AM »
Quote
Hello, since SMF 2.1 is in RC2... do you plan to update this mod to make it working with 2.1?
I tried to install the mod, but I had a lot of errors... so I did not install it.


Same here. Tried to install on ver. 2.0.17 but got warning so abandoned installation. Unfortunate.

Offline SugarD-x

  • Jr. Member
  • **
  • Posts: 381
  • Gender: Male
  • SMF and PHPBB Fan
    • SugarDx on Facebook
    • SugarD-x on GitHub
    • sugardx on LinkedIn
    • @SugarDx on Twitter
    • Clan Xperience
Re: Stop Spammer
« Reply #2089 on: March 21, 2020, 10:24:52 PM »
Quote
Hello, since SMF 2.1 is in RC2... do you plan to update this mod to make it working with 2.1?
I tried to install the mod, but I had a lot of errors... so I did not install it.


Same here. Tried to install on ver. 2.0.17 but got warning so abandoned installation. Unfortunate.
What errors did you get? It should be working fine on 2.0.x.

Offline Scooter Trash

  • Semi-Newbie
  • *
  • Posts: 34
Re: Stop Spammer
« Reply #2090 on: March 22, 2020, 12:24:46 AM »
Quote
Hello, since SMF 2.1 is in RC2... do you plan to update this mod to make it working with 2.1?
I tried to install the mod, but I had a lot of errors... so I did not install it.


Same here. Tried to install on ver. 2.0.17 but got warning so abandoned installation. Unfortunate.
What errors did you get? It should be working fine on 2.0.x.


Execute Modification   ./Sources/ManageMembers.php    Test failed

Replace    ./Sources/ManageMembers.php    Test failed

Offline wylekk

  • Semi-Newbie
  • *
  • Posts: 45
  • Gender: Male
    • WYLEK.RU
Re: Stop Spammer
« Reply #2091 on: March 22, 2020, 02:14:37 AM »
Beautiful toy, all IP blocking manually in .htaccess, and this mod only finds registered users . Who wants to test the mod on SMF 2.1 RC2 here is an adapted file install_21.xml

Code: [Select]
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>M-DVD:StopSpammer</id>
<name>Stop Spammer</name>
<version>2.3.9</version>

<file name="$sourcedir/ManageRegistration.php">
<operation>
<search position="before"><![CDATA[
require_once($sourcedir . '/ManageServer.php');
]]></search>
<add><![CDATA[
// Test if mod StopSpammer is OK
require_once($sourcedir . '/StopSpammer.php');
$txt['stopspammer_ok'] = stopspammer_test_mod_ok();
$stopspammer_faildb_sub = $txt['stopspammer_faildb_sub'];
]]></add>
</operation>

<operation>
<search position="before"><![CDATA[array('text', 'coppaPhone'),]]></search>
<add><![CDATA[
// Stop Spammer
array('title', 'stopspammer_settings'),
$txt['stopspammer_ok'],
'',
array('check', 'stopspammer_enable', 'subtext' => $txt['stopspammer_enable_sub']),
array('desc', 'stopspammer_check_sub1'),
array('check', 'stopspammer_check_name'),
array('check', 'stopspammer_check_mail'),
array('check', 'stopspammer_check_ip'),
array('desc', 'stopspammer_check_sub2'),
array('select', 'stopspammer_faildb', array($txt['stopspammer_fail01'], $txt['stopspammer_fail02'], $txt['stopspammer_fail03']), 'subtext' => $stopspammer_faildb_sub),
array('check', 'stopspammer_show01', 'subtext' => $txt['stopspammer_show01_sub']),
array('text', 'stopspammer_api_key'),
array('desc', 'stopspammer_api_key_sub'),]]></add>
</operation>
</file>

<file name="$sourcedir/ManageMembers.php">
<!--- Load our functions at the beginning of ViewMembers() for every sa we need --->
<operation>
<search position="before"><![CDATA['query' => array('ViewMemberlist', 'moderate_forum'),
);]]></search>
<add><![CDATA[$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'all';
// Load Stop Spammer Functions
if ('all' == $_REQUEST['sa'] || 'browse' == $_REQUEST['sa'] || 'query' == $_REQUEST['sa'] || 'approve' == $_REQUEST['sa'])
{
global $sourcedir;
require_once($sourcedir . '/StopSpammer.php');
}]]></add>
</operation>

<!--- First List - List All Member - BEGIN --->
<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'member_name' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=profile;u=\' . $rowData[\'id_member\'];
return sprintfspamer($rowData, $url, \'member_name\', 2);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'real_name' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=profile;u=\' . $rowData[\'id_member\'];
return sprintfspamer($rowData, $url, \'real_name\', 0);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="mailto:%1$s">%1$s</a>',
'params' => array(
'email_address' => true,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = \'mailto:\' . $rowData[\'email_address\'];
return sprintfspamer($rowData, $url, \'email_address\', 3);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=trackip;searchip=%1$s">%1$s</a>',
'params' => array(
'member_ip' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=trackip;searchip=\' . $rowData[\'member_ip\'];
return sprintfspamer($rowData, $url, \'member_ip\', 1);
'),]]></add>
</operation>
<!--- First List - List All Member - END --->

<!--- Second List - List Member Waiting Aproval - BEGIN --->
<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'member_name' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=profile;u=\' . $rowData[\'id_member\'];
return sprintfspamer($rowData, $url, \'member_name\', 2);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="mailto:%1$s">%1$s</a>',
'params' => array(
'email_address' => true,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = \'mailto:\' . $rowData[\'email_address\'];
return sprintfspamer($rowData, $url, \'email_address\', 3);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=trackip;searchip=%1$s">%1$s</a>',
'params' => array(
'member_ip' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=trackip;searchip=\' . $rowData[\'member_ip\'];
return sprintfspamer($rowData, $url, \'member_ip\', 1);
'),]]></add>
</operation>
<!--- Second List - List Member Waiting Aproval - END --->

<!--- Leyends, Info and  New Functions - BEGIN --->
<!--- Check or report inside ViewMemberlist() (sa = 'all' or 'query') - BEGIN --->
<operation>
<search position="after"><![CDATA[
// Are we performing a delete?]]></search>
<add><![CDATA[
// Are we performing a check or report?
if ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['delete']))
{
checkSession();

// Clean the input.
foreach ($_POST['delete'] as $key => $value)
{
$_POST['delete'][$key] = (int) $value;
// Don't report yourself, idiot :P
if ($value == $user_info['id'] || '1' == $value)
unset($_POST['delete'][$key]);
}

$modSettings['registration_method'] = 2;

// Check and/or Report This Members
if (!empty($_POST['delete']))
checkreportMembers($_POST['delete'], isset($_POST['spammers_report']));
}
]]></add>
</operation>
<!--- Check or report inside ViewMemberlist() (sa = 'all' or 'query') - END --->

<!--- Check or report inside AdminApprove() (sa = 'approve') - BEGIN --->
<operation>
<search position="after"><![CDATA[
// We also need to the login languages here - for emails.]]></search>
<add><![CDATA[
// Are we performing a check or report?
if ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['todoAction']))
{
checkSession();

// Clean the input.
foreach ($_POST['todoAction'] as $key => $value)
{
$_POST['delete'][$key] = (int) $value;
// Don't report yourself, idiot :P
if ($value == $user_info['id'] || '1' == $value)
unset($_POST['todoAction'][$key]);
}

$modSettings['registration_method'] = 2;

// Check and/or Report This Members
if (!empty($_POST['todoAction']))
checkreportMembers($_POST['todoAction'], isset($_POST['spammers_report']));
}
]]></add>
</operation>
<!--- Check or report inside AdminApprove() (sa = 'approve') - END --->

<operation>
<search position="after"><![CDATA[
array(
'position' => 'below_table_data',
'value' => '<input type="submit" ]]></search>
<add><![CDATA[
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="text-align: center">' . $txt['stopspammer_count'] . ' : ' . $modSettings['stopspammer_count'] . '</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="margin: auto" class="leyend_stopspammer">
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/moreinfo.gif" alt="Icon MoreInfo" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd01'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/suspect.gif" alt="Icon Suspect" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd02'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/spammer.gif" alt="Icon Spammer" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd03'] . '<br />
</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<label>' . $txt['in_stop_forum_spam'] . '</label>
<input type="submit" name="spammers_checks" value="' . $txt['spammers_checks'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_checks'] . '\');" />
<input type="submit" name="spammers_report" value="' . $txt['spammers_report'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_report'] . '\');" />',
'class' => 'titlebg','titlebg',
'style' => 'text-align: right;',
),]]></add>
</operation>

<operation>
<search position="after"><![CDATA[
array(
'position' => 'below_table_data',
'value' => '
[<a href="' . $scripturl . '?action=admin;area=viewmembers;sa=browse;showdupes=']]></search>
<add><![CDATA[
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="text-align: center">' . $txt['stopspammer_count'] . ' : ' . $modSettings['stopspammer_count'] . '</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="margin: auto" class="leyend_stopspammer">
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/moreinfo.gif" alt="Icon MoreInfo" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd01'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/suspect.gif" alt="Icon Suspect" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd02'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/spammer.gif" alt="Icon Spammer" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd03'] . '<br />
</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<label>' . $txt['in_stop_forum_spam'] . '</label>
<input type="submit" name="spammers_checks" value="' . $txt['spammers_checks'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_checks'] . '\');" />
<input type="submit" name="spammers_report" value="' . $txt['spammers_report'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_report'] . '\');" />',
'class' => 'titlebg','titlebg',
'style' => 'text-align: right;',
),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[if ($context['current_subaction'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types']))]]></search>
<add><![CDATA[if ($context['current_subaction'] == 'query' && !empty($_REQUEST['params']) && (empty($_POST['types']) || ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['delete']))))]]></add>
</operation>
<!--- Leyends, Info and  New Functions - END --->
</file>

<file name="$sourcedir/Register.php">
<operation>
<search position="after"><![CDATA[
// Include the additional options that might have been filled in.]]></search>
<add><![CDATA[
// Is Spammer? Then should be approval
if ($modSettings['stopspammer_enable'])
{
require_once($sourcedir . '/StopSpammer.php');
if ($regOptions['spammer'] = checkDBSpammer($user_info['ip'], $_POST['user'], $_POST['email']))
{
$regOptions['require'] = 'approval';
$modSettings['registration_method'] = 2;
if ($regOptions['spammer'] != 8)
updateSettings(array('stopspammer_count' => ++$modSettings['stopspammer_count']), true);
}
}
]]></add>
</operation>
</file>

<file name="$sourcedir/Subs.php">
<operation>
<search position="replace"><![CDATA[$context['unapproved_members'] = !empty($modSettings['unapprovedMembers']) ? $modSettings['unapprovedMembers'] : 0;]]></search>
<add><![CDATA[$context['unapproved_members'] = $modSettings['unapprovedMembers'];]]></add>
</operation>
</file>

<file name="$sourcedir/Subs-Members.php">
<operation>
<search position="after"><![CDATA[
'validation_code' => $validation_code,]]></search>
<add><![CDATA[
'is_spammer' => empty($regOptions['spammer']) ? 0 : $regOptions['spammer'],]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[mem.id_member, mem.member_name, mem.real_name, mem.email_address, mem.member_ip, mem.member_ip2, mem.last_login,]]></search>
<add><![CDATA[mem.id_member, mem.member_name, mem.real_name, mem.email_address, mem.member_ip, mem.member_ip2, mem.last_login, mem.is_spammer,]]></add>
</operation>
</file>

<file name="$sourcedir/Profile.php">
<!-- Profile BEGIN -->
<operation>
<search position="before"><![CDATA[ 'deleteaccount' => array(
'label' => $txt['deleteAccount'],
'file' => 'Profile-Actions.php',
'function' => 'deleteAccount',
'icon' => 'members_delete',
'sc' => 'post',
'token' => 'profile-da%u',
'password' => true,
'permission' => array(
'own' => array('profile_remove_any', 'profile_remove_own'),
'any' => array('profile_remove_any'),
),
),]]></search>
<add><![CDATA[
'checkmember' => array(
'label' => $txt['stopspammer_profilecheck'],
'custom_url' => $scripturl . '?action=admin;area=viewmembers;sa=query;params=' . base64_encode(serialize(array('mem_id' => $memID, 'types' => array('mem_id' => '=')))),
'enabled' => $cur_profile['id_group'] != 1 && !in_array(1, explode(',', $cur_profile['additional_groups'])),
'sc' => 'get',
'permission' => array(
'own' => array('profile_remove_any', 'profile_remove_own'),
'any' => array('profile_remove_any', 'moderate_forum'),
),
),]]></add>
</operation>
<!-- Profile END -->
</file>

</modification>

Offline SugarD-x

  • Jr. Member
  • **
  • Posts: 381
  • Gender: Male
  • SMF and PHPBB Fan
    • SugarDx on Facebook
    • SugarD-x on GitHub
    • sugardx on LinkedIn
    • @SugarDx on Twitter
    • Clan Xperience
Re: Stop Spammer
« Reply #2092 on: March 22, 2020, 10:51:18 AM »
Quote
Hello, since SMF 2.1 is in RC2... do you plan to update this mod to make it working with 2.1?
I tried to install the mod, but I had a lot of errors... so I did not install it.


Same here. Tried to install on ver. 2.0.17 but got warning so abandoned installation. Unfortunate.
What errors did you get? It should be working fine on 2.0.x.


Execute Modification   ./Sources/ManageMembers.php    Test failed

Replace    ./Sources/ManageMembers.php    Test failed
Do you have any other mods installed?

Edit: I'm not sure if this is related to your issue or not, as I can't see what code you have failing from that information, but this post was mentioned previously for someone having a similar issue:
https://www.simplemachines.org/community/index.php?topic=283309.msg3957547#msg3957547

Offline Scooter Trash

  • Semi-Newbie
  • *
  • Posts: 34
Re: Stop Spammer
« Reply #2093 on: March 22, 2020, 07:59:33 PM »

Edit: I'm not sure if this is related to your issue or not, as I can't see what code you have failing from that information, but this post was mentioned previously for someone having a similar issue:
https://www.simplemachines.org/community/index.php?topic=283309.msg3957547#msg3957547


httpBL
addon_OS_Browser_httpBL
and Ohara YouTube Embed.

I might try your suggestion when I have some time.
Thanks.

Offline SugarD-x

  • Jr. Member
  • **
  • Posts: 381
  • Gender: Male
  • SMF and PHPBB Fan
    • SugarDx on Facebook
    • SugarD-x on GitHub
    • sugardx on LinkedIn
    • @SugarDx on Twitter
    • Clan Xperience
Re: Stop Spammer
« Reply #2094 on: March 22, 2020, 11:31:11 PM »

Edit: I'm not sure if this is related to your issue or not, as I can't see what code you have failing from that information, but this post was mentioned previously for someone having a similar issue:
https://www.simplemachines.org/community/index.php?topic=283309.msg3957547#msg3957547


httpBL
addon_OS_Browser_httpBL
and Ohara YouTube Embed.

I might try your suggestion when I have some time.
Thanks.
As far as I know, httpBL shouldn't have any conflicts with StopSpammer in the forum code, but the YouTube embed mod I don't know about personally.

Beautiful toy, all IP blocking manually in .htaccess, and this mod only finds registered users . Who wants to test the mod on SMF 2.1 RC2 here is an adapted file install_21.xml

Code: [Select]
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>M-DVD:StopSpammer</id>
<name>Stop Spammer</name>
<version>2.3.9</version>

<file name="$sourcedir/ManageRegistration.php">
<operation>
<search position="before"><![CDATA[
require_once($sourcedir . '/ManageServer.php');
]]></search>
<add><![CDATA[
// Test if mod StopSpammer is OK
require_once($sourcedir . '/StopSpammer.php');
$txt['stopspammer_ok'] = stopspammer_test_mod_ok();
$stopspammer_faildb_sub = $txt['stopspammer_faildb_sub'];
]]></add>
</operation>

<operation>
<search position="before"><![CDATA[array('text', 'coppaPhone'),]]></search>
<add><![CDATA[
// Stop Spammer
array('title', 'stopspammer_settings'),
$txt['stopspammer_ok'],
'',
array('check', 'stopspammer_enable', 'subtext' => $txt['stopspammer_enable_sub']),
array('desc', 'stopspammer_check_sub1'),
array('check', 'stopspammer_check_name'),
array('check', 'stopspammer_check_mail'),
array('check', 'stopspammer_check_ip'),
array('desc', 'stopspammer_check_sub2'),
array('select', 'stopspammer_faildb', array($txt['stopspammer_fail01'], $txt['stopspammer_fail02'], $txt['stopspammer_fail03']), 'subtext' => $stopspammer_faildb_sub),
array('check', 'stopspammer_show01', 'subtext' => $txt['stopspammer_show01_sub']),
array('text', 'stopspammer_api_key'),
array('desc', 'stopspammer_api_key_sub'),]]></add>
</operation>
</file>

<file name="$sourcedir/ManageMembers.php">
<!--- Load our functions at the beginning of ViewMembers() for every sa we need --->
<operation>
<search position="before"><![CDATA['query' => array('ViewMemberlist', 'moderate_forum'),
);]]></search>
<add><![CDATA[$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'all';
// Load Stop Spammer Functions
if ('all' == $_REQUEST['sa'] || 'browse' == $_REQUEST['sa'] || 'query' == $_REQUEST['sa'] || 'approve' == $_REQUEST['sa'])
{
global $sourcedir;
require_once($sourcedir . '/StopSpammer.php');
}]]></add>
</operation>

<!--- First List - List All Member - BEGIN --->
<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'member_name' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=profile;u=\' . $rowData[\'id_member\'];
return sprintfspamer($rowData, $url, \'member_name\', 2);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'real_name' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=profile;u=\' . $rowData[\'id_member\'];
return sprintfspamer($rowData, $url, \'real_name\', 0);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="mailto:%1$s">%1$s</a>',
'params' => array(
'email_address' => true,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = \'mailto:\' . $rowData[\'email_address\'];
return sprintfspamer($rowData, $url, \'email_address\', 3);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=trackip;searchip=%1$s">%1$s</a>',
'params' => array(
'member_ip' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=trackip;searchip=\' . $rowData[\'member_ip\'];
return sprintfspamer($rowData, $url, \'member_ip\', 1);
'),]]></add>
</operation>
<!--- First List - List All Member - END --->

<!--- Second List - List Member Waiting Aproval - BEGIN --->
<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'member_name' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=profile;u=\' . $rowData[\'id_member\'];
return sprintfspamer($rowData, $url, \'member_name\', 2);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="mailto:%1$s">%1$s</a>',
'params' => array(
'email_address' => true,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = \'mailto:\' . $rowData[\'email_address\'];
return sprintfspamer($rowData, $url, \'email_address\', 3);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=trackip;searchip=%1$s">%1$s</a>',
'params' => array(
'member_ip' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=trackip;searchip=\' . $rowData[\'member_ip\'];
return sprintfspamer($rowData, $url, \'member_ip\', 1);
'),]]></add>
</operation>
<!--- Second List - List Member Waiting Aproval - END --->

<!--- Leyends, Info and  New Functions - BEGIN --->
<!--- Check or report inside ViewMemberlist() (sa = 'all' or 'query') - BEGIN --->
<operation>
<search position="after"><![CDATA[
// Are we performing a delete?]]></search>
<add><![CDATA[
// Are we performing a check or report?
if ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['delete']))
{
checkSession();

// Clean the input.
foreach ($_POST['delete'] as $key => $value)
{
$_POST['delete'][$key] = (int) $value;
// Don't report yourself, idiot :P
if ($value == $user_info['id'] || '1' == $value)
unset($_POST['delete'][$key]);
}

$modSettings['registration_method'] = 2;

// Check and/or Report This Members
if (!empty($_POST['delete']))
checkreportMembers($_POST['delete'], isset($_POST['spammers_report']));
}
]]></add>
</operation>
<!--- Check or report inside ViewMemberlist() (sa = 'all' or 'query') - END --->

<!--- Check or report inside AdminApprove() (sa = 'approve') - BEGIN --->
<operation>
<search position="after"><![CDATA[
// We also need to the login languages here - for emails.]]></search>
<add><![CDATA[
// Are we performing a check or report?
if ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['todoAction']))
{
checkSession();

// Clean the input.
foreach ($_POST['todoAction'] as $key => $value)
{
$_POST['delete'][$key] = (int) $value;
// Don't report yourself, idiot :P
if ($value == $user_info['id'] || '1' == $value)
unset($_POST['todoAction'][$key]);
}

$modSettings['registration_method'] = 2;

// Check and/or Report This Members
if (!empty($_POST['todoAction']))
checkreportMembers($_POST['todoAction'], isset($_POST['spammers_report']));
}
]]></add>
</operation>
<!--- Check or report inside AdminApprove() (sa = 'approve') - END --->

<operation>
<search position="after"><![CDATA[
array(
'position' => 'below_table_data',
'value' => '<input type="submit" ]]></search>
<add><![CDATA[
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="text-align: center">' . $txt['stopspammer_count'] . ' : ' . $modSettings['stopspammer_count'] . '</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="margin: auto" class="leyend_stopspammer">
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/moreinfo.gif" alt="Icon MoreInfo" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd01'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/suspect.gif" alt="Icon Suspect" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd02'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/spammer.gif" alt="Icon Spammer" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd03'] . '<br />
</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<label>' . $txt['in_stop_forum_spam'] . '</label>
<input type="submit" name="spammers_checks" value="' . $txt['spammers_checks'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_checks'] . '\');" />
<input type="submit" name="spammers_report" value="' . $txt['spammers_report'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_report'] . '\');" />',
'class' => 'titlebg','titlebg',
'style' => 'text-align: right;',
),]]></add>
</operation>

<operation>
<search position="after"><![CDATA[
array(
'position' => 'below_table_data',
'value' => '
[<a href="' . $scripturl . '?action=admin;area=viewmembers;sa=browse;showdupes=']]></search>
<add><![CDATA[
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="text-align: center">' . $txt['stopspammer_count'] . ' : ' . $modSettings['stopspammer_count'] . '</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="margin: auto" class="leyend_stopspammer">
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/moreinfo.gif" alt="Icon MoreInfo" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd01'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/suspect.gif" alt="Icon Suspect" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd02'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/spammer.gif" alt="Icon Spammer" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd03'] . '<br />
</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<label>' . $txt['in_stop_forum_spam'] . '</label>
<input type="submit" name="spammers_checks" value="' . $txt['spammers_checks'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_checks'] . '\');" />
<input type="submit" name="spammers_report" value="' . $txt['spammers_report'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_report'] . '\');" />',
'class' => 'titlebg','titlebg',
'style' => 'text-align: right;',
),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[if ($context['current_subaction'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types']))]]></search>
<add><![CDATA[if ($context['current_subaction'] == 'query' && !empty($_REQUEST['params']) && (empty($_POST['types']) || ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['delete']))))]]></add>
</operation>
<!--- Leyends, Info and  New Functions - END --->
</file>

<file name="$sourcedir/Register.php">
<operation>
<search position="after"><![CDATA[
// Include the additional options that might have been filled in.]]></search>
<add><![CDATA[
// Is Spammer? Then should be approval
if ($modSettings['stopspammer_enable'])
{
require_once($sourcedir . '/StopSpammer.php');
if ($regOptions['spammer'] = checkDBSpammer($user_info['ip'], $_POST['user'], $_POST['email']))
{
$regOptions['require'] = 'approval';
$modSettings['registration_method'] = 2;
if ($regOptions['spammer'] != 8)
updateSettings(array('stopspammer_count' => ++$modSettings['stopspammer_count']), true);
}
}
]]></add>
</operation>
</file>

<file name="$sourcedir/Subs.php">
<operation>
<search position="replace"><![CDATA[$context['unapproved_members'] = !empty($modSettings['unapprovedMembers']) ? $modSettings['unapprovedMembers'] : 0;]]></search>
<add><![CDATA[$context['unapproved_members'] = $modSettings['unapprovedMembers'];]]></add>
</operation>
</file>

<file name="$sourcedir/Subs-Members.php">
<operation>
<search position="after"><![CDATA[
'validation_code' => $validation_code,]]></search>
<add><![CDATA[
'is_spammer' => empty($regOptions['spammer']) ? 0 : $regOptions['spammer'],]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[mem.id_member, mem.member_name, mem.real_name, mem.email_address, mem.member_ip, mem.member_ip2, mem.last_login,]]></search>
<add><![CDATA[mem.id_member, mem.member_name, mem.real_name, mem.email_address, mem.member_ip, mem.member_ip2, mem.last_login, mem.is_spammer,]]></add>
</operation>
</file>

<file name="$sourcedir/Profile.php">
<!-- Profile BEGIN -->
<operation>
<search position="before"><![CDATA[ 'deleteaccount' => array(
'label' => $txt['deleteAccount'],
'file' => 'Profile-Actions.php',
'function' => 'deleteAccount',
'icon' => 'members_delete',
'sc' => 'post',
'token' => 'profile-da%u',
'password' => true,
'permission' => array(
'own' => array('profile_remove_any', 'profile_remove_own'),
'any' => array('profile_remove_any'),
),
),]]></search>
<add><![CDATA[
'checkmember' => array(
'label' => $txt['stopspammer_profilecheck'],
'custom_url' => $scripturl . '?action=admin;area=viewmembers;sa=query;params=' . base64_encode(serialize(array('mem_id' => $memID, 'types' => array('mem_id' => '=')))),
'enabled' => $cur_profile['id_group'] != 1 && !in_array(1, explode(',', $cur_profile['additional_groups'])),
'sc' => 'get',
'permission' => array(
'own' => array('profile_remove_any', 'profile_remove_own'),
'any' => array('profile_remove_any', 'moderate_forum'),
),
),]]></add>
</operation>
<!-- Profile END -->
</file>

</modification>
Which versions of 2.1 has this been tested on so far?

Offline wylekk

  • Semi-Newbie
  • *
  • Posts: 45
  • Gender: Male
    • WYLEK.RU
Re: Stop Spammer
« Reply #2095 on: March 23, 2020, 04:35:48 AM »
the same version is specified there -smf2.1rc2,  installed on my work site.


Offline SugarD-x

  • Jr. Member
  • **
  • Posts: 381
  • Gender: Male
  • SMF and PHPBB Fan
    • SugarDx on Facebook
    • SugarD-x on GitHub
    • sugardx on LinkedIn
    • @SugarDx on Twitter
    • Clan Xperience
Re: Stop Spammer
« Reply #2096 on: March 23, 2020, 10:02:26 AM »
the same version is specified there -smf2.1rc2,  installed on my work site.
Oops, my mistake! I don't know how I missed that.

Offline viulian

  • Jr. Member
  • **
  • Posts: 236
    • Hex.ro
Re: Stop Spammer
« Reply #2097 on: April 26, 2020, 02:16:25 AM »
Works for me on 2.0.17 version ... after manually fixing the code during updates and adding the IFs back.

Had to change the 'www' to 'api' and '.com' to '.org' in StopSpammer.php (_except_ for the /add URL, the one for Reporting the users).