Code Duplication    Length = 17-23 lines in 5 locations

other/upgrade.php 1 location

@@ 2736-2752 (lines=17) @@
2733
		$null_fix = strtolower($table_row['Null']) === 'yes' && !$change['null_allowed'];
2734
2735
		// Get the character set that goes with the collation of the column.
2736
		if ($column_fix && !empty($table_row['Collation']))
2737
		{
2738
			$request = $smcFunc['db_query']('', '
2739
				SHOW COLLATION
2740
				LIKE {string:collation}',
2741
				array(
2742
					'collation' => $table_row['Collation'],
2743
					'db_error_skip' => true,
2744
				)
2745
			);
2746
			// No results? Just forget it all together.
2747
			if ($smcFunc['db_num_rows']($request) === 0)
2748
				unset($table_row['Collation']);
2749
			else
2750
				$collation_info = $smcFunc['db_fetch_assoc']($request);
2751
			$smcFunc['db_free_result']($request);
2752
		}
2753
	}
2754
2755
	if ($column_fix)

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

@@ 1442-1458 (lines=17) @@
1439
1440
	$smcFunc['db_free_result']($request);
1441
1442
	if (!empty($buddiesArray))
1443
	{
1444
		$result = $smcFunc['db_query']('', '
1445
			SELECT id_member
1446
			FROM {db_prefix}members
1447
			WHERE id_member IN ({array_int:buddy_list})
1448
			ORDER BY real_name
1449
			LIMIT {int:buddy_list_count}',
1450
			array(
1451
				'buddy_list' => $buddiesArray,
1452
				'buddy_list_count' => substr_count($user_profile[$memID]['buddy_list'], ',') + 1,
1453
			)
1454
		);
1455
		while ($row = $smcFunc['db_fetch_assoc']($result))
1456
			$buddies[] = $row['id_member'];
1457
		$smcFunc['db_free_result']($result);
1458
	}
1459
1460
	$context['buddy_count'] = count($buddies);
1461
@@ 1609-1625 (lines=17) @@
1606
	// Initialise the list of members we're ignoring.
1607
	$ignored = array();
1608
1609
	if (!empty($ignoreArray))
1610
	{
1611
		$result = $smcFunc['db_query']('', '
1612
			SELECT id_member
1613
			FROM {db_prefix}members
1614
			WHERE id_member IN ({array_int:ignore_list})
1615
			ORDER BY real_name
1616
			LIMIT {int:ignore_list_count}',
1617
			array(
1618
				'ignore_list' => $ignoreArray,
1619
				'ignore_list_count' => substr_count($user_profile[$memID]['pm_ignore_list'], ',') + 1,
1620
			)
1621
		);
1622
		while ($row = $smcFunc['db_fetch_assoc']($result))
1623
			$ignored[] = $row['id_member'];
1624
		$smcFunc['db_free_result']($result);
1625
	}
1626
1627
	$context['ignore_count'] = count($ignored);
1628