Extension:CorporateContact

What can this extension do?
The extension provides a special page, Special:Contact, so that visitors of your site can contact you without the need for you to expose your e-mail address (which may help you to reduce spam). A form allows visitors to fill in some basic information about themselves, such as their name, e-mail, company or organisation.

This extension can be configured to suit your needs. You can add custom wiki texts before and/or after the contact form (according parameters) and i18n allows you to create custom subjects that visitors can select. You can also make a custom e-mail content according values (according subject, according user type ...) in form providing your own mail rendering function. It is possible to provide a custom dispatch function so that you can choose according form values where mail should be sent.

Installation
To install this extensions, put files given in code section in your MediaWiki extensions folder and then add the following to LocalSettings.php:

Runtime (HTTP) parameters
Special:Contact page can be called with some parameters, separated by / character :
 * before:value Value of before parameter is used to specify custom text displayed before contact form. It should be a short value, such as identifier or key. If $wikiGetterFunc is given in configuration, this value is passed to this function to obtain final wiki text displayed before contact form, otherwise value is directly displayed.
 * after:value Value of after parameter is used to specify custom text displayed before contact form. It should be a short value, such as identifier or key. If $wikiGetterFunc is given in configuration, this value is passed to this function to obtain final wiki text displayed after contact form, otherwise value is directly displayed.
 * subject:value Value of subject</tt> is used to specify which subject should be selected when page is loaded. Should match a value of $subjects</tt> array in configuration (if subject:foo</tt>, foo</tt> should be found on $subjects</tt>, and so it will be selected when page is loaded).

Usage samples :
 * /Special:Contact/after:aaa/subject:foo/before:bbb
 * /Special:Contact/subject:foo
 * /Special:Contact/subject:foo/after:bbb

Configuration parameters
Configuration is mainly done in ContactSettings.php</tt>. They are not global variables so you should not have to prevent conflict with other variable in your system.
 * $subjects</tt> array of subject identifier, used as value in form for the subject popup menu. You have to localized it by adding in ContactPage.i18n.YOUR_LANG.php a key-value pair in messages</tt> array. Message key should match "contactpage-subject-$subject"</tt> (for "other" in $subjects</tt> array parameter you should have a "contactpage-subject-other" in i18n messages array).
 * $dispatcherFunc</tt> (required) name of function (provided in by your own) used to know where to send mail (see MyContact.php).
 * $subjectFunc</tt> (optional) name of custom function to determine subject of mail to be sent, given form values. If not provided localized value of wpSubject</tt> field is used (see $subjects</tt>).
 * $renderFunc</tt> (optional) name of custom function to render content of mail to be sent, given form values. If not provided value of wpContent</tt> textarea in form will only be sent as mail content.
 * <tt>$pageTitleRenderer</tt> (optional) name of custom function to render page title.
 * <tt>$validateFunc</tt> (optional) name of custom function to perform custom validation upon form values. If not provided no extra validation is performed.
 * <tt>$defaultSenderName</tt> (required) name used as sender one when he does not provide it in form.
 * <tt>$defaultSenderEmail</tt> (required) email address used as sender one when he does not provide it in form.
 * <tt>$wikiGetterFunc</tt> (optional) name of custom function used to get wiki text for <tt>before</tt> and/or <tt>after</tt> runtime parameters. If not provided parameter values are used directly.
 * <tt>$formTabIndexes</tt> (optional) associative array (dictionary) used to specify tab index for form field. Very useful if you change display position of form field with CSS, so with ajusting tab indexes user can navigation through form field in a coherent way given what is displayed (if in your form subject is after first name you should add entries <tt>'wpFirstName' => x</tt> and <tt>'wpSubject' => x+1</tt> in this array parameter).

Captcha
This extension supports captcha. In order to enable it, you should add the following line in your <tt>LocalSettings.php</tt> file:

$wgCaptchaTriggers['contactpage'] = true;