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

@@ 2859-2876 (lines=18) @@
2856
	);
2857
	$context['num_boards'] = $smcFunc['db_num_rows']($request);
2858
	$context['categories'] = array();
2859
	while ($row = $smcFunc['db_fetch_assoc']($request))
2860
	{
2861
		// This category hasn't been set up yet..
2862
		if (!isset($context['categories'][$row['id_cat']]))
2863
			$context['categories'][$row['id_cat']] = array(
2864
				'id' => $row['id_cat'],
2865
				'name' => $row['cat_name'],
2866
				'boards' => array()
2867
			);
2868
2869
		// Set this board up, and let the template know when it's a child.  (indent them..)
2870
		$context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array(
2871
			'id' => $row['id_board'],
2872
			'name' => $row['name'],
2873
			'child_level' => $row['child_level'],
2874
			'selected' => $row['is_ignored'],
2875
		);
2876
	}
2877
	$smcFunc['db_free_result']($request);
2878
2879
	require_once($sourcedir . '/Subs-Boards.php');