56 lines
1.7 KiB
PHP
56 lines
1.7 KiB
PHP
<?php
|
|
If (!defined("INBCWE")) {
|
|
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
|
|
}
|
|
include dirname(__FILE__).'/chatfunctions.inc.php';
|
|
class plugins_chat{
|
|
|
|
function register_plugins(& $plugin){
|
|
$plugin->use_hook('nav_finish',array($this,"cusers"));
|
|
$plugin->use_hook('frontpage_start',array($this,"cusers_head"));
|
|
$plugin->use_hook('register_end',array($this,"register"));
|
|
$plugin->use_hook('register_openid_end',array($this,"register"));
|
|
$plugin->use_hook('admin_user_before_delete',array($this,"delete"));
|
|
$plugin->use_hook('admin_user_after_create',array($this,"register"));
|
|
}
|
|
|
|
function cusers(& $cont){
|
|
global $db, $config, $session;
|
|
$data=chat_online();
|
|
if ($data["chat_offline"]===true){
|
|
$data['usercount']='offline';
|
|
}
|
|
$cont=str_replace('[users]',$data['usercount'],$cont);
|
|
}
|
|
|
|
function cusers_head(& $tpl){
|
|
global $db, $config, $session, $log;
|
|
$data=chat_online();
|
|
if ($data["chat_offline"]===true){
|
|
$tpl->assign('cusers',"offline");
|
|
return;
|
|
}else{
|
|
//$tpl->assign('cusers',$data['usercount']);
|
|
}
|
|
|
|
}
|
|
|
|
function userlist(){
|
|
global $db, $config, $rightnav;
|
|
$rightnav.='<div id="functions"><span id="colorSelector" style="float:left;"><div id="bgcol" style="background-color: #ffffff"></div></span></div>';
|
|
return;
|
|
}
|
|
|
|
function register($rdata){
|
|
global $db, $config, $session, $functions;
|
|
$db->query("INSERT INTO `ptc_users` (`uid`, `color`, `whisperwindow`, `submit`) VALUES ('".$rdata["uid"]."','000000','true',1)");
|
|
}
|
|
|
|
function delete($rdata){
|
|
global $db, $config, $session, $functions;
|
|
$db->query("DELETE FROM `ptc_users` WHERE `uid` = '".$rdata["uid"]."'");
|
|
}
|
|
}
|
|
|
|
|
|
?>
|