DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: Contact Form

Created:2010-02-18T17:33:18
Changed by:Kai Vogel
Changed:2012-08-10T00:08:54
Classification:sp_bettercontact
Description:Secure Contact form with solid Spam protection. Input can be checked for length, allowed and disallowed signs and with Regex. Attackers can be locked. Admin can get detailed Spam notification. Requests can be stored into DB. Captcha support included.
Keywords:contact, formular, form, contactform, bettercontact, spam, check
Author:Kai Vogel
Email:kai.vogel@speedprogs.de
URL:http://www.speedprogs.de
Language:en

img-1 img-2 EXT: Contact Form - sp_bettercontact

EXT: Contact Form

Extension Key: sp_bettercontact

Language: en

Keywords: contact, formular, form, contactform, bettercontact, spam, check

Copyright 2007-2012, Kai Vogel, <kai.vogel@speedprogs.de>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.org

Table of Contents

EXT: Contact Form 1

`Introduction 3 <#__RefHeading__26056_1632740317>`_

What does it do? 3

What should I have? 3

`Screenshots 4 <#__RefHeading__26062_1632740317>`_

`Installation 5 <#__RefHeading__26064_1632740317>`_

Install the extension 5

Add the Plugin to a page 5

`Configuration 6 <#__RefHeading__26070_1632740317>`_

Tab: General 6

Tab: Templates 7

Tab: Emails 8

Tab: Spam handling 9

Tab: Database handling 10

`Backend 11 <#__RefHeading__26082_1632740317>`_

Log report 11

CSV Export 11

`TypoScript 12 <#__RefHeading__26088_1632740317>`_

plugin.tx_spbettercontact_pi1 12

plugin.tx_spbettercontact_pi1.fields 14

plugin.tx_spbettercontact_pi1.database 15

Example Configuration 15

`Page TSConfig 17 <#__RefHeading__26098_1632740317>`_

mod.tx_spbettercontact_modfunc1 17

Example Configuration 17

`Template Marker 18 <#__RefHeading__26104_1632740317>`_

Frontend 18

Backend 19

`Additional References 21 <#__RefHeading__26110_1632740317>`_

Frontend User Session 21

`How-to 22 <#__RefHeading__26114_1632740317>`_

How can I define a default value? 22

How can I use a checkbox, radio group or select field? 22

How can I use the Captcha support? 22

How can I configure my database fields? 23

How can I disable the emailing? 23

`Appendix 24 <#__RefHeading__9406_1069964170>`_

Known problems 24

Bugs and features 24

`Changelog 25 <#__RefHeading__9421_1069964170>`_

Introduction

What does it do?

This extension provides a very secure and flexible Contact form with a solid Spam protection. It detects Spam-bots, locks visitors if the try to send a lot of emails and checks the inputs with several of the following routines depending on your configuration:

  • Has it any input
  • Minimal length
  • Maximal length
  • Allowed signs
  • Not allowed signs
  • Regular Expression
  • Optional Captcha check

Error messages can be displayed in-line above the input fields, as list above the form or at any other position you want. You can redirect the visitor to another page if the form was sent. If you don't want to redirect, the same page will be shown with a status message (shows something like “Message was sent. Thank you.”).

The sender and a list of configured recipients get an HTML- or Plain- text email with specified form data. These emails and the form can be configured with templates.

You can also send a notification email to the administrator if a Spam- bot or visitor tries to send a malicious email. This notification includes all given input and a lot of information about the attacker.

Most TYPO3 installations are running with default UTF-8. But if you want to send your emails in a different character set you have to convert the emails. This extension allows you to configure which character set to use for emails and converts them automatically.

You can try the Contact form on my website: http://www.speedprogs.de/kontakt.html

What should I have?

All you need to get your own Contact form with this extension are these things:

  • TYPO3 Version 4.5.0 or higher
  • PHP Version 5.2 or higher
  • One of these extensions if you want to use a Captcha: “sr_freecap”, “jm_recaptcha”, “captcha” or “mathguard”
  • The extension “adodb” if you want to use external database storing
  • Your preferred editor to modify the HTML templates
  • This manual beside you for the abundance of features which this extension offers :-)

Screenshots

img-3

Installation

There are two steps necessary to install the Better Contact extension. If you've installed other extensions in the past, it should be no problem for you. :-)

Install the extension

The Better Contact extension can be installed through the typical TYPO3 installation process using the Extension Manager. The Extension Key is “sp_bettercontact”.

Add the Plugin to a page

Create a new page in your page tree and insert a Contact form record onto it.

img-4

Configuration

If you have completed the installation process, the next step is to configure your new Contact form. The Plugin controls how the form will be shown in the Frontend as well as offering some additional options.

Tab: General

img-5

Success page: Define a page where visitors will be redirected to if a request was successfully sent.

Spam page: Define a page where bots will be redirected to if they try to send Spam (good for tracking purposes).

Too many requests: Show this page instead of an error message if a visitor has sent too many requests.

Error page: Define a page where visitors will be redirected to if a request results in an error.

Enable Log: Use build in log table to store each successfully sent request.

Log IP address: Log users IP address also (please check if this is allowed in your country).

Tab: Templates

img-6

Form template: Define a HTML-template for the form (you can find some examples in “res/templates/examples/” in extension's main directory).

Email template: Define a template for the emails (this could be the same like the form template if it contains all required subparts).

Style sheet file: Define a style sheet file for the form. It will be added as meta tag to the site header.

Additional language file: Define an additional language file if you add more labels to your template or if you want to overwrite some of the default labels.

Field name prefix: All input field names are prefixed with an automatically generated name. You can set a static one here.

Don't use default templates: Activate this if you won't use default templates as a replacement for not configured ones (all default templates could be found in “res/templates/frontend/” in extension's main directory).

Jump to form: The Contact form will return to the same page if the visitor input was invalid or no redirect page was defined. If this check box is activated the extension jumps directly to it's dataset instead of the top of the page.

Highlight fields: Activate this check box if you want to highlight malicious fields with a red border (the error class marker “###ERR_<FIELDNAME>###” must be an attribute of each input field in HTML-template).

Empty form: Clear all input fields if form was successfully sent.

Tab: Emails

img-7

Email recipients: Define one or more email recipients for the notification email if a visitor has sent a message.

Sender: Define a single email address for the sender of the form (it's also allowed to use this format: Contact form <contact@your- domain.com>).

Administrator address: Define a single email address for the administrator of the site. He gets a notification email if a Spam-bot or a visitor tries to send a malicious message.

Return path: Define an email address for the return path. It's mostly the same as sender or administrator.

Send emails to: Select which persons will get an email from the Contact form if the form was “Spam-free” sent. Available are “Nobody” if you e.g. only want store the request to database, “Only to recipients”, “Only to sender” for only the user who has sent the request and “Both”.

Send emails from: Select which email address will be set as sender in emails to the recipients. The sender of the email to the user who has sent the request is allways the configured sender email address.

Reply-to address: Define which email address will be used as reply-to address in notification emails.

Character encoding: Select an encoding for all emails.

Email format: Select an email format, available are HTML and Plain-text.

Tab: Spam handling

img-8

Activate Captcha support: Define, which Captcha extension will be used in the Contact form (the selected extension has to be installed to use it's functionally and the HTML-template has to be configured correctly (see marker reference in this manual. If you don't get any Captcha image with activated “sr_freecap”, please try to disable “display_errors” in your php.ini).

Show input in error case: Define which fields will get their last content if the Spam check fails.

Notify administrator about Spam: This option specifies how to notify the administrator about Spam. Available are “Nothing”, “Bot- Spam”, “User-Spam”, “Both” (the options “User-Spam” and “Both” are slow because an email will be sent every time a visitor tries to send a malicious request).

Check referrer: If activated, the HTTP_REFERER will be compared with current host (only enable this if most of your users use an Browser with activated referrer).

Max count of allowed mailings: Allow visitors to send only the specified count of emails.

Waiting time: If the specified count of mailings was reached a visitor must wait for this time (in minutes) before he can send the next emails. He will get a status message in Frontend which shows something like “ You have already sent 10 messages. Please wait 60 minutes ”.

Tab: Database handling

img-9

Table name: Define an internal or external table name to store successfully sent requests in.

Auto fill default fields: Activate this to automatically fill the fields “pid”, “tstamp”, “crdate” and “cruser_id” from an internal table while inserting a new row or updating a existing one.

Field configuration: Configure your field mapping here. You can use default TypoScript to describe the mapping.

Backend

The Better Contact extension comes with a build in log table where every successfully sent request will be stored. You can analyze this log table via the Info module in TYPO3 Backend. See below, which steps are required to see the log and how you can configure the report and CSV-Export.

Log report

Follow the steps in the Screenshot below to open the report.

img-10

Show: Select if all pages or only the current will be used for the report (you can adjust the output of the report with your own Backend template. See Backend templates in “res/templates/backend/” in extension's main directory and “CSV Export” chapter below).

Period: Select the count of days to show.

Download: You can download the currently visible report with one click as a CSV File.

CSV Export

To export the currently visible log report click on the “CSV” button (3) show in the Screenshot above.

Tip: You can adjust the output to your individual needs by manipulating the CSV template. Simply copy the default template from “res/templates/backend/” in extension's main directory to any target you prefer and edit it. Finally setup the new template in the Page TSConfig. To do that, go to the page properties of the root or Contact form page and add the required TypoScript configuration in the field “TSconfig” in tab “Options”. To see, which configuration is required, have a look into the “Page TSConfig – Reference” chapter in this manual.

TypoScript

Most of the configuration can be done in Flexforms. Only the field configuration and optionally external database handling or the addition of new markers have to be done with TypoScript. Some fields are basically configured after installation (have a look into the file “ext_typoscript_setup.txt” in extension's main directory). If you want to add new fields in Frontend read this TypoScript reference and have a look to the example below the reference.

plugin.tx_spbettercontact_pi1

fields

Property

fields

Data type

cObj

Description

Configuration for the form input fields. The field names must be defined in lowercase.

fields {
    name_of_field {
        required = 1
        minLength = 3
        maxLength = 70
        default =
        regex =
        disallowed = <>[](){}&;
        allowed =
        default =
    }
}

Default

markers

Property

markers

Data type

cObj

Description

Additional markers. You can use this for additional dynamic values in your emails or Contact form. Add this markers to your template with the marker name in uppercase: ###MARKER_NAME###

markers {
    static_marker = Static marker

    dynamic_marker = TEXT
    dynamic_marker.field = title
}

Default

formTemplate

Property

formTemplate

Data type

String / cObj

Description

Template file for the form.

Default

emailTemplate

Property

emailTemplate

Data type

String / cObj

Description

Template file for the emails.

Default

stylesheetFile

Property

stylesheetFile

Data type

String / cObj

Description

Style sheet file for the form.

Default

locallangFile

Property

locallangFile

Data type

String / cObj

Description

Additional language file for the templates.

Default

successRedirectPage

Property

successRedirectPage

Data type

String / cObj

Description

Redirect visitors to this page if an email was successfully sent.

Default

errorRedirectPage

Property

errorRedirectPage

Data type

String / cObj

Description

Redirect visitors to this page if an error occurs.

Default

spamRedirectPage

Property

spamRedirectPage

Data type

String / cObj

Description

Redirect to this page if a bot tries to send Spam.

Default

exhaustedRedirectPage

Property

exhaustedRedirectPage

Data type

String / cObj

Description

Redirect to this page if a visitor has sent too many requests (see “messageCount”).

Default

disableAutoTemplates

Property

disableAutoTemplates

Data type

Boolean / cObj

Description

Disable the usage of default templates as a replacement for not configured ones.

Default

FALSE (0)

fieldPrefix

Property

fieldPrefix

Data type

String / cObj

Description

Define your own prefix for input field names in Contact form.

Default

tx_spbettercontact_pi1-<plugin_uid>

formCharset

Property

formCharset

Data type

String / cObj

Description

Optional form character set. Auto detection if not defined.

Default

emailCharset

Property

emailCharset

Data type

String / cObj

Description

Character set for emails.

Default

emailFormat

Property

emailFormat

Data type

String / cObj

Description

Define the email format, available are “html” and “plain”.

Default

html

allowReturnPath

Property

allowReturnPath

Data type

String / cObj

Description

Disable this if you have problems with the Return-path of emails. In this case also disable “forceReturnPath” in the Install-Tool.

Default

TRUE (1)

emailRecipients

Property

emailRecipients

Data type

String / cObj

Description

Comma separated list of recipients.

Default

emailSender

Property

emailSender

Data type

String / cObj

Description

Email address of the sender for notification emails.

Default

emailAdmin

Property

emailAdmin

Data type

String / cObj

Description

Email address of the administrator.

Default

sendTo

Property

sendTo

Data type

String / cObj

Description

Specify which persons will get an email (“none”, “recipients”, “user”, “both”)

Default

both

sendFrom

Property

sendFrom

Data type

String / cObj

Description

Specify which email address will be used as sender in emails to the recipients. Available are “sender” and “user”.

Default

sender

replyTo

Property

replyTo

Data type

String / cObj

Description

Add this emai as reply-to address to the notification emails. Select “user” for visitor's email address and “sender” for sender's email address.

Default

user

disableSwiftMailer

Property

disableSwiftMailer

Data type

Boolean / cObj

Description

Disable the usage of the SwiftMailer to send mails.

Default

FALSE (0)

disableOldMailApi

Property

disableOldMailApi

Data type

Boolean / cObj

Description

Disable the usage of the old mail API.

Default

FALSE (0)

showMaliciousInput

Property

showMaliciousInput

Data type

String / cObj

Description

Select which fields will get their last content if the Spam check fails. Use “none” to clear all fields, “clean” to show only Spam-free content and “all” to show all input.

Default

clean

adminMails

Property

adminMails

Data type

String / cObj

Description

Select the level for administrator notifications. Available are “none”, “bot”, “user”, “both”.

Default

bot

messageCount

Property

messageCount

Data type

Integer / cObj

Description

Specify how many emails one visitor is allowed to send.

Default

10

waitingTime

Property

waitingTime

Data type

Integer / cObj

Description

Time in minutes which the visitor has to wait if he has reached the max count before he can send emails again.

Default

60

postOnly

Property

postOnly

Data type

Boolean / cObj

Description

$_GET will be ignored and only $_POST values will be handled if activated.

Default

TRUE (1)

useRefererCheck

Property

useRefererCheck

Data type

Boolean / cObj

Description

Use referer check to recognize if the form was sent from current server (HTTP_REFERER).

Default

TRUE (1)

captchaSupport

Property

captchaSupport

Data type

String / cObj

Description

Extension key of a supported Captcha extension. Available are “sr_freecap”, “jm_recaptcha”, “captcha” and “mathguard”.

Default

spamDateFormat

Property

spamDateFormat

Data type

String / cObj

Description

Use a valid "strftime" format to display date in Spam notification.

Default

spamTimeFormat

Property

spamTimeFormat

Data type

String / cObj

Description

Use a valid "strftime" format to display time in Spam notification.

Default

enableLog

Property

enableLog

Data type

Boolean / cObj

Description

Log all valid requests into a database table.

Default

enableIPLog

Property

enableIPLog

Data type

Boolean / cObj

Description

Log IP address also (this is not allowed in some countries).

Default

highlightFields

Property

highlightFields

Data type

Boolean / cObj

Description

Activate to add the CSS class "error" to malicious fields.

Default

classError

Property

classError

Data type

String / cObj

Description

Define own class name to highlight malicious fields.

Default

classNoError

Property

classNoError

Data type

String / cObj

Description

Define a default class for fields without an error.

Default

infoWrapPositive

Property

infoWrapPositive

Data type

String / cObj

Description

Wrap around the status message if an email was successfully sent.

Default

infoWrapNegative

Property

infoWrapNegative

Data type

String / cObj

Description

Wrap around the status message if an email could not be sent.

Default

database

Property

database

Data type

cObj

Description

Database configuration for internal or external tables. Please notice, that the usage of external tables need the extension “adodb” to be installed. For more information see the “TypoScript - Database configuration Reference” in this manual.

database {
    table = tt_news
    useDefaultValues = 1

    fieldconf {
        name = TEXT
        name.data = GPvar : my_prefix|name
    }
}

Default

browsers

Property

browsers

Data type

cObj

Description

List of browser names and their identifier to check if the browser matches with user agent (HTTP_USER_AGENT). The PHP function “preg_match” is used to check the browser name.

browsers {
    firefox {
        name  = Mozilla Firefox
        ident = (Firebird)|(Firefox)
    }
    firefox30 {
        name  = Mozilla Firefox 3.0
        ident = Firefox/3.0
    }
}

Default

systems

Property

systems

Data type

cObj

Description

List of systems names and their identifier to check if the system matches with user agent (HTTP_USER_AGENT). The PHP function “preg_match” is used to check the system name.

systems {
    ubuntu {
        name  = Ubuntu
        ident = Ubuntu
    }
    ubuntu904 {
        name  = Ubuntu 9.04 (Jaunty Jackalope)
        ident = Ubuntu/9\.04
    }
}

Default

preUserFunc

Property

preUserFunc

Data type

String / cObj

Description

This option allows you to configure a userFunc which will be called before all checks and any rendering.

Default

submitUserFunc

Property

submitUserFunc

Data type

String / cObj

Description

This option allows you to configure a userFunc which will be called if the form was submitted.

Default

postUserFunc

Property

postUserFunc

Data type

String / cObj

Description

This option allows you to configure a userFunc which will be called after all checks and rendering before redirect or final output.

Default

[plugin.tx_spbettercontact_pi1]

plugin.tx_spbettercontact_pi1.fields

required

Property

required

Data type

Boolean / cObj

Description

Is it necessary that this field has input?

Default

FALSE (0)

minLength

Property

minLength

Data type

Integer / cObj

Description

Minimal length of the input.

Default

0

maxLength

Property

maxLength

Data type

Integer / cObj

Description

Maximal length of the input.

Default

0

default

Property

default

Data type

String / cObj

Description

Default value of this field.

Default

regex

Property

regex

Data type

String / cObj

Description

Check the input of this field with this Regular Expression. (preg_match is used)

Default

disallowed

Property

disallowed

Data type

String / cObj

Description

This signs are not allowed in input.

Default

allowed

Property

allowed

Data type

String / cObj

Description

Only this signs are allowed in input.

Default

[plugin.tx_spbettercontact_pi1.fields.<field name>]

plugin.tx_spbettercontact_pi1.database

driver

Property

driver

Data type

String / cObj

Description

Driver for an external database engine.

Notice: The extension will automatically activate and use the external database feature if you define one or more of these options: “driver”, “host”, “port”, “username”, “password”, “database”.

Default

host

Property

host

Data type

String / cObj

Description

Hostname or IP of an external database server.

Default

port

Property

port

Data type

String / cObj

Description

Port of an external database server.

Default

username

Property

username

Data type

String / cObj

Description

Username to login on an external database server.

Default

password

Property

password

Data type

String / cObj

Description

Password to login on an external database server.

Default

database

Property

database

Data type

String / cObj

Description

Database name which will be used on an external database server.

Default

table

Property

table

Data type

String / cObj

Description

Internal or external table name.

Default

force_charset

Property

force_charset

Data type

String / cObj

Description

Convert values to this charset before inserting them into an external table.

Default

idField

Property

idField

Data type

String / cObj

Description

Field which is used to identify rows in the configured table. Is used to check if an entry already exists. If so, the row will only be updated and no new row will be inserted.

Notice: This feature will only only be used if the field “uid” is configured in the “fieldconf” of your TypoScript setup.

Default

uid

useDefaultValues

Property

useDefaultValues

Data type

Boolean / cObj

Description

Insert default values for the fields “pid”, “tstamp”, “crdate” and “cruser_id”. These fields must not be configured in the “fieldconf” if this option is activated.

Default

fieldconf

Property

fieldconf

Data type

cObj

Description

Configuration of the fields to insert into a new or existing row in the configured table. Please notice, that “my_prefix” stands for the automatically generated or manually configured field name prefix of the Contact form. The prefix can be configured via TypoScript or Flexform (see example in the “TypoScript - Example configuration” chapter of this manual).

fieldconf {
    name = TEXT
    name.data = GPvar : my_prefix|name

    email = TEXT
    email.data = GPvar : my_prefix|email

    newsletter = TEXT
    newsletter.value = 1
}

Default

[plugin.tx_spbettercontact_pi1.database]

Example Configuration

plugin.tx_spbettercontact_pi1 {

    formTemplate         = fileadmin/your-template-file.html
    emailTemplate        = fileadmin/your-template-file.html
    stylesheetFile       = fileadmin/your-stlesheet-file.css
    emailRecipients      = recipient@your-domain.com
    emailSender          = Contact form <contact@your-domain.com>
    emailAdmin           = admin@your-domain.com
    replyTo              = user
    emailCharset         = utf-8
    showMaliciousInput   = clean
    adminMails           = bot
    messageCount         = 10
    waitingTime          = 60

    fields {
        name {
            required     = 1
            minLength    = 3
            maxLength    = 70
            regex        =
            disallowed   = 0123456789<>(){}!?%&§$/*+-\
            allowed      =
        }
        email {
            required     = 1
            minLength    = 5
            maxLength    = 70
            regex        = /^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}/
            disallowed   =
            allowed      =
        }
        message {
            required     = 1
            minLength    = 10
            maxLength    = 2000
            regex        =
            disallowed   = <>&
            allowed      =
        }
        privacy {
            required     = 1
            minLength    =
            maxLength    =
            regex        =
            disallowed   =
            allowed      =
        }
    }

    database {
        table            = tt_news
        useDefaultValues = 1

        fieldconf {
            title = TEXT
            title.data = GPvar : tx_spbettercontact_pi1-9|name

            bodytext = TEXT
            bodytext.data = GPvar : tx_spbettercontact_pi1-9|message
        }
    }

}

Page TSConfig

With the Page TSConfig you are allowed to manipulate the Backend module with your own HTML-Templates or language file. Have a look into the file “ext_ts_config.txt” in extension's main directory and into the example configuration in the “Page TSConfig - Example configuration” chapter in this manual.

mod.tx_spbettercontact_modfunc1

mainTemplate

Property

mainTemplate

Data type

String

Description

Template file for the log table in Backend module.

Default

csvTemplate

Property

csvTemplate

Data type

String

Description

Template file for the CSV export of the log table.

Default

stylesheetFile

Property

stylesheetFile

Data type

String

Description

Style sheet file for the log table in Backend module.

Default

javascriptFile

Property

javascriptFile

Data type

String

Description

Javascript file for the log table in Backend module.

Default

locallangFile

Property

locallangFile

Data type

String

Description

Language file for the log table and CSV file.

Default

disableAutoTemplates

Property

disableAutoTemplates

Data type

Boolean

Description

Disable the usage of default templates as a replacement for not configured ones.

Default

FALSE (0)

dateFormat

Property

dateFormat

Data type

String

Description

Use a valid "strftime" format to display date in log table and CSV.

Default

[mod.tx_spbettercontact_modfunc1]

Example Configuration

mod.tx_spbettercontact_modfunc1 {

    mainTemplate        = fileadmin/your-backend-template.html
    csvTemplate         = fileadmin/your-csv-template.html
    stylesheetFile      = fileadmin/your-stylesheet.html
    locallangFile       = fileadmin/your-locallang-file.xml
    dateFormat          = %Y-%m-%d

}

Template Marker

Frontend

Available markers for Frontend templates (see examples in “res/templates/examples/” in extension's main directory):

###URL_SELF###

Property

###URL_SELF###

Description

Form action. Required!

Example

action="###URL_SELF###"

###INFO###

Property

###INFO###

Description

Displays status messages (e.g. if message was sent or not).

Example

###HIDDEN###

Property

###HIDDEN###

Description

Hidden fields for Spam detection. Required!

Example

###SUBMIT###

Property

###SUBMIT###

Description

Name of the submit button. Required!

Example

name="###SUBMIT###"

###SUBMIT_VALUE###

Property

###SUBMIT_VALUE###

Description

Value of the submit button.

Example

value=”###SUBMIT_VALUE###”

###CHARSET###

Property

###CHARSET###

Description

Character set of the form. Required!

Example

accept-charset="###CHARSET###"

###ANCHOR###

Property

###ANCHOR###

Description

Adds an anchor to the form to jump directly to.

Example

<a id="###ANCHOR###" />

###MESSAGES###

Property

###MESSAGES###

Description

Display all error messages as unordered list (<ul></ul>).

Example

###MSG_<FIELDNAME>###

Property

###MSG_<FIELDNAME>###

Description

Display a single message for one field.

Example

<p>###MSG_EMAIL###</p>

###VALUE_<FIELDNAME>###

Property

###VALUE_<FIELDNAME>###

Description

Default or old value of a single input field.

Example

value=”###VALUE_EMAIL###”

###CHECKED_<FIELDNAME>###

Property

###CHECKED_<FIELDNAME>###

Description

Checked state of a check box or radio button. (See example in file “res/templates/examples/checkbox_radiobutton_select.html” in extension's main directory)

Example

###CHECKED_PRIVACY###

###CHECKED_<FIELDNAME>_[<LABEL>]###

Property

###CHECKED_<FIELDNAME>_[<LABEL>]###

Description

Checked state of a radio group. (See example in file “res/templates/examples/checkbox_radiobutton_select.html” in extension's main directory)

Example

###CHECKED_GENDER_[###LLL:male###]###

###SELECTED_<FIELDNAME>_[<LABEL>]###

Property

###SELECTED_<FIELDNAME>_[<LABEL>]###

Description

Selected state of a select field option. (See example in file “res/templates/examples/checkbox_radiobutton_select.html” in extension's main directory)

Example

###SELECTED_REASON_[###LLL:support###]###

###LABEL_<FIELDNAME>###

Property

###LABEL_<FIELDNAME>###

Description

Label for a single input field.

Example

<label for="###EMAIL###">###LABEL_EMAIL###</label>

###SPAM_DATE###

Property

###SPAM_DATE###

Description

Exact date of the Spam attack.

Example

###SPAM_TIME###

Property

###SPAM_TIME###

Description

Exact time of the Spam attack.

Example

###SPAM_IP###

Property

###SPAM_IP###

Description

IP address of the attacker.

Example

###SPAM_METHOD###

Property

###SPAM_METHOD###

Description

Method of how the form was sent (GET / POST)

Example

###SPAM_BROWSER###

Property

###SPAM_BROWSER###

Description

Browser of the attacker.

Example

###SPAM_SYSTEM###

Property

###SPAM_SYSTEM###

Description

Operating system of the attacker.

Example

###SPAM_AGENT##

Property

###SPAM_AGENT##

Description

User agent of the attacker.

Example

###SPAM_REFERER###

Property

###SPAM_REFERER###

Description

Shows the URL where the attacker comes from.

Example

###SPAM_VALUE_<FIELDNAME>###

Property

###SPAM_VALUE_<FIELDNAME>###

Description

Value of a single hidden field. Bots fill them with values.

Example

###SPAM_VALUE_EMAIL###

###SPAM_CHECKED_<FIELDNAME>###

Property

###SPAM_CHECKED_<FIELDNAME>###

Description

Checked state of a hidden check box or hidden radio button. A bot will fill it with a value.

Example

###SPAM_CHECKED_PRIVACY###

###<YOUR_OWN_TS_MARKER>###

Property

###<YOUR_OWN_TS_MARKER>###

Description

Your own marker. Define it via TypoScript and add it in upper case.

Example

###MY_MARKER###

###LLL:<label_name>###

Property

###LLL:<label_name>###

Description

Own locallang labels. Define it in your additional locallang file.

Example

###LLL:my_label###

###PAGE:<db_fieldname>###

Property

###PAGE:<db_fieldname>###

Description

Display information about current page (e.g. uid, title, ...).

Example

###PAGE:uid###

###PLUGIN:<db_fieldname>###

Property

###PLUGIN:<db_fieldname>###

Description

Display information about the current Plugin content element (e.g. uid, title, ...).

Example

###PLUGIN:title###

###USER:<db_fieldname>###

Property

###USER:<db_fieldname>###

Description

Current Frontend user information like username or email address (if logged in).

Example

###USER:email###

###CAPTCHA_DATA###

Property

###CAPTCHA_DATA###

Description

Contains the whole Captcha output if a Captcha extension is configured. You can use this also instead of the extensions own markers for “sr_freecap” and “captcha”.

Example

###CAPTCHA_FILE###

Property

###CAPTCHA_FILE###

Description

Contains the file name of the Captcha image created automatically by the “captcha” extension.

Example

<img src="###CAPTCHA_FILE###" alt="captcha image" />

###SR_FREECAP_NOTICE###

Property

###SR_FREECAP_NOTICE###

Description

The notice text of the sr_freecap extension.

Example

###SR_FREECAP_CANT_READ###

Property

###SR_FREECAP_CANT_READ###

Description

The “can't read” text and link of the sr_freecap extension.

Example

###SR_FREECAP_IMAGE###

Property

###SR_FREECAP_IMAGE###

Description

The Captcha image of the sr_freecap extension.

Example

###SR_FREECAP_ACCESSIBLE###

Property

###SR_FREECAP_ACCESSIBLE###

Description

Link for the spoken version of the characters displayed in the Captcha image of the sr_freecap extension.

Example

###CAPTCHA_FIELD###

Property

###CAPTCHA_FIELD###

Description

If a Captcha support is activated in Flexform or TypoScript for any supported Captcha extension, this marker will be replaced with sub- template content of the selected extension. (See main HTML-Template in file “res/templates/frontend/form.html” in extension's main directory)

Example

###SUB_TEMPLATE_<EXT_KEY>###

Property

###SUB_TEMPLATE_<EXT_KEY>###

Description

Sub-template for the supported Captcha extensions. Outputs the Captcha itself, an input field and the label.

Example

Backend

Available markers for Backend templates (see default ones in “res/templates/backend/” in extension's main directory):

###URL_SELF###

Property

###URL_SELF###

Description

Current URL.

Example

action="###URL_SELF###"

###IMAGE_PATH###

Property

###IMAGE_PATH###

Description

Path to theme icon folder.

Example

src="###IMAGE_PATH###/csv.gif"

###INFO###

Property

###INFO###

Description

Displays status messages.

Example

###<FIELDNAME>###

Property

###<FIELDNAME>###

Description

Displays the content from any db field of the internal log table.

Example

###AGENT###

###VALUE_<FIELDNAME>###

Property

###VALUE_<FIELDNAME>###

Description

Default or last value of a single input field from Frontend.

Example

###VALUE_EMAIL###

###FE_USER_<DB_FIELDNAME>###

Property

###FE_USER_<DB_FIELDNAME>###

Description

The UID of a frontend user will be stored in the log table if he was logged in while he sent a request. With this marker you can display the db fields of the user.

Notice: This markers are only available if the field “cruser_id” in current log table row contains the uid of the Frontend-User.

Example

###FE_USER_NAME###

###INPUT_HTML###

Property

###INPUT_HTML###

Description

Displays the whole user input with HTML linebreaks and each fieldname <–> value set in a single row.

Example

###INPUT_PLAIN###

Property

###INPUT_PLAIN###

Description

Displays the whole user input with plain linebreaks and each fieldname <–> value set in a single row.

Example

###LLL:<label_name>###

Property

###LLL:<label_name>###

Description

Own locallang labels. Define it in your additional locallang file.

Example

###LLL:my_label###

###USER:<DB_FIELDNAME>###

Property

###USER:<DB_FIELDNAME>###

Description

Current Backend user information like username or email address.

Example

###USER:email###

Additional References

Frontend User Session

Some information like the uid of last inserted table row or the complete user input will be stored into user session. You can call this information in the PHP-Script of your extension with the following keys:

lastEntryID

Key

lastEntryID

Description

UID of the Plugin which has inserted the last session entry.

Notice: The first level of the session contains an array which holds the informations in the rows below this one for each sent request with the Plugin UID as key:

$aSession = array (
  45 => array(
    'lastLogRowID' => 8,
    'tstmp'        => 1275687072
    // ...
  ),
  32 => array(
    // ...
  ),
  'lastEntryID' => 45,
);

Example

$aSession   = $GLOBALS['TSFE']->fe_user->getKey(
  'ses',
  'sp_bettercontact'
);
$iLastUID   = (int) $aSession['lastEntryID'];

// Get session content for the last sent Contact form
$aContent   = $aSession[$iLastUID];
lastLogRowID

Key

lastLogRowID

Description

UID of the last inserted row into the internal log table.

Notice: The values of the request are stored into log table in form of an JSON string. You can decode the data with the following lines:

$aInput = json_decode(
  $aRow['params'],
  TRUE
);

Example

// ...
$iLastLogID = (int) $aContent['lastLogRowID'];
lastRowID

Key

lastRowID

Description

UID of the last inserted row into a user defined internal table or configured unique identifier (“idField”) of the last inserted row to a user defined external table.

Example

// ...
$iLastID    = (int) $aContent['lastRowID'];
tstmp

Key

tstmp

Description

Timestamp of the last request.

Example

// ...
$iTimestamp = (int) $aContent['tstmp'];
cnt

Key

cnt

Description

Count of requests made from this Frontend user in this session.

Example

// ...
$iCount     = (int) $aContent['cnt'];
gpVars

Key

gpVars

Description

Complete user input in form of an array.

Example

// ...
$aGPVars    = $aContent['gpVars'];

How-to

How can I define a default value?

You can define a default value in your TypoScript field configuration:

cObj

Type of default value

cObj

Configuration

plugin.tx_spbettercontact_pi1 {
    fields {
        reason {
            required     = 1
            default      = TEXT
            default.data = LLL:EXT:sp_bettercontact/pi1/locallang.xml:support
        }
    }
}
Boolean / Integer

Type of default value

Boolean / Integer

Configuration

plugin.tx_spbettercontact_pi1 {
    fields {
        privacy {
            required     = 1
            default      = 1
        }
    }
}
String

Type of default value

String

Configuration

plugin.tx_spbettercontact_pi1 {
    fields {
        name {
            required     = 1
            default      = Your name here...
        }
    }
}

How can I use a checkbox, radio group or select field?

Since version 2.2.4 you are able to use check boxes, radio buttons and select options in the form. All you have to do for this, is to use a special syntax for the fields:

Checkbox

Field type

Checkbox

HTML

<input type="checkbox" name="###PRIVACY###" ###CHECKED_PRIVACY### />
Radio group

Field type

Radio group

HTML

<input type="radio" name="###GENDER###" value="###LLL:male###" ###CHECKED_GENDER_[###LLL:male###]### />
<input type="radio" name="###GENDER###" value="###LLL:female###" ###CHECKED_GENDER_[###LLL:female###]### />
Select field

Field type

Select field

HTML

<select name="###REASON###">
  <option ###SELECTED_REASON_[###LLL:general###]###>###LLL:general###</option>
  <option ###SELECTED_REASON_[###LLL:support###]###>###LLL:support###</option>
</select>

As you see here, it's important, that you use for radio buttons and select options the same marker for the field value and in the squared brackets of the special marker.

How can I use the Captcha support?

Since version 2.2.0 you are able to use Captcha extensions with the Contact form. You have to follow this two steps to do that:

Install a supported Captcha extension (sr_freecap, jm_recaptcha, captcha or mathguard) with the extension manager.

Select your installed Captcha extension with “Activate Captcha support for” in tab “Spam”, save the Plugin, clear your Frontend cache and enjoy ;-)

How can I configure my database fields?

Since version 2.4.0 you are able to use internal and external database tables to store user input into it. All you have to do for this, is to configure a table and the fields (these are examples, you can do nearly everything, what's is possible with TypoScript):

Static text

Value type

Static text

Configuration

plugin.tx_spbettercontact_pi1.database.fieldconf {
    deleted = 0
    hidden  = 0
}
Dynamic text

Value type

Dynamic text

Configuration

plugin.tx_spbettercontact_pi1.database.fieldconf {
    comment = TEXT
    comment.value = This is a dynamic comment
}
Current Page ID

Value type

Current Page ID

Configuration

plugin.tx_spbettercontact_pi1.database.fieldconf {
    pid = TEXT
    pid.data = TSFE : id
}
Current Frontend user information

Value type

Current Frontend user information

Configuration

plugin.tx_spbettercontact_pi1.database.fieldconf {
    cruser_id = TEXT
    cruser_id.data = TSFE : fe_user|user|uid
}
Current timestamp

Value type

Current timestamp

Configuration

plugin.tx_spbettercontact_pi1.database.fieldconf {
    crdate = TEXT
    crdate.data = date : U
}
$_GET or $_POST values

Value type

$_GET or $_POST values

Configuration

plugin.tx_spbettercontact_pi1.database.fieldconf {
    # '9' is the uid of the Better Contact plugin on this page
    firstname = TEXT
    firstname.data = GPvar : tx_spbettercontact_pi1-9|firstname
}
External TypoScript file

Value type

External TypoScript file

Configuration

<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/my_setup.txt">

Notice: If you use these examples in the “fieldconf” field in the database tab of the Flexform you have to remove the first and last line. All you need are the lines between the brackets.

Tip: The uid of the last inserted or updated dataset will be stored for each Contact form into Frontend user session (see “Frontend-User Session Reference” chapter in this manual).

Important: If you include an external TypoScript configuration file, independent of where you declare it (Flexform or TypoScript), you have to configure the Better Contact form with “plugin.tx_spbettercontact_pi1 { … }” in this file.

How can I disable the emailing?

Since version 2.4.2 you are able to disable all email sending with one of the following steps:

Choose “Nobody” in field “Send emails to” in Tab “Emails” in Flexform configuration.

Set “sendTo” to “none” in your TypoScript configuration.

Appendix

Known problems

Actually nothing. But if you know something, give me feedback via email or make a bug report at my project on http://forge.typo3.org/projects/show/extension-sp_bettercontact .

Bugs and features

Please use the bugtracker on forge.typo3.org to report bugs or request new features.

Changelog

2.5.1

Version

2.5.1

Date

2012-08-10

Changes

  • Fixed issue #37093 (Error HTTP 500)
  • Fixed issue #35206 (Hook for changing the recipients)
  • Added Polish translation for Frontend labels (Thanks to Thomas Weber)

2.5.0

Version

2.5.0

Date

2012-02-18

Changes

  • Fixed issue #31884 (Language markers broken)
  • Fixed issue #30600 (Clear all fields if successfully sent)
  • Fixed issue #25750 (Spam fields filled with valid entries)
  • Fixed issue #12843 (Validation failed)
  • Fixed the output of the info module
  • Use SwiftMailer if “substituteOldMailAPI” is active

2.4.4

Version

2.4.4

Date

2010-10-13

Changes

  • Rewritten log module template
  • Added possibility to delete log entries
  • Fixed initialization of csConvObject
  • Fixed speaking results of checkbox states in emails
  • Added possibility to force a PID where log entries will be stored (via TypoScript)
  • Externalized labels from email template
  • Added required marker to captcha labels
  • Edited manual

2.4.3

Version

2.4.3

Date

2010-08-10

Changes

  • Fixed XCLASS handling
  • Fixed manual

2.4.2

Version

2.4.2

Date

2010-07-15

Changes

  • Added French translation (Thanks to Sébastien Delcroix)
  • Fixed TemplaVoila wizard for new content elements
  • Appand plugin to content type list if no form section exists
  • Added option to send no emails (e.g. if you only want to use db storing)
  • Added option to choose the sender address for emails to recipients
  • Fixed length of extension description
  • Updated screenshots in manual

2.4.1

Version

2.4.1

Date

2010-06-30

Changes

  • Fixed manual
  • Added userFunc which will be called if form was submitted
  • Fixed comment line detection in Flexform-TypoScript-parser

2.4.0

Version

2.4.0

Date

2010-06-16

Changes

  • HTML email support
  • Logging of successfully sent requests
  • Backend module to analyze log report
  • CSV export of the log report
  • DB support for internal and external tables (“adodb” is required to use external tables)
  • The complete user input and the last log table entry ID will be stored into Frontend-User session
  • Last inserted row in a user defined table will also be stored into Frontend-User session
  • Redirect to a configured page in case of success, error, too many sendings or Spam
  • Added Captcha-support for extension “mathguard”
  • Rewritten charset handling and encoding using TYPO3 methods
  • The CSS class for highlighted (error) fields and a no-error class can be configured
  • Marker for required fields
  • Markers for Frontend-User-, Page- and Plugin-information
  • Fixed redirection bug with RealURL
  • Now only missing templates will be replaced with default ones
  • Date and time in Spam emails can be configured
  • Removed “display:none” in HTML templates
  • Form fields will be prefixed with an automatic unique or user configured name
  • Form fields can be cleared if form was successfully sent
  • Added hook declarations for pre- and post-userFunc to main method
  • Removed support for TYPO3 below 4.2.0
  • Default piVars can be be configured via “_DEFAULT_PI_VARS”
  • Reordered extension folders and files

2.3.5

Version

2.3.5

Date

2010-01-12

Changes

Replaced deprecated function “eregi” with “preg_match”

2.3.4

Version

2.3.4

Date

2010-01-12

Changes

Small correction in manual

2.3.3

Version

2.3.3

Date

2010-01-12

Changes

Show Contact form in new content element wizard in TYPO3 v. 4.3 (Fixed XCLASS definition)

2.3.2

Version

2.3.2

Date

2010-01-12

Changes

Show Contact form in new content element wizard in TYPO3 v. 4.3

2.3.1

Version

2.3.1

Date

2009-12-03

Changes

Fixed mailing problem with empty Return-Path.

2.3.0

Version

2.3.0

Date

2009-09-16

Changes

  • Fixed compatibility problems with TYPO3 versions below 4.2.x
  • Improved the Captcha inclusion. Added highlighting for malicious fields
  • Fixed a problem with the encoding of own labels.

2.2.9

Version

2.2.9

Date

2009-09-03

Changes

Show Captcha error and other error messages at the same time

2.2.8

Version

2.2.8

Date

2009-09-01

Changes

Fixed the output of the MESSAGES-Marker

2.2.7

Version

2.2.7

Date

2009-08-30

Changes

  • Fixed small bugs, added option to deactivate referer check
  • Added option to select which persons will get an email (recipients, user, both)
  • Added option to define return-path, added xclass-able Flexform configuration

2.2.6

Version

2.2.6

Date

2009-08-26

Changes

Fixed a problem with user defined markers

2.2.5

Version

2.2.5

Date

2009-08-26

Changes

Fixed a problem with radio buttons and select options

2.2.4

Version

2.2.4

Date

2009-08-26

Changes

Added possibility to use selects in form, added how-to to manual

2.2.3

Version

2.2.3

Date

2009-08-25

Changes

Fixed a problem with Spam check, added possibility to use check boxes and radio buttons

2.2.2

Version

2.2.2

Date

2009-08-24

Changes

Fixed a problem with error messages

2.2.1

Version

2.2.1

Date

2009-08-21

Changes

Added placeholder for allowed and disallowed characters in error messages

2.2.0

Version

2.2.0

Date

2009-08-19

Changes

  • Added Captcha support
  • Added possibility to select reply-to address for notifications
  • PHP5 is now required

2.1.1

Version

2.1.1

Date

2009-05-18

Changes

Fixed iteration on an empty array while using multiple languages

2.1.0

Version

2.1.0

Date

2009-05-13

Changes

Fixed a problem with mailings

2.0.9

Version

2.0.9

Date

2009-04-07

Changes

Fixed email headers

2.0.8

Version

2.0.8

Date

2009-03-24

Changes

Add functionality to add own TypoScript and locallang markers to form and email templates

2.0.7

Version

2.0.7

Date

2009-03-24

Changes

Another small fix in manual

2.0.6

Version

2.0.6

Date

2009-03-23

Changes

Fixed a mailing problem

2.0.5

Version

2.0.5

Date

2009-03-23

Changes

Small correction in manual

2.0.4

Version

2.0.4

Date

2009-03-22

Changes

Small correction in change log

2.0.3

Version

2.0.3

Date

2009-03-22

Changes

First public beta of the second version

2.0.2

Version

2.0.2

Date

2009-03-22

Changes

Fixed problem with special characters and character set in emails

2.0.1

Version

2.0.1

Date

2009-03-22

Changes

Some fixes

2.0.0

Version

2.0.0

Date

2009-03-22

Changes

Completely rewritten code and functionally

1.1.1

Version

1.1.1

Date

2007-06-03

Changes

Another small fix

1.1.0

Version

1.1.0

Date

2007-05-29

Changes

Final stable version

1.0.1

Version

1.0.1

Date

2007-05-29

Changes

Some small fixes in code and manual

1.0.0

Version

1.0.0

Date

2007-05-27

Changes

Initial release

img-2 26