Title:
Hidden Text

Original Code by:
John

Updated by:
Ahmad

Description:
This Mod will allow you to enter hidden text in a post via bbcode. It will not be viewable until a member replies to the post.

Compatability:
1.9.5

Bonus:
Default XMB Buttons

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

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

Author Note:
You downloaded this hack from XMBMods.com, the #1 source for XMB related downloads.
Please visit http://www.xmbmods.com/ for support.

=======================================================================================================================================
=======
Step 1:
=======

=============
Edit File: functions.php
=============

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

        $message = preg_replace($patterns, $replacements, $message);

===========
Add code below
===========

        global $xmbuser, $table_posts, $tid, $lang;
        $query= $db->query("SELECT count(author) FROM $table_posts WHERE tid='$tid' and author='$xmbuser'");
        $num = $db->result($query,0);
        if ($num==0) {
            $message = eregi_replace("\\[hide\\]([^\\[]*)\\[/hide\\]","<div class='hidden'>[<strong>$lang[textdetect]</strong>]</div>", $message);
        }else{
            $message = eregi_replace("\\[hide\\]([^\\[]*)\\[/hide\\]","<div class='hidden'>[<strong>$lang[textstart]</strong>]</div><br /><br />\\1<br /><br /><div class='hidden'>[<strong>$lang[textend]</strong>]</div>", $message);
        } 

=======================================================================================================================================
=======
Step 2:
=======
========================
Edit File: \include\bbcodefns-ie.js
========================

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

function underline() {
      if (helpmode) {
        alert(bbcode_help_underline);
    }else if (advmode) {
        AddText('', '', "[u] [/u]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_underline,"Text");
        if (txt!=null) {
            AddText('', '', "[u]"+txt+"[/u]", messageElement);
        }
    }
}

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

function hide() {
      if (helpmode) {
        alert(bbcode_help_hide);
    }else if (advmode) {
        AddText('', '', "[hide] [/hide]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_hide,"Text");
        if (txt!=null) {
            AddText('', '', "[hide]"+txt+"[/hide]", messageElement);
        }
    }
}

=======================================================================================================================================
=======
Step 3:
=======

========================
Edit File: \include\bbcodefns-opera.js
========================

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

function underline() {
      if (helpmode) {
        alert(bbcode_help_underline);
    }else if (advmode) {
        AddText('', '', "[u] [/u]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_underline,"Text");
        if (txt!=null) {
            AddText('', '', "[u]"+txt+"[/u]", messageElement);
        }
    }
}

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

	 function hide() {
      if (helpmode) {
        alert(bbcode_help_hide);
    }else if (advmode) {
        AddText('', '', "[hide] [/hide]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_hide,"Text");
        if (txt!=null) {
            AddText('', '', "[hide]"+txt+"[/hide]", messageElement);
        }
    }
}

=======================================================================================================================================
=======
Step 4:
=======

========================
Edit File: \include\bbcodefns-mozilla.js
========================

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

function image() {
	if(helpmode) {
		alert(bbcode_help_image);

	} else if(advmode) {
		if(hasSelection(messageElement)) {
			wrapText('[img]', '[/img]', messageElement);
		} else {
			AddText('[img]', '[/img]', ' ', messageElement);
		}

	} else {
		if(hasSelection(messageElement)) {
			text = prompt(bbcode_prompt_image, fetchSelection(messageElement));
			if(text == fetchSelection(messageElement)) {
				wrapText('[img]', '[/img]', messageElement);
			} else {
				AddText('[img]', '[/img]', text, messageElement);
			}
		} else {
			text = prompt(bbcode_prompt_image, 'http://www.example.com/image.jpg');
			AddText('[img]', '[/img]', text, messageElement);
		}
	}
}


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

function hide() {
	if(helpmode) {
		alert(bbcode_help_hide);

	} else if(advmode) {
		if(hasSelection(messageElement)) {
			wrapText('[hide]', '[/hide]', messageElement);
		} else {
			AddText('[hide]', '[/hide]', ' ', messageElement);
		}

	} else {
		if(hasSelection(messageElement)) {
			text = prompt(bbcode_prompt_hide, fetchSelection(messageElement));
			if(text == fetchSelection(messageElement)) {
				wrapText('[hide]', '[/hide]', messageElement);
			} else {
				AddText('[hide]', '[/hide]', text, messageElement);
			}
		} else {
			text = prompt(bbcode_prompt_hide, 'Hidden text');
			AddText('[hide]', '[/hide]', text, messageElement);
		}
	}
}

=======================================================================================================================================
====
Step 5:
====

=====================
Edit File: lang\English.lang.php
=====================
==============
Add this at very buttom
==============

$lang['bbcode_help_hide'] = "Hide Tag\\nMakes the enlosed text hidden.\\nUsage: [hide]This is some hidden text[/hide]";
$lang['bbcode_prompt_hide'] = "Please enter the text that should be hidden.";
$lang['cb_insert_hide'] = "Insert Hidden text";
$lang['textdetect'] = "Hidden Text Detected. You have to post a reply to see it";
$lang['textstart'] = "Start Hidden Text";
$lang['textend'] = "End Hidden Text";

=======================================================================================================================================
====
Step 6:
====

=======================================
Go to administration panel -> templates -> functions_bbcode
=======================================

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

var messageElement;

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

var bbcode_help_hide 	= "$lang[bbcode_help_hide]";
var bbcode_prompt_hide 	= "$lang[bbcode_prompt_hide]";



=======================================================================================================================================
====
Step 7:
====

===========================================
Go to administration panel -> templates -> functions_bbcodeinsert
===========================================

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

<a href="javascript:hyperlink()"><img src="$imgdir/bb_url.gif" border="0" width="23" height="22" alt="$lang[cb_insert_hyperlink]" /></a>

==========
Add Code above:
==========
<a href="javascript:hide()"><img src="$imgdir/bb_hide.gif" border="0" width="23" height="22" alt="$lang[cb_insert_hide]" /></a>

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

=============================
Go to administration panel -> templates -> CSS
=============================

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

</style>

==========
Add Code above:
==========
.hidden {
    color: #FF0000;
    font-family: $font;
    font-size: $fontsize;
    font-weight: normal;
    table-layout: fixed;
}

=======================================================================================================================================

=====
Step 9:
=====

===============================
Upload the "bb_hr.gif" to your theme directory
===============================

=======================================================================================================================================