Code Duplication    Length = 12-15 lines in 3 locations

Sources/Subs-Members.php 1 location

@@ 1365-1376 (lines=12) @@
1362
		$num_members = $modSettings['totalMembers'];
1363
1364
	// The database knows the amount when there are extra conditions.
1365
	else
1366
	{
1367
		$request = $smcFunc['db_query']('', '
1368
			SELECT COUNT(*)
1369
			FROM {db_prefix}members AS mem
1370
			WHERE ' . $where,
1371
			array_merge($where_params, array(
1372
			))
1373
		);
1374
		list ($num_members) = $smcFunc['db_fetch_row']($request);
1375
		$smcFunc['db_free_result']($request);
1376
	}
1377
1378
	return $num_members;
1379
}

Sources/Subs-Post.php 1 location

@@ 2708-2722 (lines=15) @@
2705
{
2706
	global $smcFunc;
2707
2708
	if ($member_name == null)
2709
	{
2710
		// Get the new user's name....
2711
		$request = $smcFunc['db_query']('', '
2712
			SELECT real_name
2713
			FROM {db_prefix}members
2714
			WHERE id_member = {int:id_member}
2715
			LIMIT 1',
2716
			array(
2717
				'id_member' => $memberID,
2718
			)
2719
		);
2720
		list ($member_name) = $smcFunc['db_fetch_row']($request);
2721
		$smcFunc['db_free_result']($request);
2722
	}
2723
2724
	// This is really just a wrapper for making a new background task to deal with all the fun.
2725
	$smcFunc['db_insert']('insert',

Sources/Subs-Calendar.php 1 location

@@ 1533-1545 (lines=13) @@
1530
	if (is_null($id_member) && $user_info['is_guest'] == false)
1531
		$id_member = $context['user']['id'];
1532
1533
	if (isset($id_member))
1534
	{
1535
		$request = $smcFunc['db_query']('', '
1536
			SELECT timezone
1537
			FROM {db_prefix}members
1538
			WHERE id_member = {int:id_member}',
1539
			array(
1540
				'id_member' => $id_member,
1541
			)
1542
		);
1543
		list($timezone) = $smcFunc['db_fetch_row']($request);
1544
		$smcFunc['db_free_result']($request);
1545
	}
1546
1547
	if (empty($timezone) || !in_array($timezone, timezone_identifiers_list(DateTimeZone::ALL_WITH_BC)))
1548
		$timezone = isset($modSettings['default_timezone']) ? $modSettings['default_timezone'] : date_default_timezone_get();