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

@@ 1460-1476 (lines=17) @@
1457
1458
	$smcFunc['db_free_result']($request);
1459
1460
	if (!empty($buddiesArray))
1461
	{
1462
		$result = $smcFunc['db_query']('', '
1463
			SELECT id_member
1464
			FROM {db_prefix}members
1465
			WHERE id_member IN ({array_int:buddy_list})
1466
			ORDER BY real_name
1467
			LIMIT {int:buddy_list_count}',
1468
			array(
1469
				'buddy_list' => $buddiesArray,
1470
				'buddy_list_count' => substr_count($user_profile[$memID]['buddy_list'], ',') + 1,
1471
			)
1472
		);
1473
		while ($row = $smcFunc['db_fetch_assoc']($result))
1474
			$buddies[] = $row['id_member'];
1475
		$smcFunc['db_free_result']($result);
1476
	}
1477
1478
	$context['buddy_count'] = count($buddies);
1479
@@ 1627-1643 (lines=17) @@
1624
	// Initialise the list of members we're ignoring.
1625
	$ignored = array();
1626
1627
	if (!empty($ignoreArray))
1628
	{
1629
		$result = $smcFunc['db_query']('', '
1630
			SELECT id_member
1631
			FROM {db_prefix}members
1632
			WHERE id_member IN ({array_int:ignore_list})
1633
			ORDER BY real_name
1634
			LIMIT {int:ignore_list_count}',
1635
			array(
1636
				'ignore_list' => $ignoreArray,
1637
				'ignore_list_count' => substr_count($user_profile[$memID]['pm_ignore_list'], ',') + 1,
1638
			)
1639
		);
1640
		while ($row = $smcFunc['db_fetch_assoc']($result))
1641
			$ignored[] = $row['id_member'];
1642
		$smcFunc['db_free_result']($result);
1643
	}
1644
1645
	$context['ignore_count'] = count($ignored);
1646

other/upgrade.php 1 location

@@ 2140-2156 (lines=17) @@
2137
	$null_fix = strtolower($table_row['Null']) === 'yes' && !$change['null_allowed'];
2138
2139
	// Get the character set that goes with the collation of the column.
2140
	if ($column_fix && !empty($table_row['Collation']))
2141
	{
2142
		$request = $smcFunc['db_query']('', '
2143
			SHOW COLLATION
2144
			LIKE {string:collation}',
2145
			array(
2146
				'collation' => $table_row['Collation'],
2147
				'db_error_skip' => true,
2148
			)
2149
		);
2150
		// No results? Just forget it all together.
2151
		if ($smcFunc['db_num_rows']($request) === 0)
2152
			unset($table_row['Collation']);
2153
		else
2154
			$collation_info = $smcFunc['db_fetch_assoc']($request);
2155
		$smcFunc['db_free_result']($request);
2156
	}
2157
2158
	if ($column_fix)
2159
	{