<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="./contrib/modx.prosilver.en.xsl"?>
<!-- 
	NOTICE: Please open this file in your web browser. If Internet Explorer presents a security bar, you may safely tell it to allow the blocked content.
-->
<!--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/-->
<mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpbb.com/mods/xml/modx-1.2.0.xsd">
	<header>
		<license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license>
		<title lang="en">Prime Anti-bot</title>
		<description lang="en">Implements a text-based human validation system in order to verify that a form submitter is human and not a SPAM robot. It will remember a successful validation so the user won't have to re-validate each time. The validation phrases/questions and responses are fully customizable; you can put as many or as few as you want (one is picked from the list at random each time it's needed). Can be configured to validate on new registrations and guest postings.</description>
	    <author-notes lang="en">Pass keys and responses can be added and altered in the "language/en/mods/prime_captcha_keys.php" file.

Support is given for both prosilver and subsilver2 templates. If you are using other templates then you may need to modify the template instructions to fit your templates. Instructions for subsilver2 are located in the templates directory. I have provided a default template page in the "contrib" directory which should work with any template style.

ICreating, maintaining, and updating MODs requires a lot of time and effort, so if you like this MOD and have the desire to express your thanks through a donation, that would be greatly appreciated. My Paypal ID is primehalo@gmail.com, or contact me for my mailing address. The suggested donation amount for this MOD is $5.00 (but any amount will help).</author-notes>
		<author-group>
			<author>
				<realname>Ken F. Innes IV</realname>
				<email>primehalo@gmail.com</email>
				<username>primehalo</username>
				<homepage><![CDATA[http://www.absoluteanime.com/admin/mods.htm#anti-bot]]></homepage>
			</author>
		</author-group>
		<mod-version>1.0.2c</mod-version>
		<installation>
			<level>easy</level>
			<time>300</time>
			<target-version>3.0.1</target-version>
		</installation>
		<history>
			<entry>
				<date>2007-07-27</date>
				<rev-version>0.0.0</rev-version>
				<changelog lang="en">
					<change>Initial test release</change>
				</changelog>
			</entry>
			<entry>
				<date>2007-07-29</date>
				<rev-version>0.0.1</rev-version>
				<changelog lang="en">
					<change>Changed the name from "Slick CAPTCHA" to "Quick CAPTCHA" due to a request by a MOD author who writes "Slick"-titled MODs.</change>
					<change>Fixed a bug in the template file which would make it look bad when using it with the prosilver style.</change>
				</changelog>
			</entry>
			<entry>
				<date>2007-07-30</date>
				<rev-version>0.0.2</rev-version>
				<changelog lang="en">
					<change>Added the ability to display the CAPTCHA in with the existing templates rather than on a separate page.</change>
				</changelog>
			</entry>

			<entry>
				<date>2007-08-02</date>
				<rev-version>0.0.3</rev-version>
				<changelog lang="en">
					<change>Renamed the MOD to "Prime CAPTCHA" (which changed some variable names and the names of the included files).</change>
				</changelog>
			</entry>

			<entry>
				<date>2007-08-19</date>
				<rev-version>0.0.4</rev-version>
				<changelog lang="en">
					<change>Added options to the Administration Control Panel which allow the enabling and disabling of this MOD for new user registrations and guest postings.</change>
					<change>Separated the key phrases/responses into a separate file, so if other text changes relating to this MOD occur it won't affect any customizations that had been made to the key phrases/responses.</change>
				</changelog>
			</entry>

			<entry>
				<date>2007-08-19</date>
				<rev-version>0.0.5</rev-version>
				<changelog lang="en">
					<change>Added a tabindex value to the form field.</change>
				</changelog>
			</entry>

			<entry>
				<date>2007-09-19</date>
				<rev-version>1.0.0</rev-version>
				<changelog lang="en">
					<change>Put my functions inside of a class definition so it will not conflict with other MODs that happen to use the same function names I did.</change>
					<change>Patched a hole that would still allow some automated robots to bypass the human verification check.</change>
					<change>Enabled the MOD to work even if a user has cookies disabled.</change>
					<change>Put the option to use a separate page for the validation with the Enable/Disable options in the ACP.</change>
				</changelog>
			</entry>

			<entry>
				<date>2007-10-01</date>
				<rev-version>1.0.0a</rev-version>
				<changelog lang="en">
					<change>Repackaged to comply with MOD Team Leader wGEric's specifications for proper packaging.</change>
				</changelog>
			</entry>

			<entry>
				<date>2007-10-22</date>
				<rev-version>1.0.0b</rev-version>
				<changelog lang="en">
					<change>Fixed a minor bug on the posting page (posting.php).</change>
					<change>Confirmed compatibility with phpBB3.0.RC7.</change>
				</changelog>
			</entry>

			<entry>
				<date>2007-10-26</date>
				<rev-version>1.0.0c</rev-version>
				<changelog lang="en">
					<change>Added a check for IN_PHPBB to the language file, as per RC7.</change>
				</changelog>
			</entry>

			<entry>
				<date>2007-12-27</date>
				<rev-version>1.0.1</rev-version>
				<changelog lang="en">
					<change>Increased the tabindex value on the registration page.</change>
				</changelog>
			</entry>

			<entry>
				<date>2007-12-31</date>
				<rev-version>1.0.2</rev-version>
				<changelog lang="en">
					<change>Some minor code changes that shouldn't alter performance in any way.</change>
				</changelog>
			</entry>

			<entry>
				<date>2008-01-18</date>
				<rev-version>1.0.2a</rev-version>
				<changelog lang="en">
					<change>Heeded some advice to rename from Prime CAPTCHA to Prime Anti-bot. All file names, variable names, function names, and class names will remain the same.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-05-27</date>
				<rev-version>1.0.2b</rev-version>
				<changelog lang="en">
					<change>Added a Portuguese translation.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-07-02</date>
				<rev-version>1.0.2c</rev-version>
				<changelog lang="en">
					<change>Repackaged for MODX 1.2.0.</change>
				</changelog>
			</entry>
		</history>
		<link-group>
			<link type="template" href="contrib/templates/subsilver2.xml" lang="en">subsilver2</link>
			<link type="language" href="contrib/languages/pt.xml" lang="en">Portuguese</link>
		</link-group>
	</header>
	<action-group>
		<copy>
			<file from="root/language/en/mods/prime_captcha.php" to="language/en/mods/prime_captcha.php" />
			<file from="root/language/en/mods/prime_captcha_keys.php" to="language/en/mods/prime_captcha_keys.php" />
			<file from="root/includes/prime_captcha.php" to="includes/prime_captcha.php" />
			<file from="root/styles/prosilver/template/prime_captcha.html" to="styles/prosilver/template/prime_captcha.html" />
		</copy>

		<open src="includes/acp/acp_board.php">
			<edit>
				<find><![CDATA[		$user->add_lang('acp/board');]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Anti-bot ----------------------------------------------------//
		include($phpbb_root_path . 'includes/prime_captcha.' . $phpEx);
		$user->add_lang('mods/prime_captcha');
//-- end: Prime Anti-bot ----------------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[						'override_user_style'	=> array('lang' => 'OVERRIDE_STYLE',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Anti-bot ----------------------------------------------------//
						'prime_captcha_post'	=> array('lang' => 'PRIME_CAPTCHA_POST',	'validate' => 'int',	'type' => 'custom', 'function' => 'prime_captcha_make_options', 'params' => array('{KEY}', '{CONFIG_VALUE}'), 'explain' => true),
						'prime_captcha_reg'		=> array('lang' => 'PRIME_CAPTCHA_REG',		'validate' => 'int',	'type' => 'custom', 'function' => 'prime_captcha_make_options', 'params' => array('{KEY}', '{CONFIG_VALUE}'), 'explain' => true),
//-- end: Prime Anti-bot ----------------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[						'enable_post_confirm'	=> array('lang' => 'VISUAL_CONFIRM_POST',	'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Anti-bot ----------------------------------------------------//
						'prime_captcha_post'	=> array('lang' => 'PRIME_CAPTCHA_POST',	'validate' => 'int',	'type' => 'custom', 'function' => 'prime_captcha_make_options', 'params' => array('{KEY}', '{CONFIG_VALUE}'), 'explain' => true),
//-- end: Prime Anti-bot ----------------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[						'enable_confirm'		=> array('lang' => 'VISUAL_CONFIRM_REG',	'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Anti-bot ----------------------------------------------------//
						'prime_captcha_reg'		=> array('lang' => 'PRIME_CAPTCHA_REG',		'validate' => 'int',	'type' => 'custom', 'function' => 'prime_captcha_make_options', 'params' => array('{KEY}', '{CONFIG_VALUE}'), 'explain' => true),
//-- end: Prime Anti-bot ----------------------------------------------------//]]></action>
			</edit>
		</open>


		<open src="includes/ucp/ucp_register.php">
			<edit>
				<find>		// Try to manually determine the timezone</find>
				<action type="before-add"><![CDATA[//-- mod: Prime Anti-bot ----------------------------------------------------//
		if (!empty($config['prime_captcha_reg']))
		{
			if (!class_exists('prime_captcha'))
			{
				include($phpbb_root_path . 'includes/prime_captcha.' . $phpEx);
			}
			$prime_captcha = new prime_captcha();
		}
//-- end: Prime Anti-bot ----------------------------------------------------//
]]></action>
			</edit>
			<edit>
				<find>			$error = preg_replace</find>
				<action type="after-add"><![CDATA[//-- mod: Prime Anti-bot ----------------------------------------------------//
			if ($prime_captcha->error)
			{
				$error[] = $user->lang[$prime_captcha->error];
			}
//-- end: Prime Anti-bot ----------------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[		$s_hidden_fields = build_hidden_fields($s_hidden_fields);]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Anti-bot ----------------------------------------------------//
		$s_hidden_fields .= isset($prime_captcha->fields) ? build_hidden_fields($prime_captcha->fields) : '';
//-- end: Prime Anti-bot ----------------------------------------------------//]]></action>
			</edit>
		</open>


		<open src="posting.php">
			<edit>
				<find>$user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']);</find>
				<action type="after-add"><![CDATA[
//-- mod: Prime Anti-bot ----------------------------------------------------//
if (!empty($config['prime_captcha_post']) && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply')))
{
	if (!class_exists('prime_captcha'))
	{
		include($phpbb_root_path . 'includes/prime_captcha.' . $phpEx);
	}
	$prime_captcha = new prime_captcha();
	if ($prime_captcha->error)
	{
		$error[] = $user->lang[$prime_captcha->error];
	}
}
//-- end: Prime Anti-bot ----------------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . request_var('draft_loaded', $draft_id) . '" />' : '';]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Anti-bot ----------------------------------------------------//
$s_hidden_fields .= isset($prime_captcha->fields) ? build_hidden_fields($prime_captcha->fields) : '';
//-- end: Prime Anti-bot ----------------------------------------------------//]]></action>
			</edit>
	    </open>

		<open src="styles/prosilver/template/ucp_register.html">
			<edit>
				<find><![CDATA[<!-- IF S_CONFIRM_CODE -->]]></find>
				<action type="before-add"><![CDATA[<!-- IF PRIME_CAPTCHA_TITLE -->
	<span class="corners-bottom"><span></span></span></div>
</div>

<div class="panel">
	<div class="inner"><span class="corners-top"><span></span></span>

	<h3>{PRIME_CAPTCHA_TITLE}</h3>
	<p>{PRIME_CAPTCHA_DESCRIPTION}</p>

	<fieldset class="fields2">
	<dl>
		<dt><label for="{PRIME_CAPTCHA_FIELD_KEY_RESPONSE}">{PRIME_CAPTCHA_INSTRUCTIONS}:</label></dt>
		<dd>{PRIME_CAPTCHA_KEY_PHRASE}</dd>
		<dd><input type="text" name="{PRIME_CAPTCHA_FIELD_KEY_RESPONSE}" id="{PRIME_CAPTCHA_FIELD_KEY_RESPONSE}" size="30" value="" tabindex="10" class="inputbox narrow" title="{PRIME_CAPTCHA}" />{PRIME_CAPTCHA_HIDDEN_FIELDS}</dd>
	</dl>
	</fieldset>
<!-- ENDIF -->
]]></action>
			</edit>
	    </open>

		<open src="styles/prosilver/template/posting_editor.html">
			<edit>
				<find><![CDATA[<!-- IF S_CONFIRM_CODE -->]]></find>
				<action type="before-add"><![CDATA[		<!-- IF PRIME_CAPTCHA_TITLE -->
		<dl>
			<dt><label for="{PRIME_CAPTCHA_FIELD_KEY_RESPONSE}">{PRIME_CAPTCHA_INSTRUCTIONS}:</label></dt>
				<dd>{PRIME_CAPTCHA_KEY_PHRASE}</dd>
				<dd><input type="text" name="{PRIME_CAPTCHA_FIELD_KEY_RESPONSE}" id="{PRIME_CAPTCHA_FIELD_KEY_RESPONSE}" size="30" value="" tabindex="3" class="inputbox narrow" title="{PRIME_CAPTCHA}" />{PRIME_CAPTCHA_HIDDEN_FIELDS}</dd>
		</dl>
		<!-- ENDIF -->
]]></action>
			</edit>
	    </open>

		<diy-instructions lang="en">Now you must enable the human confirmation settings. To do this, go to the
Administration Control Panel, and on the "General" page go to the "Board 
settings" section. Once there, enable both the "Enable verification
for guest postings" and "Enable verification for registrations" settings.

If you have the built-in Visual Confirmation turned on, you can now turn it
off. To do this, go to the Administration Control Panel, and on the "General"
page go to the "Visual confirmation settings" link. Once on the "Visual 
confirmation settings" page, select "Disabled" for both "Enable visual
confirmation for registrations" and "Enable visual confirmation for guest
postings".</diy-instructions>
	</action-group>
</mod>