Skip to content

Commit

Permalink
message MDL-26077 fixed up a problem with html tags being stripped out
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjdavis committed Mar 24, 2011
1 parent 92a387b commit 7e98f60
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/moodlelib.php
Expand Up @@ -9112,7 +9112,7 @@ function message_popup_window() {
$smallmessage = get_string('unreadnewnotification', 'message');
}
if (!empty($smallmessage)) {
$strmessages .= '<div id="usermessage">'.$smallmessage.'</div>';
$strmessages .= '<div id="usermessage">'.s($smallmessage).'</div>';
}
}

Expand Down
6 changes: 3 additions & 3 deletions message/lib.php
Expand Up @@ -1879,9 +1879,9 @@ function message_format_message($message, $format='', $keywords='', $class='othe

//if supplied display small messages as fullmessage may contain boilerplate text that shouldnt appear in the messaging UI
if (!empty($message->smallmessage)) {
$messagetext = format_text($message->smallmessage, FORMAT_MOODLE, $options);
$messagetext = format_text(s($message->smallmessage), FORMAT_MOODLE, $options);
} else {
$messagetext = format_text($message->fullmessage, $message->fullmessageformat, $options);
$messagetext = format_text(s($message->fullmessage), $message->fullmessageformat, $options);
}

$messagetext .= message_format_contexturl($message);
Expand Down Expand Up @@ -1945,7 +1945,7 @@ function message_post_message($userfrom, $userto, $message, $format) {
}

$eventdata->fullmessageformat = $format;
$eventdata->smallmessage = strip_tags($message);//strip just in case there are is any html that would break the popup notification
$eventdata->smallmessage = $message;//store the message unfiltered. Clean up on output.

$s = new stdClass();
$s->sitename = $SITE->shortname;
Expand Down
1 change: 1 addition & 0 deletions message/output/jabber/message_output_jabber.php
Expand Up @@ -59,6 +59,7 @@ function send_message($eventdata){
}
$jabberaddress = $jabberaddresses[$eventdata->userto->id];

//calling s() on smallmessage causes Jabber to display things like &lt; Jabber != a browser
$jabbermessage = fullname($eventdata->userfrom).': '.$eventdata->smallmessage;

if (!empty($eventdata->contexturl)) {
Expand Down

0 comments on commit 7e98f60

Please sign in to comment.