Location: PHPKode > projects > ACollab > chat/options.php
<?php
/****************************************************************************************/
/* ACollab                                                                              */
/****************************************************************************************/
/* Copyright (c) 2002-2004  Adaptive Technology Resource Centre / University of Toronto */
/*                                                                                      */
/* http://atutor.ca/acollab                                                             */
/*                                                                                      */
/* This program is free software. You may redistribute it and/or                        */
/* modify it under the terms of the GNU General Public License                          */
/* as published by the Free Software Foundation; either version 2 of the License,       */
/* or (at your option) any later version.                                               */
/*                                                                                      */
/* This program is distributed in the hope that it will be useful, but                  */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                           */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                                 */
/* See the GNU General Public License for more details.                                 */
/*                                                                                      */
/* You may access the GNU General Public License at:                                    */
/* http://www.opensource.org/licenses/gpl-license.php                                   */
/*                                                                                      */
/* You may contact the Adaptive Technology Resource Centre at                           */
/* Robarts Library, University of Toronto                                               */
/* 130 St. George Street, Toronto, Ontario, Canada M5S 1A5                              */
/* Further contact information is available at http://www.utoronto.ca/atrc/             */
/****************************************************************************************/
/* Programmer:                                                                          */
/* Joel Kronenberg - ATRC                                                               */
/****************************************************************************************/
// $Id: options.php 441 2005-03-07 21:07:59Z shozubq $

define('AC_INCLUDE_PATH', '../include/');

require(AC_INCLUDE_PATH.'vitals.inc.php');
session_write_close();
authenticate(USER_CLIENT, USER_GROUP_ADMIN);
require('include/functions.inc.php');

$myPrefs = getPrefs($_SESSION['login']);
/*updated*/
require(AC_INCLUDE_PATH.'pub/header.inc.php');
?>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
	<th class="box" align="left"><?php echo _AC('chat_options'); ?></th>
</tr>
</table>

<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
	<td align="right"><a href="chat/prefs.php" target="_top" onfocus="this.className='highlight'" onblur="this.className=''"><?php  echo _AC('chat_edit_prefs'); ?></a> | <label accesskey="q" for="help"><a id="help" href="chat/help.php" target="_top" onfocus="this.className='highlight'" onblur="this.className=''" title="<?php  echo _AC('chat_help'); ?> Alt-q"><?php  echo _AC('chat_help'); ?></a></label> | <a href="chat/logout.php" target="_top" onfocus="this.className='highlight'" onblur="this.className=''"><?php  echo _AC('chat_exit'); ?></a></td>
</tr>
</table>
<br />
<br />

<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
	<th class="box" align="left"><?php echo _AC('chat_list_and_history'); ?></th>
</tr>
</table>

<?php
	echo '<ul>';
	if ($dir = @opendir('users/')) {

		while (($file = readdir($dir)) !== false) {

			if (($file == '..') || ($file == '.')) {
				continue;
			}

			$chatName	= substr($file, 0, -strlen('.prefs'));
			if ($chatName == '') {
				continue;
			}

			$la	 = getLastAccessed($chatName);
			$now = time();

			if (getGroupID($chatName) != $_SESSION['group_id']) {
				continue;
			}
			
			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="chat/filterHistory.php?filterChatID='.$chatName.'" target="_top" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"><span style="color:'.$colour.'">'.$chatName.'</span></a> ('._AC('chat_you').')</li>';
				} else {
					echo '<li><a href="chat/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(_AC('chat_system'),
							_AC(chat_user_logged_out, $chatName),
							$topMsgNum,
							$bottomMsgNum);

				/* set the group id to 0 for this user */
				$tempPrefs = getPrefs($chatID, false);
				$tempPrefs['lastAccessed'] = 0;
				writePrefs($tempPrefs, $chatName, true);
			}
		}
	}
	closedir($dir);
	echo '</ul>';

	echo '<table width="100%" border="0" cellpadding="5" cellspacing="0">
           <tr><td align="right"><a href="chat/history.php" target="_top" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('chat_full_history').'</a> | <a href="chat/options.php" target="options" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('chat_refresh_user_list').'</a></td></tr></table>';

    if ($myPrefs['navigationAidFlag'] > 0) {
        echo '<br /><br />';
		echo '<table width="100%" border="0" cellpadding="5" cellspacing="0">
           <tr><td align="left"><h4>'._AC('chat_quick_keys').'</h4></td></tr></table>';

        echo '<p class="light">'._AC('chat_keys_available').'</p>';
        echo '<ul><li>'._AC('chat_altc').'</li>
               <li>'._AC('chat_post').'</li>
               <li>'._AC('chat_altr').'</li>
               <li>'._AC('chat_altm').'</li>
               <li>'._AC('chat_altq').'</li></ul>';
    }

require(AC_INCLUDE_PATH.'pub/footer.inc.php');
?>
Return current item: ACollab