#60916: Fix comment subject being empty when comment only contains HTML tags.

5.x
Steven Wittens 2006-12-12 06:06:41 +00:00
parent 4610499856
commit fcde99a4dd
1 changed files with 8 additions and 2 deletions

View File

@ -1545,9 +1545,15 @@ function _comment_form_submit($form_values) {
// 1) Filter it into HTML
// 2) Strip out all HTML tags
// 3) Convert entities back to plain-text.
// Note: format is checked by check_markup().
$form_values['subject'] = truncate_utf8(decode_entities(strip_tags(check_markup($form_values['comment'], $form_values['format']))), 29, TRUE);
// Note: format is checked by check_markup().
$form_values['subject'] = trim(truncate_utf8(decode_entities(strip_tags(check_markup($form_values['comment'], $form_values['format']))), 29, TRUE));
// Edge cases where the comment body is populated only by HTML tags will
// require a default subject.
if ($form_values['subject'] == '') {
$form_values['subject'] = t('(No subject)');
}
}
return $form_values;
}