<?php

if ( ! @include_once( './mainfile.php' ) ) { exit( '!! INCLUDE ERROR. ACCESS DENIED !!' ); }
error_reporting( _E_VALUE );


/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | myPHPNuke Version 188_8 RC2                                          |
// +----------------------------------------------------------------------+
// | License: GNU/GPL - http://www.gnu.org/copyleft/gpl.html              |
// +----------------------------------------------------------------------+
// | Support: http://myphpnuke.com/                                       |
// +----------------------------------------------------------------------+
// | Author: myPHPNuke Dev Team                                           |
// +----------------------------------------------------------------------+
// | Copyright: © 2001-2004 myPHPNuke Dev Team                            |
// +----------------------------------------------------------------------+
// $Id: chatuser.php,v 1.7.2.4 2004/08/27 15:51:16 kirilt Exp $



######################################################################
# ChatBox II
# =============
#
# Copyright (C) 2001 by Gerard Samuel (trini0@optonline.net)
#
# Based on code found in myPHPNuke
# Ingo van Peeren (ingo@beginner-ag.de)
# Michael Yarbrough (http://www.comediccadavers.com/)
######################################################################
# This program is free software. You can 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.
######################################################################

$userinfo =& $GLOBALS['uinf'];
$username = ( _MPN_USER ) ? ( $userinfo['uname'] ) : ( (bool)FALSE );

if ( ! isset( $userinfo['theme'] ) || $userinfo['theme'] == "" || ! is_dir( './themes/' . $userinfo['theme'] ) )
{
    $getTheme = $Default_Theme;
}
else
{
    $getTheme = $userinfo['theme'];
}

include 'themes/' . $getTheme . '/theme.' . $phpEx;

echo "<!DOCTYPE html
	PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";

echo "<html id='chatuser'>\n";

 echo "<head>\n";

    echo "<title>" . translate( "chat top" ) . "</title>\n";

    echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\" />\n";

    if ( ! is_dir( './themes/' . $getTheme . '/style/' . $getTheme . '.css' ) )
    {
        $getCSS = './themes/' . $getTheme . '/style/' . $getTheme . '.css';

        echo "<link rel='stylesheet' href='$getCSS' type='text/css' />\n";
    }

    echo "</head>\n";

    echo "<body bgcolor=\"$bgcolor2\" onload=window.setTimeout(\"location.href='{$_SERVER['PHP_SELF']}'\",10000)>\n";

        echo "<div class=\"center\" align=\"center\"><b>".translate("Chatting")."</b></div><hr />\n";

        if ( (bool)FALSE != $username )
        {
            $time = time() - 120;

            $sql = 'SELECT DISTINCT(t1.username), t2.uid
                    FROM ' . $mpnTables['chatboxII'] . ' AS t1, ' . $mpnTables['users'] . ' AS t2
                    WHERE t1.username = t2.uname && t1.date > ' . (int)$time;

            $result = mysql_query( $sql );

            if ( $result )
            {
                while ( $data = mysql_fetch_row( $result ) )
                {
                    echo "<img src=\"./images/head.gif\" /><a href=\"replypmsg.php?send2=1&to_userid=$data[1]\" target=\"_blank\">$data[0]</a><br />\n";
                }

                mysql_free_result( $result );
            }
        }

    echo "</body>\n";

echo "</html>\n";

?>