message MDL-25380 preventing html tags appearing in emailed messages when a message is sent to course participants

This commit is contained in:
Andrew Davis 2010-11-24 04:17:52 +00:00
parent a864e5ddc3
commit 156205fc97
2 changed files with 10 additions and 4 deletions

View File

@ -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;

View File

@ -94,7 +94,7 @@ $count = 0;
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++;
}