============================================================================================================================
Modification Name: BB Code: iFrame Function v1.0

Author: GuldantheWarlock (GuldantheWarlock@xmbgarage.com)

Last Updated: 12/07/10

Description:
This modification will allow you to use a BB Code iFrame function in posts.
This modification will insert a web page via an iFrame in your posts.

Supported Version: XMB 1.9.5 SP1

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

Author Note:
For security purposes, Please Check: http://www.xmbgarage.com for the latest version of this modification.
Downloading this modification from other sites could cause malicious code to enter into your XMB Forum software.
As such, XMB Garage.com will not offer support for modifications not offered in our Modifications list.
============================================================================================================================
=======
Step 1:
=======
==================
Edit File: functions.php
==================
==========
Find Code:
==========

        $patterns[] = "#\[email=([^\"'<>]*?){1}([^\"]*?)\](.*?)\[/email\]#Smi";
        $replacements[] = '<a href="mailto:\1\2">\3</a>';

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

        // BB Code iFrame Function Mod Begin
        $patterns[] = '#\[iframe\](http[s]?|ftp[s]?){1}://([:a-z\\./_\-0-9%~]+){1}(\?[a-z=_\-0-9&;~]*)?\[/iframe\]#Smi';
        $replacements[] = '<IFRAME src="\1://\2\3" frameborder="0" width="600" height="500"></IFRAME>';
        // BB Code iFrame Function Mod End
        
============================================================================================================================
=======
Step 2:
=======
========================
Edit File: include/bbcodefns-ie.js
========================
==========
Find Code:
==========

function storeCaret(textEl) {
    if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

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

// BB Code iFrame Function Mod Begin
function iframe() {
    if (helpmode) {
        alert(bbcode_help_iframe);
    }else if (advmode) {
        AddText('', '', '[iframe] [iframe]', messageElement);
    }else {
        txt = prompt(bbcode_prompt_iframe, 'http://');
        if (txt != null) {
            AddText('', '', '[iframe]'+txt+'[/iframe]', messageElement);
        }
    }
}
// BB Code iFrame Function Mod End

============================================================================================================================
=======
Step 3:
=======
============================
Edit File: include/bbcodefns-mozilla.js
============================
==========
Find Code:
==========

function storeCaret() {

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

// BB Code iFrame Function Mod Begin
function iframe() {
    if (helpmode) {
        alert(bbcode_help_iframe);
    }else if (advmode) {
        if (hasSelection(messageElement)) {
            wrapText('[iframe]', '[/iframe]', messageElement);
        }else {
            AddText('', '', '[iframe] [iframe]', messageElement);
        }
    }else {
        if (hasSelection(messageElement)) {
            text = prompt(bbcode_prompt_iframe, fetchSelection(messageElement));
            if (text == fetchSelection(messageElement)) {
                wrapText('[iframe]', '[/iframe]', messageElement);
            }else {
                AddText('[iframe]', '[/iframe]', text, messageElement);
            }
        }else {
            text = prompt(bbcode_prompt_iframe, 'http://');
            AddText('[iframe]', '[/iframe]', text, messageElement);
        }
    }
}
// BB Code iFrame Function Mod End

============================================================================================================================
=======
Step 4:
=======
===========================
Edit File: include/bbcodefns-opera.js
===========================
==========
Find Code:
==========

function storeCaret(textEl) {
    if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

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

// BB Code iFrame Function Mod Begin
function iframe() {
    if (helpmode) {
        alert(bbcode_help_iframe);
    }else if (advmode) {
        AddText('', '', '[iframe] [iframe]', messageElement);
    }else {
        txt = prompt(bbcode_prompt_iframe, 'http://');
        if (txt != null) {
            AddText('', '', '[iframe]'+txt+'[/iframe]', messageElement);
        }
    }
}
// BB Code iFrame Function Mod End

============================================================================================================================
=======
Step 5:
=======
===============================
Go To Administration Panel --> Templates
===============================
=========================
Edit Template: functions_bbcode
=========================
==========
Find Code:
==========

var bbcode_help_code = "$lang[bbcode_help_code]";
var bbcode_prompt_code = "$lang[bbcode_prompt_code]";

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

var bbcode_help_iframe = "$lang[bbcode_help_iframe]";
var bbcode_prompt_iframe = "$lang[bbcode_prompt_iframe]";

============================================================================================================================
=======
Step 6:
=======
===============================
Go To Administration Panel --> Templates
===============================
============================
Edit Template: functions_bbcodeinsert
====================================
==========
Find Code:
==========

<a href="javascript:bold()" accesskey="b"><img src="$imgdir/bb_bold.gif" border="0" width="23" height="22" alt="$lang[cb_insert_bold]" /></a>
<a href="javascript:italicize()" accesskey="i"><img src="$imgdir/bb_italicize.gif" border="0" width="23" height="22" alt="$lang[cb_insert_italics]" /></a>
<a href="javascript:underline()" accesskey="u"><img src="$imgdir/bb_underline.gif" border="0" width="23" height="22" alt="$lang[cb_insert_underlined]" /></a>
<a href="javascript:center()"><img src="$imgdir/bb_center.gif" border="0" width="23" height="22" alt="$lang[cb_insert_centered]" /></a>
<a href="javascript:hyperlink()"><img src="$imgdir/bb_url.gif" border="0" width="23" height="22" alt="$lang[cb_insert_hyperlink]" /></a>
<a href="javascript:email()"><img src="$imgdir/bb_email.gif" border="0" width="23" height="22" alt="$lang[cb_insert_email]" /></a>
<a href="javascript:image()"><img src="$imgdir/bb_image.gif" border="0" width="23" height="22" alt="$lang[cb_insert_image]" /></a>
<a href="javascript:code()"><img src="$imgdir/bb_code.gif" border="0" width="23" height="22" alt="$lang[cb_insert_code]" /></a>
<a href="javascript:quote()"><img src="$imgdir/bb_quote.gif" border="0" width="23" height="22" alt="$lang[cb_insert_quote]" /></a>
<a href="javascript:list()"><img src="$imgdir/bb_list.gif" border="0" width="23" height="22" alt="$lang[cb_insert_list]" /></a></td>

==========
Replace with:
==========

<a href="javascript:bold()" onMouseOver="tipline('bold')" accesskey="b"><img src="$imgdir/bb_bold.gif" border="0" alt="$lang[cb_insert_bold]" /></a>
<a href="javascript:italicize()" onMouseOver="tipline('italic')" accesskey="i"><img src="$imgdir/bb_italicize.gif" border="0" alt="$lang[cb_insert_italics]" /></a>
<a href="javascript:underline()" onMouseOver="tipline('underline')" accesskey="u"><img src="$imgdir/bb_underline.gif" border="0" alt="$lang[cb_insert_underlined]" /></a>
<a href="javascript:strike()" onMouseOver="tipline('strike')"><img src="$imgdir/bb_strike.gif" border="0" alt="$lang[cb_insert_strike]" /></a>
<a href="javascript:center()" onMouseOver="tipline('center')"><img src="$imgdir/bb_center.gif" border="0" alt="$lang[cb_insert_centered]" /></a>
<a href="javascript:hyperlink()" onMouseOver="tipline('url')"><img src="$imgdir/bb_url.gif" border="0" alt="$lang[cb_insert_hyperlink]" /></a>
<a href="javascript:email()" onMouseOver="tipline('email')"><img src="$imgdir/bb_email.gif" border="0" alt="$lang[cb_insert_email]" /></a>
<a href="javascript:image()" onMouseOver="tipline('image')"><img src="$imgdir/bb_image.gif" border="0" alt="$lang[cb_insert_image]" /></a>
<a href="javascript:code()" onMouseOver="tipline('code')"><img src="$imgdir/bb_code.gif" border="0" alt="$lang[cb_insert_code]" /></a>
<a href="javascript:quote()" onMouseOver="tipline('quote')"><img src="$imgdir/bb_quote.gif" border="0" alt="$lang[cb_insert_quote]" /></a>
<a href="javascript:list()" onMouseOver="tipline('list')"><img src="$imgdir/bb_list.gif" border="0" alt="$lang[cb_insert_list]" /></a>
<a href="javascript:iframe()" onMouseOver="tipline('iframe')"><img src="$imgdir/bb_iframe.gif" border="0" width="23" height="22" alt="$lang[cb_insert_iframe]" /></a></td>

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

// Iframe in BBCode
$lang['bbcode_prompt_iframe'] = "Please enter the URL for the iFrame";
$lang['bbcode_help_iframe'] = "iFrame Tag\\nInserts a webpage into the post.Usage: [iframe]http://www.anywhere.com[/iframe]";
// End Iframe in BBCode

============================================================================================================================
=======
Step 8:
=======

Upload bb_iframe.gif from the 'Contents' folder to all your theme directories.

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