Merge branch 'dev' into prod
CI / testsuite (mysql, 8.2, ) (push) Successful in 3m19s
CI / testsuite (pgsql, 8.2, ) (push) Successful in 3m21s
CI / testsuite (mysql, 8.4, ) (push) Successful in 6m7s
CI / testsuite (pgsql, 8.4, ) (push) Successful in 2m46s
CI / testsuite (sqlite, 8.2, ) (push) Successful in 3m8s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Successful in 3m22s
CI / Coding Standard & Static Analysis (push) Successful in 3m21s
Release / build (push) Successful in 11s
CI / testsuite (sqlite, 8.4, ) (push) Successful in 6m2s
CI / testsuite (mysql, 8.2, ) (push) Successful in 3m19s
CI / testsuite (pgsql, 8.2, ) (push) Successful in 3m21s
CI / testsuite (mysql, 8.4, ) (push) Successful in 6m7s
CI / testsuite (pgsql, 8.4, ) (push) Successful in 2m46s
CI / testsuite (sqlite, 8.2, ) (push) Successful in 3m8s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Successful in 3m22s
CI / Coding Standard & Static Analysis (push) Successful in 3m21s
Release / build (push) Successful in 11s
CI / testsuite (sqlite, 8.4, ) (push) Successful in 6m2s
This commit is contained in:
@@ -8,7 +8,6 @@ use Cake\Core\Configure;
|
||||
use Cake\Datasource\EntityInterface;
|
||||
use Cake\Http\Response;
|
||||
use Cake\I18n\DateTime;
|
||||
use Cake\Log\Log;
|
||||
use Cake\ORM\Table;
|
||||
use Cake\ORM\TableRegistry;
|
||||
use CakeContactUs\CakeContactUsPlugin;
|
||||
@@ -55,7 +54,6 @@ class ContactUsComponent extends Component {
|
||||
$this->setConfig('requireEmail', Configure::readOrFail('ContactUs.fields.email'));
|
||||
$this->setConfig('requireCaptcha', $requireCaptcha);
|
||||
if ($requireCaptcha) {
|
||||
// $this->_registry->load('Captcha.Captcha');
|
||||
$this->getController()->viewBuilder()->addHelpers(['Captcha.Captcha']);
|
||||
}
|
||||
}
|
||||
@@ -64,7 +62,7 @@ class ContactUsComponent extends Component {
|
||||
* @return \Cake\Datasource\EntityInterface|\CakeContactUs\Model\Entity\ContactUsFormSubmission
|
||||
*/
|
||||
public function newContactUsForm() {
|
||||
if ($this->getConfig('requireCaptcha')) {
|
||||
if ($this->getConfig('requireCaptcha') && PHP_SAPI !== 'cli') {
|
||||
$this->ContactUsFormSubmissions->addBehavior('Captcha.Captcha');
|
||||
}
|
||||
|
||||
@@ -80,8 +78,7 @@ class ContactUsComponent extends Component {
|
||||
if (!isset($postData)) {
|
||||
$postData = $this->getController()->getRequest()->getData();
|
||||
}
|
||||
$postData['client_ip'] = array_key_exists('client_ip', $postData) && $postData['client_ip'] ?
|
||||
$postData['client_ip'] :
|
||||
$postData['client_ip'] = $postData['client_ip'] ??
|
||||
($this->getConfig('clientIpHeader') ?
|
||||
$this->getController()->getRequest()->getHeaderLine($this->getConfig('clientIpHeader')) :
|
||||
$this->getController()->getRequest()->clientIp()
|
||||
@@ -92,14 +89,9 @@ class ContactUsComponent extends Component {
|
||||
'contactUsFormSubmission' => $contactUsFormSubmission,
|
||||
], $this->getController());
|
||||
$result = $event->getResult();
|
||||
|
||||
if ($result instanceof EntityInterface) {
|
||||
$postData = $result->toArray();
|
||||
$contactUsFormSubmission = $this->ContactUsFormSubmissions->patchEntity($contactUsFormSubmission, $postData);
|
||||
if ($contactUsFormSubmission->getErrors()) {
|
||||
Log::debug(print_r('$contactUsFormSubmission->getErrors()', true));
|
||||
Log::debug(print_r($contactUsFormSubmission->getErrors(), true));
|
||||
}
|
||||
$contactUsFormSubmissionSaved = $this->ContactUsFormSubmissions->save($contactUsFormSubmission);
|
||||
if ($contactUsFormSubmissionSaved) {
|
||||
return $this->_afterFormSaved($contactUsFormSubmissionSaved);
|
||||
@@ -115,11 +107,6 @@ class ContactUsComponent extends Component {
|
||||
}
|
||||
|
||||
$contactUsFormSubmission = $this->ContactUsFormSubmissions->patchEntity($contactUsFormSubmission, $postData);
|
||||
if ($contactUsFormSubmission->getErrors()) {
|
||||
Log::debug(print_r('$contactUsFormSubmission->getErrors()', true));
|
||||
Log::debug(print_r($contactUsFormSubmission->getErrors(), true));
|
||||
}
|
||||
|
||||
$contactUsFormSubmissionSaved = $this->ContactUsFormSubmissions->save($contactUsFormSubmission);
|
||||
|
||||
if ($contactUsFormSubmissionSaved) {
|
||||
|
||||
Reference in New Issue
Block a user