MDL-66808 mod_forum: set the format col to FORMAT_PLAIN when it is plain

This commit is contained in:
Shamim Rezaie 2019-10-17 13:21:05 +11:00
parent c98f448866
commit bfe6cfc9ab

View file

@ -90,11 +90,8 @@ if ($form->is_cancelled()) {
$striphtml = !empty($data->striphtml); $striphtml = !empty($data->striphtml);
$humandates = !empty($data->humandates); $humandates = !empty($data->humandates);
$fields = ['id', 'discussion', 'parent', 'userid', 'created', 'modified', 'mailed', 'subject', 'message']; $fields = ['id', 'discussion', 'parent', 'userid', 'created', 'modified', 'mailed', 'subject', 'message',
if (!$striphtml) { 'messageformat', 'messagetrust', 'attachment', 'totalscore', 'mailnow', 'deleted', 'privatereplyto'];
$fields[] = 'messageformat';
}
$fields = array_merge($fields, ['messagetrust', 'attachment', 'totalscore', 'mailnow', 'deleted', 'privatereplyto']);
$datamapper = $legacydatamapperfactory->get_post_data_mapper(); $datamapper = $legacydatamapperfactory->get_post_data_mapper();
$exportdata = new ArrayObject($datamapper->to_legacy_objects($posts)); $exportdata = new ArrayObject($datamapper->to_legacy_objects($posts));
@ -116,7 +113,7 @@ if ($form->is_cancelled()) {
// matter what. We use http://example.com/. // matter what. We use http://example.com/.
$data->message = str_replace('@@PLUGINFILE@@/', 'http://example.com/', $data->message); $data->message = str_replace('@@PLUGINFILE@@/', 'http://example.com/', $data->message);
$data->message = html_to_text(format_text($data->message, $data->messageformat), 0, false); $data->message = html_to_text(format_text($data->message, $data->messageformat), 0, false);
unset($data->messageformat); $data->messageformat = FORMAT_PLAIN;
} }
if ($humandates) { if ($humandates) {
$data->created = userdate($data->created); $data->created = userdate($data->created);