| 1 |
<?php
|
| 2 |
|
| 3 |
// $Header: /cvsroot/tikiwiki/tiki/tiki-chat_box.php,v 1.8.2.1 2005/01/01 00:11:23 damosoft Exp $
|
| 4 |
|
| 5 |
// Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
|
| 6 |
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
|
| 7 |
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
|
| 8 |
|
| 9 |
$section = 'chat';
|
| 10 |
include_once ('tiki-setup.php');
|
| 11 |
|
| 12 |
include_once ('lib/chat/chatlib.php');
|
| 13 |
|
| 14 |
if ($feature_chat != 'y') {
|
| 15 |
die;
|
| 16 |
}
|
| 17 |
|
| 18 |
if ($tiki_p_chat != 'y') {
|
| 19 |
die;
|
| 20 |
}
|
| 21 |
|
| 22 |
// Check if "send" is set (the user is sending a message)
|
| 23 |
// check if the channel is moderated if moderated save to moderated messages
|
| 24 |
// else write the message into messages
|
| 25 |
// use send_message(userId,channelId,data)
|
| 26 |
if (isset($_REQUEST["channelId"]) && isset($_REQUEST["nickname"])) {
|
| 27 |
check_ticket('chat');
|
| 28 |
if (isset($_REQUEST["data"])) {
|
| 29 |
$data = $_REQUEST["data"];
|
| 30 |
|
| 31 |
// Recognize a private message
|
| 32 |
if (substr($data, 0, 1) == ':') {
|
| 33 |
preg_match("/:([^:]+):(.*)/", $data, $reqs);
|
| 34 |
|
| 35 |
$chatlib->send_private_message($_REQUEST["nickname"], $reqs[1], $reqs[2]);
|
| 36 |
} else {
|
| 37 |
if ($_REQUEST["channelId"]) {
|
| 38 |
$chatlib->send_message($_REQUEST["nickname"], $_REQUEST["channelId"], $data);
|
| 39 |
}
|
| 40 |
}
|
| 41 |
}
|
| 42 |
|
| 43 |
$smarty->assign('nickname', $_REQUEST["nickname"]);
|
| 44 |
$smarty->assign('channelId', $_REQUEST["channelId"]);
|
| 45 |
}
|
| 46 |
|
| 47 |
// Displaythe box if we are in an active channel
|
| 48 |
if (isset($_REQUEST["channelId"])) {
|
| 49 |
$smarty->display('tiki-chat_box.tpl');
|
| 50 |
// If not display a message
|
| 51 |
} else {
|
| 52 |
print ("no channel selected");
|
| 53 |
}
|
| 54 |
|
| 55 |
?>
|