Commit b3ede3a0 by Amiya

break once the duplicate content found

it is not required to loop through the other posts once the matched post
found
parent 32ca391c
...@@ -351,8 +351,10 @@ ...@@ -351,8 +351,10 @@
foreach ($answers as $answer) foreach ($answers as $answer)
if (!$answer['hidden']) if (!$answer['hidden'])
if (implode(' ', qa_string_to_words($answer['content'])) == $testwords) if (implode(' ', qa_string_to_words($answer['content'])) == $testwords){
$errors['content']=qa_lang_html('question/duplicate_content'); $errors['content']=qa_lang_html('question/duplicate_content');
break;
}
} }
$userid = qa_get_logged_in_userid(); $userid = qa_get_logged_in_userid();
...@@ -425,8 +427,10 @@ ...@@ -425,8 +427,10 @@
foreach ($commentsfollows as $comment) foreach ($commentsfollows as $comment)
if (($comment['basetype']=='C') && ($comment['parentid']==$parentid) && !$comment['hidden']) if (($comment['basetype']=='C') && ($comment['parentid']==$parentid) && !$comment['hidden'])
if (implode(' ', qa_string_to_words($comment['content'])) == $testwords) if (implode(' ', qa_string_to_words($comment['content'])) == $testwords){
$errors['content']=qa_lang_html('question/duplicate_content'); $errors['content']=qa_lang_html('question/duplicate_content');
break;
}
} }
if (empty($errors)) { if (empty($errors)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment