Code Duplication    Length = 7-7 lines in 5 locations

Sources/ManageMembergroups.php 1 location

@@ 947-953 (lines=7) @@
944
				$moderator_string = strtr(preg_replace('~&#(\d{4,5}|[2-9]\d{2,4}|1[2-9]\d);~', '&#$1;', $smcFunc['htmlspecialchars']($moderator_string, ENT_QUOTES)), array('"' => '"'));
945
				preg_match_all('~"([^"]+)"~', $moderator_string, $matches);
946
				$moderators = array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $moderator_string)));
947
				for ($k = 0, $n = count($moderators); $k < $n; $k++)
948
				{
949
					$moderators[$k] = trim($moderators[$k]);
950
951
					if (strlen($moderators[$k]) == 0)
952
						unset($moderators[$k]);
953
				}
954
955
				// Find all the id_member's for the member_name's in the list.
956
				if (!empty($moderators))

Sources/Search.php 1 location

@@ 431-437 (lines=7) @@
428
		preg_match_all('~"([^"]+)"~', $userString, $matches);
429
		$possible_users = array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $userString)));
430
431
		for ($k = 0, $n = count($possible_users); $k < $n; $k++)
432
		{
433
			$possible_users[$k] = trim($possible_users[$k]);
434
435
			if (strlen($possible_users[$k]) == 0)
436
				unset($possible_users[$k]);
437
		}
438
439
		// Create a list of database-escaped search names.
440
		$realNameMatches = array();

Sources/Subs-Boards.php 2 locations

@@ 678-684 (lines=7) @@
675
			$moderator_string = strtr($smcFunc['htmlspecialchars']($boardOptions['moderator_string'], ENT_QUOTES), array('&quot;' => '"'));
676
			preg_match_all('~"([^"]+)"~', $moderator_string, $matches);
677
			$moderators = array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $moderator_string)));
678
			for ($k = 0, $n = count($moderators); $k < $n; $k++)
679
			{
680
				$moderators[$k] = trim($moderators[$k]);
681
682
				if (strlen($moderators[$k]) == 0)
683
					unset($moderators[$k]);
684
			}
685
686
			// Find all the id_member's for the member_name's in the list.
687
			if (empty($boardOptions['moderators']))
@@ 738-744 (lines=7) @@
735
			$moderator_group_string = strtr($smcFunc['htmlspecialchars']($boardOptions['moderator_group_string'], ENT_QUOTES), array('&quot;' => '"'));
736
			preg_match_all('~"([^"]+)"~', $moderator_group_string, $matches);
737
			$moderator_groups = array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $moderator_group_string)));
738
			for ($k = 0, $n = count($moderator_groups); $k < $n; $k++)
739
			{
740
				$moderator_groups[$k] = trim($moderator_groups[$k]);
741
742
				if (strlen($moderator_groups[$k]) == 0)
743
					unset($moderator_groups[$k]);
744
			}
745
746
			/* 	Find all the id_group's for all the group names in the list
747
				But skip any invalid ones (invisible/post groups/Administrator/Moderator) */

Sources/PersonalMessage.php 1 location

@@ 1263-1269 (lines=7) @@
1260
		preg_match_all('~"([^"]+)"~', $userString, $matches);
1261
		$possible_users = array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $userString)));
1262
1263
		for ($k = 0, $n = count($possible_users); $k < $n; $k++)
1264
		{
1265
			$possible_users[$k] = trim($possible_users[$k]);
1266
1267
			if (strlen($possible_users[$k]) == 0)
1268
				unset($possible_users[$k]);
1269
		}
1270
1271
		if (!empty($possible_users))
1272
		{