#####################################################################
## MOD Title: Advanced BBCode Box 3 ( aka ABBC3 )
##
## MOD Author: leviatan21 < info@mssti.com > (Gabriel) http://www.mssti.com/phpbb2/
##
## MOD Description: How to upgrade ABBC3 from 1.0.7 to 1.0.7b
##
## MOD Version: 1.0.7b
##
## Installation Level: Easy
## Installation Time: ~10 Minutes
##
## Files To Edit:
##	posting.php
##	includes/functions_content.php
##	includes/ucp/ucp_pm_compose.php
##
##	includes/abbcode.php
##	includes/functions_abbcode.php
##	styles/prosilver/template/posting_abbcodes_help_body.html
##
## Included Files: N/A
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 
#####################################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
#####################################################################
## Author Notes:
##
##	This fix solve the problem when DEBUG is set to true. ( Thanks to muiketi )
##	This fix solve the problem when Quoting or PM's a message. ( Thanks to Anabella )
##
#####################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#####################################################################

#
#-----[ OPEN ]-------------------------------------------------------
#
posting.php

#
#-----[ FIND ]-------------------------------------------------------
#
	$message_parser->message = '[quote=&quot;' . $post_data['quote_username'] . '&quot;]' . censor_text(trim($message_parser->message)) . "[/quote]\n";

#
#-----[ REPLACE WITH ]-----------------------------------------------
#
// MOD : ABBC3 (V1.0.7b) - START
//	$message_parser->message = '[quote=&quot;' . $post_data['quote_username'] . '&quot;]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
	$message_parser->message = '[quote=&quot;' . $post_data['quote_username'] . '&quot;]' . censor_text(trim($message_parser->message), false) . "[/quote]\n";
// MOD : ABBC3 (V1.0.7b) - END

#
#-----[ OPEN ]-------------------------------------------------------
#
includes/functions_content.php

#
#-----[ FIND ]-------------------------------------------------------
#
function censor_text($text)

#
#-----[ REPLACE WITH ]-----------------------------------------------
#
// MOD : ABBC3 (V1.0.7b) - START
function censor_text( $text, $abbcode3 = true )	//	function censor_text($text)
// MOD : ABBC3 (V1.0.7b) - END

#
#-----[ FIND ]-------------------------------------------------------
#
	// MOD : ABBC3 (V1.0.7) - START
	$abbcode3 = new abbcode3();
	$abbcode3->abbcode3_init();
	$text = $abbcode3->process_abbc3($text);
	// MOD : ABBC3 (V1.0.7) - END

#
#-----[ REPLACE WITH ]-----------------------------------------------
#
	// MOD : ABBC3 (V1.0.7b) - START
	if ( $abbcode3 )
	{
		$abbcode3 = new abbcode3();
		$abbcode3->abbcode3_init();
		$text = $abbcode3->process_abbc3($text);
	}
	// MOD : ABBC3 (V1.0.7b) - END

#
#-----[ OPEN ]-------------------------------------------------------
#
includes/ucp/ucp_pm_compose.php

#
#-----[ FIND ]-------------------------------------------------------
#
		$message_parser->message = $message_link . '[quote=&quot;' . $quote_username . '&quot;]' . censor_text(trim($message_parser->message)) . "[/quote]\n";

#
#-----[ REPLACE WITH ]-----------------------------------------------
#
	// MOD : ABBC3 (V1.0.7b) - START
	//	$message_parser->message = $message_link . '[quote=&quot;' . $quote_username . '&quot;]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
		$message_parser->message = $message_link . '[quote=&quot;' . $quote_username . '&quot;]' . censor_text(trim($message_parser->message), false) . "[/quote]\n";
	// MOD : ABBC3 (V1.0.7b) - END

#
#-----[DIY]----------------------------------------------------------
#
IN CASE YOU HAVE EXTRIMLY CUSTOMIZE YOUR ABBC3 AND YOU DON'T WANT TO DO IT AGAIN,
I SUGGEST THAT YOU CONTINUE THIS UPDATE.
BUT I SUGGESTED THAT YOU UPDATE YOUR INCLUDES FILES, INSTEAD CONTINUE.

#
#-----[ OPEN ]-------------------------------------------------------
#
includes/abbcode.php

#
#-----[ FIND ]-------------------------------------------------------
#
								'TAG_MOVER'		=> $user->lang[$abbcode_name . '_MOVER'],
								'TAG_TIP'		=> $user->lang[$abbcode_name . '_TIP'],

#
#-----[ REPLACE WITH ]-----------------------------------------------
#
								'TAG_MOVER'		=> &$user->lang[$abbcode_name . '_MOVER'],
								'TAG_TIP'		=> &$user->lang[$abbcode_name . '_TIP'],

#
#-----[ FIND ]-------------------------------------------------------
#
							$abbcode_name . '_MOVER'=> $user->lang[$abbcode_name . '_MOVER'],
							$abbcode_name . '_TIP'	=> $user->lang[$abbcode_name . '_TIP'],

#
#-----[ REPLACE WITH ]-----------------------------------------------
#
							$abbcode_name . '_MOVER'=> &$user->lang[$abbcode_name . '_MOVER'],
							$abbcode_name . '_TIP'	=> &$user->lang[$abbcode_name . '_TIP'],

#
#-----[ FIND ]-------------------------------------------------------
#
								'TAG_MOVER'		=> $user->lang[$abbcode_custom_name . '_MOVER'],
								'TAG_TIP'		=> $user->lang[$abbcode_custom_name . '_TIP'],

#
#-----[ REPLACE WITH ]-----------------------------------------------
#
								'TAG_MOVER'		=> &$user->lang[$abbcode_custom_name . '_MOVER'],
								'TAG_NOTE'		=> &$user->lang[$abbcode_custom_name . '_NOTE'],
								'TAG_TIP'		=> &$user->lang[$abbcode_custom_name . '_TIP'],

#
#-----[ OPEN ]-------------------------------------------------------
#
includes/functions_abbcode.php

#
#-----[ FIND ]-------------------------------------------------------
#
/**
* ABBC3 help page...
**/
function abbcode_show_help()
{
	global $template, $user;
	
	$abbcode3 = new abbcode3();
	$abbcode3->abbcode3_init();
	$abbcode3->display_abbc3();
	
	$user->add_lang('viewtopic');
	$user->add_lang('mods/abbcode');
	
	// Pull the array data from the lang pack
	$help_blocks = array();
	if ( sizeof( $abbcode3->abbcode_ary ) )
	{
		foreach ( $abbcode3->abbcode_ary as $abbcode_name => $abbcode_data )
		{
			if ( $abbcode_data['display'] ) // true ?
			{
				if ( substr($abbcode_name,0,11) != 'ABBC3_BREAK' && substr($abbcode_name,0,14) != 'ABBC3_DIVISION' ) // is a breck line or division ?
				{
					$template->assign_block_vars('bbc_row', array(
						'ABBC3_HELP_DESC'		=> $user->lang[$abbcode_name . '_MOVER'],
						'ABBC3_HELP_WRITE'		=> $user->lang[$abbcode_name . '_TIP'] . '<br />' . $user->lang[$abbcode_name . '_NOTE'],
						'ABBC3_HELP_VIEW'		=> $user->lang[$abbcode_name . '_VIEW'],
					));
				}
			}
		}
	}
	
	if ( sizeof( $abbcode3->abbcode_custom_ary ) )
	{
		foreach ( $abbcode3->abbcode_custom_ary as $abbcode_custom_name => $abbcode_custom_data )
		{
			if ( $abbcode_custom_data['display'] ) // true ?
			{
				if ( substr($abbcode_custom_name,0,11) != 'ABBC3_BREAK' && substr($abbcode_custom_name,0,14) != 'ABBC3_DIVISION' ) // is a breck line or division ?
				{
					$template->assign_block_vars('bbc_custom_row', array(
						'ABBC3_HELP_DESC'		=> $user->lang[$abbcode_custom_name . '_MOVER'],
						'ABBC3_HELP_WRITE'		=> $user->lang[$abbcode_custom_name . '_TIP'],
						'ABBC3_HELP_VIEW'		=> $user->lang[$abbcode_custom_name . '_VIEW'],
					));
				}
			}
		}
	}
	
	// Output page
	page_header($user->lang['ABBC3_HELP_TITLE']);
	
	$template->set_filenames(array(
		'body' => 'posting_abbcodes_help_body.html')
	);
	
	page_footer();
}

#
#-----[ REPLACE WITH ]-----------------------------------------------
#
/**
* ABBC3 help page...
**/
function abbcode_show_help()
{
	global $template, $user, $config;
	
	$abbcode3 = new abbcode3();
	$abbcode3->abbcode3_init();
	$abbcode3->display_abbc3();
	
	$user->add_lang('viewtopic');
	$user->add_lang('mods/abbcode');
	
	// Pull the array data from the lang pack
	$help_blocks = array();
	
	/**
	* Display ABBC3 ?
	**/
	if ( $abbcode3->abbcode_config['ABBC3_MOD'] )
	{
	
		/**
		* Patterns and replacements for ABBC3 bbcodes processing - Part 1 of 1
		**/
		if ( sizeof( $abbcode3->abbcode_ary ) )
		{
			foreach ( $abbcode3->abbcode_ary as $abbcode_name => $abbcode_data )
			{
				if ( $abbcode_data['display'] ) // true ?
				{
					if ( substr($abbcode_name,0,11) != 'ABBC3_BREAK' && substr($abbcode_name,0,14) != 'ABBC3_DIVISION' ) // is a breck line or division ?
					{
						$template->assign_block_vars('bbc_row', array(
							'ABBC3_HELP_DESC'	=> &$user->lang[$abbcode_name . '_MOVER'],
							'ABBC3_HELP_WRITE'	=> &$user->lang[$abbcode_name . '_TIP'],
							'ABBC3_HELP_NOTE'	=> &$user->lang[$abbcode_name . '_NOTE'] ,
							'ABBC3_HELP_VIEW'	=> &$user->lang[$abbcode_name . '_VIEW'],
						));
					}
				}
			}
		}
	}
	
	/**
	* Display CUSTOM ABBC3 ?
	**/
	if ( $abbcode3->abbcode_config['ABBC3_CUSTOM'] )
	{
		/**
		* Patterns and replacements for Custom ABBC3 bbcodes processing - Part 1 of 1
		**/
		if ( sizeof( $abbcode3->abbcode_custom_ary ) )
		{
			foreach ( $abbcode3->abbcode_custom_ary as $abbcode_custom_name => $abbcode_custom_data )
			{
				if ( $abbcode_custom_data['display'] ) // true ?
				{
					if ( substr($abbcode_custom_name,0,11) != 'ABBC3_BREAK' && substr($abbcode_custom_name,0,14) != 'ABBC3_DIVISION' ) // is a breck line or division ?
					{
						$template->assign_block_vars('bbc_custom_row', array(
							'ABBC3_HELP_DESC'	=> &$user->lang[$abbcode_custom_name . '_MOVER'],
							'ABBC3_HELP_WRITE'	=> &$user->lang[$abbcode_custom_name . '_TIP'],
							'ABBC3_HELP_VIEW'	=> &$user->lang[$abbcode_custom_name . '_VIEW'],
						));
					}
				}
			}
		}
	}
	
	// Output page
	page_header($user->lang['ABBC3_HELP_TITLE']);
	
	$template->set_filenames(array(
		'body' => 'posting_abbcodes_help_body.html')
	);
	
	page_footer();
}

#
#-----[ OPEN ]-------------------------------------------------------
# NOTE: You will have to make this change to ALL themes you have installed. I use "prosilver" as an example.
#
styles/prosilver/template/posting_abbcodes_help_body.html

#
#-----[ FIND ]-------------------------------------------------------
#
{bbc_row.ABBC3_HELP_WRITE}

#
#-----[ IN LINE, AFTER ADD ]-----------------------------------------
#
<br />{bbc_row.ABBC3_HELP_NOTE}

#
#-----[ FIND ]-------------------------------------------------------
#
{bbc_custom_row.ABBC3_HELP_WRITE}

#
#-----[ IN LINE, AFTER ADD ]-----------------------------------------
#
<br />{bbc_custom_row.ABBC3_HELP_NOTE}

#
#-----[DIY]----------------------------------------------------------
#
After installation, make sure you purge the cache and refresh all the styles through the ACP to get everything to show up correctly.

#
#-----[ SAVE/CLOSE ALL FILES ]---------------------------------------
#
# EoM