============================================================================================================================
Modification Title: Display Of Posted Code v1.0

Author: John Briggs

Contributors: Steven Waters

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

Copyright:  2010 John Briggs. All rights reserved.

Compatability: XMB 1.9.5 SP1

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

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

Author Note:
You downloaded this modification from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.
============================================================================================================================
=======
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: functions.php
==================
==========
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 Code With:
================

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

==========
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);
            } elseif (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

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