Code:<?php
/**********************************************/
/* ChatView v1.3a Block */
/* Author: Mark De Lorenzo */
/* Copyright (c) 2004 by Evidence */
/**********************************************/
if (eregi( "block-ChatView.php", $_SERVER['PHP_SELF']))
{
die("Access Denied");
}
// Some global definitions
global $user, $cookie, $db, $user_prefix;
include("config.php");
cookiedecode($user);
$username = $cookie[1];
//===================================================================================
// ChatView Configurations
//===================================================================================
// Directory off of root where your FlashChat is installed
// Include the leading slash... Case sensitive!
$FCDirectory = "/FlashChat";
// Set this to 1 if Flashchat is phpNuke integrated or 0 if installed standalone
$phpNukeIntegrated = "1";
// Set this to 1 if you want to display button to launch Chat, 0 to display info only
$ShowFCLink = "1";
//===================================================================================
// PopupWindow dimensions ( I did popups so that you could continue to browse the site )
// Width
$FlashChatWinW = "600";
// Height
$FlashChatWinH = "400";
//===================================================================================
// End of configuration settings... don't modify below here!
//===================================================================================
include($_SERVER["DOCUMENT_ROOT"].$FCDirectory."/inc/config.srv.php");
$FCpref = $GLOBALS['fc_config']['db']['pref'];
$tblFC_Rooms = $FCpref."rooms";
$tblFC_Connections = $FCpref."connections";
$tblFC_Users = $FCpref."users";
if ( $username == "" or $phpNukeIntegrated == "1" ) {
$ChatLink = $FCDirectory."/flashchat.php\" onclick=\"window.open('".$FCDirectory."/flashchat.php', '_flashchat', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=".$FlashChatWinW.",height=".$FlashChatWinH.",left = 162,top = 134');return false;\" target=\"_flashchat\"";
} else {
$ChatLink = $FCDirectory."/flashchat.php?username=$username\" onclick=\"window.open('".$FCDirectory."/flashchat.php?username=$username', '_flashchat', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=".$FlashChatWinW.",height=".$FlashChatWinH.",left = 162,top = 134');return false;\" target=\"_flashchat\"";
}
if ( $phpNukeIntegrated == "0" ) {
$sql = "SELECT ".$tblFC_Users.".login, ".$tblFC_Rooms.".name, ".$tblFC_Rooms.".id FROM ".$tblFC_Connections." INNER JOIN ".$tblFC_Users." ON ".$tblFC_Connections.".userid = ".$tblFC_Users.".id INNER JOIN ".$tblFC_Rooms." ON ".$tblFC_Connections.".roomid = ".$tblFC_Rooms.".id ORDER BY ".$tblFC_Rooms.".name, ".$tblFC_Users.".login";
} else {
$sql = "SELECT ".$user_prefix."_users.username, ".$tblFC_Rooms.".name, ".$tblFC_Rooms.".id FROM ".$tblFC_Connections." INNER JOIN ".$user_prefix."_users ON ".$tblFC_Connections.".userid = ".$user_prefix."_users.user_id INNER JOIN ".$tblFC_Rooms." ON ".$tblFC_Connections.".roomid = ".$tblFC_Rooms.".id ORDER BY ".$tblFC_Rooms.".name, ".$user_prefix."_users.username";
}
$numchat = $db->sql_query($sql);
$chatters_now_online = $db->sql_numrows($numchat);
$oldroom='';
if ($numchat) {
If ( $chatters_now_online != "0" ) {
$content = "<img src=\"images/blocks/ChatView/icon_members.gif\">\n";
$content .= "Users chatting: <STRONG>$chatters_now_online</STRONG></center>";
$content .= "<hr>";
$ChatroomImage = 0; // initialize graphics
while ($usersinchat = $db->sql_fetchrow($numchat)) {
$ChatroomImage++;
if ( $ChatroomImage > 4 ) { $ChatroomImage = 1; } // reset to 1
if ($usersinchat[1] != $oldroom) {
$content .= "<img src=\"images/blocks/ChatView/group-$ChatroomImage.gif\">\n";
$content .= "<u><b>$usersinchat[1]:</u></b><br />\n";
$oldroom = $usersinchat[1];
}
$content .= "<img src=\"images/blocks/ChatView/arrow.gif\"> ".$usersinchat[0]."<br>\n";
}
$content .= "<br>";
}
if ($usersinchat[0] == $oldroom) {
$content = "<br><center><img src=\"images/blocks/ChatView/icon_members.gif\"><br><br>\n";
$content .= "Nobody Chatting</center><br>\n";
}
if ( $ShowFCLink == "1" ) {
$content .= "<form action=\"$ChatLink\" method=\"get\" title=\"Open a chat window\" name=\"startchat\">\n";
$content .= " <center><input type=\"button\" value=\"Enter Live Chat\" name=\"chatbutton\"></center>\n";
$content .= "</form>\n";
}
} else { //could not connect to database
echo "ERROR: DB Error\n";
}
?>
|