Esempio n. 1
0
function showMessageFiltered($msgNum, &$prefs, $chatID)
{
    if (file_exists(AT_CONTENT_DIR . 'chat/' . $_SESSION['course_id'] . '/msgs/' . $msgNum . '.message')) {
        $msg = file(AT_CONTENT_DIR . 'chat/' . $_SESSION['course_id'] . '/msgs/' . $msgNum . '.message');
        $sender = trim($msg[0]);
        $msg = trim($msg[1]);
        if ($sender == $chatID) {
            $colour = getChatIDColour($sender, $prefs['colours']);
            if ($msgNum > $prefs['lastRead']) {
                echo '<tr><td width="75" class="row1" align="right"><b><span style="color: ' . $colour . ';">' . stripslashes($sender) . ' : </span></b></td><td class="row1"><b><span style="color: ' . $colour . ';">' . htmlspecialchars(stripslashes($msg)) . '</span></b></td></tr>';
            } else {
                echo '<tr><td width="75" class="row1" align="right"><span style="color: ' . $colour . ';">' . stripslashes($sender) . ' : </span></td><td class="row1"><span style="color: ' . $colour . ';">' . htmlspecialchars(stripslashes($msg)) . '</span></td></tr>';
            }
        }
    }
}
Esempio n. 2
0
?>
</th></tr></table><?php 
echo '<ul>';
if ($dir = opendir(AT_CONTENT_DIR . 'chat/' . $_SESSION['course_id'] . '/users/')) {
    while (($file = readdir($dir)) !== false) {
        if ($file == '..' || $file == '.') {
            continue;
        }
        $chatName = substr($file, 0, -strlen('.prefs'));
        $la = getLastAccessed($chatName);
        $now = time();
        if ($la == 0 || !$la) {
            $la = 0;
        } else {
            if ($now - $la < $admin['chatSessionLifeSpan']) {
                $colour = getChatIDColour($chatName, $myPrefs['colours']);
                if ($chatName == $_SESSION['login']) {
                    echo '<li><a href="filterHistory.php?filterChatID=' . $chatName . '" target="_top" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"><span style="color:' . $colour . '">' . $chatName . '</span></a> (' . _AT('chat_you') . ')</li>';
                } else {
                    if ($chatName != '') {
                        echo '<li><a href="filterHistory.php?filterChatID=' . $chatName . '" target="_top" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"><span style="color:' . $colour . '">' . $chatName . '</span></a></li>';
                    }
                }
            } else {
                resetLastAccessed($chatName);
                $topMsgNum = $bottomMsgNum = 0;
                howManyMessages($topMsgNum, $bottomMsgNum);
                postMessage(_AT('chat_system'), require AT_INCLUDE_PATH . '../mods/_standard/chat/lib/chat.inc.php', _AT('chat_user_logged_out', $chatName), $topMsgNum, $bottomMsgNum);
            }
        }
    }