Code Duplication    Length = 5-7 lines in 2 locations

Sources/ManageNews.php 1 location

@@ 558-562 (lines=5) @@
555
			preg_match_all('~"([^"]+)"~', $_POST[$type], $matches);
556
			$_POST[$type] = array_unique(array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $_POST[$type]))));
557
558
			foreach ($_POST[$type] as $index => $member)
559
				if (strlen(trim($member)) > 0)
560
					$_POST[$type][$index] = $smcFunc['htmlspecialchars']($smcFunc['strtolower'](trim($member)));
561
				else
562
					unset($_POST[$type][$index]);
563
564
			// Find the members
565
			$_POST[$type] = implode(',', array_keys(findMembers($_POST[$type])));

Sources/PersonalMessage.php 1 location

@@ 2296-2302 (lines=7) @@
2293
			preg_match_all('~"([^"]+)"~', $recipientString, $matches);
2294
			$namedRecipientList[$recipientType] = array_unique(array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $recipientString))));
2295
2296
			foreach ($namedRecipientList[$recipientType] as $index => $recipient)
2297
			{
2298
				if (strlen(trim($recipient)) > 0)
2299
					$namedRecipientList[$recipientType][$index] = $smcFunc['htmlspecialchars']($smcFunc['strtolower'](trim($recipient)));
2300
				else
2301
					unset($namedRecipientList[$recipientType][$index]);
2302
			}
2303
2304
			if (!empty($namedRecipientList[$recipientType]))
2305
			{