Code Duplication    Length = 19-22 lines in 4 locations

Sources/ManageBans.php 2 locations

@@ 744-765 (lines=22) @@
741
 * @param int $member_id The ID of the member
742
 * @return array An array of IPs used in posts by this member
743
 */
744
function banLoadAdditionalIPsMember($member_id)
745
{
746
	global $smcFunc;
747
748
	// Find some additional IP's used by this member.
749
	$message_ips = array();
750
	$request = $smcFunc['db_query']('', '
751
		SELECT DISTINCT poster_ip
752
		FROM {db_prefix}messages
753
		WHERE id_member = {int:current_user}
754
			AND poster_ip IS NOT NULL
755
		ORDER BY poster_ip',
756
		array(
757
			'current_user' => $member_id,
758
		)
759
	);
760
	while ($row = $smcFunc['db_fetch_assoc']($request))
761
		$message_ips[] = inet_dtop($row['poster_ip']);
762
	$smcFunc['db_free_result']($request);
763
764
	return $message_ips;
765
}
766
767
/**
768
 * @param int $member_id The ID of the member
@@ 771-791 (lines=21) @@
768
 * @param int $member_id The ID of the member
769
 * @return array An array of IPs associated with error messages generated by this user
770
 */
771
function banLoadAdditionalIPsError($member_id)
772
{
773
	global $smcFunc;
774
775
	$error_ips = array();
776
	$request = $smcFunc['db_query']('', '
777
		SELECT DISTINCT ip
778
		FROM {db_prefix}log_errors
779
		WHERE id_member = {int:current_user}
780
			AND ip IS NOT NULL
781
		ORDER BY ip',
782
		array(
783
			'current_user' => $member_id,
784
		)
785
	);
786
	while ($row = $smcFunc['db_fetch_assoc']($request))
787
	    $error_ips[] = inet_dtop($row['ip']);
788
	$smcFunc['db_free_result']($request);
789
790
	return $error_ips;
791
}
792
793
/**
794
 * This function handles submitted forms that add, modify or remove ban triggers.

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
?>