Code Duplication    Length = 16-18 lines in 2 locations

Sources/Subs-MessageIndex.php 1 location

@@ 69-84 (lines=16) @@
66
	$return_value = array();
67
	if ($smcFunc['db_num_rows']($request) !== 0)
68
	{
69
		while ($row = $smcFunc['db_fetch_assoc']($request))
70
		{
71
			if (!isset($return_value[$row['id_cat']]))
72
				$return_value[$row['id_cat']] = array(
73
					'id' => $row['id_cat'],
74
					'name' => $row['cat_name'],
75
					'boards' => array(),
76
				);
77
78
			$return_value[$row['id_cat']]['boards'][$row['id_board']] = array(
79
				'id' => $row['id_board'],
80
				'name' => $row['board_name'],
81
				'child_level' => $row['child_level'],
82
				'selected' => isset($boardListOptions['selected_board']) && $boardListOptions['selected_board'] == $row['id_board'],
83
			);
84
		}
85
	}
86
	$smcFunc['db_free_result']($request);
87

Sources/Profile-Modify.php 1 location

@@ 2775-2792 (lines=18) @@
2772
	);
2773
	$context['num_boards'] = $smcFunc['db_num_rows']($request);
2774
	$context['categories'] = array();
2775
	while ($row = $smcFunc['db_fetch_assoc']($request))
2776
	{
2777
		// This category hasn't been set up yet..
2778
		if (!isset($context['categories'][$row['id_cat']]))
2779
			$context['categories'][$row['id_cat']] = array(
2780
				'id' => $row['id_cat'],
2781
				'name' => $row['cat_name'],
2782
				'boards' => array()
2783
			);
2784
2785
		// Set this board up, and let the template know when it's a child.  (indent them..)
2786
		$context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array(
2787
			'id' => $row['id_board'],
2788
			'name' => $row['name'],
2789
			'child_level' => $row['child_level'],
2790
			'selected' => $row['is_ignored'],
2791
		);
2792
	}
2793
	$smcFunc['db_free_result']($request);
2794
2795
	require_once($sourcedir . '/Subs-Boards.php');