';
echo '';
break;
case 'refresh': /// Print the main frame containing the current chat
$stylesheetshtml = '';
foreach ($CFG->stylesheets as $stylesheet) {
$stylesheetshtml .= '';
}
header("Expires: Sun, 28 Dec 1997 09:32:45 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: text/html");
header("Refresh: $CFG->message_chat_refresh; url=user.php?id=$user->id&frame=refresh");
echo ''."\n";
echo '';
echo ''."\n";
echo ''."\n";
echo ''."\n";
if (!empty($playbeep)) {
echo '';
}
sleep($CFG->message_chat_refresh);
// Javascript for Mozilla to cope with the redirect bug from editor being on in this page
echo ''."\n";
echo ''."\n";
echo ''."\n";
break;
case 'edit': /// Print the bottom frame with the text editor
/// Check that the user is not blocking us!!
if ($contact = get_record('message_contacts', 'userid', $user->id, 'contactid', $USER->id)) {
if ($contact->blocked and !isadmin()) {
print_heading(get_string('userisblockingyou', 'message'));
exit;
}
}
if ($message and confirm_sesskey()) { /// Current user has just sent a message
/// Save it to the database...
$messageid = message_post_message($USER, $user, addslashes($message), $format, 'direct');
/// Format the message as HTML
$options = NULL;
$options->para = false;
$options->newlines = true;
$message = format_text($message, $format, $options, 0);
$message = str_replace("\r", ' ', $message);
$message = str_replace("\n", ' ', $message);
$time = userdate(time(), get_string('strftimedaytime'));
$message = '