Title: U2U Captcha v1.0

Author: John Briggs

Copyright: Copyright (c) 2009, John Briggs. All rights reserved.

Description: This modification provides a captcha image to standard members when sending u2us.

Compatability: 1.9.11

License: This modification is released under the GPL v3.0 license. A copy is provided with this software package.

Note: Make sure to backup all affected files and datbases before proceeding with installation.

=======================================================================================================================================================
=======
Step 1:
=======
=================
Edit File: u2u.inc.php
=================
==========
Find Code:
==========

    if (onSubmit('sendsubmit')) {
        $errors = '';
        // fixed by John Briggs
        $dbsubject = (empty($dbsubject) ? $db->escape_var($lang['textnosub']) : $dbsubject);

        // fixed lang variable use by John Briggs
        if (empty($message)) {
            error($lang['u2umsgempty'], false, $u2uheader, $u2ufooter, false, true, false, false);
        }

===============
Add Code Below:
===============

        // U2U Captcha Mod Begin
        if (!X_STAFF && $SETTINGS['captcha_status'] == 'on' && !DEBUG) {
            require ROOT.'include/captcha.inc.php';
            $Captcha = new Captcha(250, 50);
            if ($Captcha->bCompatible !== false) {
                $imghash = postedVar('imghash', '', FALSE, TRUE);
                $imgcode = postedVar('imgcode', '', FALSE, FALSE);
                if ($Captcha->ValidateCode($imgcode, $imghash) !== true) {
                    error($lang['captchaimageinvalid'], false, $u2uheader, $u2ufooter, false, true, false, false);
                }
            }
        }
        // U2U Captcha Mod End

==========
Find Code:
==========

        if (empty($errors)) {
            u2u_msg($lang['imsentmsg'], $full_url.'u2u.php');
        } else {
            u2u_msg(substr($errors, 6) , $full_url.'u2u.php');
        }
    }

===============
Add Code Below:
===============

    // U2U Captcha Mod Begin
    $captchacheck = '';
    if (!X_STAFF && $SETTINGS['captcha_status'] == 'on' && !DEBUG) {
        require ROOT.'include/captcha.inc.php';
        $Captcha = new Captcha(250, 50);
        if ($Captcha->bCompatible !== false) {
            $imghash = $Captcha->GenerateCode();
            if ($SETTINGS['captcha_code_casesensitive'] == 'off') {
                $lang['captchacaseon'] = '';
            }
            eval('$captchacheck = "'.template('u2u_send_captcha').'";');
        }
    }
    // U2U Captcha Mod End

=======================================================================================================================================================
=======
Step 2:
=======
==============
Edit File: u2u.php
==============
==========
Find Code:
==========

loadtemplates(

===============
Add Code Below:
===============

'u2u_send_captcha',

=======================================================================================================================================================
=======
Step 3:
=======
===============================
Go To Administration Panel -> Templates
===============================
===================
Edit Template: u2u_send
===================
==========
Find Code:
==========

<tr>
<td valign="top" class="ctrtablerow" bgcolor="$altbg1" colspan="2">
<input type="hidden" name="del" value="$del" />
<input type="submit" class="submit" name="sendsubmit" value="$lang[textsendu2u]" />
<input type="submit" class="submit" name="savesubmit" value="$lang[textsaveu2u]" />
<input type="submit" class="submit" name="previewsubmit" value="$lang[textpreviewu2u]" /></td>
</tr>
</table>
</td>
</tr>
</table>
</form>

===============
Add Code Above:
===============

$captchacheck

=======================================================================================================================================================
=======
Step 4:
=======
===============================
Go To Administration Panel -> Templates
===============================
===============================
Create New Template: u2u_send_captcha
===============================
======================
Add Code And Click Submit:
======================

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]">$lang[verificationnote]</td>
<td bgcolor="$THEME[altbg2]">
<img src="misc.php?action=captchaimage&amp;imagehash=$imghash" alt="$lang[captchaverification]" /><br /><br />
<input type="text" name="imgcode" value="" /><input type="hidden" name="imghash" value="$imghash" /><br />{$lang['captchacaseon']}
</td>
</tr>

=======================================================================================================================================================
Enjoy!