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/Profile-Modify.php 2 locations

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

Sources/Subs-Members.php 1 location

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

other/upgrade.php 1 location

@@ 3073-3089 (lines=17) @@
3070
		$null_fix = strtolower($table_row['Null']) === 'yes' && !$change['null_allowed'];
3071
3072
		// Get the character set that goes with the collation of the column.
3073
		if ($column_fix && !empty($table_row['Collation']))
3074
		{
3075
			$request = $smcFunc['db_query']('', '
3076
				SHOW COLLATION
3077
				LIKE {string:collation}',
3078
				array(
3079
					'collation' => $table_row['Collation'],
3080
					'db_error_skip' => true,
3081
				)
3082
			);
3083
			// No results? Just forget it all together.
3084
			if ($smcFunc['db_num_rows']($request) === 0)
3085
				unset($table_row['Collation']);
3086
			else
3087
				$collation_info = $smcFunc['db_fetch_assoc']($request);
3088
			$smcFunc['db_free_result']($request);
3089
		}
3090
	}
3091
3092
	if ($column_fix)