Well, I found nowhere on the Internet a
reCaptcha implementation into Fireboard, so I tried to make one myself.
I'm not a programmer, so I don't know if I did it in a secure way, but it works!!!
REMEMBER: by applying this modification, the built-in captcha will be overwritten.
Here's how to do it:
download the latest PHP library for reCaptcha - recaptcha.net/plugins/php/
upload the recaptchalib.php included in the PHP library to the directory "/components/com_fireboard/template/default/plugin/captcha/"
edit the file "fb_write.html.php" in your selected template (otherwise in the default template) and find this code:
| Code: |
<?php
// Begin captcha . Thanks Adeptus
if ($fbConfig['captcha'] == 1 && $my->id < 1) { ?>
<tr class = "<?php echo $boardclass; ?>sectiontableentry1">
<td class = "fb_leftcolumn"> <strong><?php echo _FB_CAPDESC; ?></strong> </td>
<td align="left" valign="middle" height="35px"> <input name="txtNumber" type="text" id="txtNumber" value="" class="button" style="vertical-align:top" size="15">
<img src="<?php echo JB_DIRECTURL ;?>/template/default/plugin/captcha/randomImage.php" alt="" />
</td>
</tr>
<?php
}
// Finish captcha
?>
|
replace it with
| Code: |
<?php
// Begin reCaptcha
if ($fbConfig['captcha'] == 1 && $my->id < 1) { ?>
<tr class = "<?php echo $boardclass; ?>sectiontableentry1">
<td class = "fb_leftcolumn"> <strong><?php echo _FB_CAPDESC; ?></strong> </td>
<td align="left" valign="middle">
<?php require_once($mosConfig_absolute_path.'/components/com_fireboard/template/default/plugin/captcha/recaptchalib.php');
$publickey = "REPLACE_THIS_WITH_YOUR_PUBLIC_KEY";
echo recaptcha_get_html($publickey);
?>
</td>
</tr>
<?php
}
// Finish reCaptcha
?>
|
Then edit the file "post.php" in your selected template (otherwise in the default template) and find this code:
| Code: |
// Begin captcha
if ($fbConfig['captcha'] == 1 && $my->id < 1) {
session_start();
$number = $_POST['txtNumber'];
if ($message != NULL)
{
if (md5($number) != $_SESSION['image_random_value'])
{
$mess = _FB_CAPERR;
echo "<script language='javascript' type='text/javascript'>alert('" . $mess . "')</script>";
echo "<script language='javascript' type='text/javascript'>window.history.back()</script>";
return;
die();
//break;
}
}
}
// Finish captcha
|
replace it with
| Code: |
// Begin reCaptcha
if ($fbConfig['captcha'] == 1 && $my->id < 1) {
require_once($mosConfig_absolute_path.'/components/com_fireboard/template/default/plugin/captcha/recaptchalib.php');
$privatekey = "REPLACE_THIS_WITH_YOUR_PRIVATE_KEY";
if ($_POST["submit"]) {
$resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], mosGetParam( $_POST, 'recaptcha_challenge_field' ), mosGetParam( $_POST, 'recaptcha_response_field') );
if (!$resp->is_valid)
{
mosRedirect( sefRelToAbs('index.php?option=com_fireboard&Itemid='. $Itemid .'&func=post&do=reply&catid='. $catid) );
}
}
}
// Finish reCaptcha
|
I also edited "message.php" and replaced:
| Code: |
<?php
// Begin captcha . Thanks Adeptus
if ($fbConfig['captcha'] == 1 && $my->id < 1) { ?>
<?php echo _FB_CAPDESC.' '?>
<input name="txtNumber" type="text" id="txtNumber" value="" style="vertical-align:middle" size="10">
<img src="<?php echo JB_DIRECTURL ;?>/template/default/plugin/captcha/randomImage.php" alt="" /><br />
<?php
}
// Finish captcha
?>
|
with
| Code: |
<?php
// Begin reCaptcha
if ($fbConfig['captcha'] == 1 && $my->id < 1) { ?>
<strong><?php echo _FB_CAPDESC; ?></strong> </td>
<?php require_once($mosConfig_absolute_path.'/components/com_fireboard/template/default/plugin/captcha/recaptchalib.php');
$publickey = "REPLACE_THIS_WITH_YOUR_PUBLIC_KEY";
echo recaptcha_get_html($publickey);
?>
<?php
}
// Finish reCaptcha
?>
|
but it worked also without this last replacement. As I said, I don't know nothing about the security of such modifications.
In the above replacements don't forget to REPLACE the "REPLACE_THIS_WITH_YOUR_PRIVATE_KEY" and "REPLACE_THIS_WITH_YOUR_PUBLIC_KEY" with you private/public keys you got from
reCaptcha.
That should do it.
If anyone more capable in programming sees any errors or bad codings in the above code - please post correction. Also welcome would be a modification that would remember the written message if the code entered is wrong - now it just displays the form again.