Alex Trofimov 12 лет назад
Родитель
Сommit
e6e36c9e56

+ 37 - 0
modules/boonex/antispam/classes/BxAntispamGridBlockLog.php

@@ -0,0 +1,37 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ * 
+ * @defgroup    Antispam Antispam
+ * @ingroup     DolphinModules
+ *
+ * @{
+ */
+
+require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
+
+bx_import('BxTemplGrid');
+
+class BxAntispamGridBlockLog extends BxTemplGrid 
+{
+    public function __construct ($aOptions, $oTemplate = false) 
+    {
+        parent::__construct ($aOptions, $oTemplate);
+    }
+
+    protected function _getCellIp ($mixedValue, $sKey, $aField, $aRow) 
+    {
+        return parent::_getCellDefault (long2ip($mixedValue), $sKey, $aField, $aRow);
+    }
+    protected function _getCellType ($mixedValue, $sKey, $aField, $aRow) 
+    {
+        return parent::_getCellDefault (_t('_bx_antispam_type_' . $mixedValue), $sKey, $aField, $aRow);
+    }
+    protected function _getCellAdded ($mixedValue, $sKey, $aField, $aRow) 
+    {
+        return parent::_getCellDefault (bx_time_js($mixedValue, BX_FORMAT_DATE), $sKey, $aField, $aRow);
+    }
+}
+
+/** @} */

+ 16 - 0
modules/boonex/antispam/classes/BxAntispamGridDNSBL.php

@@ -51,6 +51,22 @@ class BxAntispamGridDNSBL extends BxTemplGrid
      */
     public function performActionLog()
     {
+        bx_import('BxDolGrid');
+        $oGrid = BxDolGrid::getObjectInstance('bx_antispam_grid_block_log');
+        if (!$oGrid) {
+            $this->_echoResultJson(array('msg' => _t('_sys_txt_error_occured')), true);
+            exit;
+        }
+
+        bx_import('BxTemplFunctions');
+        $s = BxTemplFunctions::getInstance()->popupBox(
+            'bx_antispam_popup_block_log',
+            _t('_bx_antispam_popup_block_log'), 
+            $oGrid->getCode() . '<button class="bx-btn" style="float:none;" onclick ="$(\'.bx-popup-applied:visible\').dolPopupHide();">' . _t('_sys_close') . '</button>'
+        );
+
+        $this->_echoResultJson(array('popup' => array('html' => $s)), true);
+
     }
 
     /**

+ 1 - 0
modules/boonex/antispam/classes/BxAntispamGridIpTable.php

@@ -137,6 +137,7 @@ class BxAntispamGridIpTable extends BxTemplGrid
     {
         return parent::_getCellDefault ('allow' == $mixedValue ? _t('_bx_antispam_ip_allow') : _t('_bx_antispam_ip_deny'), $sKey, $aField, $aRow);
     }
+
     protected function _getCellLastDT ($mixedValue, $sKey, $aField, $aRow) 
     {
         return parent::_getCellDefault (bx_time_js($mixedValue, BX_FORMAT_DATE), $sKey, $aField, $aRow);

+ 11 - 0
modules/boonex/antispam/install/langs/en.xml

@@ -12,6 +12,8 @@ This functionality allows to block by IP address if it exists in one of availabl
 <br /><br />
 A URI DNSBL is a DNSBL that lists the domain names and IP addresses which are found in the "clickable" links contained in the body of spams, but generally not found inside legitimate messages.
 This antispam method scan submitted content for the URLs and check them if any of them is a link to spam site. If such URL detected in the text then content is not submitted.
+<br /><br />
+<button class="bx-btn" style="float:none;" onclick ="$('.bx-popup-applied:visible').dolPopupHide();">Close</button>
 ]]></string>
     <string name="_bx_antispam_ip_blocked"><![CDATA[IP address is blocked. {0}]]></string>
     <string name="_bx_antispam_spam_detected"><![CDATA[Spam detected. {0}]]></string>
@@ -27,9 +29,14 @@ This antispam method scan submitted content for the URLs and check them if any o
 	<string name="_bx_antispam_rule_note_surbl_org"><![CDATA[Detect spammer URLs from SURBLs (lists of web sites that have appeared in unsolicited messages)]]></string>
 	<string name="_bx_antispam_dnsbl"><![CDATA[DNSBL]]></string>
 	<string name="_bx_antispam_uri_dnsbl"><![CDATA[URI DNSBL]]></string>
+	<string name="_bx_antispam_type_dnsbl"><![CDATA[DNSBL]]></string>
+	<string name="_bx_antispam_type_dnsbluri"><![CDATA[URI DNSBL]]></string>
+	<string name="_bx_antispam_type_akismet"><![CDATA[Akismet]]></string>
+	<string name="_bx_antispam_type_stopforumspam"><![CDATA[StopForumSpam]]></string>
 
 	<string name="_bx_antispam_popup_help"><![CDATA[DNSBL help]]></string>
 	<string name="_bx_antispam_popup_dnsbl_recheck"><![CDATA[Recheck IP/URL in DNSBL/URIDNSBL]]></string>
+	<string name="_bx_antispam_popup_block_log"><![CDATA[Block log]]></string>
 
 	<string name="_bx_antispam_page_title_sys_ip_table"><![CDATA[IP table]]></string>
 	<string name="_bx_antispam_page_title_ip_table"><![CDATA[IP table]]></string>
@@ -46,6 +53,7 @@ This antispam method scan submitted content for the URLs and check them if any o
 	<string name="_bx_antispam_grid_action_help"><![CDATA[Help]]></string>
 
 	<string name="_bx_antispam_field_id"><![CDATA[ID]]></string>
+	<string name="_bx_antispam_field_ip"><![CDATA[IP]]></string>
 	<string name="_bx_antispam_field_ip_from"><![CDATA[IP from]]></string>
 	<string name="_bx_antispam_field_ip_to"><![CDATA[IP to]]></string>
 	<string name="_bx_antispam_field_action"><![CDATA[Action]]></string>
@@ -54,6 +62,9 @@ This antispam method scan submitted content for the URLs and check them if any o
 	<string name="_bx_antispam_field_chain"><![CDATA[Rule]]></string>
 	<string name="_bx_antispam_field_ip_url"><![CDATA[IP for DNSBL or URL for URI DNSBL]]></string>
 	<string name="_bx_antispam_field_dnsbl_uridnsbl"><![CDATA[Check in]]></string>
+	<string name="_bx_antispam_field_member_id"><![CDATA[Member]]></string>
+	<string name="_bx_antispam_field_type"><![CDATA[Type]]></string>
+	<string name="_bx_antispam_field_when"><![CDATA[When]]></string>
 
     <string name="_bx_antispam_form_ip_table"><![CDATA[IP table directive]]></string>
     <string name="_bx_antispam_form_ip_table_add"><![CDATA[Add IP table directive]]></string>

+ 12 - 0
modules/boonex/antispam/install/sql/enable.sql

@@ -76,6 +76,18 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `conf
 ('bx_antispam_grid_ip_table', 'single', 'delete', '', 'remove',  1, 2),
 ('bx_antispam_grid_ip_table', 'independent', 'add', '_bx_antispam_grid_action_add', '', 0, 1);
 
+-- grid: block log
+
+INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `field_id`, `field_order`, `field_active`, `paginate_url`, `paginate_per_page`, `paginate_simple`, `paginate_get_start`, `paginate_get_per_page`, `filter_fields`, `filter_fields_translatable`, `filter_mode`, `sorting_fields`, `sorting_fields_translatable`, `visible_for_levels`, `override_class_name`, `override_class_file`) VALUES
+('bx_antispam_grid_block_log', 'Sql', 'SELECT `id`, `ip`, `member_id`, `type`, `extra`, `added` FROM `bx_antispam_block_log`', 'bx_antispam_block_log', 'id', 'id', '', '', 8, NULL, 'start', '', 'type,extra', '', 'auto', 'ip,member_id,type,extra,added', '', 64, 'BxAntispamGridBlockLog', 'modules/boonex/antispam/classes/BxAntispamGridBlockLog.php');
+
+INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
+('bx_antispam_grid_block_log', 'ip', '_bx_antispam_field_ip', '20%', 0, 0, '', 1),
+('bx_antispam_grid_block_log', 'member_id', '_bx_antispam_field_member_id', '20%', 0, 0, '', 2),
+('bx_antispam_grid_block_log', 'type', '_bx_antispam_field_type', '15%', 0, 0, '', 3),
+('bx_antispam_grid_block_log', 'extra', '_bx_antispam_field_note', '15%', 0, 8, '', 4),
+('bx_antispam_grid_block_log', 'added', '_bx_antispam_field_when', '30%', 0, 0, '', 5);
+
 -- data list: ip table actions
 
 INSERT INTO `sys_form_pre_lists`(`module`, `key`, `title`, `use_for_sets`) VALUES 

+ 1 - 0
modules/boonex/antispam/install/sql/install.sql

@@ -38,6 +38,7 @@ CREATE TABLE `bx_antispam_dnsbluri_zones` (
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
 CREATE TABLE `bx_antispam_block_log` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
   `ip` int(10) unsigned NOT NULL,
   `member_id` int(10) unsigned NOT NULL,
   `type` varchar(32) NOT NULL,

+ 1 - 0
scripts/check_unused_lang.php

@@ -63,6 +63,7 @@ class BxDolCheckUnusedLangsCmd
 
             // antispam
             '/^_bx_antispam_chain_/',
+            '/^_bx_antispam_type_/',
         );
 
         $this->_aOptionsSystem = array (