Skip to content

Commit

Permalink
add reviews protection
Browse files Browse the repository at this point in the history
  • Loading branch information
davydovct committed Dec 17, 2018
1 parent 08cd08f commit e19835c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
13 changes: 12 additions & 1 deletion Cleantalk/Antispam/Observer/Predispatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,18 @@ public function execute(Observer $observer){

$ct_already_checked = true;
}

//Reviews
$reviews_test_enabled = $this->getConfigValue('ct_reviews');
if(
$reviews_test_enabled &&
strpos($_SERVER['REQUEST_URI'],'review') &&
isset($_POST['nickname'], $_POST['title'], $_POST['detail'])
){
$ct_fields = $this -> cleantalkGetFields($_POST);
$result_array = $this -> setArrayToSend($ct_fields, 'comment');

$ct_already_checked = true;
}
//Custom Forms
$custom_forms_test_enabled = $this->getConfigValue('ct_custom_contact_forms');
if( $custom_forms_test_enabled &&
Expand Down
6 changes: 5 additions & 1 deletion Cleantalk/Antispam/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
<label>Protect Contact Forms</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="ct_custom_contact_forms" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0">
<field id="ct_reviews" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Protect Reviews</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="ct_custom_contact_forms" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Protect Custom Forms</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
Expand Down
1 change: 1 addition & 0 deletions Cleantalk/Antispam/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ct_access_key>None</ct_access_key>
<ct_registrations>1</ct_registrations>
<ct_contact_forms>1</ct_contact_forms>
<ct_reviews>1</ct_reviews>
<ct_custom_contact_forms>1</ct_custom_contact_forms>
<specificerrmsg>This shipping method is not available. To use this shipping method, please contact us.</specificerrmsg>
</cleantalkantispam>
Expand Down

0 comments on commit e19835c

Please sign in to comment.