2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
14 define('AT_INCLUDE_PATH', '../../../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16 session_write_close();
17 //authenticate(USER_CLIENT, USER_ADMIN);
18 require(AT_INCLUDE_PATH.'../mods/_standard/chat/lib/chat.inc.php');
20 $myPrefs = getPrefs($_SESSION['login']);
24 howManyMessages($topMsgNum, $bottomMsgNum);
26 if ($_REQUEST['set']) {
27 if (isset($_GET['set'])) {
28 if ($_GET['set'] == $_POST['message']) {
29 $tmp_message = $_POST['tempField'];
31 $tmp_message = $_POST['message'];
34 $tmp_message = $_POST['message'];
36 //$message = $_POST['message'];
37 postMessage($_SESSION['login'], $tmp_message, $topMsgNum, $bottomMsgNum);
38 } else if ($_REQUEST['firstLoginFlag'] > 0) {
39 postMessage(_AT('chat_system'), _AT('chat_user_logged_in', $_SESSION['login']), $topMsgNum, $bottomMsgNum);
42 require('include/html/chat_header.inc.php');
43 if ($myPrefs['refresh'] != 'manual') {
45 <script language="javascript" type="text/javascript">
47 setTimeout("reDisplay()", <?php echo $myPrefs['refresh'] * 1000; ?>);
48 function reDisplay() {
49 window.location.href = "<?php echo $_SERVER[PHP_SELF]; ?>";
56 <a name="messages"></a>
57 <table width="100%" border="0" cellpadding="5" cellspacing="0">
59 <th align="left"><?php echo _AT('chat_messages') ?></th>
65 if ($topMsgNum - 10 > 1) {
66 $min = $topMsgNum - 10;
68 if ($myPrefs['onlyNewFlag'] > 0) {
69 $min = $myPrefs['lastRead'] +1;
71 if ($min <= $topMsgNum) {
72 echo '<table border="0" cellpadding="2" cellspacing="0" width="98%" class="chat-display" align="center">';
74 echo '<p>'._AT('chat_no_new_messages').'</p>';
77 if ($myPrefs['newestFirstFlag'] > 0) {
78 for ($i = $topMsgNum; $i >= $min; $i--) {
79 showMessage($i, $myPrefs);
82 for ($i = $min; $i <= $topMsgNum ; $i++) {
83 showMessage($i, $myPrefs);
87 if ($min <= $topMsgNum) {
91 echo '<table width="100%" border="0" cellpadding="5" cellspacing="0">';
93 echo '<td align="right">';
94 if ($myPrefs['navigationAidFlag'] > 0) {
95 echo '<a accesskey="m" href="display.php#messages" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'" title="'._AT('chat_jump_to_message').' Alt-m">'._AT('chat_jump_to_message').'</a> | ';
98 echo '<a accesskey="r" href="display.php" target="display" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'" title="'._AT('chat_refresh_message').' Alt-r">'._AT('chat_refresh_message').'</a>';
103 if ($myPrefs['refresh'] == 'manual') {
104 echo '<table width="100%" border="0" cellpadding="5" cellspacing="0">
105 <tr><th align="left">'._AT('chat_compose_message').'</th></tr></table>';
108 echo '<form action="display.php" target="display" name="f1" method="post" onSubmit="return checkForm();">
109 <input type="hidden" name="set" value="1" />
110 <label accesskey="c" for="message"><input type="text" maxlength="200" size="50" id="message" name="message" value="" class="input" title="Alt-c" onfocus="this.className=\'input highlight\'" onblur="this.className=\'input\'" /></label>
111 <input type="submit" name="submit" value="'._AT('send').'" class="button" title="'._AT('send').'" onfocus="this.className=\'submit highlight\'" onblur="this.className=\'submit\'" />';
114 echo '<script language="javascript"><!--
115 function checkForm() {
116 if (document.f1.message.value == "" || !document.f1.message.value) return false;
119 echo '//--></script>';
121 if ($myPrefs['bingFlag'] > 0 && $topMsgNum > $myPrefs['lastRead']) {
122 echo '<embed src="bings/chime.wav" loop="false" autoplay="true" play="true" hidden="true" width="1" height="1" />';
126 $myPrefs['lastRead'] = $topMsgNum;
127 $myPrefs['lastChecked'] = $topMsgNum;
128 writePrefs($myPrefs, $_SESSION['login']);
129 require('include/html/chat_footer.inc.php');