Skip to content

Commit

Permalink
Release 2.19
Browse files Browse the repository at this point in the history
  • Loading branch information
davydovct committed Jan 11, 2018
2 parents cc56409 + 6996bb3 commit 56ce4b4
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 26 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 2.19 December 24, 2017
------------------------------
- Support Cloudflare CDN

Version 2.18 October 30, 2017
------------------------------
- Bug fixes and other minor improvements
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SMF Antispam mod
* **Version:** 2.18
* **Version:** 2.19
* **License:** GNU General Public License
* **Compatible with:** SMF 2.0 and up
* **Languages:** English, Russian
Expand Down
2 changes: 1 addition & 1 deletion RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class RoboFile extends \Robo\Tasks
{
const PACKAGE = 'antispam_cleantalk_smf';
const VERSION = '2.18';
const VERSION = '2.19';

const SMF_VERSION = '2.0.14'; // for forumPrepare

Expand Down
2 changes: 1 addition & 1 deletion cleantalkMod.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
require_once(dirname(__FILE__) . '/CleantalkSFW.php');

// Common CleanTalk options
define('CT_AGENT_VERSION', 'smf-218');
define('CT_AGENT_VERSION', 'smf-219');
define('CT_SERVER_URL', 'http://moderate.cleantalk.org');
define('CT_DEBUG', false);

Expand Down
51 changes: 39 additions & 12 deletions lib/CleantalkSFW.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,22 @@ class CleantalkSFW
private $query;
private $db_result;
private $db_result_data = array();

private $cdn_cf = array(
'103.21.244.0/22',
'103.22.200.0/22',
'103.31.4.0/22',
'104.16.0.0/12',
'108.162.192.0/18',
'131.0.72.0/22',
'141.101.64.0/18',
'162.158.0.0/15',
'172.64.0.0/13',
'173.245.48.0/20',
'188.114.96.0/20',
'190.93.240.0/20',
'197.234.240.0/22',
'198.41.128.0/17',
);
public function __construct()
{
global $db_connection, $db_prefix;
Expand Down Expand Up @@ -68,37 +83,49 @@ public function unversal_fetch_all()
public function get_ip(){

$result=Array();

$cdn = $this->cdn_cf;

// Getting IP
$the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
$result[] = $the_ip;
$result['remote_addr'] = $the_ip;
$this->ip_str_array[]=$the_ip;
$this->ip_array[]=sprintf("%u", ip2long($the_ip));

// Getting proxy IP
// Getting Cloudflare IP
$headers = function_exists('apache_request_headers')
? apache_request_headers()
: self::apache_request_headers();

if( isset($headers['X-Forwarded-For']) ){
$the_ip = explode(",", trim($headers['X-Forwarded-For']));
$the_ip = trim($the_ip[0]);
$result[] = filter_var( $the_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
$this->ip_str_array[]=$the_ip;
$this->ip_array[]=sprintf("%u", ip2long($the_ip));
if(isset($headers['Cf_Connecting_Ip'])){
foreach ($cdn as $cidr)
{
if ($this->ip_mask_match($result['remote_addr'],$cidr)){
$result['cf_connecting_ip'] = filter_var( $_SERVER['Cf_Connecting_Ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
$this->ip_array[] = sprintf("%u", ip2long($result['cf_connecting_ip']));
unset($result['remote_addr']);
break;
}
}
}

// Getting test IP
$sfw_test_ip = isset($_GET['sfw_test_ip']) ? $_GET['sfw_test_ip'] : null;
if($sfw_test_ip){
$result[] = filter_var( $sfw_test_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
$result['remote_addr'] = filter_var( $sfw_test_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
$this->ip_str_array[]=$sfw_test_ip;
$this->ip_array[]=sprintf("%u", ip2long($sfw_test_ip));
}

return array_unique($result);
}


public function ip_mask_match($ip, $cidr){
$exploded = explode ('/', $cidr);
$net = $exploded[0];
$mask = 4294967295 << (32 - $exploded[1]);
return (ip2long($ip) & $mask) == (ip2long($net) & $mask);
}

/*
* Checks IP via Database
*/
Expand Down
2 changes: 1 addition & 1 deletion modification.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="www.simplemachines.org/xml/modification">
<id>cleantalk:antispam</id>
<version>2.18</version>
<version>2.19</version>
<file name="$sourcedir/Post.php">
<operation error="fatal">
<search position="after"><![CDATA[createPost($msgOptions, $topicOptions, $posterOptions);]]></search>
Expand Down
44 changes: 36 additions & 8 deletions package-info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<id>cleantalk:antispam</id>
<name>Anti-spam by CleanTalk</name>
<type>modification</type>
<version>2.18</version>
<version>2.19</version>
<install for="2.0 - 2.1.99">
<readme type="file" parsebbc="true">readme.txt</readme>
<readme type="file" parsebbc="true" lang="russian-utf8">readme_russian.txt</readme>
Expand Down Expand Up @@ -43,7 +43,7 @@
</readme>
</upgrade>
<upgrade from="2.12 - 2.15">
<readme type="inline" parsebbc="true">This upgrade for Antispam by Cleantalk to 2.18 version:
<readme type="inline" parsebbc="true">This upgrade for Antispam by Cleantalk to 2.19 version:
- Fix SFW update on save settings
- Change SFW template
- Remove plugin settings on uninstall
Expand All @@ -52,9 +52,10 @@
- IPv6 support
- Update sfw_networks on plugin install
- First post checking now checking all messages from users with newbie group
- Support Cloudflare CDN
- Bug fixes and other minor improvements
</readme>
<readme type="inline" parsebbc="true" lang="russian-utf8">Обновление Анти-спама от Cleantalk до версии 2.18:
<readme type="inline" parsebbc="true" lang="russian-utf8">Обновление Анти-спама от Cleantalk до версии 2.19:
- Исправлено обновление базы SpamFireWall при сохранении настроек
- Изменен шаблон для SpamFireWall
- Удаление настроек из БД при удалении плагина
Expand All @@ -63,6 +64,7 @@
- Поддержка IPV6
- Обновление баз SpamFireWall при установке плагина
- Опция "Проверки первого сообщения" изменена на проверку всех сообщений от новых пользователей
- Поддержка Cloudflare CDN
- Устранение багов и остальные незначительные улучшения
</readme>
<create-dir name="cleantalk" destination="$sourcedir"/>
Expand All @@ -86,18 +88,20 @@
</redirect>
</upgrade>
<upgrade from="2.16">
<readme type="inline" parsebbc="true">This upgrade for Antispam by Cleantalk from 2.16 to 2.18 version:
<readme type="inline" parsebbc="true">This upgrade for Antispam by Cleantalk from 2.16 to 2.19 version:
- Fix create_table for sql_lite
- IPv6 support
- Update sfw_networks on plugin install
- First post checking now checking all messages from users with newbie group
- First post checking now checking all messages from users with newbie group
- Support Cloudflare CDN
- Bug fixes and other minor improvements
</readme>
<readme type="inline" parsebbc="true" lang="russian-utf8">Обновление Анти-спама от Cleantalk с версии 2.16 до 2.18:
<readme type="inline" parsebbc="true" lang="russian-utf8">Обновление Анти-спама от Cleantalk с версии 2.16 до 2.19:
- Исправлен скрипт создания таблиц для sql_lite
- Поддержка IPV6
- Обновление баз SpamFireWall при установке плагина
- Опция "Проверки первого сообщения" изменена на проверку всех сообщений от новых пользователей
- Поддержка Cloudflare CDN
- Устранение багов и остальные незначительные улучшения
</readme>
<create-dir name="cleantalk" destination="$sourcedir"/>
Expand All @@ -114,10 +118,12 @@
</redirect>
</upgrade>
<upgrade from="2.17">
<readme type="inline" parsebbc="true">This upgrade for Antispam by Cleantalk from 2.17 to 2.18 version:
<readme type="inline" parsebbc="true">This upgrade for Antispam by Cleantalk from 2.17 to 2.19 version:
- Support Cloudflare CDN
- Bug fixes and other minor improvements
</readme>
<readme type="inline" parsebbc="true" lang="russian-utf8">Обновление Анти-спама от Cleantalk с версии 2.17 до 2.18:
<readme type="inline" parsebbc="true" lang="russian-utf8">Обновление Анти-спама от Cleantalk с версии 2.17 до 2.19:
- Поддержка Cloudflare CDN
- Устранение багов и остальные незначительные улучшения
</readme>
<create-dir name="cleantalk" destination="$sourcedir"/>
Expand All @@ -132,4 +138,26 @@
you are being redirected to this mod configuration settings.
</redirect>
</upgrade>
<upgrade from="2.18">
<readme type="inline" parsebbc="true">This upgrade for Antispam by Cleantalk from 2.18 to 2.19 version:
- Support Cloudflare CDN
- Bug fixes and other minor improvements
</readme>
<readme type="inline" parsebbc="true" lang="russian-utf8">Обновление Анти-спама от Cleantalk с версии 2.18 до 2.19:
- Поддержка Cloudflare CDN
- Устранение багов и остальные незначительные улучшения
</readme>
<create-dir name="cleantalk" destination="$sourcedir"/>
<require-file name="cleantalkMod.php" destination="$sourcedir/cleantalk">Mod main file</require-file>
<require-file name="lib/CleantalkSFW.php" destination="$sourcedir/cleantalk">SFW class</require-file>
<modification format="xml" type="file">modification.xml</modification>
<modification format="xml" type="file">languages/english.xml</modification>
<modification format="xml" type="file">languages/english-utf8.xml</modification>
<modification format="xml" type="file">languages/russian.xml</modification>
<modification format="xml" type="file">languages/russian-utf8.xml</modification>
<database>install.php</database>
<redirect url="$boardurl/index.php?action=admin;area=modsettings" type="inline">Please stand by while
you are being redirected to this mod configuration settings.
</redirect>
</upgrade>
</package-info>
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MOD [b]Anti-spam by CleanTalk[/b]
Version: 2.18
Version: 2.19

Anti-spam by CleanTalk mod with protection against spam bots and manual spam.
No Captcha, no questions, no counting animals, no puzzles, no math.
Expand Down
2 changes: 1 addition & 1 deletion readme_russian.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MOD [b]Анти-спам от Cleantalk[/b]
Версия: 2.18
Версия: 2.19

Анти-спам от Cleantalk с защитой против автоматического и ручного спама.
Без капчи, без вопросов, без подсчета животных, без паззлов и т.д
Expand Down

0 comments on commit 56ce4b4

Please sign in to comment.