<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="./contrib/xsl/modx.prosilver.en.xsl"?>
<!--
	NOTICE: Please open this file in your web browser. If presented with a security warning, 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.5.xsd">
	<header>
		<license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license>
		<title lang="en">Prime Signature Cap</title>
		<description lang="en">Provides the ability to restrict the number of lines in a signature. Detects only manual line breaks; a string that wraps due to length is still counted as a single line.</description>
		<author-notes lang="en">Creating, 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 donations, 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 $1.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#signature_cap]]></homepage>
			</author>
		</author-group>
		<mod-version>1.0.1a</mod-version>
		<installation>
			<level>easy</level>
			<time>180</time>
			<target-version>3.0.12</target-version>
		</installation>
		<history>
			<entry>
				<date>2008-02-06</date>
				<rev-version>1.0.0</rev-version>
				<changelog lang="en">
					<change>Initial release.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-04-08</date>
				<rev-version>1.0.0a</rev-version>
				<changelog lang="en">
					<change>Updated for the phpBB 3.0.1 release.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-04-12</date>
				<rev-version>1.0.1</rev-version>
				<changelog lang="en">
					<change>Changed the default value from FALSE to 0 (zero).</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-07-02</date>
				<rev-version>1.0.1a</rev-version>
				<changelog lang="en">
					<change>Repackaged for MODX 1.2.0.</change>
				</changelog>
			</entry>
		</history>
	</header>
	<action-group>
		<copy>
			<file from="root/language/en/mods/prime_signature_cap.php" to="language/en/mods/prime_signature_cap.php" />
		</copy>

		<open src="includes/acp/acp_board.php">
			<edit>
				<find><![CDATA[			case 'signature':]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Signature Cap -----------------------------------------------//
				$user->add_lang('mods/prime_signature_cap');
				if (!isset($config['max_sig_lines']))
				{
					set_config('max_sig_lines', 0);
				}
//-- end: Prime Signature Cap -----------------------------------------------//]]></action>
			</edit>
			<edit>
				<find><![CDATA[						'max_sig_chars'			=> array('lang' => 'MAX_SIG_LENGTH',		'validate' => 'int:0',	'type' => 'text:5:4', 'explain' => true),]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Signature Cap -----------------------------------------------//
						'max_sig_lines'			=> array('lang' => 'MAX_SIG_LINES',			'validate' => 'int:0',	'type' => 'text:5:4', 'explain' => true),
//-- end: Prime Signature Cap -----------------------------------------------//]]></action>
			</edit>
		</open>

		<open src="includes/message_parser.php">
			<edit>
				<find><![CDATA[		// Check for "empty" message]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Signature Cap -----------------------------------------------//
// Restrict the number of lines in a signature.
		if (!empty($config['max_' . $mode . '_lines']))
		{
			$this->message = rtrim($this->message);
			$row_len = substr_count($this->message, "\n") + 1;

			if ($row_len > $config['max_' . $mode . '_lines'])
			{
				$user->add_lang('mods/prime_signature_cap');
				$this->warn_msg[] = sprintf($user->lang['TOO_MANY_LINES_' . strtoupper($mode)], $row_len, $config['max_' . $mode . '_lines']);
				return $this->warn_msg;
			}
		}
//-- end: Prime Signature Cap -----------------------------------------------//
]]></action>
			</edit>
		</open>

		<open src="viewtopic.php">
			<edit>
				<find><![CDATA[				$user_sig = $row['user_sig'];]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Signature Cap -----------------------------------------------//
// If signature has more lines than allowed, then trim it down.
				$user_sig = (empty($config['max_sig_lines']) || substr_count($user_sig, "\n") + 1 <= $config['max_sig_lines']) ? $user_sig : preg_replace("/^((?:.*?\n){" . $config['max_sig_lines'] . "})(?:.|\n)+/i", "\\1", $user_sig);
//-- end: Prime Signature Cap -----------------------------------------------//]]></action>
			</edit>
		</open>
		<diy-instructions lang="en"><![CDATA[To configure, go to the Administration Control Panel, and navigate to the "Signature Settings" page.]]></diy-instructions>
	</action-group>
</mod>
