Code Duplication    Length = 19-22 lines in 4 locations

Sources/ManageSmileys.php 2 locations

@@ 1213-1231 (lines=19) @@
1210
 * @param string $sort A string indicating how to sort the results
1211
 * @return array An array of info about the smileys
1212
 */
1213
function list_getSmileys($start, $items_per_page, $sort)
1214
{
1215
	global $smcFunc;
1216
1217
	$request = $smcFunc['db_query']('', '
1218
		SELECT id_smiley, code, filename, description, smiley_row, smiley_order, hidden
1219
		FROM {db_prefix}smileys
1220
		ORDER BY {raw:sort}',
1221
		array(
1222
			'sort' => $sort,
1223
		)
1224
	);
1225
	$smileys = array();
1226
	while ($row = $smcFunc['db_fetch_assoc']($request))
1227
		$smileys[] = $row;
1228
	$smcFunc['db_free_result']($request);
1229
1230
	return $smileys;
1231
}
1232
1233
/**
1234
 * Callback function for createList().
@@ 1978-1997 (lines=20) @@
1975
 * @param string $sort A string indicating how to sort the items (not used here)
1976
 * @return array An array of information about message icons
1977
 */
1978
function list_getMessageIcons($start, $items_per_page, $sort)
1979
{
1980
	global $smcFunc;
1981
1982
	$request = $smcFunc['db_query']('', '
1983
		SELECT m.id_icon, m.title, m.filename, m.icon_order, m.id_board, b.name AS board_name
1984
		FROM {db_prefix}message_icons AS m
1985
			LEFT JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
1986
		WHERE ({query_see_board} OR b.id_board IS NULL)
1987
		ORDER BY m.icon_order',
1988
		array()
1989
	);
1990
1991
	$message_icons = array();
1992
	while ($row = $smcFunc['db_fetch_assoc']($request))
1993
		$message_icons[] = $row;
1994
	$smcFunc['db_free_result']($request);
1995
1996
	return $message_icons;
1997
}
1998
1999
?>

Sources/ManageBans.php 2 locations

@@ 775-796 (lines=22) @@
772
 * @param int $member_id The ID of the member
773
 * @return array An array of IPs used in posts by this member
774
 */
775
function banLoadAdditionalIPsMember($member_id)
776
{
777
	global $smcFunc;
778
779
	// Find some additional IP's used by this member.
780
	$message_ips = array();
781
	$request = $smcFunc['db_query']('', '
782
		SELECT DISTINCT poster_ip
783
		FROM {db_prefix}messages
784
		WHERE id_member = {int:current_user}
785
			AND poster_ip IS NOT NULL
786
		ORDER BY poster_ip',
787
		array(
788
			'current_user' => $member_id,
789
		)
790
	);
791
	while ($row = $smcFunc['db_fetch_assoc']($request))
792
		$message_ips[] = inet_dtop($row['poster_ip']);
793
	$smcFunc['db_free_result']($request);
794
795
	return $message_ips;
796
}
797
798
/**
799
 * @param int $member_id The ID of the member
@@ 802-822 (lines=21) @@
799
 * @param int $member_id The ID of the member
800
 * @return array An array of IPs associated with error messages generated by this user
801
 */
802
function banLoadAdditionalIPsError($member_id)
803
{
804
	global $smcFunc;
805
806
	$error_ips = array();
807
	$request = $smcFunc['db_query']('', '
808
		SELECT DISTINCT ip
809
		FROM {db_prefix}log_errors
810
		WHERE id_member = {int:current_user}
811
			AND ip IS NOT NULL
812
		ORDER BY ip',
813
		array(
814
			'current_user' => $member_id,
815
		)
816
	);
817
	while ($row = $smcFunc['db_fetch_assoc']($request))
818
	    $error_ips[] = inet_dtop($row['ip']);
819
	$smcFunc['db_free_result']($request);
820
821
	return $error_ips;
822
}
823
824
/**
825
 * This function handles submitted forms that add, modify or remove ban triggers.