Please have a look at http://joomlacode.org/gf/project/tincaptcha
I found no way to install language with my plugin, so I put it in the component. The plugin file is 120KB, but the most is font files (all fonts are grabbed from dafont.com, and they are copyrighted by their authors).
Here is the Contact page I have intergrated:
And I did:
1. Install both com_tincaptcha and plg_tincaptcha (remember active plugin, we can change some settings in the plugin)
2. In File components\com_contact\controller.php, find and add like this:
Code: Select all
function submit()
{
global $mainframe;
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
// tincaptcha-
$captchk = plgSystemTincaptcha::check(JRequest::getVar('captcha', '', 'post'));
if ($captchk !== true)
{
JError::raiseWarning(0, $captchk);
return false;
}
// -tincaptcha
Code: Select all
<label id="contact_textmsg" for="contact_text">
<?php echo JText::_( 'Enter your message' );?>:
</label>
<br />
<textarea cols="50" rows="10" name="text" id="contact_text" class="inputbox required"></textarea>
<!-- tincaptcha- -->
<br />
<label for="captcha">
<?php echo JText::_( 'TIN_CAPTCHA' );?>:
</label>
<br />
<input type="text" name="captcha" id="captcha" size="10" class="inputbox required" value="" />
<br />
<img src="index.php?option=com_tincaptcha&task=captcha_display" />
<!-- -tincaptcha -->
I do not put $this->display(); after JError::raiseWarning because it just display an empty form.
You might want raiseError instead, it will display only error message
Code: Select all
JError::raiseError(500, $captchk);
Code: Select all
//JResponse::setHeader( 'Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', false ); // <-- browsers can not remember form
JResponse::setHeader( 'Cache-Control', 'post-check=0, pre-check=0', false ); // <--browsers can with this
For Joomla registration will be available soon. I still want the captcha warning and the form display together with what we've typed in form.