Code Duplication    Length = 6-6 lines in 4 locations

Sources/SearchAPI-Custom.php 2 locations

@@ 185-190 (lines=6) @@
182
			$query_where[] = 'm.id_msg <= {int:max_msg_id}';
183
184
		$count = 0;
185
		if (!empty($query_params['excluded_phrases']) && empty($modSettings['search_force_index']))
186
			foreach ($query_params['excluded_phrases'] as $phrase)
187
			{
188
				$query_where[] = 'subject NOT ' . (empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? ' LIKE ' : ' RLIKE ') . '{string:exclude_subject_phrase_' . $count . '}';
189
				$query_params['exclude_subject_phrase_' . $count++] = empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? '%' . strtr($phrase, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $phrase), '\\\'') . '[[:>:]]';
190
			}
191
		$count = 0;
192
		if (!empty($query_params['excluded_subject_words']) && empty($modSettings['search_force_index']))
193
			foreach ($query_params['excluded_subject_words'] as $excludedWord)
@@ 192-197 (lines=6) @@
189
				$query_params['exclude_subject_phrase_' . $count++] = empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? '%' . strtr($phrase, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $phrase), '\\\'') . '[[:>:]]';
190
			}
191
		$count = 0;
192
		if (!empty($query_params['excluded_subject_words']) && empty($modSettings['search_force_index']))
193
			foreach ($query_params['excluded_subject_words'] as $excludedWord)
194
			{
195
				$query_where[] = 'subject NOT ' . (empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? ' LIKE ' : ' RLIKE ') . '{string:exclude_subject_words_' . $count . '}';
196
				$query_params['exclude_subject_words_' . $count++] = empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? '%' . strtr($excludedWord, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $excludedWord), '\\\'') . '[[:>:]]';
197
			}
198
199
		$numTables = 0;
200
		$prev_join = 0;

Sources/SearchAPI-Fulltext.php 2 locations

@@ 206-211 (lines=6) @@
203
			$query_where[] = 'm.id_msg <= {int:max_msg_id}';
204
205
		$count = 0;
206
		if (!empty($query_params['excluded_phrases']) && empty($modSettings['search_force_index']))
207
			foreach ($query_params['excluded_phrases'] as $phrase)
208
			{
209
				$query_where[] = 'subject NOT ' . (empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? ' LIKE ' : 'RLIKE') . '{string:exclude_subject_phrase_' . $count . '}';
210
				$query_params['exclude_subject_phrase_' . $count++] = empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? '%' . strtr($phrase, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $phrase), '\\\'') . '[[:>:]]';
211
			}
212
		$count = 0;
213
		if (!empty($query_params['excluded_subject_words']) && empty($modSettings['search_force_index']))
214
			foreach ($query_params['excluded_subject_words'] as $excludedWord)
@@ 213-218 (lines=6) @@
210
				$query_params['exclude_subject_phrase_' . $count++] = empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? '%' . strtr($phrase, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $phrase), '\\\'') . '[[:>:]]';
211
			}
212
		$count = 0;
213
		if (!empty($query_params['excluded_subject_words']) && empty($modSettings['search_force_index']))
214
			foreach ($query_params['excluded_subject_words'] as $excludedWord)
215
			{
216
				$query_where[] = 'subject NOT ' . (empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? ' LIKE ' : 'RLIKE') . '{string:exclude_subject_words_' . $count . '}';
217
				$query_params['exclude_subject_words_' . $count++] = empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? '%' . strtr($excludedWord, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $excludedWord), '\\\'') . '[[:>:]]';
218
			}
219
220
		if (!empty($modSettings['search_simple_fulltext']))
221
		{