<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<extension engine="1.0">
	<id>hotfix_13_moderate_topics</id>
	<title>PunBB 1.3 hotfix for the bug in moderate forum.</title>
	<version>1.0</version>
	<description>Fixed bug with incorrect multiple topic moderation.</description>
	<author>PunBB Development Team</author>
	<minversion>1.3</minversion>
	<maxtestedon>1.3</maxtestedon>

	<hooks>
		<hook id="mr_move_topics_qr_get_target_forums"><![CDATA[
if (!isset($action))
{
	if (!is_array($topics))
	{
		$action = 'single';
		// Fetch the topic subject
		$query_subject = array(
			'SELECT'	=> 't.subject',
			'FROM'		=> 'topics AS t',
			'WHERE'		=> 't.id='.$topics
		);

		($hook = get_hook('mr_move_topics_qr_get_topic_to_move_subject')) ? eval($hook) : null;
		$result = $forum_db->query_build($query_subject) or error(__FILE__, __LINE__);

		if (!$forum_db->num_rows($result))
			message($lang_common['Bad request']);

		$subject = $forum_db->result($result);
	}
	else
		$action = 'multiple';
}
		]]></hook>
		<hook id="mr_move_topics_output_start"><![CDATA[
$forum_page['hidden_fields']['topics'] = '<input type="hidden" name="topics" value="'.($action == 'single' ? $topics : implode(',', $topics)).'" />';
		]]></hook>
	</hooks>
</extension>
