This repository has been archived by the owner on Oct 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ use \Jos\Mailer; | |
* See README.md for usage instructions. | ||
* | ||
* @author Tabea David <[email protected]> | ||
* @version 1.0.4 | ||
* @version 1.0.5 | ||
* @copyright Copyright (c) 2017 | ||
* @see https://github.com/justonestep/processwire-simplecontactform | ||
* @see http://www.processwire.com | ||
|
@@ -30,7 +30,7 @@ class SimpleContactForm extends WireData implements Module { | |
return array( | ||
'title' => 'Simple Contact Form', | ||
'summary' => 'Just a simple contact form.', | ||
'version' => 103, | ||
'version' => 105, | ||
'href' => 'https://github.com/justonestep/processwire-simplecontactform', | ||
'singular' => true, | ||
'autoload' => true, | ||
|
@@ -194,17 +194,18 @@ class SimpleContactForm extends WireData implements Module { | |
$spamProtector = new SpamProtection(); | ||
|
||
// exclude markup fields from spam count | ||
$markupFields = 0; | ||
// AND exclude checkbox fields (if unchecked) from spam count | ||
// BECAUSE it's a standard browser behaviour that the value of a checkbox is only sent if the checkbox was checked | ||
$excludeFields = 0; | ||
foreach ($this->allFields as $inputfield) { | ||
if ($field = $this->fields->get($inputfield)) { | ||
if ($field->type instanceof FieldtypeFieldsetOpen || $field->type instanceof FieldtypeFieldsetTabOpen) { | ||
$markupFields++; | ||
} | ||
if ($field->type instanceof FieldtypeFieldsetOpen || $field->type instanceof FieldtypeFieldsetTabOpen) $excludeFields++; | ||
if ($field->type instanceof FieldtypeCheckbox && !$this->input->post->{$field->name}) $excludeFields++; | ||
} | ||
} | ||
|
||
$spamProtector | ||
->setCount(count($this->allFields) - $markupFields + count(self::$spamFields)) | ||
->setCount(count($this->allFields) - $excludeFields + count(self::$spamFields)) | ||
->setTimeRange($this->antiSpamTimeMin, $this->antiSpamTimeMax) | ||
->setSaveMessages($this->saveMessages) | ||
->setExcludeIpAdresses($this->antiSpamExcludeIps) | ||
|