Skip to content

Commit

Permalink
message MDL-25380 preventing html tags appearing in emailed messages …
Browse files Browse the repository at this point in the history
…when a message is sent to course participants
  • Loading branch information
Andrew Davis committed Nov 24, 2010
1 parent a864e5d commit 156205f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions message/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1561,10 +1561,16 @@ function message_post_message($userfrom, $userto, $message, $format, $messagetyp
//using string manager directly so that strings in the message will be in the message recipients language rather than the senders
$eventdata->subject = get_string_manager()->get_string('unreadnewmessage', 'message', fullname($userfrom), $userto->lang);

$eventdata->fullmessage = $message;
if ($format==FORMAT_HTML) {
$eventdata->fullmessage = '';
$eventdata->fullmessagehtml = $message;
} else {
$eventdata->fullmessage = $message;
$eventdata->fullmessagehtml = '';
}

$eventdata->fullmessageformat = $format;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = $message;
$eventdata->smallmessage = strip_tags($message);//strip just in case there are is any html that would break the popup notification

$s = new stdClass();
$s->sitename = $SITE->shortname;
Expand Down
2 changes: 1 addition & 1 deletion user/messageselect.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
foreach ($_POST as $k => $v) {
if (preg_match('/^(user|teacher)(\d+)$/',$k,$m)) {
if (!array_key_exists($m[2],$SESSION->emailto[$id])) {
if ($user = $DB->get_record_select('user', "id = ?", array($m[2]), 'id,firstname,lastname,idnumber,email,mailformat,lastaccess')) {
if ($user = $DB->get_record_select('user', "id = ?", array($m[2]), 'id,firstname,lastname,idnumber,email,mailformat,lastaccess, lang')) {
$SESSION->emailto[$id][$m[2]] = $user;
$count++;
}
Expand Down

0 comments on commit 156205f

Please sign in to comment.