<?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>GNU General Public License v2</license>
		
		<title lang="en">Signature Restrictions</title>
		
		<description lang="en">Adds additional settings for restricting the content of signatures.</description>
		
		<author-notes lang="en"><![CDATA[
Some forum administrators like to have very clear, precise limits on user signatures. These can involve restrictions on length and content that go beyond the limits of phpBB's default signature settings. For such forums, dealing with signatures that break the forum's rules can eat up a good bit of time for both forum staff, who have to handle these violations, and the users, who often have to guess if a signature is acceptable.

Signature Restrictions adds new settings to phpBB 3 forums, allowing administrators to set additional rules for signatures. These include the number of images, number of text lines, and number of characters per line. The width and height of images, in relation to the line restrictions, are also considered. With these more precise controls on signature length and layout, the hassle of monitoring signatures is reduced for users and staff.

The image filesize functions of this modification require PHP 5 or later. When used on PHP 4, those features will be disabled.

Developing and maintaining modifications can consume a great deal of time and effort. If you find this project useful and would like to express your appreciation through a donation, that generosity would be appreciated. Donations can be made to my PayPal ID, thoul@phpbbsmith.com. Any amount is helpful.
		]]></author-notes>
		
		<author-group>
			<author>
				<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.5</target-version>
		</installation>

		<history>
			<entry>
				<date>2009-06-27</date>
				<rev-version>1.0.0</rev-version>
				<changelog lang="en">
					<change>Improved handling of blank lines.</change>
					<change>Added image filesize restrictions.</change>
					<change>Added language file for fewer edits.</change>
					<change>Added subsilver2 instructions.</change>
				</changelog>
			</entry>
			<entry>
				<date>2009-04-27</date>
				<rev-version>0.0.1</rev-version>
				<changelog lang="en">
					<change>Initial release.</change>
				</changelog>
			</entry>
		</history>

		<link-group>
			<link type="template" href="contrib/subsilver2.xml" lang="en">subsilver2</link>
		</link-group>
	</header>
	
	<action-group>
		<copy>
			<file from="root/*.*" to="*.*" />
		</copy>
		
		<open src="includes/acp/acp_board.php">
			<edit>
				<find><![CDATA[						'max_sig_img_height'	=> array('lang' => 'MAX_SIG_IMG_HEIGHT',	'validate' => 'int:0',	'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),]]></find>
				<action type="after-add"><![CDATA[
//----------------------------------------------------------------------
// Signature Restrictions - Begin Code Alteration
//
						'legend3'							=> 'SIG_RESTRICT',
						'sigrestrict_enable'				=> array('lang' => 'SIGRESTRICT_ENABLE',				'validate' => 'int:0',	'type' => 'radio:yes_no',	'explain' => true),
						'sigrestrict_max_images'			=> array('lang' => 'SIGRESTRICT_MAX_IMAGES',			'validate' => 'int:0',	'type' => 'text:5:4',		'explain' => true),
						'sigrestrict_max_image_filesize'	=> array('lang' => 'SIGRESTRICT_MAX_IMAGE_FILESIZE',	'validate' => 'int:0',	'type' => 'text:5:4',	'explain' => true, 'append'	=> ' ' . $user->lang['BYTES']),
						'sigrestrict_max_image_filesize_total'	=> array('lang' => 'SIGRESTRICT_MAX_IMAGE_FILESIZE_TOTAL',	'validate' => 'int:0',	'type' => 'text:5:4',	'explain' => true, 'append'	=> ' ' . $user->lang['BYTES']),
						'sigrestrict_max_lines'				=> array('lang' => 'SIGRESTRICT_MAX_LINES',				'validate' => 'int:0',	'type' => 'text:5:4',		'explain' => true, 'append'	=> ' ' . $user->lang['LINES']),
						'sigrestrict_image_line_px'			=> array('lang' => 'SIGRESTRICT_IMAGE_LINE_PX',			'validate' => 'int:0',	'type' => 'text:5:4',		'explain' => true,	'append' => ' ' . $user->lang['PIXEL']),
						'sigrestrict_max_line_chars'		=> array('lang' => 'SIGRESTRICT_MAX_LINE_CHARS',		'validate' => 'int:0',	'type' => 'text:5:4',		'explain' => true),
						'sigrestrict_image_width_px'		=> array('lang' => 'SIGRESTRICT_IMAGE_WIDTH_PX',		'validate' => 'int:0',	'type' => 'text:5:4',		'explain' => true,	'append' => ' ' . $user->lang['PIXEL']),
						'sigrestrict_max_line_chars_silent'	=> array('lang' => 'SIGRESTRICT_MAX_LINE_CHARS_SILENT',	'validate' => 'bool',	'type' => 'radio:yes_no',	'explain' => true),
						'sigrestrict_noget_handle'			=> array('lang' => 'SIGRESTRICT_NOGET_HANDLE',			'validate' => 'int:0',	'type' => 'radio:yes_no',	'explain' => true),
//
// Signature Restrictions - End Code Alteration
//----------------------------------------------------------------------
]]></action>
			</edit>

		</open>
		<open src="includes/ucp/ucp_profile.php">
			<edit>
				<find><![CDATA[				add_form_key('ucp_sig');]]></find>
				<action type="after-add"><![CDATA[
//----------------------------------------------------------------------
// Signature Restrictions - Begin Code Alteration
//
				include("{$phpbb_root_path}mods/sig_restrict/class_restrict.{$phpEx}");
				$restrict = new Signature_Restriction();
//
// Signature Restrictions - End Code Alteration
//----------------------------------------------------------------------
]]></action>
			</edit>
			<edit>
				<find><![CDATA[						if (sizeof($message_parser->warn_msg))
						{
							$error[] = implode('<br />', $message_parser->warn_msg);
						}]]></find>

			<action type="after-add"><![CDATA[
//----------------------------------------------------------------------
// Signature Restrictions - Begin Code Alteration
//
						$restrict->check($signature);
						$restrict->get_error($error);
//
// Signature Restrictions - End Code Alteration
//----------------------------------------------------------------------
]]></action>
			</edit>
		</open>
		<open src="styles/prosilver/template/ucp_profile_signature.html">
			<edit>
				<find><![CDATA[		<!-- IF S_LINKS_ALLOWED -->
			<div><label for="disable_magic_url"><input type="checkbox" name="disable_magic_url" id="disable_magic_url"{S_MAGIC_URL_CHECKED} /> {L_DISABLE_MAGIC_URL}</label></div>
		<!-- ENDIF -->
	
	</fieldset>]]></find>
				<action type="after-add"><![CDATA[	<!-- IF SIGRESTRICT_ENABLE -->
	<h3>{L_SIGRESTRICT_RULES}</h3>
	<fieldset>
		<!-- BEGIN sig_rules -->
			<div>{sig_rules.RULE}</div>
		<!-- END sig_rules -->
	</fieldset>
	<!-- ENDIF -->
]]></action>
			</edit>

		</open>

		<diy-instructions lang="en">Run install.php by visiting it in your web browser, for example:
http://www.yoursite.com/phpBB3/install.php
When finished, delete install.php and the umil/ folder from your site.

Log in to the Administration Control Panel and visit the Signature settings 
page on the General tab to configure this modification.
</diy-instructions>
	</action-group>
</mod>

