Code Duplication    Length = 16-16 lines in 2 locations

mod/elgg_solr/lib/hooks.php 1 location

@@ 847-862 (lines=16) @@
844
	// if passed a tag metadata name, only search on that tag name.
845
	// tag_name isn't included in the params because it's specific to
846
	// tag searches.
847
	if ($tag_names = get_input('tag_names')) {
848
		if (is_array($tag_names)) {
849
			$search_tag_names = $tag_names;
850
		} else {
851
			$search_tag_names = array($tag_names);
852
		}
853
854
		// check these are valid to avoid arbitrary metadata searches.
855
		foreach ($search_tag_names as $i => $tag_name) {
856
			if (!in_array($tag_name, $valid_tag_names)) {
857
				unset($search_tag_names[$i]);
858
			}
859
		}
860
	} else {
861
		$search_tag_names = $valid_tag_names;
862
	}
863
	
864
	$query_parts = array();
865
	foreach ($search_tag_names as $tagname) {

mod/search/search_hooks.php 1 location

@@ 241-256 (lines=16) @@
238
	// if passed a tag metadata name, only search on that tag name.
239
	// tag_name isn't included in the params because it's specific to
240
	// tag searches.
241
	if ($tag_names = get_input('tag_names')) {
242
		if (is_array($tag_names)) {
243
			$search_tag_names = $tag_names;
244
		} else {
245
			$search_tag_names = array($tag_names);
246
		}
247
248
		// check these are valid to avoid arbitrary metadata searches.
249
		foreach ($search_tag_names as $i => $tag_name) {
250
			if (!in_array($tag_name, $valid_tag_names)) {
251
				unset($search_tag_names[$i]);
252
			}
253
		}
254
	} else {
255
		$search_tag_names = $valid_tag_names;
256
	}
257
258
	if (!$search_tag_names) {
259
		return array('entities' => array(), 'count' => $count);