RomanL 6 лет назад
Родитель
Сommit
7accf5ddcb

+ 2 - 1
install/sql/system.sql

@@ -463,7 +463,8 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 (@iCategoryId, 'sys_security_form_token_lifetime', '_adm_stg_cpt_option_sys_security_form_token_lifetime', '86400', 'digit', '', '', '', 11),
 (@iCategoryId, 'sys_recaptcha_key_public', '_adm_stg_cpt_option_sys_recaptcha_key_public', '', 'digit', '', '', '', 20),
 (@iCategoryId, 'sys_recaptcha_key_private', '_adm_stg_cpt_option_sys_recaptcha_key_private', '', 'digit', '', '', '', 21),
-(@iCategoryId, 'sys_add_nofollow', '_adm_stg_cpt_option_sys_add_nofollow', 'on', 'checkbox', '', '', '', 30);
+(@iCategoryId, 'sys_add_nofollow', '_adm_stg_cpt_option_sys_add_nofollow', 'on', 'checkbox', '', '', '', 30),
+(@iCategoryId, 'sys_security_block_content_after_n_reports', '_adm_stg_cpt_option_sys_security_block_content_after_n_reports', '0', 'digit', '', '', '', 35);
 
 --
 -- CATEGORY: Site Settings

+ 10 - 0
modules/base/general/classes/BxBaseModGeneralDb.php

@@ -127,6 +127,16 @@ class BxBaseModGeneralDb extends BxDolModuleDb
         return $this->query("UPDATE `" . $CNF['TABLE_ENTRIES'] . "` SET " . $this->arrayToSQL($aParamsSet) . " WHERE " . $this->arrayToSQL($aParamsWhere, " AND "));
     }
 
+    public function updateStatusAdmin($iContentId, $isActive)
+    {
+        $CNF = $this->_oConfig->CNF;
+        if (!isset($CNF['FIELD_STATUS_ADMIN']))
+            return false;
+        
+        $sQuery = $this->prepare("UPDATE `" . $CNF['TABLE_ENTRIES'] . "` SET `" . $CNF['FIELD_STATUS_ADMIN'] . "` = ? WHERE `" . $CNF['FIELD_ID'] . "` = ?", $isActive ? 'active' : 'hidden', $iContentId);
+        return $this->query($sQuery);
+    }
+    
     public function publishEntries()
     {
         $CNF = $this->_oConfig->CNF;

+ 2 - 1
modules/boonex/english/data/langs/system/en.xml

@@ -1473,7 +1473,8 @@
 	<string name="_adm_stg_cpt_option_sys_security_form_token_lifetime"><![CDATA[CSRF token lifetime in seconds(0 - do not track time)]]></string>
 	<string name="_adm_stg_cpt_option_sys_security_impact_threshold_block"><![CDATA[Total security impact threshold to send report and block aggressor]]></string>
 	<string name="_adm_stg_cpt_option_sys_security_impact_threshold_log"><![CDATA[Total security impact threshold to send report]]></string>
-	<string name="_adm_stg_cpt_option_sys_site_logo_height"><![CDATA[Logo Height]]></string>
+  <string name="_adm_stg_cpt_option_sys_security_block_content_after_n_reports"><![CDATA[Block content after N reports (0 - do not block)]]></string>
+  <string name="_adm_stg_cpt_option_sys_site_logo_height"><![CDATA[Logo Height]]></string>
 	<string name="_adm_stg_cpt_option_sys_site_logo_width"><![CDATA[Logo Width]]></string>
 	<string name="_adm_stg_cpt_option_sys_storage_default"><![CDATA[Default storage engine (other than Local may require custom/additional setup)]]></string>
 	<string name="_adm_stg_cpt_option_sys_storage_s3_access_key"><![CDATA[AWS access key]]></string>

+ 1 - 0
modules/boonex/russian/data/langs/system/ru.xml

@@ -1456,6 +1456,7 @@
 	<string name="_adm_stg_cpt_option_sys_security_form_token_lifetime"><![CDATA[CSRF token - срок жизни в секундах (0 - не вести отчёт времени)]]></string>
 	<string name="_adm_stg_cpt_option_sys_security_impact_threshold_block"><![CDATA[Общий порог угрозы бесопасности перед тем, как послать отчёт и заблокировать агрессора]]></string>
 	<string name="_adm_stg_cpt_option_sys_security_impact_threshold_log"><![CDATA[Общий порог угрозы бесопасности перед тем, как послать отчёт]]></string>
+  <string name="_adm_stg_cpt_option_sys_security_block_content_after_n_reports"><![CDATA[Блокировать контент после N жалоб (0 - не блокировать)]]></string>
 	<string name="_adm_stg_cpt_option_sys_site_logo_height"><![CDATA[Высота лого]]></string>
 	<string name="_adm_stg_cpt_option_sys_site_logo_width"><![CDATA[Ширина лого]]></string>
 	<string name="_adm_stg_cpt_option_sys_storage_default"><![CDATA[Основной движок хранения (отличный от Local может потребовать дополнительную настройку)]]></string>

+ 10 - 0
template/scripts/BxBaseReport.php

@@ -295,6 +295,16 @@ class BxBaseReport extends BxDolReport
                 }
 
                 $aReport = $this->_oQuery->getReport($iObjectId);
+                
+                $iBlockContentAfter = (int)getParam('sys_security_block_content_after_n_reports');
+                if ($iBlockContentAfter > 0 && $aReport['count'] >= $iBlockContentAfter){
+                    $oModule = BxDolModule::getInstance($this->_sSystem);
+                    if(!$oModule)
+                        return;
+                    
+                    $oModule = $oModule->_oDb->updateStatusAdmin($iObjectId, false);
+                }
+                
                 return array(
                         'eval' => $this->getJsObjectName() . '.onReport(oData, oElement)',
                         'code' => 0,