Documentation

Contact extends ContactLib

Contact

This module handles all HTML FORMs with action tags to the contact section. It sends the contact email(s) and uploads data (optional) Ex. <FORM name="form1" action="index.php?section=Contact&cmd=thanks" method="post">

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Cloudrexx Development Team info@cloudrexx.com

version
1.1.0
subpackage

coremodule_contact

Table of Contents

Constants

CHECK_TYPE_ALL  = 1
CHECK_TYPE_ALPHA  = 4
CHECK_TYPE_EMAIL  = 2
CHECK_TYPE_INTEGER  = 5
CHECK_TYPE_PHONE  = 6
CHECK_TYPE_URL  = 3
UPLOAD_DIR  = '/images/attach/'
SUBMISSION_ERROR_CAPTCHA_FAILED  = 1 << 8
Error: CAPTCHA validation failed.
SUBMISSION_ERROR_CSRF_FAILED  = 1 << 0
Error: CSRF token validation failed.
SUBMISSION_ERROR_DB_INSERT_FAILED  = 1 << 7
Error: Database insert operation failed.
SUBMISSION_ERROR_FIELD_CONTAINS_SPAM  = 1 << 10
Error: Submission field content was flagged as spam.
SUBMISSION_ERROR_MESSAGES  = [self::SUBMISSION_ERROR_CSRF_FAILED => 'TXT_CONTACT_SUBMISSION_ERROR_CSRF_FAILED', self::SUBMISSION_ERROR_UPLOAD_INIT_FAILED => 'TXT_CONTACT_UPLOAD_INIT_FAILED', self::SUBMISSION_ERROR_UPLOAD_FAILED => 'TXT_CONTACT_FILE_UPLOAD_FAILED', self::SUBMISSION_ERROR_UPLOAD_FAILED_EXCEEDED_LIMIT => 'TXT_CONTACT_FILE_SIZE_EXCEEDS_LIMIT', self::SUBMISSION_ERROR_UPLOAD_FAILED_TOO_LARGE => 'TXT_CONTACT_FILE_TOO_LARGE', self::SUBMISSION_ERROR_UPLOAD_FAILED_CORRUPT => 'TXT_CONTACT_FILE_CORRUPT', self::SUBMISSION_ERROR_UPLOAD_FAILED_NOT_ALLOWED => 'TXT_CONTACT_FILE_EXTENSION_NOT_ALLOWED', self::SUBMISSION_ERROR_DB_INSERT_FAILED => 'TXT_CONTACT_FAILED_SUBMIT_REQUEST', self::SUBMISSION_ERROR_CAPTCHA_FAILED => 'TXT_CONTACT_SUBMISSION_ERROR_CAPTCHA_FAILED', self::SUBMISSION_ERROR_REQUIRED_FIELD_MISSING => 'TXT_CONTACT_SUBMISSION_ERROR_REQUIRED_FIELD_MISSING', self::SUBMISSION_ERROR_FIELD_CONTAINS_SPAM => 'TXT_CONTACT_SUBMISSION_ERROR_FIELD_CONTAINS_SPAM']
Maps submission error codes to their corresponding localization keys.
SUBMISSION_ERROR_REQUIRED_FIELD_MISSING  = 1 << 9
Error: A required field was missing in the submission.
SUBMISSION_ERROR_UPLOAD_FAILED  = 1 << 2
Error: General file upload failure.
SUBMISSION_ERROR_UPLOAD_FAILED_CORRUPT  = 1 << 5
Error: Uploaded file is corrupt or unreadable.
SUBMISSION_ERROR_UPLOAD_FAILED_EXCEEDED_LIMIT  = 1 << 3
Error: Uploaded file exceeds allowed limit.
SUBMISSION_ERROR_UPLOAD_FAILED_NOT_ALLOWED  = 1 << 6
Error: Uploaded file type is not allowed.
SUBMISSION_ERROR_UPLOAD_FAILED_TOO_LARGE  = 1 << 4
Error: Uploaded file is too large.
SUBMISSION_ERROR_UPLOAD_INIT_FAILED  = 1 << 1
Error: File upload initialization failed.

Properties

$_arrSettings  : mixed
$arrCheckTypes  : mixed
Regexpression list
$arrFormFields  : array<string|int, mixed>
List with the names of the formular fields
$arrForms  : mixed
$errorMsg  : mixed
Contains the error message if an error occurs
$objTemplate  : unknown_type
Template object
$_arrRecipients  : mixed
$_lastRecipientId  : mixed
$depositionTarget  : string
used by @link Contact::_uploadFiles() .
$error  : int
Bitmask representing the current submission errors.
$hasFileField  : bool
Determines whether this form has a file upload field.
$legacyMode  : bool
Legacy file upload mode

Methods

_checkValues()  : bool
Checks the Values sent trough post
_deleteFormRecipients()  : bool
delete recipients
_getContactFormData()  : mixed
Get data from contact form submit
_getEmailAdressOfString()  : mixed
Searches for a valid e-mail address
_getJsSourceCode()  : mixed
Get Javascript Source
_insertIntoDatabase()  : bool
Inserts the contact form submit into the database
_isSpam()  : bool
Checks a string for spam keywords
_sortFormData()  : int
Sort the form input data
_uploadFilesLegacy()  : array<string|int, mixed>
Upload submitted files
addForm()  : mixed
Add a new form
deleteFormEntry()  : mixed
getContactFormCaptchaStatus()  : mixed
getContactFormDetails()  : mixed
getContactPage()  : mixed
Parse contact form page
getFormEntries()  : mixed
getFormEntry()  : mixed
getFormFieldNames()  : mixed
getFormFields()  : array<string|int, mixed>
Get the form fields
getHighestSortValue()  : int
return the highest sort value of a recipient list
getLastRecipientId()  : int
return the last recipient id
getRecipients()  : array<string|int, mixed>
Return the recipients of a form
getSettings()  : mixed
initCheckTypes()  : mixed
initContactForms()  : mixed
Read the contact forms
initSettings()  : mixed
isUniqueFormName()  : bool
Check if there already exist a form with this name
updateForm()  : mixed
Update an existing form
uploadFinished()  : mixed
_uploadFiles()  : array<string|int, mixed>
Handle uploads
addFormField()  : int
Add a form field to the database
addRecipient()  : mixed
Add a new recipient
cleanFormFields()  : mixed
Remove the form fields that are not in the given list
cleanRecipients()  : mixed
Delete the recipients that aren't wanted anymore
deleteForm()  : mixed
Delete a form
dropUploads()  : mixed
Drop any submitted files in case the storage of form submission is not allowed
getErrorMessages()  : array<string|int, mixed>
Retrieves a list of error messages based on the current error state.
getFormEntity()  : mixed
Get the form entity
getLegacyError()  : string
Get the error message
getTemporaryUploadPath()  : array<string|int, mixed>
Gets the temporary upload location for files.
hasError()  : bool
Checks whether any error has been set.
insertFormLangValues()  : mixed
Insert the language values, update them if they already exist
setError()  : void
Adds an error code to the current error state.
setFormFieldLang()  : mixed
Add a form lang to a field
showError()  : string
Renders the error messages within the provided template.
showFeedback()  : void
Displays the feedback message within the provided template.
updateFormField()  : mixed
Update a form field
updateRecipient()  : mixed
Update the recipient
sendMail()  : mixed
Sends an email with the contact details to the responsible persons

Constants

UPLOAD_DIR

public string UPLOAD_DIR = '/images/attach/'

Default upload directory

SUBMISSION_ERROR_CAPTCHA_FAILED

Error: CAPTCHA validation failed.

protected mixed SUBMISSION_ERROR_CAPTCHA_FAILED = 1 << 8

SUBMISSION_ERROR_CSRF_FAILED

Error: CSRF token validation failed.

protected mixed SUBMISSION_ERROR_CSRF_FAILED = 1 << 0

SUBMISSION_ERROR_DB_INSERT_FAILED

Error: Database insert operation failed.

protected mixed SUBMISSION_ERROR_DB_INSERT_FAILED = 1 << 7

SUBMISSION_ERROR_FIELD_CONTAINS_SPAM

Error: Submission field content was flagged as spam.

protected mixed SUBMISSION_ERROR_FIELD_CONTAINS_SPAM = 1 << 10

SUBMISSION_ERROR_MESSAGES

Maps submission error codes to their corresponding localization keys.

protected array<int, string> SUBMISSION_ERROR_MESSAGES = [self::SUBMISSION_ERROR_CSRF_FAILED => 'TXT_CONTACT_SUBMISSION_ERROR_CSRF_FAILED', self::SUBMISSION_ERROR_UPLOAD_INIT_FAILED => 'TXT_CONTACT_UPLOAD_INIT_FAILED', self::SUBMISSION_ERROR_UPLOAD_FAILED => 'TXT_CONTACT_FILE_UPLOAD_FAILED', self::SUBMISSION_ERROR_UPLOAD_FAILED_EXCEEDED_LIMIT => 'TXT_CONTACT_FILE_SIZE_EXCEEDS_LIMIT', self::SUBMISSION_ERROR_UPLOAD_FAILED_TOO_LARGE => 'TXT_CONTACT_FILE_TOO_LARGE', self::SUBMISSION_ERROR_UPLOAD_FAILED_CORRUPT => 'TXT_CONTACT_FILE_CORRUPT', self::SUBMISSION_ERROR_UPLOAD_FAILED_NOT_ALLOWED => 'TXT_CONTACT_FILE_EXTENSION_NOT_ALLOWED', self::SUBMISSION_ERROR_DB_INSERT_FAILED => 'TXT_CONTACT_FAILED_SUBMIT_REQUEST', self::SUBMISSION_ERROR_CAPTCHA_FAILED => 'TXT_CONTACT_SUBMISSION_ERROR_CAPTCHA_FAILED', self::SUBMISSION_ERROR_REQUIRED_FIELD_MISSING => 'TXT_CONTACT_SUBMISSION_ERROR_REQUIRED_FIELD_MISSING', self::SUBMISSION_ERROR_FIELD_CONTAINS_SPAM => 'TXT_CONTACT_SUBMISSION_ERROR_FIELD_CONTAINS_SPAM']

These constants define specific error conditions that may occur during submission handling, such as file upload issues, CSRF failures, or spam detection. The array is used to retrieve localized error messages based on the bitmask stored in $this->error.

SUBMISSION_ERROR_REQUIRED_FIELD_MISSING

Error: A required field was missing in the submission.

protected mixed SUBMISSION_ERROR_REQUIRED_FIELD_MISSING = 1 << 9

SUBMISSION_ERROR_UPLOAD_FAILED

Error: General file upload failure.

protected mixed SUBMISSION_ERROR_UPLOAD_FAILED = 1 << 2

SUBMISSION_ERROR_UPLOAD_FAILED_CORRUPT

Error: Uploaded file is corrupt or unreadable.

protected mixed SUBMISSION_ERROR_UPLOAD_FAILED_CORRUPT = 1 << 5

SUBMISSION_ERROR_UPLOAD_FAILED_EXCEEDED_LIMIT

Error: Uploaded file exceeds allowed limit.

protected mixed SUBMISSION_ERROR_UPLOAD_FAILED_EXCEEDED_LIMIT = 1 << 3

SUBMISSION_ERROR_UPLOAD_FAILED_NOT_ALLOWED

Error: Uploaded file type is not allowed.

protected mixed SUBMISSION_ERROR_UPLOAD_FAILED_NOT_ALLOWED = 1 << 6

SUBMISSION_ERROR_UPLOAD_FAILED_TOO_LARGE

Error: Uploaded file is too large.

protected mixed SUBMISSION_ERROR_UPLOAD_FAILED_TOO_LARGE = 1 << 4

SUBMISSION_ERROR_UPLOAD_INIT_FAILED

Error: File upload initialization failed.

protected mixed SUBMISSION_ERROR_UPLOAD_INIT_FAILED = 1 << 1

Properties

$arrFormFields

List with the names of the formular fields

public array<string|int, mixed> $arrFormFields = array()

$errorMsg

Contains the error message if an error occurs

public mixed $errorMsg = ''

This variable will contain a message that describes the error that happend.

$objTemplate

Template object

public unknown_type $objTemplate

This object contains an instance of the \Cx\Core\Html\Sigma class which is used as the template system.

$depositionTarget

used by @link Contact::_uploadFiles() .

protected string $depositionTarget

remembers the directory made in the first call to _uploadFiles.

$error

Bitmask representing the current submission errors.

protected int $error = 0

Each bit corresponds to a specific error condition as defined by the SUBMISSION_ERROR_* constants. Multiple errors can be combined using bitwise OR.

$hasFileField

Determines whether this form has a file upload field.

protected bool $hasFileField = false

$legacyMode

Legacy file upload mode

protected bool $legacyMode = false

In legacy file upload mode, file uploads are coming directly from inputs, rather than being handled by the cloudrexx Uploader component.

Q: What is the legacyMode for? A: With legacyMode we support the old submission forms that hadn't been migrated to the new Uploader component or if you want to build a submission form without JavaScript.

TRUE if file uploads are handled the legacy way (through HTTP Form POST).

Methods

_checkValues()

Checks the Values sent trough post

public _checkValues(mixed $arrFields, mixed $useCaptcha) : bool

Checks the Values sent trough post. Normally this is already done by Javascript, but it could be possible that the client doens't run JS, so this is done here again. Sadly, it is not possible to rewrite the posted values again

Parameters
$arrFields : mixed
$useCaptcha : mixed
Tags
access

private

global

array

see
getSettings()
see
initCheckTypes()
see
arrCheckTypes
see
_isSpam()
see
errorMsg
Return values
bool

Return FALSE if a field's value isn't valid, otherwise TRUE

_deleteFormRecipients()

delete recipients

public _deleteFormRecipients(int $id) : bool
Parameters
$id : int
Return values
bool

_getContactFormData()

Get data from contact form submit

public _getContactFormData() : mixed

Reads out the data that has been submited by the visitor.

Tags
access

private

global

array

global

array

see
getContactFormDetails()
see
getFormFields()
see
_uploadFiles()
Return values
mixed

An array with the contact details or FALSE if an error occurs

_getEmailAdressOfString()

Searches for a valid e-mail address

public _getEmailAdressOfString(string $string) : mixed

Returns the first e-mail address that occours in the given string $string

Parameters
$string : string
Tags
access

private

Return values
mixed

Returns an e-mail addess as string, or a boolean false if there is no valid e-mail address in the given string

_getJsSourceCode()

Get Javascript Source

public _getJsSourceCode(mixed $id, mixed $formFields[, mixed $preview = false ][, mixed $show = false ]) : mixed

Makes the sourcecode for the javascript based field checking

Parameters
$id : mixed
$formFields : mixed
$preview : mixed = false
$show : mixed = false
Tags
todo

The javascript code must be loaded using JS:registerCode()

_insertIntoDatabase()

Inserts the contact form submit into the database

public _insertIntoDatabase(mixed $arrFormData) : bool

This method does store the request in the database

Parameters
$arrFormData : mixed
Tags
access

private

global

ADONewConnection

global

array

see
errorMsg
Return values
bool

TRUE on succes, otherwise FALSE

_isSpam()

Checks a string for spam keywords

public _isSpam(mixed $string, mixed $arrKeywords) : bool

This method looks for forbidden words in a string that have been defined in the option "Spam protection word list"

Parameters
$string : mixed
$arrKeywords : mixed
Tags
access

private

Return values
bool

Return TRUE if the string contains an forbidden word, otherwise FALSE

_sortFormData()

Sort the form input data

public _sortFormData(string $a, string $b) : int

Sorts the input data of the form according of the field's order. This method is used as the comparison function of uksort.

Parameters
$a : string
$b : string
Return values
int

_uploadFilesLegacy()

Upload submitted files

public _uploadFilesLegacy(mixed $arrFields) : array<string|int, mixed>

Move all files that are allowed to be uploaded in the folder that has been specified in the configuration option "File upload deposition path"

Parameters
$arrFields : mixed
Tags
access

private

global

array

see
getSettings()
see
errorMsg
see
FWSystem::getMaxUploadFileSize()
Return values
array<string|int, mixed>

A list of files that have been stored successfully in the system

addForm()

Add a new form

public addForm(string $emails, string $senderEmail, string $senderName, bool $showForm, bool $useCaptcha, bool $useCustomStyle, bool $sendCopy, mixed $useEmailOfSender, mixed $sendHtmlMail, mixed $sendAttachment, mixed $saveDataInCrm, mixed $crmCustomerGroups, mixed $sendMultipleReply) : mixed
Parameters
$emails : string
$senderEmail : string

E-mail address of sender

$senderName : string

Name of sender

$showForm : bool
$useCaptcha : bool
$useCustomStyle : bool
$sendCopy : bool
$useEmailOfSender : mixed
$sendHtmlMail : mixed
$sendAttachment : mixed
$saveDataInCrm : mixed
$crmCustomerGroups : mixed
$sendMultipleReply : mixed
Tags
author

Cloudrexx AG info@Cloudrexx.com

author

Stefan Heinemann sh@adfinis.com

deleteFormEntry()

public deleteFormEntry(mixed $id) : mixed
Parameters
$id : mixed

getContactFormCaptchaStatus()

public getContactFormCaptchaStatus(mixed $id) : mixed
Parameters
$id : mixed

getContactFormDetails()

public getContactFormDetails(mixed $id, mixed &$arrEmails, mixed &$senderEmail, mixed &$senderName, mixed &$subject, mixed &$feedback, mixed &$mailTemplate, mixed &$showForm, mixed &$useCaptcha, mixed &$sendCopy, mixed &$useEmailOfSender, mixed &$htmlMail, mixed &$sendAttachment, mixed &$saveDataInCRM, mixed &$crmCustomerGroups, mixed &$sendMultipleReply) : mixed
Parameters
$id : mixed
$arrEmails : mixed
$senderEmail : mixed
$senderName : mixed
$subject : mixed
$feedback : mixed
$mailTemplate : mixed
$showForm : mixed
$useCaptcha : mixed
$sendCopy : mixed
$useEmailOfSender : mixed
$htmlMail : mixed
$sendAttachment : mixed
$saveDataInCRM : mixed
$crmCustomerGroups : mixed
$sendMultipleReply : mixed

getContactPage()

Parse contact form page

public getContactPage(Page $page) : mixed
Parameters
$page : Page

Page object

getFormEntries()

public getFormEntries(mixed $formId, mixed &$arrCols, mixed $pagingPos, mixed &$paging[, mixed $limit = true ]) : mixed
Parameters
$formId : mixed
$arrCols : mixed
$pagingPos : mixed
$paging : mixed
$limit : mixed = true

getFormEntry()

public getFormEntry(mixed $entryId) : mixed
Parameters
$entryId : mixed

getFormFieldNames()

public getFormFieldNames(mixed $id) : mixed
Parameters
$id : mixed

getFormFields()

Get the form fields

public getFormFields(int $formID) : array<string|int, mixed>
Parameters
$formID : int
Tags
author

Cloudrexx AG info@cloudrexx.com

author

Stefan Heinemann sh@adfinis.com

Return values
array<string|int, mixed>

getHighestSortValue()

return the highest sort value of a recipient list

public getHighestSortValue(mixed $formId) : int
Parameters
$formId : mixed
Return values
int

getLastRecipientId()

return the last recipient id

public getLastRecipientId([mixed $refresh = false ]) : int
Parameters
$refresh : mixed = false
Return values
int

getRecipients()

Return the recipients of a form

public getRecipients(int $formID[, mixed $allLanguages = true ]) : array<string|int, mixed>
Parameters
$formID : int
$allLanguages : mixed = true
Tags
author

Stefan Heinemann sh@adfinis.com

Return values
array<string|int, mixed>

getSettings()

public getSettings([mixed $reinitialize = false ]) : mixed
Parameters
$reinitialize : mixed = false

initContactForms()

Read the contact forms

public initContactForms([int $id = 0 ][, string $order = null ]) : mixed
Parameters
$id : int = 0

Form ID

$order : string = null

the order for the sql query (comes from Sorting class)

isUniqueFormName()

Check if there already exist a form with this name

public isUniqueFormName(string $name, int $lang[, int $id = 0 ]) : bool
Parameters
$name : string
$lang : int
$id : int = 0
Tags
author

Stefan Heinemann sh@adfinis.com

Return values
bool

updateForm()

Update an existing form

public updateForm(int $formID, string $emails, string $senderEmail, string $senderName, bool $showForm, bool $useCaptcha, bool $useCustomStyle, bool $sendCopy, mixed $useEmailOfSender, mixed $sendHtmlMail, mixed $sendAttachment, mixed $saveDataInCrm, mixed $crmCustomerGroups, mixed $sendMultipleReply) : mixed
Parameters
$formID : int
$emails : string
$senderEmail : string

E-mail address of sender

$senderName : string

Name of sender

$showForm : bool
$useCaptcha : bool
$useCustomStyle : bool
$sendCopy : bool
$useEmailOfSender : mixed
$sendHtmlMail : mixed
$sendAttachment : mixed
$saveDataInCrm : mixed
$crmCustomerGroups : mixed
$sendMultipleReply : mixed
Tags
author

Cloudrexx AG info@cloudrexx.com

author

Stefan Heinemann sh@adfinis.com

uploadFinished()

public static uploadFinished(mixed $tempPath, mixed $tempWebPath, mixed $data, mixed $uploadId, mixed $fileInfos) : mixed
Parameters
$tempPath : mixed
$tempWebPath : mixed
$data : mixed
$uploadId : mixed
$fileInfos : mixed

_uploadFiles()

Handle uploads

protected _uploadFiles(array<string|int, mixed> $arrFields[, mixed $move = false ]) : array<string|int, mixed>
Parameters
$arrFields : array<string|int, mixed>
$move : mixed = false
Tags
see
Contact::_uploadFilesLegacy()
Return values
array<string|int, mixed>

A list of files that have been stored successfully in the system

addFormField()

Add a form field to the database

protected addFormField(int $formID, array<string|int, mixed> $field) : int
Parameters
$formID : int
$field : array<string|int, mixed>
Tags
author

Stefan Heinemann sh@adfinis.com

Return values
int

addRecipient()

Add a new recipient

protected addRecipient(int $formID, array<string|int, mixed> $recipient) : mixed
Parameters
$formID : int
$recipient : array<string|int, mixed>
Tags
author

Stefan Heinemann sh@adfinis.com

cleanFormFields()

Remove the form fields that are not in the given list

protected cleanFormFields(int $formID, array<string|int, mixed> $formFields) : mixed
Parameters
$formID : int
$formFields : array<string|int, mixed>
Tags
author

Stefan Heinemann sh@adfinis.com

cleanRecipients()

Delete the recipients that aren't wanted anymore

protected cleanRecipients(int $formID, array<string|int, mixed> $recipients) : mixed
Parameters
$formID : int
$recipients : array<string|int, mixed>
Tags
author

Stefan Heinemann sh@adfinis.com

dropUploads()

Drop any submitted files in case the storage of form submission is not allowed

protected dropUploads(array<string|int, mixed> $arrFormData) : mixed
Parameters
$arrFormData : array<string|int, mixed>

Details of the contact request

getErrorMessages()

Retrieves a list of error messages based on the current error state.

protected getErrorMessages() : array<string|int, mixed>

This method checks which error codes are set in the $this->error bitmask and maps them to their corresponding language keys in the global $_ARRAYLANG array using the SUBMISSION_ERROR_MESSAGES constant. It appends a general fallback error message at the end.

Return values
array<string|int, mixed>

An array of localized error messages.

getFormEntity()

Get the form entity

protected getFormEntity(int $id, string $emails, string $senderEmail, string $senderName, bool $showForm, bool $useCaptcha, bool $useCustomStyle, bool $sendCopy, mixed $useEmailOfSender, mixed $sendHtmlMail, mixed $sendAttachment, mixed $saveDataInCrm, mixed $crmCustomerGroups, mixed $sendMultipleReply) : mixed
Parameters
$id : int
$emails : string
$senderEmail : string

E-mail address of sender

$senderName : string

Name of sender

$showForm : bool
$useCaptcha : bool
$useCustomStyle : bool
$sendCopy : bool
$useEmailOfSender : mixed
$sendHtmlMail : mixed
$sendAttachment : mixed
$saveDataInCrm : mixed
$crmCustomerGroups : mixed
$sendMultipleReply : mixed

getLegacyError()

Get the error message

protected getLegacyError() : string

Used for legacy output of placeholder CONTACT_FEEDBACK_TEXT. Superseded by static::getErrorMessages().

Returns a formatted string with error messages if there happened any errors

Return values
string

Error messages

getTemporaryUploadPath()

Gets the temporary upload location for files.

protected static getTemporaryUploadPath(mixed $fieldId) : array<string|int, mixed>
Parameters
$fieldId : mixed
Tags
throws
ContactException
Return values
array<string|int, mixed>

array('path','webpath', 'dirname')

hasError()

Checks whether any error has been set.

protected hasError() : bool

Returns true if the error bitmask is non-zero, indicating that one or more errors have occurred.

Return values
bool

True if there is at least one error, false otherwise.

insertFormLangValues()

Insert the language values, update them if they already exist

protected insertFormLangValues(int $formID, int $langID, mixed $isActive, string $name, string $text, string $feedback, mixed $mailTemplate, string $subject) : mixed
Parameters
$formID : int
$langID : int
$isActive : mixed
$name : string
$text : string
$feedback : string
$mailTemplate : mixed
$subject : string
Tags
author

Stefan Heinemann sh@adfinis.com

setError()

Adds an error code to the current error state.

protected setError(int $code) : void

Uses bitwise OR to accumulate multiple error codes in the $this->error bitmask.

Parameters
$code : int

One of the SUBMISSION_ERROR_* constants.

setFormFieldLang()

Add a form lang to a field

protected setFormFieldLang(int $fieldID, mixed $langID, array<string|int, mixed> $values) : mixed

In case it already exists, update the value

Parameters
$fieldID : int
$langID : mixed
$values : array<string|int, mixed>
Tags
author

Stefan Heinemann sh@adfinis.com

showError()

Renders the error messages within the provided template.

protected showError(Sigma $template) : string

Checks if the template has the contact_form_error block and the CONTACT_FEEDBACK_TEXT placeholder. If so, it sets the placeholder with all error messages joined by newlines and parses the error block. Otherwise, it parses the legacy error message enclosed by a span-tag into the CONTACT_FEEDBACK_TEXT placeholder. The block contact_form_error is shown and the feedback block contact_form_feedback is hidden in either case.

Parameters
$template : Sigma

Template object

Return values
string

Form content with Error message

showFeedback()

Displays the feedback message within the provided template.

protected showFeedback(array<string|int, mixed> $arrFormData, Sigma $template) : void

Checks if the contact_form_feedback block and its placeholder CONTACT_FEEDBACK_TEXT exist in the template. If so, it sets the placeholder with the feedback text and parses the block. Otherwise, it sets the legacy feedback text having two line-breaks appended into CONTACT_FEEDBACK_TEXT. The block contact_form_feedback is rendered and the error block contact_form_error is hidden in either case.

Parameters
$arrFormData : array<string|int, mixed>

Details of the requested form

$template : Sigma

Template object

updateFormField()

Update a form field

protected updateFormField(array<string|int, mixed> $field) : mixed
Parameters
$field : array<string|int, mixed>
Tags
author

Stefan Heinemann sh@adfinis.com

updateRecipient()

Update the recipient

protected updateRecipient(array<string|int, mixed> $recipient) : mixed
Parameters
$recipient : array<string|int, mixed>
Tags
author

Stefan Heinemann sh@adfinis.com

sendMail()

Sends an email with the contact details to the responsible persons

private sendMail(mixed $arrFormData) : mixed

This methode sends an email to all email addresses that are defined in the option "Receiver address(es)" of the requested contact form.

Parameters
$arrFormData : mixed
Tags
access

private

global

array

global

array

see
_getEmailAdressOfString()

        
On this page

Search results