Code Duplication    Length = 17-23 lines in 5 locations

Sources/Subs-Boards.php 1 location

@@ 309-331 (lines=23) @@
306
		if (!empty($board))
307
			$boards[] = (int) $board;
308
309
		if (isset($_REQUEST['children']) && !empty($boards))
310
		{
311
			// They want to mark the entire tree starting with the boards specified
312
			// The easiest thing is to just get all the boards they can see, but since we've specified the top of tree we ignore some of them
313
314
			$request = $smcFunc['db_query']('', '
315
				SELECT b.id_board, b.id_parent
316
				FROM {db_prefix}boards AS b
317
				WHERE {query_see_board}
318
					AND b.child_level > {int:no_parents}
319
					AND b.id_board NOT IN ({array_int:board_list})
320
				ORDER BY child_level ASC
321
				',
322
				array(
323
					'no_parents' => 0,
324
					'board_list' => $boards,
325
				)
326
			);
327
			while ($row = $smcFunc['db_fetch_assoc']($request))
328
				if (in_array($row['id_parent'], $boards))
329
					$boards[] = $row['id_board'];
330
			$smcFunc['db_free_result']($request);
331
		}
332
333
		$clauses = array();
334
		$clauseParameters = array();

Sources/Subs-Members.php 1 location

@@ 1030-1052 (lines=23) @@
1027
		$moderator_groups = array();
1028
1029
		// "Inherit" any moderator permissions as needed
1030
		if (isset($board_info['moderator_groups']))
1031
		{
1032
			$moderator_groups = array_keys($board_info['moderator_groups']);
1033
		}
1034
		elseif ($board_id !== 0)
1035
		{
1036
			// Get the groups that can moderate this board
1037
			$request = $smcFunc['db_query']('', '
1038
				SELECT id_group
1039
				FROM {db_prefix}moderator_groups
1040
				WHERE id_board = {int:board_id}',
1041
				array(
1042
					'board_id' => $board_id,
1043
				)
1044
			);
1045
1046
			while ($row = $smcFunc['db_fetch_assoc']($request))
1047
			{
1048
				$moderator_groups[] = $row['id_group'];
1049
			}
1050
1051
			$smcFunc['db_free_result']($request);
1052
		}
1053
1054
		// "Inherit" any additional permissions from the "Moderators" group
1055
		foreach ($moderator_groups as $mod_group)

Sources/Profile-Modify.php 2 locations

@@ 1478-1494 (lines=17) @@
1475
1476
	$smcFunc['db_free_result']($request);
1477
1478
	if (!empty($buddiesArray))
1479
	{
1480
		$result = $smcFunc['db_query']('', '
1481
			SELECT id_member
1482
			FROM {db_prefix}members
1483
			WHERE id_member IN ({array_int:buddy_list})
1484
			ORDER BY real_name
1485
			LIMIT {int:buddy_list_count}',
1486
			array(
1487
				'buddy_list' => $buddiesArray,
1488
				'buddy_list_count' => substr_count($user_profile[$memID]['buddy_list'], ',') + 1,
1489
			)
1490
		);
1491
		while ($row = $smcFunc['db_fetch_assoc']($result))
1492
			$buddies[] = $row['id_member'];
1493
		$smcFunc['db_free_result']($result);
1494
	}
1495
1496
	$context['buddy_count'] = count($buddies);
1497
@@ 1645-1661 (lines=17) @@
1642
	// Initialise the list of members we're ignoring.
1643
	$ignored = array();
1644
1645
	if (!empty($ignoreArray))
1646
	{
1647
		$result = $smcFunc['db_query']('', '
1648
			SELECT id_member
1649
			FROM {db_prefix}members
1650
			WHERE id_member IN ({array_int:ignore_list})
1651
			ORDER BY real_name
1652
			LIMIT {int:ignore_list_count}',
1653
			array(
1654
				'ignore_list' => $ignoreArray,
1655
				'ignore_list_count' => substr_count($user_profile[$memID]['pm_ignore_list'], ',') + 1,
1656
			)
1657
		);
1658
		while ($row = $smcFunc['db_fetch_assoc']($result))
1659
			$ignored[] = $row['id_member'];
1660
		$smcFunc['db_free_result']($result);
1661
	}
1662
1663
	$context['ignore_count'] = count($ignored);
1664

other/upgrade.php 1 location

@@ 2261-2277 (lines=17) @@
2258
	$null_fix = strtolower($table_row['Null']) === 'yes' && !$change['null_allowed'];
2259
2260
	// Get the character set that goes with the collation of the column.
2261
	if ($column_fix && !empty($table_row['Collation']))
2262
	{
2263
		$request = $smcFunc['db_query']('', '
2264
			SHOW COLLATION
2265
			LIKE {string:collation}',
2266
			array(
2267
				'collation' => $table_row['Collation'],
2268
				'db_error_skip' => true,
2269
			)
2270
		);
2271
		// No results? Just forget it all together.
2272
		if ($smcFunc['db_num_rows']($request) === 0)
2273
			unset($table_row['Collation']);
2274
		else
2275
			$collation_info = $smcFunc['db_fetch_assoc']($request);
2276
		$smcFunc['db_free_result']($request);
2277
	}
2278
2279
	if ($column_fix)
2280
	{