=======================================================================================================================================
Modification Title: Display Of Posted Code

Modification Version: 1.0

Modification Author: John Briggs

Modification Description:
This modification will display posted code in a selectable text box.

Modification Copyright:  2007-2008 XMBMods.com. All rights reserved.

Modification Compatibility: XMB 1.9.8 SP3

Modification Install Note: Before adding this modification to your forum you should back up all files related to this modification.

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

Modification Author Note:
This modification is developed and released for use with XMB 1.9.8 Engage Final SP3 which is provided by XMBGarage.com.

=======================================================================================================================================
=======
Step 1:
=======
=======================
Edit File: lang/English.lang.php
=======================
============================
Add Code To End Of File Above ?>
============================

// Display Of Posted Code Mod Begin
$lang['selectcode'] = "Select Code";
// Display Of Posted Code Mod End

=======================================================================================================================================
=======
Step 2:
=======
=========================
Edit File: include/functions.inc.php
=========================
==========
Find Code:
==========

    global $imgdir, $bordercolor, $db, $smdir, $smiliecache, $censorcache, $smiliesnum, $wordsnum, $versionbuild, $fontsize;

============
Replace With:
============

    global $imgdir, $bordercolor, $db, $smdir, $smiliecache, $censorcache, $smiliesnum, $wordsnum, $versionbuild, $fontsize, $lang;

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

    $message = nl2br($message);

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

    // Display Of Posted Code Mod Begin
    if ($bballow) {
        $find_code = array(
            0 => '[code]',
            1 => '[/code]'
        );

        $replace_code = array(
            0 => '</font><form><table align="center" class="code" cellspacing="0" cellpadding="0"><tr><td class="code">'.$lang['textcode'].'</td></tr><tr><td class="codemessage"><textarea name="code" style="width: 100%" rows="5">',
            1 => '</textarea></td></tr><tr><td align="center" class="codemessage"><input class="submit" type="button" style="font-size: 9px" value="'.$lang['selectcode'].'" onclick="javascript:this.form.code.focus();this.form.code.select();" /></td></tr></table></form><font class="mediumtxt">'
        );

        foreach($find_code as $key => $value) {
            if (isset($checkcode) && $checkcode > 0) {
                $message = $message.str_repeat("[/code]", $checkcode);
            } else if (isset($checkcode) && $checkcode < 0) {
                $message = str_repeat("[code]", abs($checkcode)).$message;
            }
        }

        while(strpos($message,'[code]') !== false) {
            $start = strpos($message, '[code]');
            $length = strpos($message, '[/code]') - $start;
            $old_code = substr($message, $start, $length+7);
            $new_code = str_replace('<br />', ' ', $old_code);
            $new_code = str_replace($find_code, $replace_code, $new_code);
            $message = str_replace($old_code, $new_code, $message);
        }
    }
    // Display Of Posted Code Mod End

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

        14 => '</font><table align="center" class="code" cellspacing="0" cellpadding="0"><tr><td class="code">'.$lang['textcode'].'</td></tr><tr><td class="codemessage">',
        15 => '</td></tr></table><font class="mediumtxt">',

============
Replace With:
============

        14 => '[code]',
        15 => '[/code]',

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