Code Duplication    Length = 14-14 lines in 3 locations

Sources/Post.php 3 locations

@@ 610-623 (lines=14) @@
607
				$attachment_stuff[] = $row2;
608
			$smcFunc['db_free_result']($request);
609
610
			if ($row['id_member'] == $user_info['id'] && !allowedTo('modify_any'))
611
			{
612
				// Give an extra five minutes over the disable time threshold, so they can type - assuming the post is public.
613
				if ($row['approved'] && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
614
					fatal_lang_error('modify_post_time_passed', false);
615
				elseif ($row['id_member_poster'] == $user_info['id'] && !allowedTo('modify_own'))
616
					isAllowedTo('modify_replies');
617
				else
618
					isAllowedTo('modify_own');
619
			}
620
			elseif ($row['id_member_poster'] == $user_info['id'] && !allowedTo('modify_any'))
621
				isAllowedTo('modify_replies');
622
			else
623
				isAllowedTo('modify_any');
624
625
			if ($context['can_announce'] && !empty($row['id_action']))
626
			{
@@ 727-740 (lines=14) @@
724
			$attachment_stuff[] = $row2;
725
		$smcFunc['db_free_result']($request);
726
727
		if ($row['id_member'] == $user_info['id'] && !allowedTo('modify_any'))
728
		{
729
			// Give an extra five minutes over the disable time threshold, so they can type - assuming the post is public.
730
			if ($row['approved'] && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
731
				fatal_lang_error('modify_post_time_passed', false);
732
			elseif ($row['id_member_poster'] == $user_info['id'] && !allowedTo('modify_own'))
733
				isAllowedTo('modify_replies');
734
			else
735
				isAllowedTo('modify_own');
736
		}
737
		elseif ($row['id_member_poster'] == $user_info['id'] && !allowedTo('modify_any'))
738
			isAllowedTo('modify_replies');
739
		else
740
			isAllowedTo('modify_any');
741
742
		if ($context['can_announce'] && !empty($row['id_action']))
743
		{
@@ 2709-2722 (lines=14) @@
2706
		if (!empty($row['locked']))
2707
			isAllowedTo('moderate_board');
2708
2709
		if ($row['id_member'] == $user_info['id'] && !allowedTo('modify_any'))
2710
		{
2711
			if ((!$modSettings['postmod_active'] || $row['approved']) && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + ($modSettings['edit_disable_time'] + 5) * 60 < time())
2712
				fatal_lang_error('modify_post_time_passed', false);
2713
			elseif ($row['id_member_started'] == $user_info['id'] && !allowedTo('modify_own'))
2714
				isAllowedTo('modify_replies');
2715
			else
2716
				isAllowedTo('modify_own');
2717
		}
2718
		// Otherwise, they're locked out; someone who can modify the replies is needed.
2719
		elseif ($row['id_member_started'] == $user_info['id'] && !allowedTo('modify_any'))
2720
			isAllowedTo('modify_replies');
2721
		else
2722
			isAllowedTo('modify_any');
2723
2724
		// Only log this action if it wasn't your message.
2725
		$moderationAction = $row['id_member'] != $user_info['id'];