sibtracker/system/ajax/chat.php

59 lines
1.8 KiB
PHP
Raw Normal View History

2019-05-18 13:46:03 +08:00
<?php
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
@session_start();
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR.'/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
require_once SYSTEM_DIR.'/data/chat.config.php';
require_once SYSTEM_DIR.'/modules/chat/chat.class.php';
require_once SYSTEM_DIR.'/modules/functions.php';
$user_group = $cache->get("usergroup");
if (!$user_group) {
$user_group = array ();
$db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC");
while($row = $db->get_row()){
$user_group[$row['id']] = array ();
foreach ($row as $key => $value)
{
$user_group[$row['id']][$key] = $value;
}
}
$cache->set ("usergroup", $user_group);
$db->free();
}
include_once ROOT_DIR.'/language/'.$config['langs'].'/website.lng';
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
$refresh = intval($_REQUEST['refresh']);
$m_id = intval($_REQUEST['mdelete']);
require_once SYSTEM_DIR.'/modules/sitelogin.php';
$chat = new Chat();
if ($m_id != 0 && $refresh && ($member_id['user_group'] == 1 || $member_id['user_group'] == 2)){
$db->query("DELETE FROM ".PREFIX."_chat WHERE id = $m_id");
$cache->del('minichat');
}
$mcadd['message'] = addslashes(convert_unicode($_POST['message'], $config['charset']));
@header("HTTP/1.1 200 OK");
@header("Cache-Control: no-cache, must-revalidate, max-age=0");
@header("Expires: 0");
@header("Pragma: no-cache");
@header( "Content-type: text/html; charset=" . $config['charset'] );
require_once SYSTEM_DIR.'/modules/chat/addmess.php';
echo $chat->GetContent($chatconfig, $member_id, $config);
?>