<commit_before><?php

require("../../../config.php");
require("../lib.php");

if (!$chatuser = get_record("chat_users", "sid", $chat_sid)) {
    echo "Not logged in!";
    die;
}

if (!$chat = get_record("chat", "id", $chatuser->chatid)) {
    error("No chat found");
}

require_login($chat->course);


if ($message = chat_get_latest_message($chatuser->chatid)) {
    $chat_newlasttime = $message->timestamp;
} else {
    $chat_newlasttime = 0;
}

if (empty($chat_lasttime)) {
    $chat_lasttime = 0;
}


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: 4; URL=jsupdate.php?chat_sid=".$chat_sid."&chat_lasttime=".$chat_newlasttime);

?>
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  <html>
   <head>
    <script language="Javascript">
    <!--
<?php
     $beep = false;

     if ($chat_lasttime) {
         if ($messages = get_records_select("chat_messages", 
                                            "chatid = '$chatuser->chatid' AND timestamp > '$chat_lasttime'", 
                                            "timestamp ASC")) {
             foreach ($messages as $message) {
                 $formatmessage = chat_format_message($message);
                 if ($formatmessage->beep) {
                     $beep = $formatmessage->beep;
                 }
                 echo "parent.msg.document.write('".addslashes($formatmessage->html)."\\n');";
             }
         }
     }

     $chatuser->lastping = time();
     update_record("chat_users", $chatuser);
     ?>
     parent.msg.scroll(1,5000000);
    // -->
    </script>
   </head>
   <body bgcolor="<?php echo $THEME->body ?>">
   <?php if ($beep) { ?>
           <embed src="../beep.wav" autostart="true" hidden="true" />
   <?php } ?>
   </body>
  </html><commit_msg>No need for body colour<commit_after><?php

require("../../../config.php");
require("../lib.php");

if (!$chatuser = get_record("chat_users", "sid", $chat_sid)) {
    echo "Not logged in!";
    die;
}

if (!$chat = get_record("chat", "id", $chatuser->chatid)) {
    error("No chat found");
}

require_login($chat->course);


if ($message = chat_get_latest_message($chatuser->chatid)) {
    $chat_newlasttime = $message->timestamp;
} else {
    $chat_newlasttime = 0;
}

if (empty($chat_lasttime)) {
    $chat_lasttime = 0;
}


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: 4; URL=jsupdate.php?chat_sid=".$chat_sid."&chat_lasttime=".$chat_newlasttime);

?>
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  <html>
   <head>
    <script language="Javascript">
    <!--
<?php
     $beep = false;

     if ($chat_lasttime) {
         if ($messages = get_records_select("chat_messages", 
                                            "chatid = '$chatuser->chatid' AND timestamp > '$chat_lasttime'", 
                                            "timestamp ASC")) {
             foreach ($messages as $message) {
                 $formatmessage = chat_format_message($message);
                 if ($formatmessage->beep) {
                     $beep = $formatmessage->beep;
                 }
                 echo "parent.msg.document.write('".addslashes($formatmessage->html)."\\n');";
             }
         }
     }

     $chatuser->lastping = time();
     update_record("chat_users", $chatuser);
     ?>
     parent.msg.scroll(1,5000000);
    // -->
    </script>
   </head>
   <body>
   <?php if ($beep) { ?>
           <embed src="../beep.wav" autostart="true" hidden="true" />
   <?php } ?>
   </body>
  </html>
{'fraction_non_alphanumeric': 0.1923756627114365, 'fraction_numerical': 0.01464276697803585, 'mean_word_length': 2.4037800687285222, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '230105', 'n_tokens_mistral': 1369, 'n_tokens_neox': 1298, 'n_words': 236}