Code Duplication    Length = 20-22 lines in 2 locations

Sources/ManagePaid.php 1 location

@@ 958-979 (lines=22) @@
955
 * @param array $search_vars An array of variables for the search string
956
 * @return int The number of subscribed users matching the given parameters
957
 */
958
function list_getSubscribedUserCount($id_sub, $search_string, $search_vars = array())
959
{
960
	global $smcFunc;
961
962
	// Get the total amount of users.
963
	$request = $smcFunc['db_query']('', '
964
		SELECT COUNT(*) AS total_subs
965
		FROM {db_prefix}log_subscribed AS ls
966
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = ls.id_member)
967
		WHERE ls.id_subscribe = {int:current_subscription} ' . $search_string . '
968
			AND (ls.end_time != {int:no_end_time} OR ls.payments_pending != {int:no_pending_payments})',
969
		array_merge($search_vars, array(
970
			'current_subscription' => $id_sub,
971
			'no_end_time' => 0,
972
			'no_pending_payments' => 0,
973
		))
974
	);
975
	list ($memberCount) = $smcFunc['db_fetch_row']($request);
976
	$smcFunc['db_free_result']($request);
977
978
	return $memberCount;
979
}
980
981
/**
982
 * Return the subscribed users list, for the given parameters.

Sources/ModerationCenter.php 1 location

@@ 1800-1819 (lines=20) @@
1797
  * Callback for createList().
1798
  * @return int The total number of warning templates
1799
  */
1800
function list_getWarningTemplateCount()
1801
{
1802
	global $smcFunc, $user_info;
1803
1804
	$request = $smcFunc['db_query']('', '
1805
		SELECT COUNT(*)
1806
		FROM {db_prefix}log_comments
1807
		WHERE comment_type = {string:warntpl}
1808
			AND (id_recipient = {string:generic} OR id_recipient = {int:current_member})',
1809
		array(
1810
			'warntpl' => 'warntpl',
1811
			'generic' => 0,
1812
			'current_member' => $user_info['id'],
1813
		)
1814
	);
1815
	list ($totalWarns) = $smcFunc['db_fetch_row']($request);
1816
	$smcFunc['db_free_result']($request);
1817
1818
	return $totalWarns;
1819
}
1820
1821
/**
1822
 * Callback for createList().