<?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 Trash Bin</title>
		<description lang="en">Allows topics and posts to be kept when they are deleted so that they can be reviewed before being permanently deleted (or undeleted). Also, provides the ability to enter a reason for the deletion, and allows deleted topics to be moved to a specified Trash Bin forum. These deleted topics and posts can be viewed, undeleted, or permanently deleted by those with the proper permissions. Permanent deletion will occur when deleting topics in the Trash Bin forum or topics and posts that have already been marked as deleted.</description>
	    <author-notes lang="en">The deletion options are set from the "Board Settings" section of the Administration Control.

Support is given for both prosilver and subsilver2 templates. If you are using other templates then you will need to modify the template instructions to fit your templates.

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 $20.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#trash_bin]]></homepage>
			</author>
		</author-group>
		<mod-version>1.1.6</mod-version>
		<installation>
			<level>easy</level>
			<time>900</time>
			<target-version>3.0.10</target-version>
		</installation>
		<history>
			<entry>
				<date>2007-09-19</date>
				<rev-version>0.2.0</rev-version>
				<changelog lang="en">
					<change>Renamed the MOD from "Prime Recycle Bin" to "Prime Trash Bin"</change>
					<change>Allow topics to be deleted in place, without requiring them to be moved to a special folder.</change>
					<change>Update user post counts when deleting and undeleting.</change>
					<change>Update last post info when deleting and undeleting.</change>
					<change>Log deletes and undeletes.</change>
					<change>Added board permissions for permanently deleting and undeleting.</change>
					<change>When revealing a deleted post, the poster and subject is now listed in addition to the post itself.</change>
					<change>Allows the entering of a reason for deletion without requiring a separate MOD.</change>
					<change>Fixed a lot of minor bugs.</change>
					<change>Updated the styling for showing deleted topics and posts.</change>
					<change>Added the undelete option to the quickmod and moderator control panel.</change>
					<change>Reorganized the code so most future updates should only require copying over the included files.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-01-07</date>
				<rev-version>0.2.9</rev-version>
				<changelog lang="en">
					<change>Fixed an "Undefined index: user_id" error that could occur with deleted posts in the moderator control panel.</change>
					<change>Fixed a bug where topics were not permanently deleted when selecting the "Permanently delete this topic" option.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-01-12</date>
				<rev-version>0.2.10</rev-version>
				<changelog lang="en">
					<change>When viewing the contents of a deleted post, the author would always show up as Guest.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-01-12</date>
				<rev-version>0.2.11	</rev-version>
				<changelog lang="en">
					<change>Fixed a minor styling issue with a subsilver2 template.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-01-19</date>
				<rev-version>0.2.12	</rev-version>
				<changelog lang="en">
					<change>Added a define that can be set to allow users to view deleted topic titles.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-01-30</date>
				<rev-version>0.2.13</rev-version>
				<changelog lang="en">
					<change>Fixed a bug where selecting multiple posts to delete from the MCP would only end up deleting the first post.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-01-31</date>
				<rev-version>0.2.14</rev-version>
				<changelog lang="en">
					<change>Allow the viewing of a deleted post's content on the search results page when the results are displayed as posts.</change>
					<change>Added a link to the deleted post next to the deleted post announcement so the post can be accessed from the search results page and so users can send the link for moderators to look over.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-02-01</date>
				<rev-version>0.2.15</rev-version>
				<changelog lang="en">
					<change>Allow the viewing of a deleted topic's content on the search results page when the results are displayed as posts.</change>
					<change>Added a link to the deleted topic next to the deleted topic announcement so the topic can be accessed from the search results page and so users can send the link for moderators to look over.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-02-01</date>
				<rev-version>0.2.16</rev-version>
				<changelog lang="en">
					<change>Added IN_PHPBB check to the included PHP files.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-02-26</date>
				<rev-version>0.2.17</rev-version>
				<changelog lang="en">
					<change>Hide the poll on a deleted topic.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-03-05</date>
				<rev-version>0.2.18</rev-version>
				<changelog lang="en">
					<change>Attempted fix for potential error when moving multiple threads to the Trash Bin forum.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-04-06</date>
				<rev-version>0.2.19</rev-version>
				<changelog lang="en">
					<change>Fixed an "Undefined variable: forum_id" error that may happen while viewing a deleted topic.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-04-08</date>
				<rev-version>0.2.19a</rev-version>
				<changelog lang="en">
					<change>Updated instructions for the phpBB 3.0.1 release.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-05-04</date>
				<rev-version>0.2.20</rev-version>
				<changelog lang="en">
					<change>Fixed a bug that caused global announcements to not undelete properly.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-06-18</date>
				<rev-version>0.2.21</rev-version>
				<changelog lang="en">
					<change>Fixed: A deleted Global Announcement topic would fail to display the name of the user who deleted it, showing "Guest" instead.</change>
					<change>Fixed: A user would not be able to see the contents of a deleted post even if they had permission to do so. Only users who could delete or undelete the post had the ability to view it.</change>
					<change>Repackaged for MODX 1.2.0.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-06-23</date>
				<rev-version>1.0.0</rev-version>
				<changelog lang="en">
					<change>Link to the included stylesheet file from within the template header file rather than the common CSS file (so there is one less file edit and there is no need to refresh the theme after installation).</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-06-26</date>
				<rev-version>1.0.1</rev-version>
				<changelog lang="en">
					<change>Fixed: An administrator would not be able to permanently delete posts from the MCP.</change>
					<change>Fixed: The option to permanently delete would not show up when deleting posts from the MCP.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-07-27</date>
				<rev-version>1.0.2</rev-version>
				<changelog lang="en">
					<change>Fixed a bug whereby deleting a post would sometimes cause two log entries.</change>
					<change>Repackaged to fix the Firefox 3 restricted parent directory issue.</change>
					<change>Included an optional file for removing database fields added by this MOD (to assist in uninstallation).</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-08-14</date>
				<rev-version>1.0.2a</rev-version>
				<changelog lang="en">
					<change>Added a Dutch translation.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-08-20</date>
				<rev-version>1.0.3</rev-version>
				<changelog lang="en">
					<change>Permanently delete shadow topics.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-08-22</date>
				<rev-version>1.0.4</rev-version>
				<changelog lang="en">
					<change>Fixed a bug introduced by the previous bug fix where attempting to delete a single topic from the MCP would present the original, permanent delete form.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-08-23</date>
				<rev-version>1.0.5</rev-version>
				<changelog lang="en">
					<change>Fixed a bug where deleting topics to the Trash Bin forum, then deleting the forum from which they were deleted, then undeleting the topics would cause them to be moved to the forum which no longer exists, thus making them inaccessible except through directly accessing the database.</change>
					<change>Fixed a string in the language file which referenced the Trash Bin forum as the Recycle Bin forum (the name change happened a while back; I'm stunned it took me this long to notice the mistake).</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-08-26</date>
				<rev-version>1.0.6</rev-version>
				<changelog lang="en">
					<change>Fixed a mistake in the installation instructions dealing with the search page.</change>
					<change>Fixed a bug that could cause the contents of a deleted topic to be displayed on the search results page.</change>
					<change>Don't automatically give administrators permission to undelete and permanently delete, but do give these permissions to founders.</change>
					<change>Added an option to hide the placeholders for deleted topics and posts.</change>
					<change>Make available permissions allowing users to undelete and permanently delete their own posts (these are forum-based permissions, just like the board's "Can delete own posts" permission).</change>
				</changelog>
			</entry>
			<entry>
				<date>2009-04-30</date>
				<rev-version>1.0.7</rev-version>
				<changelog lang="en">
					<change>Fixed a bug that decremented a user's post count again during a permanent post delete, even though it had already been reduced when the post was marked as deleted.</change>
				</changelog>
			</entry>
			<entry>
				<date>2009-06-10</date>
				<rev-version>1.0.8</rev-version>
				<changelog lang="en">
					<change>Fixed a bug that would display an error message about the forum not existing when attempting to permanently delete a post from a global announcement.</change>
					<change>Fixed an SQL error message that could be displayed when attempting to permanently delete a post from the MCP without having the proper permissions to do so.</change>
					<change>Fixed an SQL error message that could be displayed when attempting to mark a post as deleted from the MCP while having the proper permissions to do so but without having the permissions to permanently delete.</change>
				</changelog>
			</entry>
			<entry>
				<date>2009-08-17</date>
				<rev-version>1.0.8a</rev-version>
				<changelog lang="en">
					<change>Updated instruction for phpBB3.0.5.</change>
				</changelog>
			</entry>
			<entry>
				<date>2009-12-15</date>
				<rev-version>1.0.8b</rev-version>
				<changelog lang="en">
					<change>Added a Ukrainian translation.</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-01-03</date>
				<rev-version>1.0.9</rev-version>
				<changelog lang="en">
					<change>Fixed: The last post information for forums and topics would not be updated when marking a post as deleted.</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-02-20</date>
				<rev-version>1.0.10</rev-version>
				<changelog lang="en">
					<change>Fixed: Some posts would not be displayed in situations where there were multiple pages in a topic.</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-06-01</date>
				<rev-version>1.0.10a</rev-version>
				<changelog lang="en">
					<change>Added an Arabic translation.</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-06-01</date>
				<rev-version>1.0.10b</rev-version>
				<changelog lang="en">
					<change>Added an Slovak translation.</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-10-01</date>
				<rev-version>1.0.10c</rev-version>
				<changelog lang="en">
					<change>Added an Polish translation.</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-10-26</date>
				<rev-version>1.0.11</rev-version>
				<changelog lang="en">
					<change>Hide the quick reply on deleted topics.</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-12-28</date>
				<rev-version>1.1.0</rev-version>
				<changelog lang="en">
					<change>Updated instructions for phpBB3.0.8.</change>
					<change>Renamed some files.</change>
					<change>Security fix.</change>
				</changelog>
			</entry>
			<entry>
				<date>2011-01-27</date>
				<rev-version>1.1.1</rev-version>
				<changelog lang="en">
					<change>Fix a bug that would not present the option to permanently delete all posts from a user in the ACP.</change>
				</changelog>
			</entry>
			<entry>
				<date>2011-02-04</date>
				<rev-version>1.1.2</rev-version>
				<changelog lang="en">
					<change>Added an option to sort topics by the deletion date in the Trash Bin forum.</change>
					<change>Added spaces between the checkboxes and the text on the delete confirmation page.</change>
				</changelog>
			</entry>
			<entry>
				<date>2011-03-09</date>
				<rev-version>1.1.3</rev-version>
				<changelog lang="en">
					<change>Fixed: when the placeholders for mock-deleted posts are hidden on a topic with multiple pages, the number of pages were not recalculated and then remaining posts were not redistributed across the pages.</change>
					<change>Remove the pagination for deleted topics when the viewer does not have permission to see the contents of the deleted topic.</change>
				</changelog>
			</entry>
			<entry>
				<date>2011-07-19</date>
				<rev-version>1.1.3a</rev-version>
				<changelog lang="en">
					<change>Updated the French translation.</change>
				</changelog>
			</entry>
			<entry>
				<date>2011-08-05</date>
				<rev-version>1.1.4</rev-version>
				<changelog lang="en">
					<change>Updated the Polish translation.</change>
					<change>Bug fix: When mock-deleting multiple posts, if one of the posts encountered was the only post in an already mock-deleted topic, then mock-deletion would immediately cease causing some of the posts not to be mock-deleted.</change>
				</changelog>
			</entry>
			<entry>
				<date>2012-01-30</date>
				<rev-version>1.1.5</rev-version>
				<changelog lang="en">
					<change>Updated for phpBB 3.0.10</change>
					<change>Updated the German translation.</change>
				</changelog>
			</entry>
			<entry>
				<date>2012-03-30</date>
				<rev-version>1.1.6</rev-version>
				<changelog lang="en">
					<change>Fixed: If a user's forum permission "Can permanently delete own posts" was set to Yes, that user could permanently delete any posts in that forum.</change>
					<change>Fixed: When deleting a user, selecting "Delete all posts" would permanently delete all posts, and selecting "Permanently delete all posts" would not delete any posts.</change>
				</changelog>
			</entry>
		</history>
		<link-group>
			<link type="template" href="contrib/template - subsilver2.xml" realname="subsilver2" lang="en">subsilver2</link>
			<link type="language" href="contrib/language - ar.xml" realname="ar" lang="en">Arabic</link>
			<link type="language" href="contrib/language - de.xml" realname="de" lang="en">German</link>
			<link type="language" href="contrib/language - fr.xml" realname="fr" lang="en">French</link>
			<link type="language" href="contrib/language - nl.xml" realname="nl" lang="en">Dutch</link>
			<link type="language" href="contrib/language - pl.xml" realname="pl" lang="en">Polish</link>
			<link type="language" href="contrib/language - ru.xml" realname="ru" lang="en">Russian</link>
			<link type="language" href="contrib/language - sk.xml" realname="sk" lang="en">Slovak</link>
			<link type="language" href="contrib/language - uk.xml" realname="uk" lang="en">Ukrainian</link>

			<link type="contrib" href="contrib/update 0.2.0 to 0.2.2.xml" lang="en">Update 0.2.0 to 0.2.2</link>
			<link type="contrib" href="contrib/update 0.2.16 to 0.2.17.xml" lang="en">Update 0.2.16 to 0.2.17</link>
			<link type="contrib" href="contrib/update 0.2.20 to 1.0.0 (subsilver2).xml" lang="en">Update 0.2.20 to 1.0.0 (subsilver2)</link>
			<link type="contrib" href="contrib/update 0.2.20 to 1.0.0.xml" lang="en">Update 0.2.20 to 1.0.0</link>
			<link type="contrib" href="contrib/update 0.2.3 to 0.2.4.xml" lang="en">Update 0.2.3 to 0.2.4</link>
			<link type="contrib" href="contrib/update 0.2.4 to 0.2.5.xml" lang="en">Update 0.2.4 to 0.2.5</link>
			<link type="contrib" href="contrib/update 0.2.5c to 0.2.5d.xml" lang="en">Update 0.2.5c to 0.2.5d</link>
			<link type="contrib" href="contrib/update 0.2.5d to 0.2.6.xml" lang="en">Update 0.2.5d to 0.2.6</link>
			<link type="contrib" href="contrib/update 0.2.6 to 0.2.7.xml" lang="en">Update 0.2.6 to 0.2.7</link>
			<link type="contrib" href="contrib/update 0.2.7 to 0.2.8.xml" lang="en">Update 0.2.7 to 0.2.8</link>
			<link type="contrib" href="contrib/update 1.0.4 to 1.0.5.xml" lang="en">Update 1.0.4 to 1.0.5</link>
			<link type="contrib" href="contrib/update 1.0.5 to 1.0.6.xml" lang="en">Update 1.0.5 to 1.0.6</link>
			<link type="contrib" href="contrib/update 1.0.6 to 1.0.7.xml" lang="en">Update 1.0.6 to 1.0.7</link>
			<link type="contrib" href="contrib/update 1.0.7 to 1.0.8.xml" lang="en">Update 1.0.7 to 1.0.8</link>
			<link type="contrib" href="contrib/update 1.0.8 to 1.0.9.xml" lang="en">Update 1.0.8 to 1.0.9</link>
			<link type="contrib" href="contrib/update 1.0.9 to 1.0.10.xml" lang="en">Update 1.0.9 to 1.0.10</link>
			<link type="contrib" href="contrib/update 1.0.10 to 1.0.11.xml" lang="en">Update 1.0.10 to 1.0.11</link>
			<link type="contrib" href="contrib/update 1.0.11 to 1.1.0.xml" lang="en">Update 1.0.11 to 1.1.0</link>
			<link type="contrib" href="contrib/update 1.1.0 to 1.1.1.xml" lang="en">Update 1.1.0 to 1.1.1</link>
			<link type="contrib" href="contrib/update 1.1.1 to 1.1.2.xml" lang="en">Update 1.1.1 to 1.1.2</link>
			<link type="contrib" href="contrib/update 1.1.2 to 1.1.3.xml" lang="en">Update 1.1.2 to 1.1.3</link>
			<link type="contrib" href="contrib/update 1.1.3 to 1.1.4.xml" lang="en">Update 1.1.3 to 1.1.4</link>
			<link type="contrib" href="contrib/update 1.1.4 to 1.1.5.xml" lang="en">Update 1.1.4 to 1.1.5</link>
			<link type="contrib" href="contrib/update 1.1.5 to 1.1.6.xml" lang="en">Update 1.1.5 to 1.1.6</link>
		</link-group>
	</header>
	<action-group>
		<php-installer>update_db.php</php-installer>

		<copy>
			<file from="root/update_db.php" to="update_db.php" />
			<file from="root/includes/prime_trash_bin_a.php" to="includes/prime_trash_bin_a.php" />
			<file from="root/includes/prime_trash_bin_b.php" to="includes/prime_trash_bin_b.php" />
			<file from="root/language/en/mods/permissions_prime_trash_bin.php" to="language/en/mods/permissions_prime_trash_bin.php" />
			<file from="root/language/en/mods/prime_trash_bin_a.php" to="language/en/mods/prime_trash_bin_a.php" />
			<file from="root/language/en/mods/prime_trash_bin_b.php" to="language/en/mods/prime_trash_bin_b.php" />
			<file from="root/styles/prosilver/template/prime_delete_confirm.html" to="styles/prosilver/template/prime_delete_confirm.html" />
			<file from="root/styles/prosilver/template/prime_deleted_msg.html" to="styles/prosilver/template/prime_deleted_msg.html" />
			<file from="root/styles/prosilver/template/prime_show_deleted_post.html" to="styles/prosilver/template/prime_show_deleted_post.html" />
			<file from="root/styles/prosilver/theme/prime_trash_bin.css" to="styles/prosilver/theme/prime_trash_bin.css" />
		</copy>

		<open src="adm/style/acp_users_overview.html">
			<edit>
				<find><![CDATA[			if (option != 'banuser' && option != 'banemail' && option != 'banip')]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Un-hide the form field used to specify a reason for deleting a user's posts.
			if (option == 'delposts')
			{
				dE('delete_reason_area', 1);
				return;
			}
			else
			{
				dE('delete_reason_area', -1);
			}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[	<div style="display: none;" id="reasons">]]></find>
				<action type="before-add"><![CDATA[<!-- mod: Prime Trash Bin (Posts) -->
<!-- This is the form field used to specify a reason for deleting a user's posts. -->
	<div style="display: none;" id="delete_reason_area">
		<dl>
			<dt><label for="delete_reason">{L_PRIME_DELETE_POST_REASON}:</label></dt>
			<dd><input name="delete_reason" type="text" class="text medium" maxlength="100" id="delete_reason" /></dd>
		</dl>
		<!-- IF S_CAN_DELETE_FOREVER -->
		<dl>
			<dd><label for="delete_forever"><input type="checkbox" name="delete_forever" id="delete_forever" style="cursor:auto;" onchange="document.getElementById('delete_reason').disabled = this.checked;" /> {L_PRIME_DELETE_POSTS_FOREVER}</label></dd>
		</dl>
		<!-- ENDIF -->
	</div>
<!-- end: Prime Trash Bin (Posts) -->]]></action>
			</edit>

			<edit>
				<find><![CDATA[{L_DELETE_POSTS}</option>]]></find>
				<inline-edit>
					<inline-find><![CDATA[{L_DELETE_POSTS}</option>]]></inline-find>
					<inline-action type="after-add"><![CDATA[<!-- mod: Prime Trash Bin --><!-- IF S_CAN_DELETE_FOREVER --><option value="remove_forever">{L_PRIME_FOREVER_WHEN_DELETE_USER}</option><!-- ENDIF --><!-- end: Prime Trash Bin -->]]></inline-action>
				</inline-edit>
			</edit>
		</open>


		<open src="adm/index.php">
			<edit>
				<find><![CDATA[$user->setup('acp/common');]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin ---------------------------------------------------//
// Include our language file for the logs.
$user->add_lang('mods/prime_trash_bin_b');
//-- end: Prime Trash Bin ---------------------------------------------------//]]></action>
			</edit>
		</open>


		<open src="includes/acp/acp_board.php">
			<edit>
				<find><![CDATA[			case 'settings':]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
				$user->add_lang('mods/prime_trash_bin_b');
				include($phpbb_root_path . 'includes/prime_trash_bin_b.' . $phpEx);
//-- end: Prime Trash Bin (Topics) ------------------------------------------//]]></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 Trash Bin (Topics) ------------------------------------------//
						'topic_delete_mode'		=> array('lang' => 'PRIME_FAKE_DELETE',		'validate' => 'string',	'type' => 'select', 'function' => 'make_fake_delete_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => true),
						'trash_forum'			=> array('lang' => 'PRIME_TRASH_FORUM',		'validate' => 'string',	'type' => 'select', 'function' => 'make_trash_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => true),
//-- end: Prime Trash Bin (Topics) ------------------------------------------//]]></action>
			</edit>

			<edit>
				<comment lang="en">The following FIND will match several lines in the file. We want the one that is found just after our previous FIND.</comment>
				<find><![CDATA[			break;]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
// If this admin cannot see the Trash forum, then don't show the Trash forum option
				if (get_trash_forum() && !$auth->acl_get('f_list', get_trash_forum()))
				{
					unset($display_vars['vars']['recycle_bin_forum']);
				}
//-- end: Prime Trash Bin (Topics) ------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[		validate_config_vars($display_vars['vars'], $cfg_array, $error);]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
		include($phpbb_root_path . 'includes/prime_trash_bin_b.' . $phpEx);
		validate_fake_delete_options($cfg_array, $error);
//-- end: Prime Trash Bin (Topics) ------------------------------------------//]]></action>
			</edit>
		</open>

		<open src="includes/acp/acp_forums.php">
			<edit>
				<find><![CDATA[		$table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE);]]></find>
		       <action type="before-add"><![CDATA[//-- mod: Prime Trash Bin ---------------------------------------------------//
		global $phpbb_root_path, $phpEx;
		include($phpbb_root_path . 'includes/prime_trash_bin_b.' . $phpEx);
		update_stifled_from($from_id, $to_id);
//-- end: Prime Trash Bin ---------------------------------------------------//]]></action>
			</edit>
			<edit>
				<find><![CDATA[				AND post_approved = 1';]]></find>
		       <action type="after-add"><![CDATA[//-- mod: Prime Trash Bin ---------------------------------------------------//
// Do not reduce post counts for posts that have already been marked as deleted.
		$sql = substr_replace($sql, 'AND post_deleted_time = 0 ', strpos($sql, 'AND post_approved = 1'), 0);
//-- end: Prime Trash Bin ---------------------------------------------------//]]></action>
			</edit>
		</open>

		<open src="includes/acp/acp_users.php">
			<edit>
				<find><![CDATA[								// Delete posts, attachments, etc.]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Intercept the post deletion (deleting all posts by a specific user).
								include($phpbb_root_path . 'includes/prime_trash_bin_b.' . $phpEx);
								stifle_users_posts($user_id, $user_row['username'], adm_back_link($this->u_action . '&amp;u=' . $user_id));
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>

			<edit>
				<comment lang="en">The following FIND will match several lines in the file. We want the one that is found just after our previous FIND.</comment>
				<find><![CDATA[								confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Pass on our variables through the confirmation page.
									'delete_reason'		=> request_var('delete_reason', '', true),
									'delete_forever'	=> request_var('delete_forever', false),
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[					'USER_INACTIVE_REASON'	=> $inactive_reason,
				));
]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Add a flag to the template so our Permanent Delete option will appear.
				include($phpbb_root_path . 'includes/prime_trash_bin_b.' . $phpEx);
				if (stifle_posts_enabled())
				{
					$user->add_lang('mods/prime_trash_bin_a');
					$template->assign_var('S_CAN_DELETE_FOREVER', auth_fake_delete('delete'));
				}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>
		</open>


		<open src="includes/mcp/mcp_forum.php">
			<edit>
				<find><![CDATA[		$template->assign_block_vars('topicrow', $topic_row);]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
		if (!empty($row['topic_deleted_time']))
		{
			include($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
			set_stifled_topic_template_vars($row, $topic_title, $topic_row);
		}
//-- end: Prime Trash Bin (Topics) ------------------------------------------//]]></action>
			</edit>
		</open>


		<open src="includes/mcp/mcp_logs.php">
			<edit>
				<find><![CDATA[		$user->add_lang('acp/common');]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin ---------------------------------------------------//
// Include our language file for the logs.
		$user->add_lang('mods/prime_trash_bin_b');
//-- end: Prime Trash Bin ---------------------------------------------------//]]></action>
			</edit>
		</open>


		<open src="includes/mcp/mcp_main.php">
			<edit>
				<find><![CDATA[		global $config, $phpbb_root_path, $phpEx;]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin ---------------------------------------------------//
// Include our language file for the logs.
		$user->add_lang('mods/prime_trash_bin_b');
//-- end: Prime Trash Bin ---------------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[				mcp_delete_topic($topic_ids);]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
// Intercept the topic deletion (for the moderator control panel).
				include($phpbb_root_path . 'includes/prime_trash_bin_b.' . $phpEx);
				mcp_stifle_topic($topic_ids);
//-- end: Prime Trash Bin (Topics) ------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[				mcp_delete_post($post_ids);
			break;]]></find>
				<action type="replace-with"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Intercept the post deletion (for the moderator control panel).
				include($phpbb_root_path . 'includes/prime_trash_bin_b.' . $phpEx);
				mcp_stifle_post($post_ids);
//-- end: Prime Trash Bin (Posts) -------------------------------------------//
				mcp_delete_post($post_ids);
			break;
//-- mod: Prime Trash Bin ---------------------------------------------------//
// Reverse a deletion.
			case 'undelete_topic':
				$topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
				if (!sizeof($topic_ids))
				{
					$user->add_lang('mcp');
					trigger_error('NO_TOPIC_SELECTED');
				}
				include($phpbb_root_path . 'includes/prime_trash_bin_b.' . $phpEx);
				mcp_unstifle_topic($topic_ids);
			break;

			case 'undelete_post':
				$post_ids = (!$quickmod) ? request_var('post_id_list', array(0)) : array(request_var('p', 0));
				if (!sizeof($post_ids))
				{
					$user->add_lang('mcp');
					trigger_error('NO_POST_SELECTED');
				}
				include($phpbb_root_path . 'includes/prime_trash_bin_b.' . $phpEx);
				mcp_unstifle_post($post_ids);
			break;
//-- end: Prime Trash Bin (Topics) ------------------------------------------//]]></action>
			</edit>
		</open>


		<open src="includes/mcp/mcp_post.php">
			<edit>
				<find><![CDATA[	// Get User Notes]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
// Set up what we're going to display for the deleted topic.
	if (!empty($post_info['post_deleted_time']))
	{
		include($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
		set_stifled_post_template_vars($post_info, $message, $post_info['post_subject'], ($blockname = true));
	}
//-- end: Prime Trash Bin (Topics) ------------------------------------------//
]]></action>
			</edit>
		</open>


		<open src="includes/mcp/mcp_topic.php">
			<edit>
				<find><![CDATA[		// Display not already displayed Attachments for this post, we already parsed them. ;)]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Set up what we're going to display for the deleted post.
		if (!empty($row['post_deleted_time']))
		{
			include($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
			set_stifled_post_template_vars($row, $message, $post_subject, ($blockname = 'postrow'));
		}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//
]]></action>
			</edit>

			<edit>
				<find><![CDATA[		'TOTAL_POSTS'		=> ($total == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total),
	));
]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
// Set up what we're going to display for the deleted topic.
	if (!empty($topic_info['topic_deleted_time']))
	{
		include ($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
		set_stifled_topic_template_vars($topic_info, $topic_info['topic_title'], ($blockname = true));
	}
//-- end: Prime Trash Bin (Topics) ------------------------------------------//]]></action>
			</edit>
		</open>


		<open src="includes/functions_admin.php">
			<edit>
				<find><![CDATA[	$sql = 'SELECT post_id, poster_id, post_approved, post_postcount, topic_id, forum_id
		FROM ' . POSTS_TABLE . '
		WHERE ' . $where_clause;]]></find>
		       <action type="after-add"><![CDATA[//-- mod: Prime Trash Bin ---------------------------------------------------//
	$sql = substr_replace($sql, 'post_deleted_time, ', strpos($sql, 'post_id'), 0);
//-- end: Prime Trash Bin ---------------------------------------------------//]]></action>
			</edit>
			<edit>
				<find><![CDATA[		if ($row['post_postcount'] && $post_count_sync && $row['post_approved'])
		{]]></find>
		       <action type="after-add"><![CDATA[//-- mod: Prime Trash Bin ---------------------------------------------------//
// Do not reduce post counts for posts that have already been marked as deleted.
			if (!empty($row['post_deleted_time']))
			{
				continue;
			}
//-- end: Prime Trash Bin ---------------------------------------------------//]]></action>
			</edit>
			<edit>
				<comment lang="en">The first FIND is just to get your cursor into position so the next FIND will locate the correct line.</comment>
				<find><![CDATA[			// 4: Get last_post_id for each forum]]></find>
				<find><![CDATA[			$result = $db->sql_query($sql);]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
// Here we update the last post information for the forums.
			global $phpbb_root_path, $phpEx;
			include ($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
			if (stifle_topics_enabled())
			{
				// Get the last topic that isn't deleted, except for when doing the Trash forum.
				$sql = str_replace('AND t.topic_approved', 'AND (t.topic_deleted_time = 0' . (get_trash_forum() ? ' OR t.forum_id = ' . get_trash_forum() : '') . ') AND t.topic_approved', $sql);
			}
//-- end: Prime Trash Bin (Topics) ------------------------------------------//]]></action>
			</edit>
			<edit>
				<find><![CDATA[			// Use "t" as table alias because of the $where_sql clause
			// NOTE: 't.post_approved' in the GROUP BY is causing a major slowdown.]]></find>
		       <action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Here we update the last post information for the topics.
			global $phpbb_root_path, $phpEx;
			include ($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
			if (stifle_posts_enabled())
			{
				// Get the last topic that isn't deleted, except for when doing the Trash forum.
				$where_sql2 = str_replace('WHERE ', 'WHERE (t.post_deleted_time = 0' . (get_trash_forum() ? ' OR t.forum_id = ' . get_trash_forum() : '') . ') AND ', $where_sql);
				$sql = 'SELECT t.topic_id, MIN(t.post_id) AS first_post_id, MAX(t.post_id) AS last_post_id
					FROM ' . POSTS_TABLE . " t
					$where_sql2
					GROUP BY t.topic_id";
				$result = $db->sql_query($sql);
				while ($row2 = $db->sql_fetchrow($result))
				{
					$topic_id = (int) $row2['topic_id'];
					$first_post_ids[$topic_id] = $row2['first_post_id'];
					$last_post_ids[$topic_id] = $row2['last_post_id'];
				}
				$db->sql_freeresult($result);
			}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>
			<edit>
				<find><![CDATA[				$row['first_post_id'] = (int) $row['first_post_id'];
				$row['last_post_id'] = (int) $row['last_post_id'];]]></find>
		       <action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Here we update the last post information for the topics.
				if (stifle_posts_enabled())
				{
					if (!empty($first_post_ids[$topic_id]))
					{
						$row['first_post_id'] = (int) $first_post_ids[$topic_id];
					}
					if (!empty($last_post_ids[$topic_id]))
					{
						$row['last_post_id'] = (int) $last_post_ids[$topic_id];
					}
				}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>
			<edit>
				<find><![CDATA[		$log[$i] = array(]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin ---------------------------------------------------//
// Here we set the log entry to display the optional "Reason" parameter if it exists.
		$log_data_ary = unserialize($row['log_data']);
		if (count($log_data_ary) == 2 && !empty($log_data_ary[1]) && in_array($row['log_operation'], array('LOG_TOPIC_STIFLED', 'LOG_TOPIC_TRASHED', 'LOG_TOPIC_UNSTIFLED', 'LOG_POST_STIFLED', 'LOG_POST_TRASHED', 'LOG_POST_UNSTIFLED')) && isset($user->lang[$row['log_operation'] . '_2']))
		{
			$row['log_operation'] = $row['log_operation'] . '_2';
		}
//-- end: Prime Trash Bin ---------------------------------------------------//
]]></action>
			</edit>
		</open>


		<open src="includes/functions_posting.php">
			<edit>
				<comment lang="en">The first FIND is just to get your cursor into position so the next FIND will locate the correct line.</comment>
				<find><![CDATA[function topic_review(]]></find>
				<find><![CDATA[	$result = $db->sql_query($sql);]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// When doing topic review, get only posts that aren't mock-deleted.
	include ($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
	if (stifle_topics_enabled())
	{
		$sql = str_replace('AND u.user_id = p.poster_id', 'AND u.user_id = p.poster_id AND p.post_deleted_time = 0', $sql);
	}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//
]]></action>
			</edit>

			<edit>
				<find><![CDATA[		// Display not already displayed Attachments for this post, we already parsed them. ;)]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Set up what we're going to display for the deleted message (topic review).
		if (!empty($row['post_deleted_time']))
		{
			include ($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
			set_stifled_post_template_vars($row, $message, $post_subject, ($blockname = $mode . '_row'));
		}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//
]]></action>
			</edit>
		</open>

		<open src="includes/functions_user.php">
			<edit>
				<find><![CDATA[	switch ($mode)
	{
		case 'retain':]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
	if ($mode == 'remove')
	{
		// Mock-deleting all posts by the user that's being deleted. Change the
		// mode to 'retain' since we're actually keeping the posts.
		include($phpbb_root_path . 'includes/prime_trash_bin_b.' . $phpEx);
		stifle_posts($user_id, 'poster_id');
		$mode = 'retain';
	}
	else if ($mode == 'remove_forever')
	{
		$mode = 'remove';
	}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>
		</open>

		<open src="mcp.php">
			<edit>
				<find><![CDATA[		case 'delete_topic':]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin ---------------------------------------------------//
// Set undelete as a valid quickmod option.
		case 'undelete_post':
		case 'undelete_topic':
//-- end: Prime Trash Bin ---------------------------------------------------//]]></action>
			</edit>
		</open>


		<open src="posting.php">
			<edit>
				<find><![CDATA[	handle_post_delete($forum_id, $topic_id, $post_id, $post_data);]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
	include($phpbb_root_path . 'includes/prime_trash_bin_b.' . $phpEx);
	handle_post_stifle($forum_id, $topic_id, $post_id, $post_data);
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>
		</open>


		<open src="search.php">
			<edit>
				<find><![CDATA[		foreach ($rowset as $row)]]></find>
		       <action type="before-add"><![CDATA[//-- mod: Prime Trash Bin ---------------------------------------------------//
// If the topic or post has been deleted, we need to check if the user is allowed to view the placeholder.
		include($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
		$old_match_count = $total_match_count;
		foreach ($rowset as $key => $row)
		{
			if ((!empty($row['topic_deleted_time']) || !empty($row['post_deleted_time'])) && !auth_fake_delete('list', $row['forum_id']))
			{
				$total_match_count--;
				unset($rowset[$key]);
			}
		}
		if ($old_match_count != $total_match_count)
		{
			$template->assign_var('SEARCH_MATCHES', str_replace($old_match_count, $total_match_count, $l_search_matches));
		}
//-- end: Prime Trash Bin ---------------------------------------------------//]]></action>
			</edit>
			<edit>
				<find><![CDATA[				'U_VIEW_POST'		=> (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=" . $row['topic_id'] . '&amp;p=' . $row['post_id'] . (($u_hilit) ? '&amp;hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '')
			));
]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
			if (!empty($row['topic_deleted_time']))
			{
				set_stifled_topic_template_vars($row, $topic_title, ($blockname = 'searchresults'));
			}
			if (!empty($row['post_deleted_time']))
			{
				set_stifled_post_template_vars($row, $row['post_text'], $row['post_subject'], ($blockname = 'searchresults'));
			}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>
		</open>


		<open src="viewforum.php">
			<edit>
				<find><![CDATA[$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
// Option to sort topics by the deletion date in the Trash forum
include ($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
if (get_trash_forum() === $forum_id)
{
	$user->add_lang('mods/prime_trash_bin_a');
	$sort_by_text['d'] = $user->lang['PRIME_DELETED_DATE'];
	$sort_by_sql['d'] = 't.topic_deleted_time';
}
//-- end: Prime Trash Bin (Topics) ------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[// Grab just the sorted topic ids]]></find>
		       <action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
// When doing active topics, get only topics that aren't mock-deleted, except for when doing the Trash forum.
if (stifle_topics_enabled() && ($s_display_active || !auth_fake_delete('list', $forum_id)))
{
	$sql_where .= ' AND (t.topic_deleted_time = 0' . (get_trash_forum() ? ' OR t.forum_id = ' . get_trash_forum() : '') . ')';
}
//-- end: Prime Trash Bin (Topics) ------------------------------------------//
]]></action>
			</edit>

			<edit>
				<find><![CDATA[		$s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
		if (!empty($row['topic_deleted_time']))
		{
			include ($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
			set_stifled_topic_template_vars($row, $row['topic_title'], ($blockname = 'topicrow'));
		}
//-- end: Prime Trash Bin (Topics) ------------------------------------------//]]></action>
			</edit>
		</open>


		<open src="viewtopic.php">
			<edit>
				<find><![CDATA[		$sql = 'SELECT COUNT(p.post_id) AS prev_posts
			FROM ' . POSTS_TABLE . " p
			WHERE p.topic_id = {$topic_data['topic_id']}
				" . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '');

		if ($sort_dir == 'd')
		{
			$sql .= " AND (p.post_time > {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id >= {$topic_data['post_id']}))";
		}
		else
		{
			$sql .= " AND (p.post_time < {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id <= {$topic_data['post_id']}))";
		}]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Don't include posts that have been mock-deleted if user isn't supposed to see the placeholder
		include ($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
		if (stifle_posts_enabled() && !auth_fake_delete('list', $forum_id))
		{
			$sql = str_replace('WHERE ', 'WHERE (p.post_deleted_time = 0) AND ', $sql);
		}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[$topic_replies = ($auth->acl_get('m_approve', $forum_id)) ? $topic_data['topic_replies_real'] : $topic_data['topic_replies'];]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Don't include posts that have been mock-deleted if user isn't supposed to see the placeholder
include ($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
if (stifle_posts_enabled() && !auth_fake_delete('list', $forum_id))
{
	$sql = 'SELECT COUNT(post_id) AS deleted_posts FROM ' . POSTS_TABLE . ' WHERE topic_id = ' . $topic_id . ' AND post_deleted_time > 0 AND post_id <> ' . $topic_data['topic_first_post_id'];
	$result = $db->sql_query($sql);
	$row = $db->sql_fetchrow($result);
	$db->sql_freeresult($result);
	$topic_replies = $topic_replies - $row['deleted_posts'];
}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[	$sql = 'SELECT COUNT(post_id) AS num_posts
		FROM ' . POSTS_TABLE . "
		WHERE topic_id = $topic_id
			AND post_time >= $min_post_time
		" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND post_approved = 1');]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Don't include posts that have been mock-deleted if user isn't supposed to see the placeholder
	if (stifle_posts_enabled() && !auth_fake_delete('list', $forum_id))
	{
		$sql = str_replace('WHERE ', 'WHERE (post_deleted_time = 0) AND ', $sql);
	}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[// Send vars to template]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
// Adjust the quickmod dropdown list if necessary.
include ($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
$topic_deleted = !empty($topic_data['topic_deleted_time']);
if ($topic_deleted)
{
	$topic_mod = fake_delete_alter_quickmod($topic_mod, $forum_id);
}
//-- end: Prime Trash Bin (Topics) ------------------------------------------//
]]></action>
			</edit>

			<edit>
				<find><![CDATA[// Go ahead and pull all data for this topic
$sql = 'SELECT p.post_id
	FROM ' . POSTS_TABLE . ' p' . (($join_user_sql[$sort_key]) ? ', ' . USERS_TABLE . ' u': '') . "
	WHERE p.topic_id = $topic_id
		" . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . "
		" . (($join_user_sql[$sort_key]) ? 'AND u.user_id = p.poster_id': '') . "
		$limit_posts_time
	ORDER BY $sql_sort_order";]]></find>
				<action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Don't include posts that have been mock-deleted if user isn't supposed to see the placeholder
if (stifle_posts_enabled() && !auth_fake_delete('list', $forum_id))
{
	$sql = str_replace('WHERE ', 'WHERE (p.post_deleted_time = 0) AND ', $sql);
}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[if (!sizeof($post_list))]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
// Make it so no posts will show up if the topic has been deleted and
// the user doesn't have the permissions to view the deleted content.
if ($topic_deleted)
{
	if (!auth_fake_delete('list', $forum_id)) // User can't view placeholder, so display "No Topic"
	{
		$post_list = array();
	}
	else if (!auth_fake_delete('view', $forum_id)) // User can view placeholder, but not the deleted posts
	{
		$post_list = array(0); //Needs an element or a "No Topic" message will be displayed
	}
}
//-- end: Prime Trash Bin (Topics) ------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[// Posts are stored in the $rowset array while $attach_list, $user_cache
// and the global bbcode_bitfield are built
while ($row = $db->sql_fetchrow($result))
{]]></find>
		       <action type="after-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// If the post has been deleted, we need to check if the user is allowed to view the placeholder.
	if (!empty($row['post_deleted_time']) && !auth_fake_delete('list', $forum_id))
	{
		continue;
	}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//]]></action>
			</edit>

			<edit>
				<find><![CDATA[	// Define the global bbcode bitfield, will be used to load bbcodes]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// This is where we make the deletion info available for when the script starts
// looping through each post to set the template variables. If we're viewing
// the post's revision history (another MOD), then don't hide the post's content.
	if (!empty($row['post_deleted_time']) && empty($display_history))
	{
		$rowset[$row['post_id']]['post_deleted_from']   = $row['post_deleted_from'];
		$rowset[$row['post_id']]['post_deleted_user']   = $row['post_deleted_user'];
		$rowset[$row['post_id']]['post_deleted_time']   = $row['post_deleted_time'];
		$rowset[$row['post_id']]['post_deleted_reason'] = censor_text($row['post_deleted_reason']);

		// We don't want to display any info about previous edits.
		$rowset[$row['post_id']]['post_edit_reason'] = '';
		$rowset[$row['post_id']]['post_edit_count']  = 0;
	}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//
]]></action>
			</edit>

			<edit>
				<find><![CDATA[	// Dump vars into template]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Posts) -------------------------------------------//
// Set up what we're going to display for the deleted message.
	if (!empty($row['post_deleted_time']))
	{
		include ($phpbb_root_path . 'includes/prime_trash_bin_a.' . $phpEx);
		set_stifled_post_template_vars($row, $message, $row['post_subject'], $postrow);
	}
	// If there is only one post, and the topic has been deleted, then only display the delete icon if user can permanently delete the topic.
	if ($topic_data['topic_first_post_id'] == $topic_data['topic_last_post_id'] && !empty($topic_data['topic_deleted_time']))
	{
		$postrow['U_DELETE'] = auth_fake_delete('delete', $topic_data['forum_id'], $topic_data['poster_id']) ? $postrow['U_DELETE'] : '';
	}
//-- end: Prime Trash Bin (Posts) -------------------------------------------//
]]></action>
			</edit>

			<edit>
				<find><![CDATA[// Output the page]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Trash Bin (Topics) ------------------------------------------//
if ($topic_deleted)
{
	$template_vars = set_stifled_topic_template_vars($topic_data, $topic_data['topic_title'], ($blockname = true));

	// This will become the page's title (in the browser's title bar).
	$topic_data['topic_title'] = $template_vars['TOPIC_TITLE'];
}
//-- end: Prime Trash Bin (Topics) ------------------------------------------//
]]></action>
			</edit>
		</open>

		<open src="styles/prosilver/template/mcp_forum.html">
			<edit>
				<find><![CDATA[		<li class="row<!-- IF topicrow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->]]></find>
				<inline-edit>
					<inline-find><![CDATA[<!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->]]></inline-find>
					<inline-action type="after-add"><![CDATA[<!-- IF topicrow.S_DELETED --> deleted_topic<!-- ENDIF -->]]></inline-action>
				</inline-edit>
			</edit>

			<edit>
				<find><![CDATA[		<!-- IF S_CAN_DELETE --><option value="delete_topic">{L_DELETE}</option><!-- ENDIF -->]]></find>
				<action type="after-add"><![CDATA[		<!-- IF S_CAN_UNDELETE --><option value="undelete_topic">{L_PRIME_UNDELETE_POSTS}</option><!-- ENDIF -->]]></action>
			</edit>
		</open>


		<open src="styles/prosilver/template/mcp_post.html">
			<edit>
				<comment lang="en">The initial FIND is just to get your cursor into position so the final FIND will locate the correct line.</comment>
				<find><![CDATA[	<h2>{L_POST_DETAILS}</h2>]]></find>
				<find><![CDATA[<div class="panel">]]></find>
				<inline-edit>
					<inline-find><![CDATA[<div class="panel]]></inline-find>
					<inline-action type="after-add"><![CDATA[<!-- IF S_DELETED --> deleted_post<!-- ENDIF -->]]></inline-action>
				</inline-edit>
			</edit>

			<edit>
				<find><![CDATA[				<!-- IF POST_IPADDR -->{POST_IPADDR} ({POST_IP})<!-- ELSE -->{POST_IP}<!-- IF U_LOOKUP_IP --> (<a href="{U_LOOKUP_IP}">{L_LOOKUP_IP}</a>)<!-- ENDIF --><!-- ENDIF -->
			<!-- ENDIF --></div>
		<!-- ENDIF -->]]></find>
				<action type="after-add"><![CDATA[		<!-- IF DELETED_REASON --><hr /><strong>{L_PRIME_POST_DELETED_REASON}:</strong> {DELETED_REASON}<!-- ENDIF -->]]></action>
			</edit>

			<edit>
				<find><![CDATA[					<!-- IF S_CAN_DELETE_POST --><option value="delete_post">{L_DELETE_POST}</option><!-- ENDIF -->]]></find>
				<action type="after-add"><![CDATA[					<!-- IF S_CAN_UNDELETE_POST --><option value="undelete_post">{L_PRIME_UNDELETE_POST}</option><!-- ENDIF -->]]></action>
			</edit>
		</open>


		<open src="styles/prosilver/template/mcp_topic.html">
			<edit>
				<comment lang="en">For those of you adapting this to a different template style, the HTML you're adding is basically just a copy of the HTML which appears directly underneath where it's being added, with some template variables removed (ones that we don't want displayed, such as post count and last post info) and "DELETED_MSG" added.</comment>
				<find><![CDATA[		<!-- BEGIN postrow -->]]></find>
				<action type="before-add"><![CDATA[		<!-- IF S_TOPIC_DELETED -->
		<div class="post bg2 deleted_topic">
			<div class="inner"><span class="corners-top"><span></span></span>
			<div class="postbody" id="pr0">
				<h3>{L_PRIME_TOPIC_DELETED_MSG}</h3>
				<div class="content">
					{DELETED_MSG}
				</div>
			</div>
			<span class="corners-bottom"><span></span></span></div>
		</div>
		<!-- ENDIF -->
]]></action>
			</edit>

			<edit>
				<find><![CDATA[		<div class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->]]></find>
				<inline-edit>
					<inline-find><![CDATA[<!-- ELSE -->bg2<!-- ENDIF -->]]></inline-find>
					<inline-action type="after-add"><![CDATA[<!-- IF postrow.S_DELETED --> deleted_post<!-- ENDIF -->]]></inline-action>
				</inline-edit>
			</edit>

			<edit>
				<find><![CDATA[		<!-- IF S_CAN_DELETE --><option value="delete_post">{L_DELETE_POSTS}</option><!-- ENDIF -->]]></find>
				<action type="after-add"><![CDATA[		<!-- IF S_CAN_UNDELETE --><option value="undelete_post">{L_PRIME_UNDELETE_POSTS}</option><!-- ENDIF -->]]></action>
			</edit>
		</open>


		<open src="styles/prosilver/template/overall_header.html">
			<edit>
				<find><![CDATA[</head>]]></find>
		       <action type="before-add"><![CDATA[<!-- INCLUDE prime_show_deleted_post.html -->]]></action>
			</edit>
		</open>

		<open src="styles/prosilver/template/search_results.html">
			<edit>
				<comment lang="en">For those of you adapting this to a different template style, the HTML you're adding is basically just a copy of the HTML which appears directly underneath where it's being added, with some template variables removed (ones that we don't want displayed, such as post count and last post info) and "DELETED_MSG" added.</comment>
				<find><![CDATA[		<ul class="topiclist topics">

		<!-- BEGIN searchresults -->
]]></find>
				<action type="after-add"><![CDATA[		<!-- IF searchresults.S_DELETED -->
			<li class="row<!-- IF searchresults.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF searchresults.S_POST_ANNOUNCE --> announce<!-- ENDIF --><!-- IF searchresults.S_POST_STICKY --> sticky<!-- ENDIF --><!-- IF searchresults.S_TOPIC_REPORTED --> reported<!-- ENDIF --> deleted_topic">
				<dl class="icon" style="background-image: url({searchresults.TOPIC_FOLDER_IMG_SRC}); background-repeat: no-repeat;">
					<dt style="<!-- IF searchresults.TOPIC_ICON_IMG and S_TOPIC_ICONS -->background-image: url({T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}); background-repeat: no-repeat;<!-- ENDIF -->" title="{searchresults.TOPIC_FOLDER_IMG_ALT}"><!-- IF searchresults.S_UNREAD_TOPIC --><a href="{searchresults.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a>
						<!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --><a href="{searchresults.U_MCP_QUEUE}">{searchresults.UNAPPROVED_IMG}</a> <!-- ENDIF -->
						<!-- IF searchresults.S_TOPIC_REPORTED --><a href="{searchresults.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br />
						<!-- IF searchresults.PAGINATION --><strong class="pagination"><span>{searchresults.PAGINATION}</span></strong><!-- ENDIF -->
						<!-- IF searchresults.ATTACH_ICON_IMG -->{searchresults.ATTACH_ICON_IMG} <!-- ENDIF -->
						{searchresults.DELETED_MSG}
					</dt>
				</dl>
			</li>
		<!-- ELSE -->]]></action>
			</edit>

			<edit>
				<find><![CDATA[		<!-- END searchresults -->]]></find>
				<action type="before-add"><![CDATA[		<!-- ENDIF -->]]></action>
			</edit>

			<edit>
				<find><![CDATA[<!-- IF searchresults.S_POST_REPORTED --> reported<!-- ENDIF -->]]></find>
				<inline-edit>
					<inline-find><![CDATA[<!-- IF searchresults.S_POST_REPORTED --> reported<!-- ENDIF -->]]></inline-find>
					<inline-action type="after-add"><![CDATA[<!-- IF searchresults.S_DELETED --> deleted_post<!-- ENDIF -->]]></inline-action>
				</inline-edit>
			</edit>
		</open>


		<open src="styles/prosilver/template/viewforum_body.html">
			<edit>
				<comment lang="en">For those of you adapting this to a different template style, the HTML you're adding is basically just a copy of the HTML which appears directly underneath where it's being added, with some template variables removed (ones that we don't want displayed, such as post count and last post info) and "DELETED_MSG" added.</comment>
				<find><![CDATA[		<li class="row<!-- IF topicrow.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_POST_GLOBAL --> global-announce<!-- ENDIF --><!-- IF topicrow.S_POST_ANNOUNCE --> announce<!-- ENDIF --><!-- IF topicrow.S_POST_STICKY --> sticky<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->">]]></find>
				<action type="before-add"><![CDATA[	<!-- IF topicrow.S_DELETED -->
		<li class="row<!-- IF topicrow.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_POST_ANNOUNCE --> announce<!-- ENDIF --><!-- IF topicrow.S_POST_STICKY --> sticky<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF --> deleted_topic">
			<dl class="icon" style="background-image: url({topicrow.TOPIC_FOLDER_IMG_SRC}); background-repeat: no-repeat;">
				<dt style="<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS -->background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;<!-- ENDIF -->" title="{topicrow.TOPIC_FOLDER_IMG_ALT}"><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
					<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF -->
					<!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br />
					<!-- IF topicrow.PAGINATION --><strong class="pagination"><span>{topicrow.PAGINATION}</span></strong><!-- ENDIF -->
					<!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF -->
					{topicrow.DELETED_MSG}
				</dt>
			</dl>
		</li>
	<!-- ELSE -->]]></action>
			</edit>

			<edit>
				<find><![CDATA[
	<!-- IF topicrow.S_LAST_ROW -->]]></find>
		       <action type="before-add"><![CDATA[	<!-- ENDIF -->]]></action>
			</edit>
		</open>


		<open src="styles/prosilver/template/viewtopic_body.html">
			<edit>
				<comment lang="en">For those of you adapting this to a different template style, the HTML you're adding is basically just a copy of the HTML in which a post is displayed, with some template variables removed (ones that we don't want displayed, such as post count and last post info) and "DELETED_MSG" added.</comment>
				<find><![CDATA[<!-- IF S_HAS_POLL -->]]></find>
		       <action type="before-add"><![CDATA[<!-- IF S_TOPIC_DELETED -->
	<div id="p0" class="post bg2 deleted_topic">
		<div class="inner"><span class="corners-top"><span></span></span>
		<div class="postbody">
			<h3 class="first">{L_PRIME_TOPIC_DELETED_MSG}</h3>
			<div class="ignore">
				{DELETED_MSG}
			</div>
		</div>
		<div class="back2top"><a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></div>
		<span class="corners-bottom"><span></span></span></div>
	</div>
<!-- ENDIF -->
]]></action>
			</edit>

			<edit>
				<find><![CDATA[<!-- IF postrow.S_ONLINE and not postrow.S_IGNORE_POST --> online<!-- ENDIF -->]]></find>
				<inline-edit>
					<inline-find><![CDATA[<!-- IF postrow.S_ONLINE and not postrow.S_IGNORE_POST --> online<!-- ENDIF -->]]></inline-find>
					<inline-action type="after-add"><![CDATA[<!-- IF postrow.S_DELETED --> deleted_post<!-- ENDIF -->]]></inline-action>
				</inline-edit>
			</edit>
		</open>

		<diy-instructions lang="en">Make sure to delete the install_db.php file once it has been successfully executed.

After installing the MOD, you'll need to log into the Administration Control Panel and
take care of a few things. First, purge the cache! Next, under the "Board configuration"
section, click "Board Settings", and setup the deletion options. Now, if you want to assign
permissions to moderators, click the "Permissions" tab, and under the "Permission Roles"
section click "Moderator Roles" section. From here, click on a moderator type to edit, and
set their undelete/permanent delete permissions.
		</diy-instructions>
	</action-group>
</mod>
