diff --git a/ccm-cms-types-formitem/src/ccm-cms-types-formitem.config b/ccm-cms-types-formitem/src/ccm-cms-types-formitem.config index adfdba100..a66bb4e38 100755 --- a/ccm-cms-types-formitem/src/ccm-cms-types-formitem.config +++ b/ccm-cms-types-formitem/src/ccm-cms-types-formitem.config @@ -1,4 +1,5 @@ - + diff --git a/ccm-cms-types-formitem/src/com/arsdigita/cms/formbuilder/FormItem.java b/ccm-cms-types-formitem/src/com/arsdigita/cms/formbuilder/FormItem.java index 0982f9448..987871779 100755 --- a/ccm-cms-types-formitem/src/com/arsdigita/cms/formbuilder/FormItem.java +++ b/ccm-cms-types-formitem/src/com/arsdigita/cms/formbuilder/FormItem.java @@ -52,7 +52,9 @@ import com.arsdigita.cms.dispatcher.SimpleXMLGenerator; import com.arsdigita.web.URL; import com.arsdigita.web.Web; +import java.io.IOException; import java.math.BigDecimal; +import javax.servlet.http.HttpServletResponse; public class FormItem extends ContentPage implements XMLGenerator { @@ -212,6 +214,15 @@ public class FormItem extends ContentPage implements XMLGenerator { public void generateXML(PageState state, Element parent, String useContext) { + if (FormItemConfig.getConfig().isHoneypotEnabled()) { + final String honeypotName = FormItemConfig.getConfig().getHoneypotName(); + final String honeypotValue = state.getRequest().getParameter(honeypotName); + if (honeypotValue != null + && !honeypotValue.isEmpty()) { + throw new UncheckedWrapperException(""); + } + } + PersistentForm form = getForm(); Component c = null; try { @@ -262,6 +273,18 @@ public class FormItem extends ContentPage implements XMLGenerator { element.addAttribute(FormBuilderUtil.FORM_ACTION, action); + if (FormItemConfig.getConfig().isHoneypotEnabled()) { + final Element honeypot = element.newChildElement("honeypot"); + honeypot.addAttribute("name", "your-homepage"); + } + + if (FormItemConfig.getConfig().isMinTimeCheckEnabled()) { + final Element minTimeCheck = element.newChildElement("minTimeCheck"); + minTimeCheck.addAttribute( + "generated", + Long.toString(System.currentTimeMillis())); + } + FormBuilderXMLRenderer renderer = new FormBuilderXMLRenderer(element); renderer.setWrapAttributes(true); renderer.setWrapRoot(false); diff --git a/ccm-core/web/themes/foundry/foundry/lib/template-tags/content-items/formitem.xsl b/ccm-core/web/themes/foundry/foundry/lib/template-tags/content-items/formitem.xsl index f414cfa6b..a6dbec20f 100644 --- a/ccm-core/web/themes/foundry/foundry/lib/template-tags/content-items/formitem.xsl +++ b/ccm-core/web/themes/foundry/foundry/lib/template-tags/content-items/formitem.xsl @@ -75,6 +75,22 @@ else $data-tree//cms:item/@formAction}" accept-charset="utf-8"> + +
+ + + +
+
+ + + + + \ No newline at end of file + diff --git a/ccm-core/web/themes/foundry/foundry/lib/template-tags/html-tags.xsl b/ccm-core/web/themes/foundry/foundry/lib/template-tags/html-tags.xsl index b902357e8..ea72e7269 100644 --- a/ccm-core/web/themes/foundry/foundry/lib/template-tags/html-tags.xsl +++ b/ccm-core/web/themes/foundry/foundry/lib/template-tags/html-tags.xsl @@ -1454,12 +1454,12 @@ - + - +