sibtracker/system/modules/chat/block.php

38 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2019-05-18 13:46:03 +08:00
<?php
if(!defined('DATALIFEENGINE')) {die("Hacking Attempt!"); }
require_once SYSTEM_DIR.'/data/config.php';
require_once SYSTEM_DIR.'/data/chat.config.php';
require_once SYSTEM_DIR.'/modules/chat/chat.class.php';
$chat= new Chat();
$tpl->load_template('chat/block.tpl');
$tpl->copy_template .= '<script type="text/javascript" src="/system/modules/chat/ajax.js"></script>
<script type="text/javascript">
var Chat_RefInterval = '.$chatconfig['refresh'].'*1000;
setInterval(Chat_Refresh, Chat_RefInterval);
</script>';
if ($is_logged){
$tpl->set('[isloged]',"");
$tpl->set('[/isloged]',"");
$tpl->set_block("'\\[notloged\\].*?\\[/notloged\\]'si","");
} else {
$tpl->set_block("'\\[isloged\\].*?\\[/isloged\\]'si","");
$tpl->set('[notloged]',"");
$tpl->set('[/notloged]',"");
}
$tpl->set('[historylink]',"<a href=\"".$config['http_home_url']."chat/history/\" >");
$tpl->set('[/historylink]',"</a>");
$tpl->set('{chatmsg}', $chat->GetContent($chatconfig, $member_id, $config));
$tpl->copy_template = "<form method=\"post\" onsubmit=\"SendMessage(); return false;\" name=\"chat_form\" id=\"chat-form\">".$tpl->copy_template."
</form> ";
$tpl->compile('minichat');
$tpl->clear();
return $tpl->result['minichat'];
?>