<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<?xml-stylesheet type="text/xsl" href="./modx.smith.en.xsl"?>
<mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpbb.com/mods/xml/modx-1.2.2.xsd">
	<header>
		<license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license>
		
		<title lang="en">Censor Block</title>
		
		<description lang="en">
			Prevents users from entering naughty words into the database.
		</description>
		
		<author-notes lang="en"><![CDATA[
Censor Block is a moderation assistance tool that prevents vulgar words from being posted on a phpBB forum.  When someone attempts to post on a forum, Censor Block will scan the submission for words defined in the forum's word censors. If a naughty word is detected, a message will be displayed asking the user to alter their post.  The error message will include a preview of the post with the censor triggering words highlighted.

Censor Block also checks private messages and user profile fields in the same manner.  Custom Profile Fields created in the phpBB 3 admin panel are checked as well, if they are defined as a text field.  The highlighting format is controlled via CSS in the stylesheet of your themes.
		]]></author-notes>
		
		<author-group>
			<author>
				<realname>Jeremy Rogers</realname>
				<username>Thoul</username>
				<homepage>http://www.phpbbsmith.com</homepage>
			</author>
		</author-group>
		
		<mod-version>1.0.0</mod-version>
		
		<installation>
			<level>easy</level>
			<time>300</time>
			<target-version>3.0.4</target-version>
		</installation>

		<history>
			<entry>
				<date>2009-03-25</date>
				<rev-version>1.0.0</rev-version>
				<changelog lang="en">
					<change>Fixed minor bug in highlighting code</change>
					<change>Forced disabling if censors are empty</change>
					<change>Added prosilver CSS file.</change>
					<change>Modified language file to be a little more like standard phpBB 3 files.</change>
					<change>Added CSS class for formatting the entire preview displayed if censors are triggered.</change>
					<change>Added ModX instructions</change>
				</changelog>
			</entry>
			<entry>
				<date>2009-03-09</date>
				<rev-version>0.0.2</rev-version>
				<changelog lang="en">
					<change>First phpBB 3 release.</change>
				</changelog>
			</entry>
		</history>
	</header>
	
	<action-group>
		<copy>
			<file from="root/*.*" to="*.*" />
		</copy>
		<open src="posting.php">
			<edit>
				<find><![CDATA[include($phpbb_root_path . 'includes/message_parser.' . $phpEx);]]></find>
				<action type="after-add"><![CDATA[
//----------------------------------------------------------------------
// Censor Block - Begin Code Alteration
//
include($phpbb_root_path . 'mods/cenblock.' . $phpEx);
//
// Censor Block - End Code Alteration
//----------------------------------------------------------------------
]]></action>
			</edit>
			<edit>
				<find><![CDATA[	if (sizeof($message_parser->warn_msg))
	{
		$error[] = implode('<br />', $message_parser->warn_msg);
	}]]></find>
				<action type="before-add"><![CDATA[
//----------------------------------------------------------------------
// Censor Block - Begin Code Alteration
//
	$cenblock->check_post($error, $post_data, $poll);
//
// Censor Block - End Code Alteration
//----------------------------------------------------------------------
]]></action>
			</edit>

		</open>
		<open src="includes/functions_profile_fields.php">
			<edit>
				<find><![CDATA[				if ($error != '')
				{
					$cp_error[] = $error;
				}
			}]]></find>
				<action type="after-add"><![CDATA[
//----------------------------------------------------------------------
// Censor Block - Begin Code Alteration
//
			global $cenblock;
			if( is_object($cenblock) )
			{
				$cenblock->check_cp_field($cp_error, $row['field_type'], $check_value, $row['lang_name']);
			}
//
// Censor Block - End Code Alteration
//----------------------------------------------------------------------
]]></action>
			</edit>

		</open>
		<open src="includes/ucp/ucp_pm_compose.php">
			<edit>
				<find><![CDATA[	include($phpbb_root_path . 'includes/message_parser.' . $phpEx);]]></find>
				<action type="after-add"><![CDATA[
//----------------------------------------------------------------------
// Censor Block - Begin Code Alteration
//
	include($phpbb_root_path . 'mods/cenblock.' . $phpEx);
//
// Censor Block - End Code Alteration
//----------------------------------------------------------------------
]]></action>
			</edit>
			<edit>
				<find><![CDATA[		// Parse message
		$message_parser->parse($enable_bbcode, ($config['allow_post_links']) ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, $config['allow_post_links']);]]></find>
				<action type="after-add"><![CDATA[
//----------------------------------------------------------------------
// Censor Block - Begin Code Alteration
//
		$post_data	= array(
			'post_subject'	=> $subject,
			'message'		=> $message_parser->message
		);
		$cenblock->check_post($error, $post_data);
//
// Censor Block - End Code Alteration
//----------------------------------------------------------------------
]]></action>
			</edit>

		</open>
		<open src="includes/ucp/ucp_profile.php">
			<edit>
				<find><![CDATA[					// validate custom profile fields
					$cp->submit_cp_field('profile', $user->get_iso_lang_id(), $cp_data, $cp_error);]]></find>
				<action type="before-add"><![CDATA[
//----------------------------------------------------------------------
// Censor Block - Begin Code Alteration
//
					include($phpbb_root_path . 'mods/cenblock.' . $phpEx);
					$cenblock->check_profile($error, $data, $validate_array);
//
// Censor Block - End Code Alteration
//----------------------------------------------------------------------
]]></action>
			</edit>
			<edit>
				<find><![CDATA[						if (sizeof($message_parser->warn_msg))
						{
							$error[] = implode('<br />', $message_parser->warn_msg);
						}]]></find>
				<action type="before-add"><![CDATA[
//----------------------------------------------------------------------
// Censor Block - Begin Code Alteration
//
						include($phpbb_root_path . 'mods/cenblock.' . $phpEx);
						$cenblock->check_post($error);
//
// Censor Block - End Code Alteration
//----------------------------------------------------------------------
]]></action>
			</edit>

		</open>
		<open src="styles/prosilver/theme/stylesheet.css">
			<edit>
				<find><![CDATA[@import url("colours.css");]]></find>
				<action type="after-add"><![CDATA[
@import url("censorblock.css");
]]></action>
			</edit>

		</open>
	</action-group>
</mod>

