
<?php
/*
::::::::::::::::::::::::::::::::::::::::
Snippet name: PHPFreeChat
Short Desc: Allows PHP Free Chat (http://www.phpfreechat.net) to be used within MODx
Version: 1.0
Author: Al B
Date: 22nd January, 2007
::::::::::::::::::::::::::::::::::::::::
Description:
Allows you to include PHP Free Chat in your MODx web site.
::::::::::::::::::::::::::::::::::::::::
Instructions:
Download PHP Free Chat from http://www.phpfreechat.net
Unzip the archive, and put it in /assets/snippets/phpfreechat
Change ownership of all files in that directory to make them writeable by
the web server if necessary
Copy the contents of this file as a new snippet called 'PHPFreeChat'.
Call this snippet from a MODx document.
::::::::::::::::::::::::::::::::::::::::
Example Usage:
[[PHPFreeChat]]
::::::::::::::::::::::::::::::::::::::::
*/
global $modx;
$snipPath = $modx->config["base_path"]."assets/snippets/";
include_once($snipPath . "phpfreechat/src/phpfreechat.class.php");
// You can configure PHP Free Chat by setting variables below. See the PHP Free Chat
// documentation for options.
$params = array();
$params["client_script_path"] = "/storage/home/srv15311/htdocs/index.php";
$params["title"] = "Chat Room";
$params["refresh_delay"] = 2000; // 2000ms = 2s
$params["nick"] = "guest".rand(1,1000); // setup the intitial nickname
$params["isadmin"] = true; // just for debug ;)
$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat
$chat = new phpFreeChat( $params );
// register chat javascript and css
$modx->regClientStartupScript($chat->printJavascript());
$modx->regClientCSS($chat->printStyle());
return $chat->printChat();
?>