//////////////////////////////////////////////////////////////////////////////
//
// phpChat - Copyright (c) 1999 by Till Gerken - till@phpwebdev.com
//
// This is the code for an IRC bot. It will simply sit there, print all incoming
// traffic to the browser and pass all outgoing messages on to the network.
//
// Tricky implementation of browser timeout prevention.
//
//////////////////////////////////////////////////////////////////////////////
include("configuration.inc.php3");
include("chat_db.php3");
include($chat_phpIRC_path."/phpIRC.inc.php3");
include($chat_phpIRC_path."/phpIRC.php3");
//////////////////////////////////////////////////////////////////////////////
// this variable keeps the timestamp of when traffic was sent to the browser
$chat_last_timeout_prevention = 0;
$chat_shm_current_handle = 0;
//////////////////////////////////////////////////////////////////////////////
//
// chat_print_js(string code) - print javascript code
//
//////////////////////////////////////////////////////////////////////////////
//
// Prints a JavaScript code snippet and embeds it into the correct tags needed
// for the browsers to interprete it
//
//////////////////////////////////////////////////////////////////////////////
//
// Parameteres:
// $code - string containing the javascript code
//
//////////////////////////////////////////////////////////////////////////////
function chat_print_js($code)
{
printf("", $code);
}
//////////////////////////////////////////////////////////////////////////////
//
// chat_print_whois(array whois_info) - prints out someone's whois info
//
//////////////////////////////////////////////////////////////////////////////
//
// This function is a helper function of the user command interpreter and
// prints out someone's whois info in a nicely formatted way
//
//////////////////////////////////////////////////////////////////////////////
//
// Parameters:
// $whois_info - whois info in an array as returned by phpIRC
//
//////////////////////////////////////////////////////////////////////////////
function chat_print_whois($whois_info)
{
// initialize whois template
$tpl = new EasyTemplate("templates/whois.inc.html");
// replace template variables
$tpl->assign("NICK", $whois_info["nick"]);
$tpl->assign("IDENT", $whois_info["identd"]);
$tpl->assign("HOST", $whois_info["host"]);
$tpl->assign("REALNAME", $whois_info["realname"]);
$tpl->assign("CHANNELS", $whois_info["channels"]);
$tpl->assign("SERVER", $whois_info["server"]);
$tpl->assign("SERVER_INFO", $whois_info["serverinfo"]);
$tpl->assign("IDLE", !empty($whois_info["idle"]) ? $whois_info["idle"]." seconds" : "not idle at all");
$tpl->assign("AWAY", !empty($whois_info["away"]) ? $whois_info["away"] : "not away");
// print template
$tpl->easy_print();
// scroll down enough to display the whois info
chat_print_js("window.scrollBy(0, 300);");
}
//////////////////////////////////////////////////////////////////////////////
//
// chat_update_nick_list() - updates the nick list frame
//
//////////////////////////////////////////////////////////////////////////////
//
// Updates the nick list in the database and issues JavaScript code to
// reload the frames related to it
//
bla bla bala
it's very important "include" ..