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

@@ 2751-2768 (lines=18) @@
2748
	);
2749
	$context['num_boards'] = $smcFunc['db_num_rows']($request);
2750
	$context['categories'] = array();
2751
	while ($row = $smcFunc['db_fetch_assoc']($request))
2752
	{
2753
		// This category hasn't been set up yet..
2754
		if (!isset($context['categories'][$row['id_cat']]))
2755
			$context['categories'][$row['id_cat']] = array(
2756
				'id' => $row['id_cat'],
2757
				'name' => $row['cat_name'],
2758
				'boards' => array()
2759
			);
2760
2761
		// Set this board up, and let the template know when it's a child.  (indent them..)
2762
		$context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array(
2763
			'id' => $row['id_board'],
2764
			'name' => $row['name'],
2765
			'child_level' => $row['child_level'],
2766
			'selected' => $row['is_ignored'],
2767
		);
2768
	}
2769
	$smcFunc['db_free_result']($request);
2770
2771
	require_once($sourcedir . '/Subs-Boards.php');