Code Duplication    Length = 14-14 lines in 3 locations

Sources/Post.php 3 locations

@@ 607-620 (lines=14) @@
604
				$attachment_stuff[] = $row2;
605
			$smcFunc['db_free_result']($request);
606
607
			if ($row['id_member'] == $user_info['id'] && !allowedTo('modify_any'))
608
			{
609
				// Give an extra five minutes over the disable time threshold, so they can type - assuming the post is public.
610
				if ($row['approved'] && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
611
					fatal_lang_error('modify_post_time_passed', false);
612
				elseif ($row['id_member_poster'] == $user_info['id'] && !allowedTo('modify_own'))
613
					isAllowedTo('modify_replies');
614
				else
615
					isAllowedTo('modify_own');
616
			}
617
			elseif ($row['id_member_poster'] == $user_info['id'] && !allowedTo('modify_any'))
618
				isAllowedTo('modify_replies');
619
			else
620
				isAllowedTo('modify_any');
621
622
			if ($context['can_announce'] && !empty($row['id_action']))
623
			{
@@ 724-737 (lines=14) @@
721
			$attachment_stuff[] = $row2;
722
		$smcFunc['db_free_result']($request);
723
724
		if ($row['id_member'] == $user_info['id'] && !allowedTo('modify_any'))
725
		{
726
			// Give an extra five minutes over the disable time threshold, so they can type - assuming the post is public.
727
			if ($row['approved'] && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
728
				fatal_lang_error('modify_post_time_passed', false);
729
			elseif ($row['id_member_poster'] == $user_info['id'] && !allowedTo('modify_own'))
730
				isAllowedTo('modify_replies');
731
			else
732
				isAllowedTo('modify_own');
733
		}
734
		elseif ($row['id_member_poster'] == $user_info['id'] && !allowedTo('modify_any'))
735
			isAllowedTo('modify_replies');
736
		else
737
			isAllowedTo('modify_any');
738
739
		if ($context['can_announce'] && !empty($row['id_action']))
740
		{
@@ 2743-2756 (lines=14) @@
2740
		if (!empty($row['locked']))
2741
			isAllowedTo('moderate_board');
2742
2743
		if ($row['id_member'] == $user_info['id'] && !allowedTo('modify_any'))
2744
		{
2745
			if ((!$modSettings['postmod_active'] || $row['approved']) && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
2746
				fatal_lang_error('modify_post_time_passed', false);
2747
			elseif ($row['id_member_started'] == $user_info['id'] && !allowedTo('modify_own'))
2748
				isAllowedTo('modify_replies');
2749
			else
2750
				isAllowedTo('modify_own');
2751
		}
2752
		// Otherwise, they're locked out; someone who can modify the replies is needed.
2753
		elseif ($row['id_member_started'] == $user_info['id'] && !allowedTo('modify_any'))
2754
			isAllowedTo('modify_replies');
2755
		else
2756
			isAllowedTo('modify_any');
2757
2758
		// Only log this action if it wasn't your message.
2759
		$moderationAction = $row['id_member'] != $user_info['id'];