Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
e95df45b
Commit
e95df45b
authored
Oct 26, 2017
by
Marina Glancy
Browse files
MDL-60591 mod_forum: inline attachments are not displayed in plain text
parent
5bde2c2b
Changes
1
Hide whitespace changes
Inline
Side-by-side
mod/forum/classes/message/inbound/reply_handler.php
View file @
e95df45b
...
...
@@ -170,9 +170,20 @@ class reply_handler extends \core\message\inbound\handler {
// We don't trust text coming from e-mail.
$addpost
->
messagetrust
=
false
;
// Find all attachments. If format is plain text, treat inline attachments as regular ones.
$attachments
=
!
empty
(
$messagedata
->
attachments
[
'attachment'
])
?
$messagedata
->
attachments
[
'attachment'
]
:
[];
$inlineattachments
=
[];
if
(
!
empty
(
$messagedata
->
attachments
[
'inline'
]))
{
if
(
$addpost
->
messageformat
==
FORMAT_HTML
)
{
$inlineattachments
=
$messagedata
->
attachments
[
'inline'
];
}
else
{
$attachments
=
array_merge
(
$attachments
,
$messagedata
->
attachments
[
'inline'
]);
}
}
// Add attachments to the post.
if
(
!
empty
(
$messagedata
->
attachments
[
'attachment'
])
&&
count
(
$messagedata
->
attachments
[
'attachment'
])
)
{
$attachmentcount
=
count
(
$
messagedata
->
attachments
[
'attachment'
]
);
if
(
$attachments
)
{
$attachmentcount
=
count
(
$
attachments
);
if
(
!
forum_can_create_attachment
(
$forum
,
$modcontext
))
{
// Attachments are not allowed.
mtrace
(
"--> User does not have permission to attach files in this forum. Rejecting e-mail."
);
...
...
@@ -196,7 +207,7 @@ class reply_handler extends \core\message\inbound\handler {
$filesize
=
0
;
$addpost
->
attachments
=
file_get_unused_draft_itemid
();
foreach
(
$
messagedata
->
attachments
[
'attachment'
]
as
$attachment
)
{
foreach
(
$
attachments
as
$attachment
)
{
mtrace
(
"--> Processing
{
$attachment
->
filename
}
as an attachment."
);
$this
->
process_attachment
(
'*'
,
$usercontext
,
$addpost
->
attachments
,
$attachment
);
$filesize
+=
$attachment
->
filesize
;
...
...
@@ -215,8 +226,8 @@ class reply_handler extends \core\message\inbound\handler {
}
// Process any files in the message itself.
if
(
!
empty
(
$messagedata
->
attachments
[
'inline'
])
)
{
foreach
(
$
messagedata
->
attachments
[
'inline'
]
as
$attachment
)
{
if
(
$inlineattachments
)
{
foreach
(
$
inline
attachments
as
$attachment
)
{
mtrace
(
"--> Processing
{
$attachment
->
filename
}
as an inline attachment."
);
$this
->
process_attachment
(
'*'
,
$usercontext
,
$addpost
->
itemid
,
$attachment
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment