<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<extension engine="1.0">
	<id>hotfix_131_sql_injection_in_admin_users</id>
	<title>PunBB 1.3.1 hotfix for a potential SQL-injections at admin users page.</title>
	<version>1.0</version>
	<description>Fixed an potential SQL-injection at admin users page.</description>
	<author>PunBB Development Team</author>
	<minversion>1.3.1</minversion>
	<maxtestedon>1.3.1</maxtestedon>

	<hooks>
		<hook id="aus_find_user_qr_find_users" priority = "1"><![CDATA[
//Check up for order_by and direction values
$order_by = isset($_POST['order_by']) ? forum_trim($_POST['order_by']) : null;
$direction = isset($_POST['direction']) ? forum_trim($_POST['direction']) : null;
if ($order_by == null || $direction == null)
	message($lang_common['Bad request']);
if (!in_array($order_by, array('username', 'email', 'num_posts', 'num_posts', 'registered')) || !in_array($direction, array('ASC', 'DESC')))
	message($lang_common['Bad request']);
$query['ORDER BY'] = $order_by.' '.$direction;
		]]></hook>
	</hooks>
</extension>
