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_URL  = 3

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() .
$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
_getError()  : string
Get the error message
_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
getFormEntity()  : mixed
Get the form entity
getTemporaryUploadPath()  : array<string|int, mixed>
Gets the temporary upload location for files.
insertFormLangValues()  : mixed
Insert the language values, update them if they already exist
setFormFieldLang()  : mixed
Add a form lang to a field
showError()  : string
Show Error
showFeedback()  : mixed
Show the feedback message
updateFormField()  : mixed
Update a form field
updateRecipient()  : mixed
Update the recipient
_deleteFormFieldsAndDataByFormId()  : mixed
Delete form fields and data
sendMail()  : mixed
Sends an email with the contact details to the responsible persons
setRecipientLang()  : mixed
Set the recipient name of a lang

Constants

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.

$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

_getError()

Get the error message

public _getError() : string

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

Tags
access

private

see
errorMsg
Return values
string

Error messages

_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, bool $showForm, bool $useCaptcha, bool $useCustomStyle, bool $sendCopy, mixed $useEmailOfSender, mixed $sendHtmlMail, mixed $sendAttachment, mixed $saveDataInCrm, mixed $crmCustomerGroups, mixed $sendMultipleReply) : mixed
Parameters
$emails : string
$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 &$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
$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, 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
$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

getFormEntity()

Get the form entity

protected getFormEntity(int $id, string $emails, 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
$showForm : bool
$useCaptcha : bool
$useCustomStyle : bool
$sendCopy : bool
$useEmailOfSender : mixed
$sendHtmlMail : mixed
$sendAttachment : mixed
$saveDataInCrm : mixed
$crmCustomerGroups : mixed
$sendMultipleReply : mixed

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')

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

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()

Show Error

protected showError(Sigma $template) : string
Parameters
$template : Sigma

Template object

Return values
string

Form content with Error message

showFeedback()

Show the feedback message

protected showFeedback(array<string|int, mixed> $arrFormData, Sigma $template) : mixed
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

_deleteFormFieldsAndDataByFormId()

Delete form fields and data

private _deleteFormFieldsAndDataByFormId(int $id) : mixed
Parameters
$id : int
Tags
author

Cloudrexx AG info@cloudrexx.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()
see
phpmailer::From
see
phpmailer::FromName
see
phpmailer::AddReplyTo()
see
phpmailer::Subject
see
phpmailer::IsHTML()
see
phpmailer::Body
see
phpmailer::AddAddress()
see
phpmailer::Send()
see
phpmailer::ClearAddresses()

setRecipientLang()

Set the recipient name of a lang

private setRecipientLang(int $rcID, int $langID, string $name) : mixed
Parameters
$rcID : int
$langID : int
$name : string
Tags
author

Stefan Heinemann sh@adfinis.com


        
On this page

Search results