Skip to content
Permalink
Browse files

Fix eform.inc.php

http://forum.modx.jp/viewtopic.php?p=10075#p10075
Error : count(): Parameter must be an array or an object that implements Countable
  • Loading branch information...
yama committed May 15, 2019
1 parent e71fdba commit 9d474428f5bd37c9fa42e252357fbed5e10250a0
Showing with 4 additions and 4 deletions.
  1. +4 −4 assets/snippets/eform/eform.inc.php
@@ -184,7 +184,7 @@ function eForm($modx,$params) {
$validFormId = (isset($_POST['formid']) && $formid==$_POST['formid'])?1:0;
# check if postback mode
$efPostBack = ($validFormId && count($_POST)>0 && ( strpos($_SERVER["HTTP_REFERER"], $modx->config["site_url"]) !== FALSE ) )? true:false; //retain old variable?
$efPostBack = ($validFormId && $_POST && ( strpos($_SERVER["HTTP_REFERER"], $modx->config["site_url"]) !== FALSE ) )? true:false; //retain old variable?
if($efPostBack){
@@ -349,7 +349,7 @@ function eForm($modx,$params) {
}
if(count($vMsg)>0 || count($rMsg)>0){
if($vMsg || $rMsg){
//New in 1.4.2 - classes are set in labels and form elements for invalid fields
foreach($rClass as $n => $class){
@@ -375,7 +375,7 @@ function eForm($modx,$params) {
}
#set validation message
$tmp = (count($rMsg)>0)?str_replace("{fields}", implode(", ",$rMsg),$_lang['ef_required_message']):"";
$tmp = ($rMsg)?str_replace("{fields}", implode(", ",$rMsg),$_lang['ef_required_message']):"";
$tmp .= implode("<br />",$vMsg);
if(!strstr($tpl,'[+validationmessage+]'))
$modx->setPlaceholder('validationmessage',str_replace('[+ef_wrapper+]', $tmp, $_lang['ef_validation_message']));
@@ -774,7 +774,7 @@ function AddAddressToMailer(&$mail,$type,$addr){
# Attach Files to Mailer
function AttachFilesToMailer(&$mail,&$attachFiles) {
if(count($attachFiles)>0){
if($attachFiles){
foreach($attachFiles as $attachFile){
if(!file_exists($attachFile)) continue;
$FileName = $attachFile;

0 comments on commit 9d47442

Please sign in to comment.
You can’t perform that action at this time.